Merge branch 'develop' into FixWrongVisibleTaxMenuEntry

This commit is contained in:
Tobias Sekan 2020-09-08 14:19:29 +02:00 committed by GitHub
commit f7ea3dba70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
408 changed files with 53544 additions and 42136 deletions

2
.gitignore vendored
View File

@ -36,8 +36,8 @@ htdocs/includes/jakub-onderka/
htdocs/includes/phpdocumentor/
htdocs/includes/phpspec/
htdocs/includes/phpunit/
htdocs/includes/php-parallel-lint/
htdocs/includes/sebastian/
htdocs/includes/squizlabs/
htdocs/includes/symfony/
htdocs/includes/webmozart/
htdocs/.well-known/apple-developer-merchantid-domain-association

View File

@ -119,24 +119,18 @@ install:
echo
- |
echo "Installing Composer dependencies (PHP Unit, Parallel Lint & PHP CodeSniffer"
if [ "$TRAVIS_PHP_VERSION" = '5.4' ] || [ "$TRAVIS_PHP_VERSION" = '5.5' ]; then
composer -n require phpunit/phpunit ^4 \
jakub-onderka/php-parallel-lint ^0 \
jakub-onderka/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
echo "Installing Composer dependencies - PHP Unit, Parallel Lint, PHP CodeSniffer - for $TRAVIS_PHP_VERSION"
if [ "$TRAVIS_PHP_VERSION" = '5.6' ] || [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] \
[ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
composer -n require phpunit/phpunit ^5 \
jakub-onderka/php-parallel-lint ^0 \
jakub-onderka/php-console-highlighter ^0 \
php-parallel-lint/php-parallel-lint ^0 \
php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
if [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer -n require --ignore-platform-reqs phpunit/phpunit ^5 \
jakub-onderka/php-parallel-lint ^0 \
jakub-onderka/php-console-highlighter ^0 \
php-parallel-lint/php-parallel-lint ^1 \
php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
echo
@ -283,7 +277,11 @@ script:
# Ensure we catch errors
set -e
#parallel-lint --exclude htdocs/includes --blame .
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame .
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
--exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/maximebf \
--exclude htdocs/includes/phpunit/ --exclude htdocs/includes/tecnickcom/tcpdf/include/barcodes --exclude htdocs/includes/webmozart --blame .
set +e
echo

View File

@ -21,7 +21,7 @@ Mobiledetect 2.8.34 MIT License Yes
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
ParseDown 1.6 MIT License Yes Markdown parser
PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
PHPSpreadSheet ? LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP

View File

@ -13,7 +13,10 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Properties ->contactid has been renamed into ->contact_id
* Rename property $paiementid in API api_supplier_invoices into $payment_mode_id
* The deprecated subsitution key __SIGNATURE__ has been removed. Replace with __USER_SIGNATURE__ if you still use old syntax in
your email templates.
* The hidden option HOLIDAY_MORE_PUBLIC_HOLIDAYS has been removed. Use instead the dictionary table if you need to define custom
days of holiday.
***** ChangeLog for 12.0.2 compared to 12.0.1 *****
FIX: computation of the bottom margin of <body> returns NaN because body is not loaded yet
@ -341,14 +344,14 @@ Following changes may create regressions for some external modules, but were nec
WARNING FOR DOLIWAMP USERS ONLY:
Only people that installed Dolibarr using the all-in-one autoinstaller for Windows called "DoliWAMP" are concerned by the following warnings:
Only people that installed Dolibarr using the all-in-one auto-installer for Windows called "DoliWAMP" are concerned by the following warnings:
* DoliWAMP autoinstaller for Windows is not more available on 32bits systems. Use standard package if you need to use such architecture.
* It is not possible to migrate from an installation done with the old DoliWAMP autoinstaller for Windows by using this new one. You must make a backup
of your database, make a fresh installation using the new installer and reload your backup. Don't forget that DoliWAMP is a good solution to make a
quick test of Dolibarr on your local computer but was never recommanded as a production solution on a local desktop since a desktop computer has not
a backup and security policy as good as on a server (when there is one).
DoliWAMP remains a solution for fast test or demo purposes. Prefer using standard package for production.
* DoliWAMP auto-installer for Windows is no more available on 32 bits systems. Use standard package if you need to use such architecture.
* It is not possible to migrate from an installation done with the old DoliWAMP auto-installer for Windows by using this new one.
You must make a backup of your database, make a fresh installation using the new installer and reload your backup.
Don't forget that DoliWAMP is a good solution to make a quick test of Dolibarr on your local computer but is not recommended as a production
solution on a local desktop since a local desktop computer has often no backup and security policy, or not as good as on a server (when there is one).
DoliWAMP remains a solution for fast test or demo purposes. Prefer using standard packages for production.
***** ChangeLog for 11.0.5 compared to 11.0.4 *****

View File

@ -64,9 +64,10 @@ No vulnerability disclosure, including partial is allowed for the moment.
ONLY vulnerabilities discovered, when the following setup on tested platform is used, are accepted:
* $dolibarr_main_prod must be 1 into conf.php
* $dolibarr_nocsrfcheck must not be set to 0 (should be 1 by default) into conf.php
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this value should be hard switched soon to 1 by default)
* $dolibarr_main_prod must be set to 1 into conf.php
* $dolibarr_nocsrfcheck must be kept to the default value 1 into conf.php
* The module DebugBar must NOT be enabled (by default, this module is not enabled)
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this value should be switched soon to 1 by default)
* ONLY security reports on "stable" modules are allowed (troubles into "experimental" and "developement" modules are not accepted).
Scope is the web application (back office) and the APIs.

View File

@ -24,7 +24,7 @@
"vendor-dir" : "htdocs/includes"
},
"require" : {
"php" : ">=5.5.0",
"php" : ">=5.6.0",
"ext-curl" : "*",
"ckeditor/ckeditor" : "4.12.1",
"mike42/escpos-php" : "2.2",
@ -33,11 +33,13 @@
"restler/framework" : "3.0.0-RC6",
"tecnickcom/tcpdf" : "6.3.2",
"nnnick/chartjs" : "^2.9",
"stripe/stripe-php" : "6.43.1"
"stripe/stripe-php" : "6.43.1",
"maximebf/debugbar" : "1.15.1",
"symfony/var-dumper": "3"
},
"require-dev" : {
"jakub-onderka/php-parallel-lint" : "^0",
"jakub-onderka/php-console-highlighter" : "^0",
"php-parallel-lint/php-parallel-lint" : "^0",
"php-parallel-lint/php-console-highlighter" : "^0",
"phpunit/phpunit" : "^4",
"squizlabs/php_codesniffer" : "^2",
"phpunit/phpunit-selenium" : "^2"

458
composer.lock generated
View File

@ -1,10 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "17e906996157e8a94564f686a6096dc5",
"content-hash": "1dbd2d05cc0836acfca5988f29005cf2",
"packages": [
{
"name": "ckeditor/ckeditor",
@ -47,6 +47,67 @@
],
"time": "2019-06-28T10:41:23+00:00"
},
{
"name": "maximebf/debugbar",
"version": "v1.15.1",
"source": {
"type": "git",
"url": "https://github.com/maximebf/php-debugbar.git",
"reference": "6c4277f6117e4864966c9cb58fb835cee8c74a1e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/6c4277f6117e4864966c9cb58fb835cee8c74a1e",
"reference": "6c4277f6117e4864966c9cb58fb835cee8c74a1e",
"shasum": ""
},
"require": {
"php": ">=5.6",
"psr/log": "^1.0",
"symfony/var-dumper": "^2.6|^3|^4"
},
"require-dev": {
"phpunit/phpunit": "^5"
},
"suggest": {
"kriswallsmith/assetic": "The best way to manage assets",
"monolog/monolog": "Log using Monolog",
"predis/predis": "Redis storage"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.15-dev"
}
},
"autoload": {
"psr-4": {
"DebugBar\\": "src/DebugBar/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maxime Bouroumeau-Fuseau",
"email": "maxime.bouroumeau@gmail.com",
"homepage": "http://maximebf.com"
},
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Debug bar in the browser for php application",
"homepage": "https://github.com/maximebf/php-debugbar",
"keywords": [
"debug",
"debugbar"
],
"time": "2019-09-24T14:55:42+00:00"
},
{
"name": "mike42/escpos-php",
"version": "v2.2",
@ -253,6 +314,53 @@
"abandoned": "phpoffice/phpspreadsheet",
"time": "2015-05-01T07:00:55+00:00"
},
{
"name": "psr/log",
"version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
],
"time": "2020-03-23T09:12:05+00:00"
},
{
"name": "restler/framework",
"version": "3.0.0-RC6",
@ -260,12 +368,12 @@
"source": {
"type": "git",
"url": "https://github.com/Luracast/Restler-Framework.git",
"reference": "0f6b0f26152f83e43a2a86820206c455095fb2b0"
"reference": "d52e61600d153bca60a287c35141c5c01863127b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Luracast/Restler-Framework/zipball/0f6b0f26152f83e43a2a86820206c455095fb2b0",
"reference": "0f6b0f26152f83e43a2a86820206c455095fb2b0",
"url": "https://api.github.com/repos/Luracast/Restler-Framework/zipball/d52e61600d153bca60a287c35141c5c01863127b",
"reference": "d52e61600d153bca60a287c35141c5c01863127b",
"shasum": ""
},
"require": {
@ -312,7 +420,7 @@
"rest",
"server"
],
"time": "2019-05-12T15:15:11+00:00"
"time": "2020-02-13T16:05:12+00:00"
},
{
"name": "stripe/stripe-php",
@ -370,6 +478,146 @@
],
"time": "2019-08-29T16:56:12+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/var-dumper",
"version": "v3.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "737e07704cca83f9dd0af926d45ce27eedc25657"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/737e07704cca83f9dd0af926d45ce27eedc25657",
"reference": "737e07704cca83f9dd0af926d45ce27eedc25657",
"shasum": ""
},
"require": {
"php": ">=5.5.9",
"symfony/polyfill-mbstring": "~1.0"
},
"require-dev": {
"twig/twig": "~1.20|~2.0"
},
"suggest": {
"ext-symfony_debug": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"files": [
"Resources/functions/dump.php"
],
"psr-4": {
"Symfony\\Component\\VarDumper\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony mechanism for exploring and dumping PHP variables",
"homepage": "https://symfony.com",
"keywords": [
"debug",
"dump"
],
"time": "2015-11-18T13:48:51+00:00"
},
{
"name": "tecnickcom/tcpdf",
"version": "6.3.2",
@ -489,16 +737,16 @@
"time": "2015-06-14T21:17:01+00:00"
},
{
"name": "jakub-onderka/php-console-color",
"name": "php-parallel-lint/php-console-color",
"version": "v0.2",
"source": {
"type": "git",
"url": "https://github.com/JakubOnderka/PHP-Console-Color.git",
"url": "https://github.com/php-parallel-lint/PHP-Console-Color.git",
"reference": "d5deaecff52a0d61ccb613bb3804088da0307191"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Color/zipball/d5deaecff52a0d61ccb613bb3804088da0307191",
"url": "https://api.github.com/repos/php-parallel-lint/PHP-Console-Color/zipball/d5deaecff52a0d61ccb613bb3804088da0307191",
"reference": "d5deaecff52a0d61ccb613bb3804088da0307191",
"shasum": ""
},
@ -531,28 +779,31 @@
"time": "2018-09-29T17:23:10+00:00"
},
{
"name": "jakub-onderka/php-console-highlighter",
"version": "v0.4",
"name": "php-parallel-lint/php-console-highlighter",
"version": "v0.5",
"source": {
"type": "git",
"url": "https://github.com/JakubOnderka/PHP-Console-Highlighter.git",
"reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547"
"url": "https://github.com/php-parallel-lint/PHP-Console-Highlighter.git",
"reference": "21bf002f077b177f056d8cb455c5ed573adfdbb8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Console-Highlighter/zipball/9f7a229a69d52506914b4bc61bfdb199d90c5547",
"reference": "9f7a229a69d52506914b4bc61bfdb199d90c5547",
"url": "https://api.github.com/repos/php-parallel-lint/PHP-Console-Highlighter/zipball/21bf002f077b177f056d8cb455c5ed573adfdbb8",
"reference": "21bf002f077b177f056d8cb455c5ed573adfdbb8",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"jakub-onderka/php-console-color": "~0.2",
"php": ">=5.4.0"
"php": ">=5.4.0",
"php-parallel-lint/php-console-color": "~0.2"
},
"replace": {
"jakub-onderka/php-console-highlighter": "*"
},
"require-dev": {
"jakub-onderka/php-code-style": "~1.0",
"jakub-onderka/php-parallel-lint": "~1.0",
"jakub-onderka/php-var-dump-check": "~0.1",
"php-parallel-lint/php-code-style": "~1.0",
"php-parallel-lint/php-parallel-lint": "~1.0",
"php-parallel-lint/php-var-dump-check": "~0.1",
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~1.5"
},
@ -574,19 +825,19 @@
}
],
"description": "Highlight PHP code in terminal",
"time": "2018-09-29T18:48:56+00:00"
"time": "2020-05-13T07:37:49+00:00"
},
{
"name": "jakub-onderka/php-parallel-lint",
"name": "php-parallel-lint/php-parallel-lint",
"version": "v0.9.2",
"source": {
"type": "git",
"url": "https://github.com/JakubOnderka/PHP-Parallel-Lint.git",
"url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git",
"reference": "2ead2e4043ab125bee9554f356e0a86742c2d4fa"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/JakubOnderka/PHP-Parallel-Lint/zipball/2ead2e4043ab125bee9554f356e0a86742c2d4fa",
"url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/2ead2e4043ab125bee9554f356e0a86742c2d4fa",
"reference": "2ead2e4043ab125bee9554f356e0a86742c2d4fa",
"shasum": ""
},
@ -1082,6 +1333,7 @@
"keywords": [
"tokenizer"
],
"abandoned": true,
"time": "2017-12-04T08:55:13+00:00"
},
{
@ -1785,6 +2037,159 @@
],
"time": "2019-08-06T08:03:45+00:00"
},
{
"name": "symfony/polyfill-php72",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
"reference": "639447d008615574653fb3bc60d1986d7172eaae"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae",
"reference": "639447d008615574653fb3bc60d1986d7172eaae",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php72\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981",
"reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981",
"shasum": ""
},
"require": {
"php": ">=7.0.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.18-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Php80\\": ""
},
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"polyfill",
"portable",
"shim"
],
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2020-07-14T12:35:20+00:00"
},
{
"name": "symfony/yaml",
"version": "v3.4.32",
@ -1903,8 +2308,9 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.5.0",
"php": ">=5.6.0",
"ext-curl": "*"
},
"platform-dev": []
"platform-dev": [],
"plugin-api-version": "1.1.0"
}

View File

@ -28,19 +28,6 @@ With
DEBUGBAR:
---------
Move
this.options = {
bodyMarginBottom: true,
bodyMarginBottomHeight: parseInt($('body').css('margin-bottom')),
};
few line lower in the
initialize: function() {
ESCPOS:
-------
Replace

View File

@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "admin", "accountancy"));
$langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other"));
// Security access
if (empty($user->rights->accounting->chartofaccount))
@ -46,14 +46,15 @@ $action = GETPOST('action', 'aZ09');
// Parameters ACCOUNTING_* and others
$list = array(
'ACCOUNTING_LENGTH_GACCOUNT',
'ACCOUNTING_LENGTH_AACCOUNT',
'ACCOUNTING_LENGTH_GACCOUNT',
'ACCOUNTING_LENGTH_AACCOUNT',
// 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
// 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
);
$list_binding = array(
'ACCOUNTING_DATE_START_BINDING',
'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER'
);
/*
@ -67,17 +68,17 @@ if ($action == 'update') {
if (!$error)
{
foreach ($list as $constname)
{
$constvalue = GETPOST($constname, 'alpha');
foreach ($list as $constname)
{
$constvalue = GETPOST($constname, 'alpha');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
if ($error) {
setEventMessages($langs->trans("Error"), null, 'errors');
}
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
if ($error) {
setEventMessages($langs->trans("Error"), null, 'errors');
}
foreach ($list_binding as $constname)
{
@ -96,46 +97,46 @@ if ($action == 'update') {
}
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
}
if ($action == 'setlistsorttodo') {
$setlistsorttodo = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
if (!$res > 0)
$error++;
$setlistsorttodo = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
if (!$res > 0)
$error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setlistsortdone') {
$setlistsortdone = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
if (!$res > 0)
$error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
$setlistsortdone = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
if (!$res > 0)
$error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setmanagezero') {
$setmanagezero = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
if (!$res > 0)
$error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
$setmanagezero = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
if (!$res > 0)
$error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setdisabledirectinput') {
@ -163,15 +164,51 @@ if ($action == 'setenabledraftexport') {
}
if ($action == 'setenablesubsidiarylist') {
$setenablesubsidiarylist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity);
if (!$res > 0)
$error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
$setenablesubsidiarylist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTANCY_COMBO_FOR_AUX", $setenablesubsidiarylist, 'yesno', 0, '', $conf->entity);
if (!$res > 0)
$error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setdisablebindingonsales') {
$setdisablebindingonsales = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_SALES", $setdisablebindingonsales, 'yesno', 0, '', $conf->entity);
if (!$res > 0)
$error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setdisablebindingonpurchases') {
$setdisablebindingonpurchases = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_PURCHASES", $setdisablebindingonpurchases, 'yesno', 0, '', $conf->entity);
if (!$res > 0)
$error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setdisablebindingonexpensereports') {
$setdisablebindingonexpensereports = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS", $setdisablebindingonexpensereports, 'yesno', 0, '', $conf->entity);
if (!$res > 0)
$error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
/*
@ -226,82 +263,78 @@ print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('Options').'</td>';
print "</tr>\n";
if (!empty($user->admin))
// TO DO Mutualize code for yes/no constants
/* Set this option as a hidden option but keep it for some needs.
print '<tr>';
print '<td>'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setenabledraftexport&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setenabledraftexport&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
*/
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>';
if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisabledirectinput&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisabledirectinput&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX").'</td>';
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setenablesubsidiarylist&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setenablesubsidiarylist&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_MANAGE_ZERO").'</td>';
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setmanagezero&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setmanagezero&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
// Param a user $user->rights->accounting->chartofaccount can access
foreach ($list as $key)
{
// TO DO Mutualize code for yes/no constants
print '<tr class="oddeven value">';
/* Set this option as a hidden option but keep it for some needs.
print '<tr>';
print '<td>'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setenabledraftexport&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setenabledraftexport&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue;
// Param
$label = $langs->trans($key);
print '<td>'.$label.'</td>';
// Value
print '<td class="right">';
print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
print '</td>';
print '</tr>';
*/
print '<tr class="oddeven">';
print '<td>'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").'</td>';
if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisabledirectinput&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisabledirectinput&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX").'</td>';
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setenablesubsidiarylist&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setenablesubsidiarylist&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("ACCOUNTING_MANAGE_ZERO").'</td>';
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setmanagezero&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setmanagezero&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
// Param a user $user->rights->accounting->chartofaccount can access
foreach ($list as $key)
{
print '<tr class="oddeven value">';
if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue;
// Param
$label = $langs->trans($key);
print '<td>'.$label.'</td>';
// Value
print '<td class="right">';
print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
print '</td>';
print '</tr>';
}
}
print '</table>';
print '<br>';
@ -312,57 +345,94 @@ print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>';
print "</tr>\n";
if (!empty($user->admin))
{
// TO DO Mutualize code for yes/no constants
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setlistsorttodo&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setlistsorttodo&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setlistsortdone&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setlistsortdone&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
// TO DO Mutualize code for yes/no constants
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setlistsorttodo&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setlistsorttodo&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setlistsortdone&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setlistsortdone&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
// Param a user $user->rights->accounting->chartofaccount can access
foreach ($list_binding as $key)
{
print '<tr class="oddeven value">';
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
print '<td>'.$label.'</td>';
// Value
print '<td class="right">';
if ($key == 'ACCOUNTING_DATE_START_BINDING') {
// Param
$label = $langs->trans($key);
print '<td>'.$label.'</td>';
// Value
print '<td class="right">';
if ($key == 'ACCOUNTING_DATE_START_BINDING') {
print $form->selectDate(($conf->global->$key ? $db->idate($conf->global->$key) : -1), $key, 0, 0, 1);
} else {
} elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') {
$array=array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear"));
print $form->selectarray($key, $array, (isset($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER)?$conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER:0));
} else {
print '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
}
print '</td>';
print '</tr>';
print '</td>';
print '</tr>';
}
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_SALES").'</td>';
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablebindingonsales&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablebindingonsales&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_PURCHASES").'</td>';
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablebindingonpurchases&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablebindingonpurchases&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS").'</td>';
if (!empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablebindingonexpensereports&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablebindingonexpensereports&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '</table>';

View File

@ -93,7 +93,7 @@ $formaccounting = new FormAccounting($db);
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$search_societe = '';
$search_lineid = '';
$search_lineid = '';
$search_ref = '';
$search_invoice = '';
$search_label = '';
@ -203,7 +203,7 @@ if ($search_societe) {
$sql .= natural_search('s.nom', $search_societe);
}
if ($search_lineid) {
$sql .= natural_search("fd.rowid", $search_lineid, 1);
$sql .= natural_search("fd.rowid", $search_lineid, 1);
}
if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.ref", $search_invoice);
@ -251,13 +251,13 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
}
$sql .= $db->plimit($limit + 1, $offset);
@ -309,9 +309,9 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
print '<td class="liste_titre center nowraponall">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
}
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
}
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
$formother->select_year($search_year, 'search_year', 1, 20, 5);
print '</td>';
@ -349,10 +349,10 @@ if ($result) {
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n";
$thirdpartystatic = new Societe($db);
$facturestatic = new Facture($db);
$thirdpartystatic = new Societe($db);
$facturestatic = new Facture($db);
$productstatic = new Product($db);
$accountingaccountstatic = new AccountingAccount($db);
$accountingaccountstatic = new AccountingAccount($db);
$i = 0;
while ($i < min($num_lines, $limit)) {
@ -362,16 +362,16 @@ if ($result) {
$facturestatic->id = $objp->facid;
$facturestatic->type = $objp->ftype;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
$thirdpartystatic->client = $objp->client;
$thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->code_client = $objp->code_client;
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
$thirdpartystatic->client = $objp->client;
$thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->code_client = $objp->code_client;
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code;
$productstatic->ref = $objp->product_ref;
$productstatic->id = $objp->product_id;
@ -412,7 +412,7 @@ if ($result) {
print '<td class="right">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
// Thirdparty
print '<td class="tdoverflowmax100">' . $thirdpartystatic->getNomUrl(1, 'customer') . '</td>';
print '<td class="tdoverflowmax100">'.$thirdpartystatic->getNomUrl(1, 'customer').'</td>';
// Country
print '<td>';
@ -425,7 +425,7 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>';
print '<td class="center">';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit();
print '</a></td>';
@ -434,14 +434,14 @@ if ($result) {
print '</tr>';
$i++;
}
print '</table>';
print "</div>";
print '</table>';
print "</div>";
if ($nbtotalofrecords > $limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
}
if ($nbtotalofrecords > $limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
}
print '</form>';
print '</form>';
} else {
print $db->lasterror();
}

View File

@ -114,7 +114,7 @@ if (empty($reshook))
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
{
$search_societe='';
$search_societe = '';
$search_lineid = '';
$search_ref = '';
$search_invoice = '';
@ -386,7 +386,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="' . dol_escape_htmltag($search_societe) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1);
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
@ -582,7 +582,7 @@ if ($result) {
print '</td>';
// Thirdparty
print '<td class="tdoverflowmax100">' . $thirdpartystatic->getNomUrl(1, 'customer') . '</td>';
print '<td class="tdoverflowmax100">'.$thirdpartystatic->getNomUrl(1, 'customer').'</td>';
// Country
print '<td>';

View File

@ -201,16 +201,16 @@ if ($resql) {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
} else print $row[1];
print '</td>';
for ($i = 2; $i <= 12; $i++) {
print '<td class="nowrap right">'.price($row[$i]).'</td>';
}
print '<td class="nowrap right">'.price($row[13]).'</td>';
print '<td class="nowrap right"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
$db->free($resql);
for ($i = 2; $i <= 12; $i++) {
print '<td class="nowrap right">'.price($row[$i]).'</td>';
}
print '<td class="nowrap right">'.price($row[13]).'</td>';
print '<td class="nowrap right"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
@ -275,16 +275,16 @@ if ($resql) {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
} else print $row[1];
print '</td>';
for ($i = 2; $i <= 12; $i++) {
print '<td class="nowrap right">'.price($row[$i]).'</td>';
}
print '<td class="nowrap right">'.price($row[13]).'</td>';
print '<td class="nowrap right"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
$db->free($resql);
for ($i = 2; $i <= 12; $i++) {
print '<td class="nowrap right">'.price($row[$i]).'</td>';
}
print '<td class="nowrap right">'.price($row[13]).'</td>';
print '<td class="nowrap right"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
@ -293,60 +293,60 @@ print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report where results depends on next step (so not yet available) ?
{
print '<br>';
print '<br>';
print '<br>';
print '<br>';
print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');
print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="400" class="left">'.$langs->trans("Total").'</td>';
for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) $j -= 12;
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
}
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="400" class="left">'.$langs->trans("Total").'</td>';
for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) $j -= 12;
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
}
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
$sql = "SELECT '".$langs->trans("TotalExpenseReport")."' AS label,";
for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) $j -= 12;
$sql .= " SUM(".$db->ifsql('MONTH(er.date_create)='.$j, 'erd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
}
$sql .= " SUM(erd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expensereport as er ON er.rowid = erd.fk_expensereport";
$sql .= " WHERE er.date_debut >= '".$db->idate($search_date_start)."'";
$sql .= " AND er.date_debut <= '".$db->idate($search_date_end)."'";
$sql = "SELECT '".$langs->trans("TotalExpenseReport")."' AS label,";
for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) $j -= 12;
$sql .= " SUM(".$db->ifsql('MONTH(er.date_create)='.$j, 'erd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
}
$sql .= " SUM(erd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expensereport as er ON er.rowid = erd.fk_expensereport";
$sql .= " WHERE er.date_debut >= '".$db->idate($search_date_start)."'";
$sql .= " AND er.date_debut <= '".$db->idate($search_date_end)."'";
// Define begin binding date
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND er.date_debut >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
}
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr><td>'.$row[0].'</td>';
for ($i = 1; $i <= 12; $i++) {
print '<td class="nowrap right">'.price($row[$i]).'</td>';
}
print '<td class="nowrap right"><b>'.price($row[13]).'</b></td>';
print '</tr>';
}
while ($row = $db->fetch_row($resql)) {
print '<tr><td>'.$row[0].'</td>';
for ($i = 1; $i <= 12; $i++) {
print '<td class="nowrap right">'.price($row[$i]).'</td>';
}
print '<td class="nowrap right"><b>'.price($row[13]).'</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
}
// End of page

View File

@ -86,8 +86,8 @@ $formaccounting = new FormAccounting($db);
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
{
$search_login = '';
$search_expensereport = '';
$search_login = '';
$search_expensereport = '';
$search_label = '';
$search_desc = '';
$search_amount = '';
@ -178,7 +178,7 @@ $sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't sha
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
// Add search filter like
if (strlen(trim($search_login))) {
$sql .= natural_search("u.login", $search_login);
$sql .= natural_search("u.login", $search_login);
}
if (strlen(trim($search_expensereport))) {
$sql .= natural_search("er.ref", $search_expensereport);
@ -207,13 +207,13 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
}
$sql .= $db->plimit($limit + 1, $offset);
@ -228,7 +228,7 @@ if ($result) {
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_login) $param .= '&search_login='.urlencode($search_login);
if ($search_login) $param .= '&search_login='.urlencode($search_login);
if ($search_expensereport) $param .= "&search_expensereport=".urlencode($search_expensereport);
if ($search_label) $param .= "&search_label=".urlencode($search_label);
if ($search_desc) $param .= "&search_desc=".urlencode($search_desc);
@ -257,12 +257,12 @@ if ($result) {
$moreforfilter = '';
print '<div class="div-table-responsive">';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
print '<td class="liste_titre"></td>';
print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>';
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
print '<td class="liste_titre"></td>';
@ -278,14 +278,14 @@ if ($result) {
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre("Employees", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Employees", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
print_liste_field_titre("DateValidation", $_SERVER["PHP_SELF"], "er.date_valid", "", $param, '', $sortfield, $sortorder, 'center ');
@ -296,31 +296,31 @@ if ($result) {
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
$checkpicto = $form->showCheckAddButtons();
$checkpicto = $form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n";
$expensereportstatic = new ExpenseReport($db);
$accountingaccountstatic = new AccountingAccount($db);
$userstatic = new User($db);
$userstatic = new User($db);
$i = 0;
$i = 0;
while ($i < min($num_lines, $limit)) {
$objp = $db->fetch_object($result);
$expensereportstatic->ref = $objp->ref;
$expensereportstatic->id = $objp->erid;
$userstatic->id = $objp->rowid;
$userstatic->ref = $objp->label;
$userstatic->login = $objp->login;
$userstatic->statut = $objp->statut;
$userstatic->email = $objp->email;
$userstatic->gender = $objp->gender;
$userstatic->firstname = $objp->firstname;
$userstatic->lastname = $objp->lastname;
$userstatic->employee = $objp->employee;
$userstatic->photo = $objp->photo;
$userstatic->id = $objp->rowid;
$userstatic->ref = $objp->label;
$userstatic->login = $objp->login;
$userstatic->statut = $objp->statut;
$userstatic->email = $objp->email;
$userstatic->gender = $objp->gender;
$userstatic->firstname = $objp->firstname;
$userstatic->lastname = $objp->lastname;
$userstatic->employee = $objp->employee;
$userstatic->photo = $objp->photo;
$accountingaccountstatic->rowid = $objp->fk_compte;
$accountingaccountstatic->label = $objp->label;
@ -329,15 +329,15 @@ if ($result) {
print '<tr class="oddeven">';
// Login
print '<td class="nowraponall">';
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
print '</td>';
// Login
print '<td class="nowraponall">';
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
print '</td>';
// Line id
// Line id
print '<td>'.$objp->rowid.'</td>';
// Ref Expense report
// Ref Expense report
print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
// Date validation
@ -347,10 +347,10 @@ if ($result) {
print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>';
// Fees label
// Fees label
print '<td class="tdoverflow">'.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).'</td>';
// Fees description -- Can be null
// Fees description -- Can be null
print '<td>';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
@ -360,13 +360,13 @@ if ($result) {
// Amount without taxes
print '<td class="nowrap right">'.price($objp->total_ht).'</td>';
// Vat rate
// Vat rate
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
// Accounting account affected
print '<td class="center">';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit();
print '</a></td>';
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>';
@ -379,7 +379,7 @@ if ($result) {
print "</div>";
if ($nbtotalofrecords > $limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
}
print '</form>';

View File

@ -102,16 +102,16 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
{
$search_login = '';
$search_expensereport = '';
$search_label = '';
$search_desc = '';
$search_amount = '';
$search_account = '';
$search_vat = '';
$search_day = '';
$search_month = '';
$search_year = '';
$search_login = '';
$search_expensereport = '';
$search_label = '';
$search_desc = '';
$search_amount = '';
$search_account = '';
$search_vat = '';
$search_day = '';
$search_month = '';
$search_year = '';
}
// Mass actions
@ -124,46 +124,46 @@ include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($massaction == 'ventil') {
$msg = '';
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if (!empty($mesCasesCochees)) {
$msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
$msg .= '<div class="detail">';
$cpt = 0;
$ok = 0;
$ko = 0;
//print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if (!empty($mesCasesCochees)) {
$msg = '<div>'.$langs->trans("SelectedLines").': '.count($mesCasesCochees).'</div>';
$msg .= '<div class="detail">';
$cpt = 0;
$ok = 0;
$ko = 0;
foreach ($mesCasesCochees as $maLigneCochee) {
$maLigneCourante = explode("_", $maLigneCochee);
$monId = $maLigneCourante[0];
$monCompte = GETPOST('codeventil'.$monId);
foreach ($mesCasesCochees as $maLigneCochee) {
$maLigneCourante = explode("_", $maLigneCochee);
$monId = $maLigneCourante[0];
$monCompte = GETPOST('codeventil'.$monId);
if ($monCompte <= 0)
{
$msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>';
$ko++;
} else {
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det";
$sql .= " SET fk_code_ventilation = ".$monCompte;
$sql .= " WHERE rowid = ".$monId;
if ($monCompte <= 0)
{
$msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>';
$ko++;
} else {
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det";
$sql .= " SET fk_code_ventilation = ".$monCompte;
$sql .= " WHERE rowid = ".$monId;
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '');
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '');
dol_syslog('accountancy/expensereport/list.php:: sql='.$sql, LOG_DEBUG);
if ($db->query($sql)) {
$msg .= '<div><font color="green">'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</font></div>';
$ok++;
} else {
$msg .= '<div><font color="red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br/> <pre>'.$sql.'</pre></font></div>';
$ko++;
}
}
dol_syslog('accountancy/expensereport/list.php:: sql='.$sql, LOG_DEBUG);
if ($db->query($sql)) {
$msg .= '<div><font color="green">'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</font></div>';
$ok++;
} else {
$msg .= '<div><font color="red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br/> <pre>'.$sql.'</pre></font></div>';
$ko++;
}
}
$cpt++;
}
$msg .= '</div>';
$msg .= '<div>'.$langs->trans("EndProcessing").'</div>';
}
$cpt++;
}
$msg .= '</div>';
$msg .= '<div>'.$langs->trans("EndProcessing").'</div>';
}
}
@ -181,8 +181,8 @@ if (empty($chartaccountcode))
{
print $langs->trans("ErrorChartOfAccountSystemNotSelected");
// End of page
llxFooter();
$db->close();
llxFooter();
$db->close();
exit;
}
@ -204,25 +204,25 @@ if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
}
// Add search filter like
if (strlen(trim($search_login))) {
$sql .= natural_search("u.login", $search_login);
$sql .= natural_search("u.login", $search_login);
}
if (strlen(trim($search_expensereport))) {
$sql .= natural_search("er.ref", $search_expensereport);
$sql .= natural_search("er.ref", $search_expensereport);
}
if (strlen(trim($search_label))) {
$sql .= natural_search("f.label", $search_label);
$sql .= natural_search("f.label", $search_label);
}
if (strlen(trim($search_desc))) {
$sql .= natural_search("erd.comments", $search_desc);
$sql .= natural_search("erd.comments", $search_desc);
}
if (strlen(trim($search_amount))) {
$sql .= natural_search("erd.total_ht", $search_amount, 1);
$sql .= natural_search("erd.total_ht", $search_amount, 1);
}
if (strlen(trim($search_account))) {
$sql .= natural_search("aa.account_number", $search_account);
$sql .= natural_search("aa.account_number", $search_account);
}
if (strlen(trim($search_vat))) {
$sql .= natural_search("erd.tva_tx", $search_vat, 1);
$sql .= natural_search("erd.tva_tx", $search_vat, 1);
}
$sql .= dolSqlDateFilter('erd.date', $search_day, $search_month, $search_year);
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
@ -233,13 +233,13 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
}
$sql .= $db->plimit($limit + 1, $offset);
@ -255,7 +255,7 @@ if ($result) {
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($search_login) $param .= '&search_login='.urlencode($search_login);
if ($search_login) $param .= '&search_login='.urlencode($search_login);
if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid);
if ($search_day) $param .= '&search_day='.urlencode($search_day);
if ($search_month) $param .= '&search_month='.urlencode($search_month);
@ -267,7 +267,7 @@ if ($result) {
if ($search_vat) $param .= '&search_vat='.urlencode($search_vat);
$arrayofmassactions = array(
'ventil' => $langs->trans("Ventilate")
'ventil' => $langs->trans("Ventilate")
);
$massactionbutton = $form->selectMassAction('ventil', $arrayofmassactions, 1);
@ -295,12 +295,12 @@ if ($result) {
$moreforfilter = '';
print '<div class="div-table-responsive">';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// We add search filter
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>';
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
@ -324,7 +324,7 @@ if ($result) {
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
@ -356,23 +356,23 @@ if ($result) {
$expensereport_static->ref = $objp->ref;
$expensereport_static->id = $objp->erid;
$userstatic->id = $objp->rowid;
$userstatic->ref = $objp->label;
$userstatic->login = $objp->login;
$userstatic->statut = $objp->statut;
$userstatic->email = $objp->email;
$userstatic->gender = $objp->gender;
$userstatic->firstname = $objp->firstname;
$userstatic->lastname = $objp->lastname;
$userstatic->employee = $objp->employee;
$userstatic->photo = $objp->photo;
$userstatic->id = $objp->rowid;
$userstatic->ref = $objp->label;
$userstatic->login = $objp->login;
$userstatic->statut = $objp->statut;
$userstatic->email = $objp->email;
$userstatic->gender = $objp->gender;
$userstatic->firstname = $objp->firstname;
$userstatic->lastname = $objp->lastname;
$userstatic->employee = $objp->employee;
$userstatic->photo = $objp->photo;
print '<tr class="oddeven">';
print '<tr class="oddeven">';
// Login
print '<td class="nowraponall">';
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
print '</td>';
// Login
print '<td class="nowraponall">';
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
print '</td>';
// Line id
print '<td>'.$objp->rowid.'</td>';
@ -400,7 +400,7 @@ if ($result) {
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
print '</td>';
// Amount without taxes
// Amount without taxes
print '<td class="nowrap right">';
print price($objp->price);
print '</td>';

View File

@ -90,17 +90,16 @@ if ($user->socid > 0 && empty($id_journal))
$error = 0;
$year_current = strftime("%Y", dol_now());
$pastmonth = strftime("%m", dol_now()) - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
$pastmonthyear--;
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
{
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);

View File

@ -70,17 +70,16 @@ $accountingjournalstatic->fetch($id_journal);
$journal = $accountingjournalstatic->code;
$journal_label = $accountingjournalstatic->label;
$year_current = strftime("%Y", dol_now());
$pastmonth = strftime("%m", dol_now()) - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
$pastmonthyear--;
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
{
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);

View File

@ -75,17 +75,16 @@ $accountingjournalstatic->fetch($id_journal);
$journal = $accountingjournalstatic->code;
$journal_label = $accountingjournalstatic->label;
$year_current = strftime("%Y", dol_now());
$pastmonth = strftime("%m", dol_now()) - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
$pastmonthyear--;
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
{
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);

View File

@ -78,17 +78,16 @@ $accountingjournalstatic->fetch($id_journal);
$journal = $accountingjournalstatic->code;
$journal_label = $accountingjournalstatic->label;
$year_current = strftime("%Y", dol_now());
$pastmonth = strftime("%m", dol_now()) - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
$pastmonthyear--;
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
// Period by default on transfer
$dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start'];
$date_end = $dates['date_end'];
$pastmonthyear = $dates['pastmonthyear'];
$pastmonth = $dates['pastmonth'];
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
{
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);

View File

@ -331,9 +331,9 @@ $sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
dol_syslog('htdocs/accountancy/supplier/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
while ($row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>';
if ($row[0] == 'tobind')
{
@ -346,16 +346,16 @@ if ($resql) {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.$y, $langs->transnoentitiesnoconv("ToBind"));
} else print $row[1];
print '</td>';
for ($i = 2; $i <= 12; $i++) {
print '<td class="nowrap right">'.price($row[$i]).'</td>';
}
print '<td class="nowrap right">'.price($row[13]).'</td>';
print '<td class="nowrap right"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
$db->free($resql);
for ($i = 2; $i <= 12; $i++) {
print '<td class="nowrap right">'.price($row[$i]).'</td>';
}
print '<td class="nowrap right">'.price($row[13]).'</td>';
print '<td class="nowrap right"><b>'.price($row[14]).'</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
@ -364,60 +364,60 @@ print '</div>';
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
{
print '<br>';
print '<br>';
print '<br>';
print '<br>';
print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');
print_barre_liste($langs->trans("OtherInfo"), '', '', '', '', '', '', -1, '', '', 0, '', '', 0, 1, 1);
//print load_fiche_titre($langs->trans("OtherInfo"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="400" class="left">'.$langs->trans("Total").'</td>';
for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) $j -= 12;
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
}
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td width="400" class="left">'.$langs->trans("Total").'</td>';
for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) $j -= 12;
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
}
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
$sql = "SELECT '".$langs->trans("CAHTF")."' AS label,";
for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) $j -= 12;
$sql .= " SUM(".$db->ifsql('MONTH(ff.datef)='.$j, 'ffd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
}
$sql .= " SUM(ffd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
$sql = "SELECT '".$langs->trans("CAHTF")."' AS label,";
for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) $j -= 12;
$sql .= " SUM(".$db->ifsql('MONTH(ff.datef)='.$j, 'ffd.total_ht', '0').") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
}
$sql .= " SUM(ffd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
// Define begin binding date
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND ff.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
}
$sql .= " AND ff.fk_statut > 0";
$sql .= " AND ff.fk_statut > 0";
$sql .= " AND ffd.product_type <= 2";
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
$sql .= " AND ff.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/supplier/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
dol_syslog('htdocs/accountancy/supplier/index.php');
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr><td>'.$row[0].'</td>';
for ($i = 1; $i <= 12; $i++) {
print '<td class="nowrap right">'.price($row[$i]).'</td>';
}
print '<td class="nowrap right"><b>'.price($row[13]).'</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
while ($row = $db->fetch_row($resql)) {
print '<tr><td>'.$row[0].'</td>';
for ($i = 1; $i <= 12; $i++) {
print '<td class="nowrap right">'.price($row[$i]).'</td>';
}
print '<td class="nowrap right"><b>'.price($row[13]).'</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
print '</div>';
}
// End of page

View File

@ -94,7 +94,7 @@ $formaccounting = new FormAccounting($db);
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$search_societe = '';
$search_lineid = '';
$search_lineid = '';
$search_ref = '';
$search_invoice = '';
$search_label = '';
@ -196,7 +196,7 @@ if ($search_societe) {
$sql .= natural_search('s.nom', $search_societe);
}
if ($search_lineid) {
$sql .= natural_search("l.rowid", $search_lineid, 1);
$sql .= natural_search("l.rowid", $search_lineid, 1);
}
if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.ref", $search_invoice);
@ -250,13 +250,13 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
}
$sql .= $db->plimit($limit + 1, $offset);
@ -318,7 +318,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="' . dol_escape_htmltag($search_societe) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1);
// print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
@ -348,29 +348,29 @@ if ($result) {
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n";
$thirdpartystatic = new Societe($db);
$thirdpartystatic = new Societe($db);
$facturefournisseur_static = new FactureFournisseur($db);
$productstatic = new ProductFournisseur($db);
$accountingaccountstatic = new AccountingAccount($db);
$accountingaccountstatic = new AccountingAccount($db);
$i = 0;
$i = 0;
while ($i < min($num_lines, $limit))
{
{
$objp = $db->fetch_object($result);
$facturefournisseur_static->ref = $objp->ref;
$facturefournisseur_static->id = $objp->facid;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
$thirdpartystatic->client = $objp->client;
$thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->code_client = $objp->code_client;
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->id = $objp->socid;
$thirdpartystatic->name = $objp->name;
$thirdpartystatic->client = $objp->client;
$thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->code_client = $objp->code_client;
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code;
$productstatic->ref = $objp->product_ref;
$productstatic->id = $objp->product_id;
@ -415,7 +415,7 @@ if ($result) {
print '<td class="right">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
// Thirdparty
print '<td class="tdoverflowmax100">' . $thirdpartystatic->getNomUrl(1, 'supplier') . '</td>';
print '<td class="tdoverflowmax100">'.$thirdpartystatic->getNomUrl(1, 'supplier').'</td>';
// Country
print '<td>';
@ -428,7 +428,7 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>';
print '<td class="center">';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit();
print '</a></td>';
@ -437,14 +437,14 @@ if ($result) {
print '</tr>';
$i++;
}
print '</table>';
print "</div>";
print '</table>';
print "</div>";
if ($nbtotalofrecords > $limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
}
if ($nbtotalofrecords > $limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords, '', 0, '', '', $limit, 1);
}
print '</form>';
print '</form>';
} else {
print $db->lasterror();
}

View File

@ -118,7 +118,7 @@ if (empty($reshook))
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
{
$search_societe='';
$search_societe = '';
$search_lineid = '';
$search_ref = '';
$search_invoice = '';
@ -385,7 +385,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="' . dol_escape_htmltag($search_societe) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1);
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
@ -419,7 +419,7 @@ if ($result) {
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n";
$thirdpartystatic=new Societe($db);
$thirdpartystatic = new Societe($db);
$facturefourn_static = new FactureFournisseur($db);
$product_static = new Product($db);
@ -569,7 +569,7 @@ if ($result) {
print '</td>';
// Thirdparty
print '<td class="tdoverflowmax100">' . $thirdpartystatic->getNomUrl(1, 'supplier') . '</td>';
print '<td class="tdoverflowmax100">'.$thirdpartystatic->getNomUrl(1, 'supplier').'</td>';
// Country
print '<td>';

View File

@ -47,15 +47,15 @@ $error = 0;
// Editing global variables not related to a specific theme
$constantes = array(
'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))),
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */
'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */
'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
'ADHERENT_MAIL_FROM'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html',
'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))),
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */
'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */
'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
'ADHERENT_MAIL_FROM'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html',
);
@ -66,16 +66,16 @@ $constantes = array(
//
if ($action == 'updateall') {
$db->begin();
$res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
$res1 = dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
$db->rollback();
} else {
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
$db->commit();
}
$db->begin();
$res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
$res1 = dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0) {
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
$db->rollback();
} else {
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
$db->commit();
}
}
// Action to update or add a constant

View File

@ -335,8 +335,8 @@ if (empty($reshook)) {
if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) {
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
} else {
// Create thumbs
$object->addThumbs($newfile);
// Create thumbs
$object->addThumbs($newfile);
}
}
} else {
@ -354,8 +354,8 @@ if (empty($reshook)) {
}
}
$rowid = $object->id;
$id = $object->id;
$rowid = $object->id;
$id = $object->id;
$action = '';
if (!empty($backtopage)) {
@ -402,7 +402,7 @@ if (empty($reshook)) {
// $skype=GETPOST("member_skype", 'alpha');
// $twitter=GETPOST("member_twitter", 'alpha');
// $facebook=GETPOST("member_facebook", 'alpha');
// $linkedin=GETPOST("member_linkedin", 'alpha');
// $linkedin=GETPOST("member_linkedin", 'alpha');
$email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
$login = GETPOST("member_login", 'alpha');
$pass = GETPOST("password", 'alpha');
@ -755,7 +755,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($result <= 0) dol_print_error('', $object->error);
}
$objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates
$objcanvas->display_canvas($action); // Show template
$objcanvas->display_canvas($action); // Show template
} else {
// -----------------------------------------
// When used in standard mode
@ -778,16 +778,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$object->country = $tmparray['label'];
}
if (!empty($socid)) {
$object = new Societe($db);
if ($socid > 0) $object->fetch($socid);
if (!empty($socid)) {
$object = new Societe($db);
if ($socid > 0) $object->fetch($socid);
if (!($object->id > 0)) {
$langs->load("errors");
print($langs->trans('ErrorRecordNotFound'));
exit;
}
}
if (!($object->id > 0)) {
$langs->load("errors");
print($langs->trans('ErrorRecordNotFound'));
exit;
}
}
$adht = new AdherentType($db);
@ -829,7 +829,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<input type="hidden" name="socid" value="'.$socid.'">';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
dol_fiche_head('');
dol_fiche_head('');
print '<table class="border centpercent">';
print '<tbody>';
@ -934,14 +934,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
print '<td>'.img_picto('', 'object_phoning_mobile').' <input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td></tr>';
if (!empty($conf->socialnetworks->enabled)) {
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
if (!$value['active']) break;
if (!$value['active']) break;
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="member_'.$key.'" size="40" value="'.(GETPOSTISSET('member_'.$key) ? GETPOST('member_'.$key, 'alpha') : $object->socialnetworks[$key]).'"></td></tr>';
}
}
// Birth Date
// Birth Date
print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
print "</td></tr>\n";
@ -1167,14 +1167,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
print '<td>'.img_picto('', 'object_phoning_mobile').' <input type="text" name="phone_mobile" value="'.(GETPOSTISSET("phone_mobile") ? GETPOST("phone_mobile") : $object->phone_mobile).'"></td></tr>';
if (!empty($conf->socialnetworks->enabled)) {
if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) {
if (!$value['active']) break;
if (!$value['active']) break;
print '<tr><td>'.$langs->trans($value['label']).'</td><td><input type="text" name="'.$key.'" class="minwidth100" value="'.(GETPOSTISSET($key) ? GETPOST($key, 'alphanohtml') : $object->socialnetworks[$key]).'"></td></tr>';
}
}
// Birth Date
// Birth Date
print "<tr><td>".$langs->trans("DateToBirth")."</td><td>\n";
print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
print "</td></tr>\n";
@ -1447,10 +1447,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
// Login
@ -1483,13 +1483,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $object->pass);
if ($object->pass) print preg_replace('/./i', '*', $object->pass);
else {
if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
else print $langs->trans("Hidden");
if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
else print $langs->trans("Hidden");
}
if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) {
$langs->load("errors");
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
$langs->load("errors");
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
}
print '</td></tr>';
}
@ -1503,8 +1503,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
} else {
if ($object->need_subscription == 0) {
print $langs->trans("SubscriptionNotNeeded");
} elseif (!$adht->subscription) {
print $langs->trans("SubscriptionNotNeeded");
} elseif (!$adht->subscription) {
print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
} else {
@ -1560,14 +1560,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
print '</td></tr>';
print '</table>';
print '</table>';
print '</div>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield tableforfield" width="100%">';
print '<table class="border tableforfield tableforfield" width="100%">';
// Birth Date
print '<tr><td class="titlefield">'.$langs->trans("DateToBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
@ -1585,12 +1585,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
//VCard
print '<tr><td>';
print $langs->trans("VCard").'</td><td colspan="3">';
print $langs->trans("VCard").'</td><td colspan="3">';
print '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'">';
print img_picto($langs->trans("Download"), 'vcard.png', 'class="paddingrightonly"');
print $langs->trans("Download");
print '</a>';
print '</td></tr>';
print '</td></tr>';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
@ -1598,9 +1598,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print "</table>\n";
print "</div></div></div>\n";
print '<div style="clear:both"></div>';
print '<div style="clear:both"></div>';
dol_fiche_end();
dol_fiche_end();
/*
@ -1769,7 +1769,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$morehtmlright .= '</a>';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'member', $socid, 1, 'listactions', $MAX, '', $morehtmlright);

View File

@ -62,26 +62,26 @@ class AdherentType extends CommonObject
public $libelle;
/**
* @var string Adherent type label
*/
public $label;
* @var string Adherent type label
*/
public $label;
/**
* @var string Adherent type nature
*/
public $morphy;
/**
* @var string Adherent type nature
*/
public $morphy;
public $duration;
public $duration;
/*
/*
* type expiration
*/
public $duration_value;
public $duration_value;
/**
* Expiration unit
*/
public $duration_unit;
/**
* Expiration unit
*/
public $duration_unit;
/**
* @var int Subsription required (0 or 1)
@ -101,7 +101,7 @@ class AdherentType extends CommonObject
/** @var array Array of members */
public $members = array();
public $multilangs = array();
public $multilangs = array();
/**
@ -115,157 +115,157 @@ class AdherentType extends CommonObject
$this->status = 1;
}
/**
* Load array this->multilangs
*
* @return int <0 if KO, >0 if OK
*/
public function getMultiLangs()
{
global $langs;
/**
* Load array this->multilangs
*
* @return int <0 if KO, >0 if OK
*/
public function getMultiLangs()
{
global $langs;
$current_lang = $langs->getDefaultLang();
$current_lang = $langs->getDefaultLang();
$sql = "SELECT lang, label, description, email";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql .= " WHERE fk_type=".$this->id;
$sql = "SELECT lang, label, description, email";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql .= " WHERE fk_type=".$this->id;
$result = $this->db->query($sql);
if ($result) {
while ($obj = $this->db->fetch_object($result)) {
//print 'lang='.$obj->lang.' current='.$current_lang.'<br>';
if ($obj->lang == $current_lang) { // si on a les traduct. dans la langue courante on les charge en infos principales.
$result = $this->db->query($sql);
if ($result) {
while ($obj = $this->db->fetch_object($result)) {
//print 'lang='.$obj->lang.' current='.$current_lang.'<br>';
if ($obj->lang == $current_lang) { // si on a les traduct. dans la langue courante on les charge en infos principales.
$this->label = $obj->label;
$this->description = $obj->description;
$this->email = $obj->email;
}
$this->multilangs["$obj->lang"]["label"] = $obj->label;
$this->multilangs["$obj->lang"]["description"] = $obj->description;
$this->multilangs["$obj->lang"]["email"] = $obj->email;
}
return 1;
} else {
$this->error = "Error: ".$this->db->lasterror()." - ".$sql;
return -1;
}
}
$this->description = $obj->description;
$this->email = $obj->email;
}
$this->multilangs["$obj->lang"]["label"] = $obj->label;
$this->multilangs["$obj->lang"]["description"] = $obj->description;
$this->multilangs["$obj->lang"]["email"] = $obj->email;
}
return 1;
} else {
$this->error = "Error: ".$this->db->lasterror()." - ".$sql;
return -1;
}
}
/**
* Update or add a translation for a product
*
* @param User $user Object user making update
* @return int <0 if KO, >0 if OK
*/
public function setMultiLangs($user)
{
global $conf, $langs;
/**
* Update or add a translation for a product
*
* @param User $user Object user making update
* @return int <0 if KO, >0 if OK
*/
public function setMultiLangs($user)
{
global $conf, $langs;
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 0, 2);
$current_lang = $langs->getDefaultLang();
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 0, 2);
$current_lang = $langs->getDefaultLang();
foreach ($langs_available as $key => $value) {
if ($key == $current_lang) {
$sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql .= " WHERE fk_type=".$this->id;
$sql .= " AND lang='".$key."'";
foreach ($langs_available as $key => $value) {
if ($key == $current_lang) {
$sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql .= " WHERE fk_type=".$this->id;
$sql .= " AND lang='".$key."'";
$result = $this->db->query($sql);
$result = $this->db->query($sql);
if ($this->db->num_rows($result)) { // if there is already a description line for this language
if ($this->db->num_rows($result)) { // if there is already a description line for this language
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
$sql2 .= " SET ";
$sql2 .= " label='".$this->db->escape($this->label)."',";
$sql2 .= " description='".$this->db->escape($this->description)."'";
$sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
} else {
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
$sql2 .= ")";
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->label)."',";
$sql2 .= " '".$this->db->escape($this->description)."'";
$sql2 .= ")";
}
dol_syslog(get_class($this).'::setMultiLangs key = current_lang = '.$key);
if (!$this->db->query($sql2)) {
$this->error = $this->db->lasterror();
return -1;
}
} elseif (isset($this->multilangs[$key])) {
$sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql .= " WHERE fk_type=".$this->id;
$sql .= " AND lang='".$key."'";
$sql2 .= " SET ";
$sql2 .= " label='".$this->db->escape($this->label)."',";
$sql2 .= " description='".$this->db->escape($this->description)."'";
$sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
} else {
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
$sql2 .= ")";
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->label)."',";
$sql2 .= " '".$this->db->escape($this->description)."'";
$sql2 .= ")";
}
dol_syslog(get_class($this).'::setMultiLangs key = current_lang = '.$key);
if (!$this->db->query($sql2)) {
$this->error = $this->db->lasterror();
return -1;
}
} elseif (isset($this->multilangs[$key])) {
$sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql .= " WHERE fk_type=".$this->id;
$sql .= " AND lang='".$key."'";
$result = $this->db->query($sql);
$result = $this->db->query($sql);
if ($this->db->num_rows($result)) { // if there is already a description line for this language
if ($this->db->num_rows($result)) { // if there is already a description line for this language
$sql2 = "UPDATE ".MAIN_DB_PREFIX."adherent_type_lang";
$sql2 .= " SET ";
$sql2 .= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',";
$sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'";
$sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
} else {
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
$sql2 .= ")";
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->multilangs["$key"]["label"])."',";
$sql2 .= " '".$this->db->escape($this->multilangs["$key"]["description"])."'";
$sql2 .= ")";
}
$sql2 .= " SET ";
$sql2 .= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',";
$sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'";
$sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'";
} else {
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description";
$sql2 .= ")";
$sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->multilangs["$key"]["label"])."',";
$sql2 .= " '".$this->db->escape($this->multilangs["$key"]["description"])."'";
$sql2 .= ")";
}
// We do not save if main fields are empty
if ($this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"]) {
if (!$this->db->query($sql2)) {
$this->error = $this->db->lasterror();
return -1;
}
}
} else {
// language is not current language and we didn't provide a multilang description for this language
}
}
// We do not save if main fields are empty
if ($this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"]) {
if (!$this->db->query($sql2)) {
$this->error = $this->db->lasterror();
return -1;
}
}
} else {
// language is not current language and we didn't provide a multilang description for this language
}
}
// Call trigger
$result = $this->call_trigger('MEMBER_TYPE_SET_MULTILANGS', $user);
if ($result < 0) {
$this->error = $this->db->lasterror();
return -1;
}
// End call triggers
// Call trigger
$result = $this->call_trigger('MEMBER_TYPE_SET_MULTILANGS', $user);
if ($result < 0) {
$this->error = $this->db->lasterror();
return -1;
}
// End call triggers
return 1;
}
return 1;
}
/**
* Delete a language for this product
*
* @param string $langtodelete Language code to delete
* @param User $user Object user making delete
*
* @return int <0 if KO, >0 if OK
*/
public function delMultiLangs($langtodelete, $user)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($langtodelete)."'";
/**
* Delete a language for this product
*
* @param string $langtodelete Language code to delete
* @param User $user Object user making delete
*
* @return int <0 if KO, >0 if OK
*/
public function delMultiLangs($langtodelete, $user)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent_type_lang";
$sql .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($langtodelete)."'";
dol_syslog(get_class($this).'::delMultiLangs', LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
// Call trigger
$result = $this->call_trigger('ADHERENT_TYPE_DEL_MULTILANGS', $user);
if ($result < 0) {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
return -1;
}
// End call triggers
return 1;
} else {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
return -1;
}
}
dol_syslog(get_class($this).'::delMultiLangs', LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
// Call trigger
$result = $this->call_trigger('ADHERENT_TYPE_DEL_MULTILANGS', $user);
if ($result < 0) {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
return -1;
}
// End call triggers
return 1;
} else {
$this->error = $this->db->lasterror();
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
return -1;
}
}
/**
* Fonction qui permet de creer le status de l'adherent
@ -337,7 +337,7 @@ class AdherentType extends CommonObject
*/
public function update($user, $notrigger = 0)
{
global $langs, $conf, $hookmanager;
global $langs, $conf, $hookmanager;
$error = 0;
@ -359,15 +359,15 @@ class AdherentType extends CommonObject
$result = $this->db->query($sql);
if ($result) {
$this->description = $this->db->escape($this->note);
$this->description = $this->db->escape($this->note);
// Multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) {
if ($this->setMultiLangs($user) < 0) {
$this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql;
return -2;
}
}
// Multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) {
if ($this->setMultiLangs($user) < 0) {
$this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql;
return -2;
}
}
$action = 'update';
@ -439,7 +439,7 @@ class AdherentType extends CommonObject
*/
public function fetch($rowid)
{
global $langs, $conf;
global $langs, $conf;
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.mail_valid, d.note, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
@ -465,10 +465,10 @@ class AdherentType extends CommonObject
$this->note = $obj->note;
$this->vote = $obj->vote;
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) {
$this->getMultiLangs();
}
// multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) {
$this->getMultiLangs();
}
}
return 1;
@ -478,7 +478,7 @@ class AdherentType extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of members' type
*
@ -487,7 +487,7 @@ class AdherentType extends CommonObject
*/
public function liste_array($status = -1)
{
// phpcs:enable
// phpcs:enable
global $conf, $langs;
$adherenttypes = array();
@ -578,31 +578,31 @@ class AdherentType extends CommonObject
//return $morphy;
}
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max label
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0)
{
global $langs;
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max label
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0)
{
global $langs;
$result = '';
$label = $langs->trans("ShowTypeCard", $this->label);
$result = '';
$label = $langs->trans("ShowTypeCard", $this->label);
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend = '</a>';
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend = '</a>';
$result .= $linkstart;
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto != 2) $result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label);
$result .= $linkend;
$result .= $linkstart;
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
if ($withpicto != 2) $result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label);
$result .= $linkend;
return $result;
}
return $result;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
@ -611,7 +611,7 @@ class AdherentType extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
}
@ -623,9 +623,9 @@ class AdherentType extends CommonObject
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Status label
*/
public function LibStatut($status, $mode = 0)
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
// phpcs:enable
global $langs;
$langs->load('companies');
@ -640,10 +640,10 @@ class AdherentType extends CommonObject
}
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*
@ -655,7 +655,7 @@ class AdherentType extends CommonObject
*/
public function _load_ldap_dn($info, $mode = 0)
{
// phpcs:enable
// phpcs:enable
global $conf;
$dn = '';
if ($mode == 0) $dn = $conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES].",".$conf->global->LDAP_MEMBER_TYPE_DN;
@ -665,8 +665,8 @@ class AdherentType extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Initialize the info array (array of LDAP values) that will be used to call LDAP functions
*
@ -674,7 +674,7 @@ class AdherentType extends CommonObject
*/
public function _load_ldap_info()
{
// phpcs:enable
// phpcs:enable
global $conf, $langs;
$info = array();
@ -766,15 +766,15 @@ class AdherentType extends CommonObject
*
* @return string Return mail model content of type or empty
*/
public function getMailOnResiliate()
{
global $conf;
public function getMailOnResiliate()
{
global $conf;
// NOTE mail_resiliate not defined so never used
if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) { // Property not yet defined
// NOTE mail_resiliate not defined so never used
if (!empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) { // Property not yet defined
return $this->mail_resiliate;
}
}
return '';
}
return '';
}
}

View File

@ -81,10 +81,10 @@ $extrafields->fetch_name_optionals_label($object->table_element);
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_lastname = "";
$search_login = "";
$search_email = "";
$type = "";
$sall = "";
$search_login = "";
$search_email = "";
$type = "";
$sall = "";
}
@ -226,8 +226,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
$newcardbutton = '';
if ($user->rights->adherent->configurer) {
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create');
}
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create');
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -247,7 +247,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Ref").'</th>';
print '<th>'.$langs->trans("Label").'</th>';
print '<th class="center">'.$langs->trans("MemberNature").'</th>';
print '<th class="center">'.$langs->trans("MemberNature").'</th>';
print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
print '<th class="center">'.$langs->trans("Status").'</th>';
@ -270,9 +270,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td class="center">';
print '<td class="center">';
if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } else print $langs->trans("MorPhy");
print '</td>';
print '</td>';
print '<td class="center">'.yn($objp->subscription).'</td>';
print '<td class="center">'.yn($objp->vote).'</td>';
print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
@ -308,7 +308,7 @@ if ($action == 'create') {
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
dol_fiche_head('');
dol_fiche_head('');
print '<table class="border centpercent">';
print '<tbody>';
@ -319,10 +319,10 @@ if ($action == 'create') {
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1);
print '</td></tr>';
// Morphy
// Morphy
$morphys = array();
$morphys[""] = $langs->trans("MorPhy");
$morphys["phy"] = $langs->trans("Physical");
$morphys[""] = $langs->trans("MorPhy");
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy", 'aZ09') : 'morphy');
@ -447,11 +447,11 @@ if ($rowid > 0) {
}
// Add
if ($user->rights->adherent->configurer && !empty($object->status)) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
}
if ($user->rights->adherent->configurer && !empty($object->status)) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
}
// Delete
if ($user->rights->adherent->configurer) {
@ -479,7 +479,7 @@ if ($rowid > 0) {
$sql .= natural_search(array("f.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
}
if ($status != '') {
$sql .= natural_search('d.statut', $status, 2);
$sql .= natural_search('d.statut', $status, 2);
}
if ($action == 'search') {
if (GETPOST('search', 'alpha')) {
@ -495,12 +495,12 @@ if ($rowid > 0) {
if (!empty($search_email)) {
$sql .= natural_search("d.email", $search_email);
}
if ($filter == 'uptodate') {
$sql .= " AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)";
}
if ($filter == 'outofdate') {
$sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
}
if ($filter == 'uptodate') {
$sql .= " AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)";
}
if ($filter == 'outofdate') {
$sql .= " AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
}
$sql .= " ".$db->order($sortfield, $sortorder);
@ -508,71 +508,71 @@ if ($rowid > 0) {
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$resql = $db->query($sql);
if ($resql) $nbtotalofrecords = $db->num_rows($result);
else dol_print_error($db);
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
if ($resql) $nbtotalofrecords = $db->num_rows($result);
else dol_print_error($db);
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
$offset = 0;
}
}
$sql .= " ".$db->plimit($conf->liste_limit + 1, $offset);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$num = $db->num_rows($resql);
$i = 0;
$titre = $langs->trans("MembersList");
if ($status != '') {
if ($status == '-1,1') {
$titre = $langs->trans("MembersListQualified");
} elseif ($status == '-1') {
$titre = $langs->trans("MembersListToValid");
} elseif ($status == '1' && !$filter) {
$titre = $langs->trans("MembersListValid");
} elseif ($status == '1' && $filter == 'uptodate') {
$titre = $langs->trans("MembersListUpToDate");
} elseif ($status == '1' && $filter == 'outofdate') {
$titre = $langs->trans("MembersListNotUpToDate");
} elseif ($status == '0') {
$titre = $langs->trans("MembersListResiliated");
}
} elseif ($action == 'search') {
$titre = $langs->trans("MembersListQualified");
}
$titre = $langs->trans("MembersList");
if ($status != '') {
if ($status == '-1,1') {
$titre = $langs->trans("MembersListQualified");
} elseif ($status == '-1') {
$titre = $langs->trans("MembersListToValid");
} elseif ($status == '1' && !$filter) {
$titre = $langs->trans("MembersListValid");
} elseif ($status == '1' && $filter == 'uptodate') {
$titre = $langs->trans("MembersListUpToDate");
} elseif ($status == '1' && $filter == 'outofdate') {
$titre = $langs->trans("MembersListNotUpToDate");
} elseif ($status == '0') {
$titre = $langs->trans("MembersListResiliated");
}
} elseif ($action == 'search') {
$titre = $langs->trans("MembersListQualified");
}
if ($type > 0) {
if ($type > 0) {
$membertype = new AdherentType($db);
$result = $membertype->fetch($type);
$result = $membertype->fetch($type);
$titre .= " (".$membertype->label.")";
}
}
$param = "&rowid=".$object->id;
if (!empty($status)) $param .= "&status=".$status;
if (!empty($search_lastname)) $param .= "&search_lastname=".$search_lastname;
if (!empty($search_firstname)) $param .= "&search_firstname=".$search_firstname;
if (!empty($search_login)) $param .= "&search_login=".$search_login;
if (!empty($search_email)) $param .= "&search_email=".$search_email;
if (!empty($filter)) $param .= "&filter=".$filter;
$param = "&rowid=".$object->id;
if (!empty($status)) $param .= "&status=".$status;
if (!empty($search_lastname)) $param .= "&search_lastname=".$search_lastname;
if (!empty($search_firstname)) $param .= "&search_firstname=".$search_firstname;
if (!empty($search_login)) $param .= "&search_login=".$search_login;
if (!empty($search_email)) $param .= "&search_email=".$search_email;
if (!empty($filter)) $param .= "&filter=".$filter;
if ($sall) {
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
}
if ($sall) {
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input class="flat" type="hidden" name="rowid" value="'.$object->id.'" size="12"></td>';
print '<br>';
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
$moreforfilter = '';
$moreforfilter = '';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Fields title search
// Fields title search
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre left">';
@ -590,105 +590,105 @@ if ($rowid > 0) {
print '<td class="liste_titre right" colspan="2">';
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp; ';
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '&nbsp; ';
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
while ($i < $num && $i < $conf->liste_limit) {
$objp = $db->fetch_object($resql);
while ($i < $num && $i < $conf->liste_limit) {
$objp = $db->fetch_object($resql);
$datefin = $db->jdate($objp->datefin);
$datefin = $db->jdate($objp->datefin);
$adh = new Adherent($db);
$adh->lastname = $objp->lastname;
$adh->firstname = $objp->firstname;
$adh = new Adherent($db);
$adh->lastname = $objp->lastname;
$adh->firstname = $objp->firstname;
// Lastname
print '<tr class="oddeven">';
if ($objp->company != '') {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).'</a></td>'."\n";
} else {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 32).'</a></td>'."\n";
}
// Lastname
print '<tr class="oddeven">';
if ($objp->company != '') {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).'</a></td>'."\n";
} else {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 32).'</a></td>'."\n";
}
// Login
print "<td>".$objp->login."</td>\n";
// Login
print "<td>".$objp->login."</td>\n";
// Type
/*print '<td class="nowrap">';
// Type
/*print '<td class="nowrap">';
$membertypestatic->id=$objp->type_id;
$membertypestatic->label=$objp->type;
print $membertypestatic->getNomUrl(1,12);
print '</td>';
*/
// Moral/Physique
print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
// Moral/Physique
print "<td>".$adh->getmorphylib($objp->morphy)."</td>\n";
// EMail
print "<td>".dol_print_email($objp->email, 0, 0, 1)."</td>\n";
// EMail
print "<td>".dol_print_email($objp->email, 0, 0, 1)."</td>\n";
// Statut
print '<td class="nowrap">';
print $adh->LibStatut($objp->status, $objp->subscription, $datefin, 2);
print "</td>";
// Statut
print '<td class="nowrap">';
print $adh->LibStatut($objp->status, $objp->subscription, $datefin, 2);
print "</td>";
// Date end subscription
if ($datefin) {
print '<td class="nowrap center">';
if ($datefin < dol_now() && $objp->status > 0) {
print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate"));
} else {
print dol_print_date($datefin, 'day');
}
print '</td>';
} else {
print '<td class="nowrap left">';
if ($objp->subscription == 'yes') {
print $langs->trans("SubscriptionNotReceived");
if ($objp->status > 0) print " ".img_warning();
} else {
print '&nbsp;';
}
print '</td>';
}
// Date end subscription
if ($datefin) {
print '<td class="nowrap center">';
if ($datefin < dol_now() && $objp->status > 0) {
print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate"));
} else {
print dol_print_date($datefin, 'day');
}
print '</td>';
} else {
print '<td class="nowrap left">';
if ($objp->subscription == 'yes') {
print $langs->trans("SubscriptionNotReceived");
if ($objp->status > 0) print " ".img_warning();
} else {
print '&nbsp;';
}
print '</td>';
}
// Actions
print '<td class="center">';
// Actions
print '<td class="center">';
if ($user->rights->adherent->creer) {
print '<a class="editfielda" href="card.php?rowid='.$objp->rowid.'&action=edit&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.img_edit().'</a>';
}
print '&nbsp;';
if ($user->rights->adherent->supprimer) {
print '<a href="card.php?rowid='.$objp->rowid.'&action=resign">'.img_picto($langs->trans("Resiliate"), 'disable.png').'</a>';
}
}
print "</td>";
print "</tr>\n";
$i++;
}
print "</tr>\n";
$i++;
}
print "</table>\n";
print '</div>';
print '</form>';
print "</table>\n";
print '</div>';
print '</form>';
if ($num > $conf->liste_limit) {
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
}
} else {
dol_print_error($db);
dol_print_error($db);
}
}
@ -719,18 +719,18 @@ if ($rowid > 0) {
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" size="40" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status);
print '</td></tr>';
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status);
print '</td></tr>';
// Morphy
$morphys[""] = $langs->trans("MorPhy");
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy") : $object->morphy);
print "</td></tr>";
// Morphy
$morphys[""] = $langs->trans("MorPhy");
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy") : $object->morphy);
print "</td></tr>";
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("subscription", $object->subscription, 1);
print '</td></tr>';

View File

@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
$langs->loadLangs(array("admin", "companies", "bills", "other", "banks"));
if (!$user->admin)
accessforbidden();
accessforbidden();
$action = GETPOST('action', 'alpha');
$actionsave = GETPOST('save', 'alpha');
@ -240,31 +240,31 @@ $i = 0;
$nbofbank = count($bankorder);
while ($i < $nbofbank) {
print '<tr class="oddeven">';
print '<td>'.$bankorder[$i][0]."</td><td>\n";
print $bankorder[$i][1];
print '</td>';
print '<td class="nowrap">';
$tmparray = explode(' ', $bankorder[$i][2]);
foreach ($tmparray as $key => $val) {
if ($key > 0)
print ', ';
print $langs->trans($val);
}
print "</td>\n";
print '<tr class="oddeven">';
print '<td>'.$bankorder[$i][0]."</td><td>\n";
print $bankorder[$i][1];
print '</td>';
print '<td class="nowrap">';
$tmparray = explode(' ', $bankorder[$i][2]);
foreach ($tmparray as $key => $val) {
if ($key > 0)
print ', ';
print $langs->trans($val);
}
print "</td>\n";
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) {
print '<td class="center">';
print img_picto($langs->trans("Activated"), 'on');
print '</td>';
} else {
print '<td class="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbankorder&amp;value='.$i.'">';
print img_picto($langs->trans("Disabled"), 'off');
print '</a></td>';
}
print '<td>&nbsp;</td>';
print '</tr>'."\n";
$i++;
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) {
print '<td class="center">';
print img_picto($langs->trans("Activated"), 'on');
print '</td>';
} else {
print '<td class="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbankorder&amp;value='.$i.'">';
print img_picto($langs->trans("Disabled"), 'off');
print '</a></td>';
}
print '<td>&nbsp;</td>';
print '</tr>'."\n";
$i++;
}
print '</table>'."\n";
@ -287,15 +287,15 @@ $sql .= " WHERE type = '".$type."'";
$sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows) {
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows) {
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
} else {
dol_print_error($db);
dol_print_error($db);
}
print "<table class=\"noborder\" width=\"100%\">\n";
@ -311,100 +311,100 @@ print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir) {
foreach (array('', '/doc') as $valdir) {
$dir = dol_buildpath($reldir."core/modules/bank".$valdir);
foreach (array('', '/doc') as $valdir) {
$dir = dol_buildpath($reldir."core/modules/bank".$valdir);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false) {
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (file_exists($dir.'/'.$file)) {
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
foreach ($filelist as $file) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (file_exists($dir.'/'.$file)) {
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
$modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
$modulequalified = 0;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
$modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
$modulequalified = 0;
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info'))
print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print(empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info'))
print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def)) {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def)) {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->BANKADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Default
print '<td class="center">';
if ($conf->global->BANKADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf') {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
//$htmltooltip .= '<br>' . $langs->trans("PaymentMode") . ': ' . yn($module->option_modereg, 1, 1);
//$htmltooltip .= '<br>' . $langs->trans("PaymentConditions") . ': ' . yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
// $htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
// $htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
//$htmltooltip .= '<br>' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1);
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf') {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
//$htmltooltip .= '<br>' . $langs->trans("PaymentMode") . ': ' . yn($module->option_modereg, 1, 1);
//$htmltooltip .= '<br>' . $langs->trans("PaymentConditions") . ': ' . yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
// $htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
// $htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
//$htmltooltip .= '<br>' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
//}
@ -423,38 +423,38 @@ print $langs->trans('BankColorizeMovementDesc');
print "</td>";
// Active
if ($conf->global->BANK_COLORIZE_MOVEMENT) {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetbankcolorizemovement">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetbankcolorizemovement">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setbankcolorizemovement">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setbankcolorizemovement">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
print "</tr>\n";
if (!empty($conf->global->BANK_COLORIZE_MOVEMENT))
{
$i = 1;
while ($i <= 2)
{
$key = $i;
$color = 'BANK_COLORIZE_MOVEMENT_COLOR'.$key;
$i = 1;
while ($i <= 2)
{
$key = $i;
$color = 'BANK_COLORIZE_MOVEMENT_COLOR'.$key;
print '<tr class="oddeven">';
print '<tr class="oddeven">';
// Label
print '<td colspan="4" width="180" class="nowrap">'.$langs->trans("BankColorizeMovementName".$key)."</td>";
// Color
print '<td class="nowrap right">';
print $formother->selectColor((GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) ?GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) : $conf->global->$color), "BANK_COLORIZE_MOVEMENT_COLOR".$key, 'bankmovementcolorconfig', 1, '', 'right hideifnotset');
print '</td>';
print "</tr>";
$i++;
}
// Label
print '<td colspan="4" width="180" class="nowrap">'.$langs->trans("BankColorizeMovementName".$key)."</td>";
// Color
print '<td class="nowrap right">';
print $formother->selectColor((GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) ?GETPOST("BANK_COLORIZE_MOVEMENT_COLOR".$key) : $conf->global->$color), "BANK_COLORIZE_MOVEMENT_COLOR".$key, 'bankmovementcolorconfig', 1, '', 'right hideifnotset');
print '</td>';
print "</tr>";
$i++;
}
}
print '</table>';
@ -482,15 +482,15 @@ print $langs->trans('AutoReportLastAccountStatement');
print '</td>';
// Active
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetreportlastnumreleve">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetreportlastnumreleve">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setreportlastnumreleve">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setreportlastnumreleve">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
print "</tr>\n";

View File

@ -55,11 +55,11 @@ if ($action == 'updateMask')
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen')
{
$modele = GETPOST('module', 'alpha');
@ -72,7 +72,7 @@ if ($action == 'updateMask')
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/bom/doc/pdf_".$modele.".modules.php", 0);
$file = dol_buildpath($reldir."core/modules/bom/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
@ -110,7 +110,7 @@ elseif ($action == 'set')
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->BOM_ADDON_PDF == "$value") dolibarr_del_const($db, 'BOM_ADDON_PDF', $conf->entity);
if ($conf->global->BOM_ADDON_PDF == "$value") dolibarr_del_const($db, 'BOM_ADDON_PDF', $conf->entity);
}
}
@ -144,11 +144,11 @@ elseif ($action == 'setdoc')
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'set_BOM_FREE_TEXT')
{
$freetext = GETPOST("BOM_FREE_TEXT", 'none'); // No alpha here, we want exact string
@ -158,11 +158,11 @@ elseif ($action == 'setdoc')
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -211,7 +211,7 @@ foreach ($dirmodels as $reldir)
{
while (($file = readdir($handle)) !== false)
{
if (substr($file, 0, 8) == 'mod_bom_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
if (substr($file, 0, 8) == 'mod_bom_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file) - 4);
@ -229,13 +229,13 @@ foreach ($dirmodels as $reldir)
print $module->info();
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->BOM_ADDON == $file)
@ -256,16 +256,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$bom->type = 0;
$nextval = $module->getNextValue($mysoc, $bom);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
@ -324,108 +324,108 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/bom".$valdir;
$dir = dol_buildpath($realpath);
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/bom".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->BOM_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Default
print '<td class="center">';
if ($conf->global->BOM_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
@ -457,11 +457,11 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("
$variablename = 'BOM_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';

View File

@ -48,99 +48,99 @@ $boxes = array();
if ($action == 'addconst')
{
dolibarr_set_const($db, "MAIN_BOXES_MAXLINES", $_POST["MAIN_BOXES_MAXLINES"], '', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_ACTIVATE_FILECACHE", $_POST["MAIN_ACTIVATE_FILECACHE"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_BOXES_MAXLINES", $_POST["MAIN_BOXES_MAXLINES"], '', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_ACTIVATE_FILECACHE", $_POST["MAIN_ACTIVATE_FILECACHE"], 'chaine', 0, '', $conf->entity);
}
if ($action == 'add') {
$error = 0;
$db->begin();
if (isset($_POST['boxid']) && is_array($_POST['boxid']))
{
foreach ($_POST['boxid'] as $boxid)
{
if (is_numeric($boxid['pos']) && $boxid['pos'] >= 0) // 0=Home, 1=...
{
$pos = $boxid['pos'];
$error = 0;
$db->begin();
if (isset($_POST['boxid']) && is_array($_POST['boxid']))
{
foreach ($_POST['boxid'] as $boxid)
{
if (is_numeric($boxid['pos']) && $boxid['pos'] >= 0) // 0=Home, 1=...
{
$pos = $boxid['pos'];
// Initialize distinct fk_user with all already existing values of fk_user (user that use a personalized view of boxes for page "pos")
$distinctfkuser = array();
if (!$error)
{
$sql = "SELECT fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."user_param";
$sql .= " WHERE param = 'MAIN_BOXES_".$db->escape($pos)."' AND value = '1'";
$sql .= " AND entity = ".$conf->entity;
dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$distinctfkuser[$obj->fk_user] = $obj->fk_user;
$i++;
}
} else {
setEventMessages($db->lasterror(), null, 'errors');
$error++;
}
}
// Initialize distinct fk_user with all already existing values of fk_user (user that use a personalized view of boxes for page "pos")
$distinctfkuser = array();
if (!$error)
{
$sql = "SELECT fk_user";
$sql .= " FROM ".MAIN_DB_PREFIX."user_param";
$sql .= " WHERE param = 'MAIN_BOXES_".$db->escape($pos)."' AND value = '1'";
$sql .= " AND entity = ".$conf->entity;
dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$distinctfkuser[$obj->fk_user] = $obj->fk_user;
$i++;
}
} else {
setEventMessages($db->lasterror(), null, 'errors');
$error++;
}
}
$distinctfkuser['0'] = '0'; // Add entry for fk_user = 0. We must use string as key and val
$distinctfkuser['0'] = '0'; // Add entry for fk_user = 0. We must use string as key and val
foreach ($distinctfkuser as $fk_user)
{
if (!$error && $fk_user != '')
{
$arrayofexistingboxid = array();
$nbboxonleft = $nbboxonright = 0;
$sql = "SELECT box_id, box_order FROM ".MAIN_DB_PREFIX."boxes";
$sql .= " WHERE position = ".$pos." AND fk_user = ".$fk_user." AND entity = ".$conf->entity;
dol_syslog("boxes.php activate box", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
while ($obj = $db->fetch_object($resql))
{
$boxorder = $obj->box_order;
if (preg_match('/A/', $boxorder)) $nbboxonleft++;
if (preg_match('/B/', $boxorder)) $nbboxonright++;
$arrayofexistingboxid[$obj->box_id] = 1;
}
} else dol_print_error($db);
foreach ($distinctfkuser as $fk_user)
{
if (!$error && $fk_user != '')
{
$arrayofexistingboxid = array();
$nbboxonleft = $nbboxonright = 0;
$sql = "SELECT box_id, box_order FROM ".MAIN_DB_PREFIX."boxes";
$sql .= " WHERE position = ".$pos." AND fk_user = ".$fk_user." AND entity = ".$conf->entity;
dol_syslog("boxes.php activate box", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
while ($obj = $db->fetch_object($resql))
{
$boxorder = $obj->box_order;
if (preg_match('/A/', $boxorder)) $nbboxonleft++;
if (preg_match('/B/', $boxorder)) $nbboxonright++;
$arrayofexistingboxid[$obj->box_id] = 1;
}
} else dol_print_error($db);
if (empty($arrayofexistingboxid[$boxid['value']])) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
$sql .= "box_id, position, box_order, fk_user, entity";
$sql .= ") values (";
$sql .= $boxid['value'].", ".$pos.", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity;
$sql .= ")";
if (empty($arrayofexistingboxid[$boxid['value']])) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
$sql .= "box_id, position, box_order, fk_user, entity";
$sql .= ") values (";
$sql .= $boxid['value'].", ".$pos.", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity;
$sql .= ")";
dol_syslog("boxes.php activate box", LOG_DEBUG);
$resql = $db->query($sql);
if (!$resql)
{
setEventMessages($db->lasterror(), null, 'errors');
$error++;
}
} else {
dol_syslog("boxes.php activate box - already exists in database", LOG_DEBUG);
}
}
}
}
}
}
if (!$error)
{
$db->commit();
$action = '';
} else {
$db->rollback();
}
dol_syslog("boxes.php activate box", LOG_DEBUG);
$resql = $db->query($sql);
if (!$resql)
{
setEventMessages($db->lasterror(), null, 'errors');
$error++;
}
} else {
dol_syslog("boxes.php activate box - already exists in database", LOG_DEBUG);
}
}
}
}
}
}
if (!$error)
{
$db->commit();
$action = '';
} else {
$db->rollback();
}
}
if ($action == 'delete')
@ -150,23 +150,23 @@ if ($action == 'delete')
$resql = $db->query($sql);
$obj = $db->fetch_object($resql);
if (!empty($obj->box_id))
{
$db->begin();
if (!empty($obj->box_id))
{
$db->begin();
// Remove all personalized setup when a box is activated or disabled (why removing all ? We removed only removed boxes)
// $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_param";
// $sql.= " WHERE param LIKE 'MAIN_BOXES_%'";
// $resql = $db->query($sql);
// Remove all personalized setup when a box is activated or disabled (why removing all ? We removed only removed boxes)
// $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_param";
// $sql.= " WHERE param LIKE 'MAIN_BOXES_%'";
// $resql = $db->query($sql);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
$sql .= " WHERE entity = ".$conf->entity;
$sql .= " AND box_id=".$obj->box_id;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
$sql .= " WHERE entity = ".$conf->entity;
$sql .= " AND box_id=".$obj->box_id;
$resql = $db->query($sql);
$resql = $db->query($sql);
$db->commit();
}
$db->commit();
}
}
if ($action == 'switch')
@ -184,14 +184,14 @@ if ($action == 'switch')
$resultupdateto = 0;
if (is_object($objfrom) && is_object($objto))
{
$newfirst = $objto->box_order;
$newfirst = $objto->box_order;
$newsecond = $objfrom->box_order;
if ($newfirst == $newsecond)
{
$newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
}
if ($newfirst == $newsecond)
{
$newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
}
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$newfirst."' WHERE rowid=".$objfrom->rowid;
dol_syslog($sql);
$resultupdatefrom = $db->query($sql);
@ -268,7 +268,7 @@ if ($resql)
if ($decalage)
{
// If we have renumbered, we correct the field box_order
// If we have renumbered, we correct the field box_order
// This occurs just after an insert.
$sql = "SELECT box_order";
$sql .= " FROM ".MAIN_DB_PREFIX."boxes";
@ -339,34 +339,34 @@ print "</tr>\n";
foreach ($boxtoadd as $box)
{
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg))
{
$logo = $box->boximg;
} else {
$logo = preg_replace("/^object_/i", "", $box->boximg);
}
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg))
{
$logo = $box->boximg;
} else {
$logo = preg_replace("/^object_/i", "", $box->boximg);
}
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
print '<tr class="oddeven">'."\n";
print '<td>'.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
if (!empty($box->class) && preg_match('/graph_/', $box->class)) print ' ('.$langs->trans("Graph").')';
print '</td>'."\n";
print '<td>';
if ($box->note == '(WarningUsingThisBoxSlowDown)')
{
$langs->load("errors");
print $langs->trans("WarningUsingThisBoxSlowDown");
} else print ($box->note ? $box->note : '&nbsp;');
print '</td>'."\n";
print '<td>'.$box->sourcefile.'</td>'."\n";
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
print '<tr class="oddeven">'."\n";
print '<td>'.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
if (!empty($box->class) && preg_match('/graph_/', $box->class)) print ' ('.$langs->trans("Graph").')';
print '</td>'."\n";
print '<td>';
if ($box->note == '(WarningUsingThisBoxSlowDown)')
{
$langs->load("errors");
print $langs->trans("WarningUsingThisBoxSlowDown");
} else print ($box->note ? $box->note : '&nbsp;');
print '</td>'."\n";
print '<td>'.$box->sourcefile.'</td>'."\n";
// For each possible position, an activation link is displayed if the box is not already active for that position
print '<td class="center">';
print $form->selectarray("boxid[".$box->box_id."][pos]", $pos_name, -1, 1, 0, 0, '', 1)."\n";
print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n";
print '</td>';
// For each possible position, an activation link is displayed if the box is not already active for that position
print '<td class="center">';
print $form->selectarray("boxid[".$box->box_id."][pos]", $pos_name, -1, 1, 0, 0, '', 1)."\n";
print '<input type="hidden" name="boxid['.$box->box_id.'][value]" value="'.$box->box_id.'">'."\n";
print '</td>';
print '</tr>'."\n";
print '</tr>'."\n";
}
if (!count($boxtoadd) && count($boxactivated))
{
@ -408,7 +408,7 @@ foreach ($boxactivated as $key => $box)
$logo = preg_replace("/^object_/i", "", $box->boximg);
}
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
print '<tr class="oddeven">';
print '<td>'.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel);
if (!empty($box->class) && preg_match('/graph_/', $box->class)) print ' ('.$langs->trans("Graph").')';
@ -465,10 +465,10 @@ print '</tr>';
// Activate FileCache - Developement
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>';
print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1);
print '</td>';
print '</tr>';
print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>';
print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1);
print '</td>';
print '</tr>';
}
print '</table>';

View File

@ -64,11 +64,11 @@ if ($action == 'updateMask')
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen')
{
$modele = GETPOST('module', 'alpha');
@ -81,7 +81,7 @@ if ($action == 'updateMask')
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php", 0);
$file = dol_buildpath($reldir."core/modules/commande/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
@ -119,7 +119,7 @@ elseif ($action == 'set')
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->COMMANDE_ADDON_PDF == "$value") dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity);
if ($conf->global->COMMANDE_ADDON_PDF == "$value") dolibarr_del_const($db, 'COMMANDE_ADDON_PDF', $conf->entity);
}
}
@ -153,11 +153,11 @@ elseif ($action == 'setdoc')
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'set_ORDER_FREE_TEXT')
{
$freetext = GETPOST("ORDER_FREE_TEXT", 'none'); // No alpha here, we want exact string
@ -167,21 +167,21 @@ elseif ($action == 'setdoc')
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == "setshippableiconinlist") {
// Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
// Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'setribchq')
{
$rib = GETPOST('rib', 'alpha');
@ -203,31 +203,31 @@ elseif ($action == 'setdoc')
// Activate ask for payment bank
elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
{
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
// Activate ask for warehouse
elseif ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
{
$res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -294,13 +294,13 @@ foreach ($dirmodels as $reldir)
print $module->info();
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->COMMANDE_ADDON == $file)
@ -321,16 +321,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$commande->type = 0;
$nextval = $module->getNextValue($mysoc, $commande);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
@ -389,113 +389,113 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/commande".$valdir;
$dir = dol_buildpath($realpath);
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/commande".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->COMMANDE_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Default
print '<td class="center">';
if ($conf->global->COMMANDE_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
//$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
//$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
//$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
//$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
@ -636,11 +636,11 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans
$variablename = 'ORDER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';

View File

@ -109,7 +109,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
foreach ($arrayofimages as $varforimage)
{
if ($_FILES[$varforimage]["name"] && ! preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["name"])) { // Logo can be used on a lot of different places. Only jpg and png can be supported.
if ($_FILES[$varforimage]["name"] && !preg_match('/(\.jpeg|\.jpg|\.png)$/i', $_FILES[$varforimage]["name"])) { // Logo can be used on a lot of different places. Only jpg and png can be supported.
$langs->load("errors");
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
break;

View File

@ -41,7 +41,7 @@ $type = 'contract';
if (empty($conf->global->CONTRACT_ADDON))
{
$conf->global->CONTRACT_ADDON = 'mod_contract_serpis';
$conf->global->CONTRACT_ADDON = 'mod_contract_serpis';
}
@ -53,18 +53,18 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask')
{
$maskconst = GETPOST('maskconstcontract', 'alpha');
$maskvalue = GETPOST('maskcontract', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
$maskconst = GETPOST('maskconstcontract', 'alpha');
$maskvalue = GETPOST('maskcontract', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen') // For contract
{
$modele = GETPOST('module', 'alpha');
@ -77,7 +77,7 @@ if ($action == 'updateMask')
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/contract/doc/pdf_".$modele.".modules.php", 0);
$file = dol_buildpath($reldir."core/modules/contract/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
@ -115,7 +115,7 @@ elseif ($action == 'set')
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->CONTRACT_ADDON_PDF == "$value") dolibarr_del_const($db, 'CONTRACT_ADDON_PDF', $conf->entity);
if ($conf->global->CONTRACT_ADDON_PDF == "$value") dolibarr_del_const($db, 'CONTRACT_ADDON_PDF', $conf->entity);
}
}
@ -149,17 +149,17 @@ elseif ($action == 'setdoc')
$draft = GETPOST('CONTRACT_DRAFT_WATERMARK', 'alpha');
$res2 = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
$value = GETPOST('activate_hideClosedServiceByDefault', 'alpha');
$res3 = dolibarr_set_const($db, "CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT", $value, 'chaine', 0, '', $conf->entity);
$value = GETPOST('activate_hideClosedServiceByDefault', 'alpha');
$res3 = dolibarr_set_const($db, "CONTRACT_HIDE_CLOSED_SERVICES_BY_DEFAULT", $value, 'chaine', 0, '', $conf->entity);
if (!$res1 > 0 || !$res2 > 0 || !$res3 > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -251,16 +251,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mysoc, $contract);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
@ -319,111 +319,111 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/contract".$valdir;
$dir = dol_buildpath($realpath);
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/contract".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Defaut
print '<td class="center">';
if ($conf->global->CONTRACT_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Defaut
print '<td class="center">';
if ($conf->global->CONTRACT_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
@ -457,11 +457,11 @@ print '<br>';
$variablename = 'CONTRACT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td></tr>'."\n";

View File

@ -76,8 +76,6 @@ $form = new Form($db);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("DebugBarSetup"), $linkback, 'title_setup');
//print load_fiche_titre($langs->trans("DebugBar"));
if (!function_exists('mb_check_encoding'))
{
$langs->load("errors");

View File

@ -165,19 +165,19 @@ if (GETPOST('addoperation', 'alpha'))
if ($action == 'updateoperation')
{
$emailcollectoroperation = new EmailCollectorAction($db);
$emailcollectoroperation->fetch(GETPOST('rowidoperation2', 'int'));
$emailcollectoroperation = new EmailCollectorAction($db);
$emailcollectoroperation->fetch(GETPOST('rowidoperation2', 'int'));
$emailcollectoroperation->actionparam = GETPOST('operationparam2', 'none');
$emailcollectoroperation->actionparam = GETPOST('operationparam2', 'none');
$result = $emailcollectoroperation->update($user);
$result = $emailcollectoroperation->update($user);
if ($result > 0)
{
$object->fetchActions();
} else {
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
}
if ($result > 0)
{
$object->fetchActions();
} else {
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
}
}
if ($action == 'deleteoperation')
{
@ -199,11 +199,11 @@ if ($action == 'confirm_collect')
$res = $object->doCollectOneCollector();
if ($res > 0)
{
$debuginfo = $object->debuginfo;
setEventMessages($object->lastresult, null, 'mesgs');
$debuginfo = $object->debuginfo;
setEventMessages($object->lastresult, null, 'mesgs');
} else {
$debuginfo = $object->debuginfo;
setEventMessages($object->error, null, 'errors');
$debuginfo = $object->debuginfo;
setEventMessages($object->error, null, 'errors');
}
$action = '';
@ -475,27 +475,27 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<tr class="oddeven">';
print '<td>';
$arrayoftypes = array(
'from'=>array('label'=>'MailFrom', 'data-placeholder'=>$langs->trans('SearchString')),
'to'=>array('label'=>'MailTo', 'data-placeholder'=>$langs->trans('SearchString')),
'cc'=>array('label'=>'Cc', 'data-placeholder'=>$langs->trans('SearchString')),
'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>$langs->trans('SearchString')),
'subject'=>array('label'=>'Subject', 'data-placeholder'=>$langs->trans('SearchString')),
'body'=>array('label'=>'Body', 'data-placeholder'=>$langs->trans('SearchString')),
// disabled because PHP imap_search is not compatible IMAPv4, only IMAPv2
//'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value
//'X1'=>'---',
//'notinsubject'=>array('label'=>'SubjectNotIn', 'data-placeholder'=>'SearchString'),
//'notinbody'=>array('label'=>'BodyNotIn', 'data-placeholder'=>'SearchString'),
'X2'=>'---',
'seen'=>array('label'=>'AlreadyRead', 'data-noparam'=>1),
'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1),
'unanswered'=>array('label'=>'Unanswered', 'data-noparam'=>1),
'answered'=>array('label'=>'Answered', 'data-noparam'=>1),
'smaller'=>array('label'=>'SmallerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')),
'larger'=>array('label'=>'LargerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')),
'X3'=>'---',
'withtrackingid'=>array('label'=>'WithDolTrackingID', 'data-noparam'=>1),
'withouttrackingid'=>array('label'=>'WithoutDolTrackingID', 'data-noparam'=>1),
'from'=>array('label'=>'MailFrom', 'data-placeholder'=>$langs->trans('SearchString')),
'to'=>array('label'=>'MailTo', 'data-placeholder'=>$langs->trans('SearchString')),
'cc'=>array('label'=>'Cc', 'data-placeholder'=>$langs->trans('SearchString')),
'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>$langs->trans('SearchString')),
'subject'=>array('label'=>'Subject', 'data-placeholder'=>$langs->trans('SearchString')),
'body'=>array('label'=>'Body', 'data-placeholder'=>$langs->trans('SearchString')),
// disabled because PHP imap_search is not compatible IMAPv4, only IMAPv2
//'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value
//'X1'=>'---',
//'notinsubject'=>array('label'=>'SubjectNotIn', 'data-placeholder'=>'SearchString'),
//'notinbody'=>array('label'=>'BodyNotIn', 'data-placeholder'=>'SearchString'),
'X2'=>'---',
'seen'=>array('label'=>'AlreadyRead', 'data-noparam'=>1),
'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1),
'unanswered'=>array('label'=>'Unanswered', 'data-noparam'=>1),
'answered'=>array('label'=>'Answered', 'data-noparam'=>1),
'smaller'=>array('label'=>'SmallerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')),
'larger'=>array('label'=>'LargerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')),
'X3'=>'---',
'withtrackingid'=>array('label'=>'WithDolTrackingID', 'data-noparam'=>1),
'withouttrackingid'=>array('label'=>'WithoutDolTrackingID', 'data-noparam'=>1),
'X4'=>'---',
'isnotanswer'=>array('label'=>'IsNotAnAnswer', 'data-noparam'=>1),
'isanswer'=>array('label'=>'IsAnAnswer', 'data-noparam'=>1)
@ -559,9 +559,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<tr class="oddeven">';
print '<td>';
$arrayoftypes = array(
'loadthirdparty'=>$langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
'loadandcreatethirdparty'=>$langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
'recordevent'=>'RecordEvent');
'loadthirdparty'=>$langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")),
'loadandcreatethirdparty'=>$langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")),
'recordevent'=>'RecordEvent');
if ($conf->projet->enabled) $arrayoftypes['project'] = 'CreateLeadAndThirdParty';
if ($conf->ticket->enabled) $arrayoftypes['ticket'] = 'CreateTicketAndThirdParty';
if ($conf->recruitment->enabled) $arrayoftypes['candidature'] = 'CreateCandidature';
@ -602,7 +602,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print $langs->trans($arrayoftypes[$ruleaction['type']]);
if (in_array($ruleaction['type'], array('recordevent')))
{
print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked'));
print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked'));
} elseif (in_array($ruleaction['type'], array('loadthirdparty', 'loadandcreatethirdparty'))) {
print $form->textwithpicto('', $langs->transnoentitiesnoconv('EmailCollectorLoadThirdPartyHelp'));
}
@ -610,11 +610,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td class="wordbreak">';
if ($action == 'editoperation' && $ruleaction['id'] == $operationid)
{
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.$ruleaction['actionparam'].'"><br>';
print '<input type="hidden" name="rowidoperation2" value="'.$ruleaction['id'].'"><br>';
print '<input type="submit" class="button" name="saveoperation2" value="'.$langs->trans("Save").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.$ruleaction['actionparam'].'"><br>';
print '<input type="hidden" name="rowidoperation2" value="'.$ruleaction['id'].'"><br>';
print '<input type="submit" class="button" name="saveoperation2" value="'.$langs->trans("Save").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
} else {
print $ruleaction['actionparam'];
print $ruleaction['actionparam'];
}
print '</td>';
// Move up/down
@ -641,7 +641,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</div>';
if (!empty($conf->use_javascript_ajax)) {
$urltorefreshaftermove = DOL_URL_ROOT.'/admin/emailcollector_card.php?id='.$id;
$urltorefreshaftermove = DOL_URL_ROOT.'/admin/emailcollector_card.php?id='.$id;
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
}
@ -668,7 +668,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Edit").'</a></div>';
// Clone
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a></div>';
// Collect now
if (count($object->actions) > 0) {
@ -684,7 +684,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (!empty($debuginfo))
{
print info_admin($debuginfo);
print info_admin($debuginfo);
}

View File

@ -48,7 +48,7 @@ $type = 'shipping';
if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
{
$conf->global->EXPEDITION_ADDON_NUMBER = 'mod_expedition_safor';
$conf->global->EXPEDITION_ADDON_NUMBER = 'mod_expedition_safor';
}
@ -105,7 +105,7 @@ if ($action == 'updateMask')
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/expedition/doc/pdf_".$modele.".modules.php", 0);
$file = dol_buildpath($reldir."core/modules/expedition/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
@ -143,7 +143,7 @@ elseif ($action == 'set')
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->EXPEDITION_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPEDITION_ADDON_PDF', $conf->entity);
if ($conf->global->EXPEDITION_ADDON_PDF == "$value") dolibarr_del_const($db, 'EXPEDITION_ADDON_PDF', $conf->entity);
}
}
@ -231,14 +231,14 @@ foreach ($dirmodels as $reldir)
print $module->info();
print '</td>';
// Show example of numbering module
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
// Show example of numbering module
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->EXPEDITION_ADDON_NUMBER == "$file")
@ -258,16 +258,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mysoc, $expedition);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
@ -328,107 +328,107 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/expedition".$valdir);
foreach (array('', '/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/expedition".$valdir);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified)
{
print '<tr><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Defaut
print '<td class="center">';
if ($conf->global->EXPEDITION_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Defaut
print '<td class="center">';
if ($conf->global->EXPEDITION_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'sending').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'sending').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
@ -461,11 +461,11 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->tr
$variablename = 'SHIPPING_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print "</td></tr>\n";

View File

@ -35,13 +35,11 @@ $langs->loadLangs(array("admin", "trips", "errors", "other", "dict"));
if (!$user->admin) accessforbidden();
//Init error
$error = false;
$message = false;
$error = 0;
$action = GETPOST('action', 'alpha');
$id = GETPOST('id', 'int');
$offset = GETPOST('offset', 'int');
$ikoffset = GETPOST('ikoffset', 'int');
$coef = GETPOST('coef', 'int');
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
@ -59,10 +57,13 @@ if ($action == 'updateik')
$expIk->setValues($_POST);
$result = $expIk->create($user);
if ($result > 0) setEventMessages('SetupSaved', null, 'mesgs');
header('Location: '.$_SERVER['PHP_SELF']);
exit;
if ($result > 0) {
setEventMessages('SetupSaved', null, 'mesgs');
header('Location: '.$_SERVER['PHP_SELF']);
exit;
} else {
setEventMessages($expIk->error, $expIk->errors, 'errors');
}
} elseif ($action == 'delete') // TODO add confirm
{
$expIk = new ExpenseReportIk($db);
@ -81,6 +82,7 @@ if ($action == 'updateik')
$rangesbycateg = ExpenseReportIk::getAllRanges();
/*
* View
*/
@ -90,12 +92,13 @@ llxHeader('', $langs->trans("ExpenseReportsSetup"));
$form = new Form($db);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ExpenseReportsIkSetup"), $linkback, 'title_setup');
print load_fiche_titre($langs->trans("ExpenseReportsSetup"), $linkback, 'title_setup');
$head = expensereport_admin_prepare_head();
dol_fiche_head($head, 'expenseik', $langs->trans("ExpenseReportsIk"), -1, 'trip');
echo $langs->trans('ExpenseReportIkDesc');
echo '<span class="opacitymedium">'.$langs->trans('ExpenseReportIkDesc').'</span>';
print '<br><br>';
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
@ -136,21 +139,23 @@ foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab)
echo '<tr class="oddeven">';
// Label
echo '<td width="20%"><b>['.$langs->trans('RangeNum', $tranche++).']</b> - '.$label.'</td>';
echo '<td class="nowraponall"><b>['.$langs->trans('RangeNum', $tranche++).']</b> - '.$label.'</td>';
// Offset
echo '<td width="20%">';
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" name="offset" value="'.$range->ik->offset.'" />';
else echo $range->ik->offset;
echo '<td class="nowraponall">';
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" class="maxwidth100" name="ikoffset" value="'.$range->ik->ikoffset.'" />';
else {
echo $range->ik->ikoffset;
}
echo '</td>';
// Coef
echo '<td width="20%">';
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" name="coef" value="'.$range->ik->coef.'" />';
echo '<td class="nowraponall">';
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" class="maxwidth100" name="coef" value="'.$range->ik->coef.'" />';
else echo ($range->ik->id > 0 ? $range->ik->coef : $langs->trans('expenseReportCoefUndefined'));
echo '</td>';
// Total for one
echo '<td width="30%">'.$langs->trans('expenseReportPrintExample', price($range->ik->offset + 5 * $range->ik->coef)).'</td>';
echo '<td class="nowraponall">'.$langs->trans('expenseReportPrintExample', price($range->ik->ikoffset + 5 * $range->ik->coef)).'</td>';
// Action
echo '<td class="right">';
@ -161,8 +166,8 @@ foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab)
echo '<input id="" class="button" name="save" value="'.$langs->trans('Save').'" type="submit" />';
echo '<input class="button" value="'.$langs->trans('Cancel').'" onclick="javascript:history.go(-1)" type="button" />';
} else {
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$range->ik->id.'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.'&fk_range='.$range->rowid.'">'.img_edit().'</a>';
if (!empty($range->ik->id)) echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$range->ik->id.'">'.img_delete().'</a>';
echo '<a class="editfielda marginrightonly paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$range->ik->id.'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.'&fk_range='.$range->rowid.'">'.img_edit().'</a>';
if (!empty($range->ik->id)) echo '<a class="paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$range->ik->id.'">'.img_delete().'</a>';
// TODO add delete link
}
}

View File

@ -138,6 +138,7 @@ $rules = ExpenseReportRule::getAllRule();
$tab_apply = array('A' => $langs->trans('All'), 'G' => $langs->trans('Group'), 'U' => $langs->trans('User'));
$tab_rules_type = array('EX_DAY' => $langs->trans('Day'), 'EX_MON' => $langs->trans('Month'), 'EX_YEA' => $langs->trans('Year'), 'EX_EXP' => $langs->trans('OnExpense'));
/*
* View
*/
@ -147,12 +148,13 @@ llxHeader('', $langs->trans("ExpenseReportsSetup"));
$form = new Form($db);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ExpenseReportsRulesSetup"), $linkback, 'title_setup');
print load_fiche_titre($langs->trans("ExpenseReportsSetup"), $linkback, 'title_setup');
$head = expensereport_admin_prepare_head();
dol_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRules"), -1, 'trip');
echo $langs->trans('ExpenseReportRulesDesc');
echo '<span class="opacitymedium">'.$langs->trans('ExpenseReportRulesDesc').'</span>';
print '<br><br>';
if ($action != 'edit')
{
@ -164,7 +166,7 @@ if ($action != 'edit')
echo '<tr class="liste_titre">';
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDomain').'</th>';
echo '<th>'.$langs->trans('Type').'</th>';
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
@ -184,7 +186,7 @@ if ($action != 'edit')
echo '<td>'.$form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0).'</td>';
echo '<td>'.$form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0).'</td>';
echo '<td>'.$form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0).'</td>';
echo '<td><input type="text" value="" name="amount" class="amount" />'.$conf->currency.'</td>';
echo '<td><input type="text" value="" class="maxwidth100" name="amount" class="amount" /> '.$conf->currency.'</td>';
echo '<td>'.$form->selectyesno('restrictive', 0, 1).'</td>';
echo '<td class="right"><input type="submit" class="button" value="'.$langs->trans('Add').'" /></td>';
echo '</tr>';
@ -207,7 +209,7 @@ echo '<table class="noborder centpercent">';
echo '<tr class="liste_titre">';
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDomain').'</th>';
echo '<th>'.$langs->trans('Type').'</th>';
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
@ -300,11 +302,11 @@ foreach ($rules as $rule)
echo '</td>';
echo '<td>';
echo '<td class="center">';
if ($object->id != $rule->id)
{
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$rule->id.'">'.img_edit().'</a>&nbsp;';
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$rule->id.'">'.img_delete().'</a>';
echo '<a class="editfielda paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$rule->id.'">'.img_edit().'</a>&nbsp;';
echo '<a class="paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$rule->id.'">'.img_delete().'</a>';
} else {
echo '<input type="submit" class="button" value="'.$langs->trans('Update').'" />&nbsp;';
echo '<a href="'.$_SERVER['PHP_SELF'].'" class="button">'.$langs->trans('Cancel').'</a>';

View File

@ -53,66 +53,66 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask')
{
$maskconstinvoice = GETPOST('maskconstinvoice', 'alpha');
$maskconstreplacement = GETPOST('maskconstreplacement', 'alpha');
$maskconstcredit = GETPOST('maskconstcredit', 'alpha');
$maskconstinvoice = GETPOST('maskconstinvoice', 'alpha');
$maskconstreplacement = GETPOST('maskconstreplacement', 'alpha');
$maskconstcredit = GETPOST('maskconstcredit', 'alpha');
$maskconstdeposit = GETPOST('maskconstdeposit', 'alpha');
$maskinvoice = GETPOST('maskinvoice', 'alpha');
$maskreplacement = GETPOST('maskreplacement', 'alpha');
$maskcredit = GETPOST('maskcredit', 'alpha');
$maskinvoice = GETPOST('maskinvoice', 'alpha');
$maskreplacement = GETPOST('maskreplacement', 'alpha');
$maskcredit = GETPOST('maskcredit', 'alpha');
$maskdeposit = GETPOST('maskdeposit', 'alpha');
if ($maskconstinvoice) $res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity);
if ($maskconstreplacement) $res = dolibarr_set_const($db, $maskconstreplacement, $maskreplacement, 'chaine', 0, '', $conf->entity);
if ($maskconstcredit) $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity);
if ($maskconstinvoice) $res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity);
if ($maskconstreplacement) $res = dolibarr_set_const($db, $maskconstreplacement, $maskreplacement, 'chaine', 0, '', $conf->entity);
if ($maskconstcredit) $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity);
if ($maskconstdeposit) $res = dolibarr_set_const($db, $maskconstdeposit, $maskdeposit, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen')
{
$modele = GETPOST('module', 'alpha');
$modele = GETPOST('module', 'alpha');
$facture = new Facture($db);
$facture->initAsSpecimen();
$facture = new Facture($db);
$facture->initAsSpecimen();
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
$file = dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
if ($filefound)
{
require_once $file;
$module = new $classname($db);
$module = new $classname($db);
if ($module->write_file($facture, $langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
if ($module->write_file($facture, $langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Activate a model
elseif ($action == 'set')
@ -123,7 +123,7 @@ elseif ($action == 'set')
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->FACTURE_ADDON_PDF == "$value") dolibarr_del_const($db, 'FACTURE_ADDON_PDF', $conf->entity);
if ($conf->global->FACTURE_ADDON_PDF == "$value") dolibarr_del_const($db, 'FACTURE_ADDON_PDF', $conf->entity);
}
}
// Set default model
@ -144,89 +144,89 @@ elseif ($action == 'setdoc')
}
} elseif ($action == 'setmod')
{
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
// TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated
dolibarr_set_const($db, "FACTURE_ADDON", $value, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "FACTURE_ADDON", $value, 'chaine', 0, '', $conf->entity);
} elseif ($action == 'setribchq')
{
$rib = GETPOST('rib', 'alpha');
$chq = GETPOST('chq', 'alpha');
$res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'set_FACTURE_DRAFT_WATERMARK')
{
$draft = GETPOST('FACTURE_DRAFT_WATERMARK', 'alpha');
$res = dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'set_INVOICE_FREE_TEXT')
{
$freetext = GETPOST('INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'setforcedate')
{
$forcedate = GETPOST('forcedate', 'alpha');
$res = dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION", $forcedate, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION", $forcedate, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'setDefaultPDFModulesByType')
{
$invoicetypemodels = GETPOST('invoicetypemodels');
$invoicetypemodels = GETPOST('invoicetypemodels');
if (!empty($invoicetypemodels) && is_array($invoicetypemodels))
{
$error = 0;
if (!empty($invoicetypemodels) && is_array($invoicetypemodels))
{
$error = 0;
foreach ($invoicetypemodels as $type => $value)
{
$res = dolibarr_set_const($db, 'FACTURE_ADDON_PDF_'.intval($type), $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
}
foreach ($invoicetypemodels as $type => $value)
{
$res = dolibarr_set_const($db, 'FACTURE_ADDON_PDF_'.intval($type), $value, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
}
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
}
@ -267,144 +267,144 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/facture/");
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if (!is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
{
$filebis = $file;
$classname = preg_replace('/\.php$/', '', $file);
// For compatibility
if (!is_file($dir.$filebis))
{
$filebis = $file."/".$file.".modules.php";
$classname = "mod_facture_".$file;
}
// Check if there is a filter on country
preg_match('/\-(.*)_(.*)$/', $classname, $reg);
if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
if (!is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
{
$filebis = $file;
$classname = preg_replace('/\.php$/', '', $file);
// For compatibility
if (!is_file($dir.$filebis))
{
$filebis = $file."/".$file.".modules.php";
$classname = "mod_facture_".$file;
}
// Check if there is a filter on country
preg_match('/\-(.*)_(.*)$/', $classname, $reg);
if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
$classname = preg_replace('/\-.*$/', '', $classname);
if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php')
{
// Charging the numbering class
require_once $dir.$filebis;
$classname = preg_replace('/\-.*$/', '', $classname);
if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php')
{
// Charging the numbering class
require_once $dir.$filebis;
$module = new $classname($db);
$module = new $classname($db);
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
print '<tr class="oddeven"><td width="100">';
echo preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
print "</td><td>\n";
if ($module->isEnabled())
{
print '<tr class="oddeven"><td width="100">';
echo preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
print "</td><td>\n";
print $module->info();
print $module->info();
print '</td>';
print '</td>';
// Show example of numbering module
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
// Show example of numbering module
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
//print "> ".$conf->global->FACTURE_ADDON." - ".$file;
if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file)
{
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
}
print '</td>';
print '<td class="center">';
//print "> ".$conf->global->FACTURE_ADDON." - ".$file;
if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file)
{
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
}
print '</td>';
$facture = new Facture($db);
$facture->initAsSpecimen();
$facture = new Facture($db);
$facture->initAsSpecimen();
// Example for standard invoice
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type = 0;
$nextval = $module->getNextValue($mysoc, $facture);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= $langs->trans("NextValueForInvoices").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
// Example for remplacement
$facture->type = 1;
$nextval = $module->getNextValue($mysoc, $facture);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= $langs->trans("NextValueForReplacements").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
// Example for standard invoice
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type = 0;
$nextval = $module->getNextValue($mysoc, $facture);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= $langs->trans("NextValueForInvoices").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
// Example for remplacement
$facture->type = 1;
$nextval = $module->getNextValue($mysoc, $facture);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= $langs->trans("NextValueForReplacements").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
// Example for credit invoice
$facture->type = 2;
$nextval = $module->getNextValue($mysoc, $facture);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= $langs->trans("NextValueForCreditNotes").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
// Example for deposit invoice
$facture->type = 3;
$nextval = $module->getNextValue($mysoc, $facture);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= $langs->trans("NextValueForDeposit").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval;
} else {
$htmltooltip .= $langs->trans($module->error);
}
}
// Example for credit invoice
$facture->type = 2;
$nextval = $module->getNextValue($mysoc, $facture);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= $langs->trans("NextValueForCreditNotes").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
// Example for deposit invoice
$facture->type = 3;
$nextval = $module->getNextValue($mysoc, $facture);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= $langs->trans("NextValueForDeposit").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval;
} else {
$htmltooltip .= $langs->trans($module->error);
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
if ($conf->global->FACTURE_ADDON.'.php' == $file) // If module is the one used, we show existing errors
{
if (!empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1);
}
if ($conf->global->FACTURE_ADDON.'.php' == $file) // If module is the one used, we show existing errors
{
if (!empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1);
}
print '</td>';
print '</td>';
print "</tr>\n";
}
}
}
}
closedir($handle);
}
}
print "</tr>\n";
}
}
}
}
closedir($handle);
}
}
}
print '</table>';
@ -426,16 +426,16 @@ $sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql)
{
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
} else {
dol_print_error($db);
dol_print_error($db);
}
print '<table class="noborder centpercent">';
@ -454,156 +454,156 @@ $activatedModels = array();
foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/facture".$valdir;
$dir = dol_buildpath($realpath);
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/facture".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"), 'switch_off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"), 'switch_off').'</a>';
print "</td>";
}
// Defaut
print '<td class="center">';
if ($conf->global->FACTURE_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').'</a>';
}
print '</td>';
// Defaut
print '<td class="center">';
if ($conf->global->FACTURE_ADDON_PDF == "$name")
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf
{
/*
/*
* Document templates generators
*/
print '<br>';
print load_fiche_titre($langs->trans("BillsPDFModulesAccordindToInvoiceType"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'#default-pdf-modules-by-type-table" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="setDefaultPDFModulesByType" >';
print '<table id="default-pdf-modules-by-type-table" class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Name").'</td>';
print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
print '<br>';
print load_fiche_titre($langs->trans("BillsPDFModulesAccordindToInvoiceType"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'#default-pdf-modules-by-type-table" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="action" value="setDefaultPDFModulesByType" >';
print '<table id="default-pdf-modules-by-type-table" class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Name").'</td>';
print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
$listtype = array(
Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"),
Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
);
if (!empty($conf->global->INVOICE_USE_SITUATION))
{
$listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");
}
$listtype = array(
Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"),
Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
);
if (!empty($conf->global->INVOICE_USE_SITUATION))
{
$listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");
}
foreach ($listtype as $type => $trans)
{
$thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type;
$current = !empty($conf->global->{$thisTypeConfName}) ? $conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF;
print '<tr >';
print '<td>'.$trans.'</td>';
print '<td colspan="2" >'.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current, 0, 0, 0).'</td>';
print "</tr>\n";
}
foreach ($listtype as $type => $trans)
{
$thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type;
$current = !empty($conf->global->{$thisTypeConfName}) ? $conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF;
print '<tr >';
print '<td>'.$trans.'</td>';
print '<td colspan="2" >'.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current, 0, 0, 0).'</td>';
print "</tr>\n";
}
print '</table>';
print "</form>";
print '</table>';
print "</form>";
}
/*
@ -629,37 +629,37 @@ print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
print "<td>";
if (!empty($conf->banque->enabled))
{
$sql = "SELECT rowid, label";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql .= " WHERE clos = 0";
$sql .= " AND courant = 1";
$sql .= " AND entity IN (".getEntity('bank_account').")";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
if ($num > 0)
{
print '<select name="rib" class="flat" id="rib">';
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
while ($i < $num)
{
$row = $db->fetch_row($resql);
$sql = "SELECT rowid, label";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql .= " WHERE clos = 0";
$sql .= " AND courant = 1";
$sql .= " AND entity IN (".getEntity('bank_account').")";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
if ($num > 0)
{
print '<select name="rib" class="flat" id="rib">';
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
while ($i < $num)
{
$row = $db->fetch_row($resql);
print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected' : '';
print '>'.$row[1].'</option>';
print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected' : '';
print '>'.$row[1].'</option>';
$i++;
}
print "</select>";
} else {
print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
}
}
$i++;
}
print "</select>";
} else {
print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
}
}
} else {
print $langs->trans("BankModuleNotActive");
print $langs->trans("BankModuleNotActive");
}
print "</td></tr>";
@ -679,18 +679,18 @@ $sql .= " AND entity IN (".getEntity('bank_account').")";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($resql);
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($resql);
print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : '';
print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>';
print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : '';
print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>';
$i++;
}
$i++;
}
}
print "</select>";
print "</td></tr>";
@ -735,11 +735,11 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->tra
$variablename = 'INVOICE_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';

View File

@ -43,7 +43,7 @@ $type = 'contract';
if (empty($conf->global->HOLIDAY_ADDON))
{
$conf->global->HOLIDAY_ADDON = 'mod_holiday_madonna';
$conf->global->HOLIDAY_ADDON = 'mod_holiday_madonna';
}
@ -55,18 +55,18 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask')
{
$maskconst = GETPOST('maskconstholiday', 'alpha');
$maskvalue = GETPOST('maskholiday', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
$maskconst = GETPOST('maskconstholiday', 'alpha');
$maskvalue = GETPOST('maskholiday', 'alpha');
if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++;
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen') // For contract
{
$modele = GETPOST('module', 'alpha');
@ -79,7 +79,7 @@ if ($action == 'updateMask')
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php", 0);
$file = dol_buildpath($reldir."core/modules/holiday/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
@ -117,7 +117,7 @@ elseif ($action == 'set')
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->HOLIDAY_ADDON_PDF == "$value") dolibarr_del_const($db, 'HOLIDAY_ADDON_PDF', $conf->entity);
if ($conf->global->HOLIDAY_ADDON_PDF == "$value") dolibarr_del_const($db, 'HOLIDAY_ADDON_PDF', $conf->entity);
}
}
@ -154,11 +154,11 @@ elseif ($action == 'setdoc')
if (!$res1 > 0 || !$res2 > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -251,16 +251,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mysoc, $holiday);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
@ -282,11 +282,11 @@ print '<br>';
if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
dol_fiche_end();
// End of page
llxFooter();
$db->close();
exit;
dol_fiche_end();
// End of page
llxFooter();
$db->close();
exit;
}
/*
@ -304,8 +304,8 @@ $sql .= " AND entity = ".$conf->entity;
$resql = $db->query($sql);
if ($resql)
{
$i = 0;
$num_rows = $db->num_rows($resql);
$i = 0;
$num_rows = $db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
@ -332,111 +332,111 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/holiday".$valdir;
$dir = dol_buildpath($realpath);
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/holiday".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->HOLIDAY_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Default
print '<td class="center">';
if ($conf->global->HOLIDAY_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
@ -473,11 +473,11 @@ print '<br>';
$variablename = 'HOLIDAY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td></tr>'."\n";

View File

@ -113,29 +113,29 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
{
$tmp = FormMail::getAvailableSubstitKey('formemail');
$tmp['__(AnyTranslationKey)__'] = 'Translation';
$helpsubstit = $langs->trans("AvailableVariables").':<br>';
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>';
foreach ($tmp as $key => $val)
{
$helpsubstit .= $key.' -> '.$val.'<br>';
$helpsubstitforlines .= $key.' -> '.$val.'<br>';
}
$tmp = FormMail::getAvailableSubstitKey('formemail');
$tmp['__(AnyTranslationKey)__'] = 'Translation';
$helpsubstit = $langs->trans("AvailableVariables").':<br>';
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>';
foreach ($tmp as $key => $val)
{
$helpsubstit .= $key.' -> '.$val.'<br>';
$helpsubstitforlines .= $key.' -> '.$val.'<br>';
}
} else {
$tmp = FormMail::getAvailableSubstitKey('formemailwithlines');
$tmp['__(AnyTranslationKey)__'] = 'Translation';
$helpsubstit = $langs->trans("AvailableVariables").':<br>';
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>';
foreach ($tmp as $key => $val)
{
$helpsubstit .= $key.' -> '.$val.'<br>';
}
$tmp = FormMail::getAvailableSubstitKey('formemailforlines');
foreach ($tmp as $key => $val)
{
$helpsubstitforlines .= $key.' -> '.$val.'<br>';
}
$tmp = FormMail::getAvailableSubstitKey('formemailwithlines');
$tmp['__(AnyTranslationKey)__'] = 'Translation';
$helpsubstit = $langs->trans("AvailableVariables").':<br>';
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>';
foreach ($tmp as $key => $val)
{
$helpsubstit .= $key.' -> '.$val.'<br>';
}
$tmp = FormMail::getAvailableSubstitKey('formemailforlines');
foreach ($tmp as $key => $val)
{
$helpsubstitforlines .= $key.' -> '.$val.'<br>';
}
}
@ -201,206 +201,206 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$search_label = '';
$search_type_template = '';
$search_lang = '';
$search_fk_user = '';
$search_topic = '';
$toselect = '';
$search_array_options = array();
}
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$search_label = '';
$search_type_template = '';
$search_lang = '';
$search_fk_user = '';
$search_topic = '';
$toselect = '';
$search_array_options = array();
}
// Actions add or modify an entry into a dictionary
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
{
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
$listfieldvalue = explode(',', $tabfieldvalue[$id]);
// Actions add or modify an entry into a dictionary
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
{
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
$listfieldvalue = explode(',', $tabfieldvalue[$id]);
// Check that all fields are filled
$ok = 1;
foreach ($listfield as $f => $value)
{
// Not mandatory fields
if ($value == 'joinfiles') continue;
if ($value == 'content') continue;
if ($value == 'content_lines') continue;
// Check that all fields are filled
$ok = 1;
foreach ($listfield as $f => $value)
{
// Not mandatory fields
if ($value == 'joinfiles') continue;
if ($value == 'content') continue;
if ($value == 'content_lines') continue;
if (GETPOST('actionmodify', 'alpha') && $value == 'topic') $_POST['topic'] = $_POST['topic-'.$rowid];
if (GETPOST('actionmodify', 'alpha') && $value == 'topic') $_POST['topic'] = $_POST['topic-'.$rowid];
if ((!isset($_POST[$value]) || $_POST[$value] == '' || $_POST[$value] == '-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position')
{
$ok = 0;
$fieldnamekey = $listfield[$f];
// We take translate key of field
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey = 'Code';
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
if ($fieldnamekey == 'type_template') $fieldnamekey = 'TypeOfTemplate';
if ($fieldnamekey == 'fk_user') $fieldnamekey = 'Owner';
if ($fieldnamekey == 'private') $fieldnamekey = 'Private';
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
if ($fieldnamekey == 'topic') $fieldnamekey = 'Topic';
if ((!isset($_POST[$value]) || $_POST[$value] == '' || $_POST[$value] == '-1') && $value != 'lang' && $value != 'fk_user' && $value != 'position')
{
$ok = 0;
$fieldnamekey = $listfield[$f];
// We take translate key of field
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey = 'Code';
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
if ($fieldnamekey == 'type_template') $fieldnamekey = 'TypeOfTemplate';
if ($fieldnamekey == 'fk_user') $fieldnamekey = 'Owner';
if ($fieldnamekey == 'private') $fieldnamekey = 'Private';
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
if ($fieldnamekey == 'topic') $fieldnamekey = 'Topic';
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
}
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
}
// Si verif ok et action add, on ajoute la ligne
if ($ok && GETPOST('actionadd'))
{
// Add new entry
$sql = "INSERT INTO ".$tabname[$id]." (";
// List of fields
$sql .= $tabfieldinsert[$id];
$sql .= ",active)";
$sql .= " VALUES(";
// Si verif ok et action add, on ajoute la ligne
if ($ok && GETPOST('actionadd'))
{
// Add new entry
$sql = "INSERT INTO ".$tabname[$id]." (";
// List of fields
$sql .= $tabfieldinsert[$id];
$sql .= ",active)";
$sql .= " VALUES(";
// List of values
$i = 0;
foreach ($listfieldinsert as $f => $value)
{
$keycode = $listfieldvalue[$i];
if ($value == 'lang') $keycode = 'langcode';
if (empty($keycode)) $keycode = $value;
// List of values
$i = 0;
foreach ($listfieldinsert as $f => $value)
{
$keycode = $listfieldvalue[$i];
if ($value == 'lang') $keycode = 'langcode';
if (empty($keycode)) $keycode = $value;
if ($value == 'entity') $_POST[$keycode] = $conf->entity;
if ($value == 'fk_user' && !($_POST[$keycode] > 0)) $_POST[$keycode] = '';
if ($value == 'private' && !is_numeric($_POST[$keycode])) $_POST[$keycode] = '0';
if ($value == 'position' && !is_numeric($_POST[$keycode])) $_POST[$keycode] = '1';
//var_dump($keycode.' '.$value);
if ($value == 'entity') $_POST[$keycode] = $conf->entity;
if ($value == 'fk_user' && !($_POST[$keycode] > 0)) $_POST[$keycode] = '';
if ($value == 'private' && !is_numeric($_POST[$keycode])) $_POST[$keycode] = '0';
if ($value == 'position' && !is_numeric($_POST[$keycode])) $_POST[$keycode] = '1';
//var_dump($keycode.' '.$value);
if ($i) $sql .= ", ";
if (GETPOST($keycode) == '' && $keycode != 'langcode') $sql .= "null"; // langcode must be '' if not defined so the unique key that include lang will work
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int');
} else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
}
if ($i) $sql .= ", ";
if (GETPOST($keycode) == '' && $keycode != 'langcode') $sql .= "null"; // langcode must be '' if not defined so the unique key that include lang will work
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int');
} else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
}
$i++;
}
$sql .= ", 1)";
$i++;
}
$sql .= ", 1)";
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only id
} else {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
} else {
dol_print_error($db);
}
}
}
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only id
} else {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
} else {
dol_print_error($db);
}
}
}
// Si verif ok et action modify, on modifie la ligne
if ($ok && GETPOST('actionmodify'))
{
$rowidcol = "rowid";
// Si verif ok et action modify, on modifie la ligne
if ($ok && GETPOST('actionmodify'))
{
$rowidcol = "rowid";
// Modify entry
$sql = "UPDATE ".$tabname[$id]." SET ";
// Modifie valeur des champs
$i = 0;
foreach ($listfieldmodify as $field)
{
$keycode = $listfieldvalue[$i];
if ($field == 'lang') $keycode = 'langcode';
if (empty($keycode)) $keycode = $field;
// Modify entry
$sql = "UPDATE ".$tabname[$id]." SET ";
// Modifie valeur des champs
$i = 0;
foreach ($listfieldmodify as $field)
{
$keycode = $listfieldvalue[$i];
if ($field == 'lang') $keycode = 'langcode';
if (empty($keycode)) $keycode = $field;
if ($field == 'fk_user' && !($_POST['fk_user'] > 0)) $_POST['fk_user'] = '';
if ($field == 'topic') $_POST['topic'] = $_POST['topic-'.$rowid];
if ($field == 'joinfiles') $_POST['joinfiles'] = $_POST['joinfiles-'.$rowid];
if ($field == 'content') $_POST['content'] = $_POST['content-'.$rowid];
if ($field == 'content_lines') $_POST['content_lines'] = $_POST['content_lines-'.$rowid];
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
if ($field == 'fk_user' && !($_POST['fk_user'] > 0)) $_POST['fk_user'] = '';
if ($field == 'topic') $_POST['topic'] = $_POST['topic-'.$rowid];
if ($field == 'joinfiles') $_POST['joinfiles'] = $_POST['joinfiles-'.$rowid];
if ($field == 'content') $_POST['content'] = $_POST['content-'.$rowid];
if ($field == 'content_lines') $_POST['content_lines'] = $_POST['content_lines-'.$rowid];
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
if ($i) $sql .= ", ";
$sql .= $field."=";
if ($i) $sql .= ", ";
$sql .= $field."=";
if (GETPOST($keycode) == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && !GETPOST($keycode))) $sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int');
} else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
}
if (GETPOST($keycode) == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && !GETPOST($keycode))) $sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int');
} else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
}
$i++;
}
$sql .= " WHERE ".$rowidcol." = '".$rowid."'";
//print $sql;exit;
dol_syslog("actionmodify", LOG_DEBUG);
//print $sql;
$resql = $db->query($sql);
if ($resql)
{
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
} else {
setEventMessages($db->error(), null, 'errors');
}
}
}
$i++;
}
$sql .= " WHERE ".$rowidcol." = '".$rowid."'";
//print $sql;exit;
dol_syslog("actionmodify", LOG_DEBUG);
//print $sql;
$resql = $db->query($sql);
if ($resql)
{
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
} else {
setEventMessages($db->error(), null, 'errors');
}
}
}
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{
$rowidcol = "rowid";
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{
$rowidcol = "rowid";
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
dol_syslog("delete", LOG_DEBUG);
$result = $db->query($sql);
if (!$result)
{
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
{
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
} else {
dol_print_error($db);
}
}
}
dol_syslog("delete", LOG_DEBUG);
$result = $db->query($sql);
if (!$result)
{
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
{
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
} else {
dol_print_error($db);
}
}
}
// activate
if ($action == $acts[0])
{
$rowidcol = "rowid";
// activate
if ($action == $acts[0])
{
$rowidcol = "rowid";
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
}
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
}
// disable
if ($action == $acts[1])
{
$rowidcol = "rowid";
// disable
if ($action == $acts[1])
{
$rowidcol = "rowid";
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
}
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
}
}
@ -428,7 +428,7 @@ dol_fiche_head($head, 'templates', '', -1);
// Confirmation de la suppression de la ligne
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
}
//var_dump($elementList);
@ -613,90 +613,90 @@ dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$num = $db->num_rows($resql);
$i = 0;
$param = '&id='.$id;
if ($search_label) $param .= '&search_label='.urlencode($search_label);
if ($search_lang > 0) $param .= '&search_lang='.urlencode($search_lang);
if ($search_type_template != '-1') $param .= '&search_type_template='.urlencode($search_type_template);
if ($search_fk_user > 0) $param .= '&search_fk_user='.urlencode($search_fk_user);
if ($search_topic) $param .= '&search_topic='.urlencode($search_topic);
$param = '&id='.$id;
if ($search_label) $param .= '&search_label='.urlencode($search_label);
if ($search_lang > 0) $param .= '&search_lang='.urlencode($search_lang);
if ($search_type_template != '-1') $param .= '&search_type_template='.urlencode($search_type_template);
if ($search_fk_user > 0) $param .= '&search_fk_user='.urlencode($search_fk_user);
if ($search_topic) $param .= '&search_topic='.urlencode($search_topic);
$paramwithsearch = $param;
if ($sortorder) $paramwithsearch .= '&sortorder='.urlencode($sortorder);
if ($sortfield) $paramwithsearch .= '&sortfield='.urlencode($sortfield);
if (GETPOST('from', 'alpha')) $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
$paramwithsearch = $param;
if ($sortorder) $paramwithsearch .= '&sortorder='.urlencode($sortorder);
if ($sortfield) $paramwithsearch .= '&sortfield='.urlencode($sortfield);
if (GETPOST('from', 'alpha')) $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
// There is several pages
if ($num > $listlimit)
{
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '</td></tr>';
}
// There is several pages
if ($num > $listlimit)
{
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '</td></tr>';
}
// Title line with search boxes
print '<tr class="liste_titre">';
// Title line with search boxes
print '<tr class="liste_titre">';
$filterfound = 0;
foreach ($fieldlist as $field => $value)
{
if ($value == 'label') {
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth100" value="'.dol_escape_htmltag($search_label).'"></td>';
} elseif ($value == 'lang') {
print '<td class="liste_titre">';
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
print '</td>';
} elseif ($value == 'fk_user') {
print '<td class="liste_titre">';
$restrictid = array();
if (!$user->admin) $restrictid = array($user->id);
//var_dump($restrictid);
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth100');
print '</td>';
} elseif ($value == 'topic') {
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
} elseif ($value == 'type_template') {
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 maxwidth100onsmartphone').'</td>';
} elseif (!in_array($value, array('content', 'content_lines'))) {
print '<td class="liste_titre"></td>';
}
}
$filterfound = 0;
foreach ($fieldlist as $field => $value)
{
if ($value == 'label') {
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth100" value="'.dol_escape_htmltag($search_label).'"></td>';
} elseif ($value == 'lang') {
print '<td class="liste_titre">';
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
print '</td>';
} elseif ($value == 'fk_user') {
print '<td class="liste_titre">';
$restrictid = array();
if (!$user->admin) $restrictid = array($user->id);
//var_dump($restrictid);
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth100');
print '</td>';
} elseif ($value == 'topic') {
print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
} elseif ($value == 'type_template') {
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 maxwidth100onsmartphone').'</td>';
} elseif (!in_array($value, array('content', 'content_lines'))) {
print '<td class="liste_titre"></td>';
}
}
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
// Action column
print '<td class="liste_titre right" width="64">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
// Action column
print '<td class="liste_titre right" width="64">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
// Title of lines
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value)
{
$showfield = 1; // By defaut
$align = "left";
$sortable = 1;
$valuetoshow = '';
$forcenowrap = 1;
/*
// Title of lines
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value)
{
$showfield = 1; // By defaut
$align = "left";
$sortable = 1;
$valuetoshow = '';
$forcenowrap = 1;
/*
$tmparray=getLabelOfField($fieldlist[$field]);
$showfield=$tmp['showfield'];
$valuetoshow=$tmp['valuetoshow'];
$align=$tmp['align'];
$sortable=$tmp['sortable'];
*/
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field] == 'fk_user') { $valuetoshow = $langs->trans("Owner"); }
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Code"); }
if ($fieldlist[$field] == 'type_template') { $valuetoshow = $langs->trans("TypeOfTemplate"); }
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field] == 'fk_user') { $valuetoshow = $langs->trans("Owner"); }
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Code"); }
if ($fieldlist[$field] == 'type_template') { $valuetoshow = $langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field] == 'private') { $align = 'center'; }
if ($fieldlist[$field] == 'position') { $align = 'center'; }
@ -704,99 +704,99 @@ if ($resql)
if ($fieldlist[$field] == 'content') { $valuetoshow = $langs->trans("Content"); $showfield = 0; }
if ($fieldlist[$field] == 'content_lines') { $valuetoshow = $langs->trans("ContentLines"); $showfield = 0; }
// Show fields
if ($showfield)
{
if (!empty($tabhelp[$id][$value]))
{
if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value, $forcenowrap); // Tooltip on click
else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', $forcenowrap); // Tooltip on hover
}
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder);
}
}
// Show fields
if ($showfield)
{
if (!empty($tabhelp[$id][$value]))
{
if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value, $forcenowrap); // Tooltip on click
else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', $forcenowrap); // Tooltip on hover
}
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder);
}
}
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
print getTitleFieldOfList('');
print '</tr>';
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
print getTitleFieldOfList('');
print '</tr>';
if ($num)
{
// Lines with values
while ($i < $num)
{
$obj = $db->fetch_object($resql);
if ($num)
{
// Lines with values
while ($i < $num)
{
$obj = $db->fetch_object($resql);
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code)))
{
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code)))
{
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
$tmpaction = 'edit';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
$tmpaction = 'edit';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
// Show fields
if (empty($reshook)) fieldList($fieldlist, $obj, $tabname[$id], 'edit');
// Show fields
if (empty($reshook)) fieldList($fieldlist, $obj, $tabname[$id], 'edit');
print '<td></td><td></td><td></td>';
print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button buttongen" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button buttongen" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
print '<td></td><td></td><td></td>';
print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button buttongen" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button buttongen" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
$fieldsforcontent = array('topic', 'joinfiles', 'content');
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
{
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
}
foreach ($fieldsforcontent as $tmpfieldlist)
{
$showfield = 1;
$align = "left";
$valuetoshow = $obj->{$tmpfieldlist};
$fieldsforcontent = array('topic', 'joinfiles', 'content');
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
{
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
}
foreach ($fieldsforcontent as $tmpfieldlist)
{
$showfield = 1;
$align = "left";
$valuetoshow = $obj->{$tmpfieldlist};
$class = 'tddict';
// Show value for field
if ($showfield) {
$class = 'tddict';
// Show value for field
if ($showfield) {
// Show line for topic, joinfiles and content
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
print '<td colspan="8">';
if ($tmpfieldlist == 'topic')
{
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
}
if ($tmpfieldlist == 'joinfiles')
{
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
}
if ($tmpfieldlist == 'content')
{
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
$okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
print $doleditor->Create(1);
}
print '</td>';
print '<td></td>';
print '<td></td>';
}
}
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
print '<td colspan="8">';
if ($tmpfieldlist == 'topic')
{
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
}
if ($tmpfieldlist == 'joinfiles')
{
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
}
if ($tmpfieldlist == 'content')
{
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
$okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
print $doleditor->Create(1);
}
print '</td>';
print '<td></td>';
print '<td></td>';
}
}
print "</tr>\n";
} else {
$keyforobj = 'type_template';
if (!in_array($obj->$keyforobj, array_keys($elementList)))
{
$i++;
continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled)
}
print "</tr>\n";
} else {
$keyforobj = 'type_template';
if (!in_array($obj->$keyforobj, array_keys($elementList)))
{
$i++;
continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled)
}
// Test on 'enabled'
if (!dol_eval($obj->enabled, 1))
{
@ -804,100 +804,100 @@ if ($resql)
continue; // Email template not qualified
}
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
$tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
$error = $hookmanager->error; $errors = $hookmanager->errors;
if (empty($reshook))
{
foreach ($fieldlist as $field => $value)
{
if (in_array($fieldlist[$field], array('content', 'content_lines'))) continue;
$showfield = 1;
$align = "left";
$valuetoshow = $obj->{$fieldlist[$field]};
if ($value == 'label' || $value == 'topic')
{
$valuetoshow = dol_escape_htmltag($valuetoshow);
}
if ($value == 'type_template')
{
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
}
if ($value == 'lang' && $valuetoshow)
{
$valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
}
if ($value == 'fk_user')
{
if ($valuetoshow > 0)
{
$fuser = new User($db);
$fuser->fetch($valuetoshow);
$valuetoshow = $fuser->getNomUrl(1);
}
}
if ($value == 'private')
{
$align = "center";
if ($valuetoshow) $valuetoshow = yn($valuetoshow);
else $valuetoshow = '';
}
if ($value == 'position')
{
$align = "center";
}
if ($value == 'joinfiles')
{
$align = "center";
if ($valuetoshow) $valuetoshow = 1;
else $valuetoshow = '';
}
if (empty($reshook))
{
foreach ($fieldlist as $field => $value)
{
if (in_array($fieldlist[$field], array('content', 'content_lines'))) continue;
$showfield = 1;
$align = "left";
$valuetoshow = $obj->{$fieldlist[$field]};
if ($value == 'label' || $value == 'topic')
{
$valuetoshow = dol_escape_htmltag($valuetoshow);
}
if ($value == 'type_template')
{
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
}
if ($value == 'lang' && $valuetoshow)
{
$valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
}
if ($value == 'fk_user')
{
if ($valuetoshow > 0)
{
$fuser = new User($db);
$fuser->fetch($valuetoshow);
$valuetoshow = $fuser->getNomUrl(1);
}
}
if ($value == 'private')
{
$align = "center";
if ($valuetoshow) $valuetoshow = yn($valuetoshow);
else $valuetoshow = '';
}
if ($value == 'position')
{
$align = "center";
}
if ($value == 'joinfiles')
{
$align = "center";
if ($valuetoshow) $valuetoshow = 1;
else $valuetoshow = '';
}
$class = 'tddict';
$class = 'tddict';
// Show value for field
if ($showfield)
{
print '<!-- '.$fieldlist[$field].' -->';
print '<td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
print '<!-- '.$fieldlist[$field].' -->';
print '<td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
}
}
}
}
}
// Can an entry be erased or disabled ?
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
if (!$user->admin && $obj->fk_user != $user->id)
{
$iserasable = 0;
$canbedisabled = 0;
$canbemodified = 0;
}
// Can an entry be erased or disabled ?
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
if (!$user->admin && $obj->fk_user != $user->id)
{
$iserasable = 0;
$canbedisabled = 0;
$canbemodified = 0;
}
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if ($param) $url .= '&'.$param;
$url .= '&';
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if ($param) $url .= '&'.$param;
$url .= '&';
// Status / Active
print '<td class="center nowrap">';
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else print '<span class="opacitymedium">'.$actl[$obj->active].'</span>';
print "</td>";
// Status / Active
print '<td class="center nowrap">';
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else print '<span class="opacitymedium">'.$actl[$obj->active].'</span>';
print "</td>";
// Modify link / Delete link
print '<td class="center nowraponall" width="64">';
if ($canbemodified) print '<a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a>';
if ($iserasable)
{
print '<a class="marginleftonly" href="'.$url.'action=delete">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
}
print '</td>';
// Modify link / Delete link
print '<td class="center nowraponall" width="64">';
if ($canbemodified) print '<a class="reposition editfielda" href="'.$url.'action=edit">'.img_edit().'</a>';
if ($iserasable)
{
print '<a class="marginleftonly" href="'.$url.'action=delete">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
}
print '</td>';
/*
/*
$fieldsforcontent = array('content');
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
{
@ -925,15 +925,15 @@ if ($resql)
}
}*/
print "</tr>\n";
}
print "</tr>\n";
}
$i++;
}
}
$i++;
}
}
} else {
dol_print_error($db);
dol_print_error($db);
}
print '</table>';

View File

@ -89,7 +89,6 @@ if ($action == 'update')
$result = $menu->fetch(GETPOST('menuId', 'int'));
if ($result > 0)
{
$menu->titre = GETPOST('titre', 'alpha'); // deprecated
$menu->title = GETPOST('titre', 'alpha');
$menu->leftmenu = GETPOST('leftmenu', 'aZ09');
$menu->url = GETPOST('url', 'alpha');
@ -200,7 +199,6 @@ if ($action == 'add')
$menu = new Menubase($db);
$menu->menu_handler = preg_replace('/_menu$/', '', GETPOST('menu_handler', 'aZ09'));
$menu->type = GETPOST('type', 'alpha');
$menu->titre = GETPOST('titre', 'alpha'); // deprecated
$menu->title = GETPOST('titre', 'alpha');
$menu->url = GETPOST('url', 'alpha');
$menu->langs = GETPOST('langs', 'alpha');
@ -478,7 +476,7 @@ if ($action == 'create')
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
// Title
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->titre ? $menu->titre : $menu->title).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->title).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
// Url
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';

View File

@ -56,11 +56,11 @@ if ($action == 'updateMask')
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen')
{
$modele = GETPOST('module', 'alpha');
@ -73,7 +73,7 @@ if ($action == 'updateMask')
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/mrp/doc/pdf_".$modele.".modules.php", 0);
$file = dol_buildpath($reldir."core/modules/mrp/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
@ -111,7 +111,7 @@ elseif ($action == 'set')
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->MRP_MO_ADDON_PDF == "$value") dolibarr_del_const($db, 'MRP_MO_ADDON_PDF', $conf->entity);
if ($conf->global->MRP_MO_ADDON_PDF == "$value") dolibarr_del_const($db, 'MRP_MO_ADDON_PDF', $conf->entity);
}
}
@ -145,11 +145,11 @@ elseif ($action == 'setdoc')
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'set_MRP_MO_FREE_TEXT')
{
$freetext = GETPOST("MRP_MO_FREE_TEXT", 'none'); // No alpha here, we want exact string
@ -159,11 +159,11 @@ elseif ($action == 'setdoc')
if (!$res > 0) $error++;
if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -212,7 +212,7 @@ foreach ($dirmodels as $reldir)
{
while (($file = readdir($handle)) !== false)
{
if (substr($file, 0, 7) == 'mod_mo_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
if (substr($file, 0, 7) == 'mod_mo_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file) - 4);
@ -230,13 +230,13 @@ foreach ($dirmodels as $reldir)
print $module->info();
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
// Show example of numbering model
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->MRP_MO_ADDON == $file)
@ -257,16 +257,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$mrp->type = 0;
$nextval = $module->getNextValue($mysoc, $mrp);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
@ -325,108 +325,108 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/mrp".$valdir;
$dir = dol_buildpath($realpath);
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/mrp".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified)
{
print '<tr class="oddeven"><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->MRP_MO_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Default
print '<td class="center">';
if ($conf->global->MRP_MO_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
@ -458,11 +458,11 @@ print $form->textwithpicto($langs->trans("FreeLegalTextOnMOs"), $langs->trans("A
$variablename = 'MRP_MO_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';

View File

@ -45,13 +45,13 @@ $type = 'reception';
if (!empty($conf->reception->enabled) && empty($conf->global->MAIN_SUBMODULE_RECEPTION))
{
// This option should always be set to on when module is on.
dolibarr_set_const($db, "MAIN_SUBMODULE_RECEPTION", "1", 'chaine', 0, '', $conf->entity);
// This option should always be set to on when module is on.
dolibarr_set_const($db, "MAIN_SUBMODULE_RECEPTION", "1", 'chaine', 0, '', $conf->entity);
}
if (empty($conf->global->RECEPTION_ADDON_NUMBER))
{
$conf->global->RECEPTION_ADDON_NUMBER = 'mod_reception_beryl';
$conf->global->RECEPTION_ADDON_NUMBER = 'mod_reception_beryl';
}
@ -108,7 +108,7 @@ if ($action == 'updateMask')
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir)
{
$file = dol_buildpath($reldir."core/modules/reception/doc/pdf_".$modele.".modules.php", 0);
$file = dol_buildpath($reldir."core/modules/reception/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound = 1;
@ -146,7 +146,7 @@ elseif ($action == 'set')
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->RECEPTION_ADDON_PDF == "$value") dolibarr_del_const($db, 'RECEPTION_ADDON_PDF', $conf->entity);
if ($conf->global->RECEPTION_ADDON_PDF == "$value") dolibarr_del_const($db, 'RECEPTION_ADDON_PDF', $conf->entity);
}
}
@ -236,14 +236,14 @@ foreach ($dirmodels as $reldir)
print $module->info();
print '</td>';
// Show example of numbering module
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
// Show example of numbering module
print '<td class="nowrap">';
$tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
} elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->RECEPTION_ADDON_NUMBER == "$file")
@ -263,16 +263,16 @@ foreach ($dirmodels as $reldir)
$htmltooltip = '';
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$nextval = $module->getNextValue($mysoc, $reception);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip .= ''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
@ -333,110 +333,110 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/reception".$valdir;
$dir = dol_buildpath($realpath);
foreach (array('', '/doc') as $valdir)
{
$realpath = $reldir."core/modules/reception".$valdir;
$dir = dol_buildpath($realpath);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle)) !== false)
{
$filelist[] = $file;
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
foreach ($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir.'/'.$file;
$module = new $classname($db);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
if ($modulequalified)
{
print '<tr><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
if ($modulequalified)
{
print '<tr><td width="100">';
print (empty($module->name) ? $name : $module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Defaut
print '<td class="center">';
if ($conf->global->RECEPTION_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Defaut
print '<td class="center">';
if ($conf->global->RECEPTION_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'reception').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'reception').'</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';

View File

@ -51,42 +51,42 @@ $reg = array();
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{
$code = $reg[1];
$code = $reg[1];
// If constant is for a unique choice, delete other choices
if (in_array($code, array('STOCK_CALCULATE_ON_BILL', 'STOCK_CALCULATE_ON_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_SHIPMENT', 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE'))) {
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_BILL', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_VALIDATE_ORDER', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE', $conf->entity);
}
if (in_array($code, array('STOCK_CALCULATE_ON_SUPPLIER_BILL', 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_RECEPTION', 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'))) {
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_BILL', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', $conf->entity);
}
// If constant is for a unique choice, delete other choices
if (in_array($code, array('STOCK_CALCULATE_ON_BILL', 'STOCK_CALCULATE_ON_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_SHIPMENT', 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE'))) {
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_BILL', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_VALIDATE_ORDER', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE', $conf->entity);
}
if (in_array($code, array('STOCK_CALCULATE_ON_SUPPLIER_BILL', 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_RECEPTION', 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'))) {
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_BILL', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', $conf->entity);
}
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
}
if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
{
$code = $reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
$code = $reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
} else {
dol_print_error($db);
}
}
if ($action == 'warehouse')
@ -224,14 +224,14 @@ print '<td>'.$langs->trans("DeStockOnBill").'</td>';
print '<td class="right">';
if (!empty($conf->facture->enabled))
{
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
}
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name"));
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name"));
}
print "</td>\n</tr>\n";
$found++;
@ -242,14 +242,14 @@ print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>';
print '<td class="right">';
if (!empty($conf->commande->enabled))
{
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
}
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name"));
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name"));
}
print "</td>\n</tr>\n";
$found++;
@ -262,14 +262,14 @@ print '<td>'.$langs->trans("DeStockOnShipment").'</td>';
print '<td class="right">';
if (!empty($conf->expedition->enabled))
{
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
}
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
}
print "</td>\n</tr>\n";
$found++;
@ -280,14 +280,14 @@ print '<td>'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
print '<td class="right">';
if (!empty($conf->expedition->enabled))
{
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
}
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
}
print "</td>\n</tr>\n";
$found++;
@ -312,14 +312,14 @@ print '<td>'.$langs->trans("ReStockOnBill").'</td>';
print '<td class="right">';
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
{
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
}
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
}
print "</td>\n</tr>\n";
$found++;
@ -331,14 +331,14 @@ print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
print '<td class="right">';
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
{
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
}
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
}
print "</td>\n</tr>\n";
$found++;
@ -347,43 +347,43 @@ if (!empty($conf->reception->enabled))
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockOnReception").'</td>';
print '<td class="right">';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION);
}
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION);
}
print "</td>\n</tr>\n";
$found++;
print '<tr class="oddeven">';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockOnReceptionOnClosing").'</td>';
print '<td class="right">';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE);
}
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE);
}
print "</td>\n</tr>\n";
$found++;
} else {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
print '<td class="right">';
print '<td class="right">';
if (!empty($conf->fournisseur->enabled))
{
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);
}
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1);
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);
}
} else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
}
@ -406,10 +406,10 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("WarehouseAllowNegativeTransfer").'</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_ALLOW_NEGATIVE_TRANSFER');
print ajax_constantonoff('STOCK_ALLOW_NEGATIVE_TRANSFER');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_ALLOW_NEGATIVE_TRANSFER", $arrval, $conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER);
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_ALLOW_NEGATIVE_TRANSFER", $arrval, $conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER);
}
print "</td>\n";
print "</tr>\n";
@ -419,28 +419,28 @@ if ($conf->invoice->enabled)
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_INVOICE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_INVOICE", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE);
}
print "</td>\n";
print "</tr>\n";
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_INVOICE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_INVOICE", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE);
}
print "</td>\n";
print "</tr>\n";
}
if ($conf->order->enabled)
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_ORDER');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_ORDER", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER);
}
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_ORDER');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_ORDER", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER);
}
print "</td>\n";
print "</tr>\n";
}
@ -449,13 +449,13 @@ if ($conf->expedition->enabled)
{
print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT);
}
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT);
}
print "</td>\n";
print "</tr>\n";
}
@ -471,26 +471,26 @@ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
|| !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)
|| !empty($conf->mrp->enabled))
{
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
$virtualdiffersfromphysical = 1; // According to increase/decrease stock options, virtual and physical stock may differs.
}
if ($virtualdiffersfromphysical)
{
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print "<td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help', $langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
print '<td class="right">'.$langs->trans("Status").'</td>'."\n";
print '<td class="right">'.$langs->trans("Status").'</td>'."\n";
print '</tr>'."\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK);
}
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK);
}
print "</td>\n";
print "</tr>\n";
print '</table>';
@ -725,10 +725,10 @@ print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans(
print '</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_SUPPORTS_SERVICES');
print ajax_constantonoff('STOCK_SUPPORTS_SERVICES');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_SUPPORTS_SERVICES", $arrval, $conf->global->STOCK_SUPPORTS_SERVICES);
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_SUPPORTS_SERVICES", $arrval, $conf->global->STOCK_SUPPORTS_SERVICES);
}
print "</td>\n";
print "</tr>\n";
@ -737,10 +737,10 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("AllowAddLimitStockByWarehouse").'</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE');
print ajax_constantonoff('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE", $arrval, $conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE);
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE", $arrval, $conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE);
}
print "</td>\n";
print "</tr>\n";
@ -749,10 +749,10 @@ print '<tr class="oddeven">';
print '<td>'.$langs->trans("AlwaysShowFullArbo").'</td>';
print '<td class="right">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_ALWAYS_SHOW_FULL_ARBO');
print ajax_constantonoff('STOCK_ALWAYS_SHOW_FULL_ARBO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_ALWAYS_SHOW_FULL_ARBO", $arrval, $conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO);
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_ALWAYS_SHOW_FULL_ARBO", $arrval, $conf->global->STOCK_ALWAYS_SHOW_FULL_ARBO);
}
print "</td>\n";
print "</tr>\n";

View File

@ -158,11 +158,12 @@ if ($action == 'setlevel')
}
}
/*
* View
*/
llxHeader();
llxHeader('', $langs->trans("SyslogSetup"));
$form = new Form($db);
@ -170,8 +171,6 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_valu
print load_fiche_titre($langs->trans("SyslogSetup"), $linkback, 'title_setup');
print '<br>';
$def = array();
$syslogfacility = $defaultsyslogfacility = dolibarr_get_const($db, "SYSLOG_FACILITY", 0);
$syslogfile = $defaultsyslogfile = dolibarr_get_const($db, "SYSLOG_FILE", 0);
@ -188,7 +187,7 @@ if ($conf->global->MAIN_MODULE_MULTICOMPANY && $user->entity)
//print "conf->global->MAIN_FEATURES_LEVEL = ".$conf->global->MAIN_FEATURES_LEVEL."<br><br>\n";
// Output mode
print load_fiche_titre($langs->trans("SyslogOutput"));
print load_fiche_titre($langs->trans("SyslogOutput"), '', '');
// Mode
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
@ -260,7 +259,7 @@ print "</form>\n";
print '<br>'."\n\n";
print load_fiche_titre($langs->trans("SyslogLevel"));
print load_fiche_titre($langs->trans("SyslogLevel"), '', '');
// Level
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';

View File

@ -114,16 +114,29 @@ if (!function_exists("session_id"))
}
print '</td></tr>';
print '<tr><td>UTF-8 support</td><td>';
if (!function_exists("utf8_encode"))
{
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportUTF8");
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "UTF8");
} else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportUTF8");
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "UTF8");
}
print '</td></tr>';
print '<tr><td>MBString support</td><td>';
if (!function_exists("mb_check_encoding"))
{
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "mbstring");
} else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "mbstring");
}
print '</td></tr>';
print '</table>';
print '<br>';

View File

@ -61,7 +61,7 @@ $search_all = GETPOST("search_all", 'alpha');
$search = array();
foreach ($object->fields as $key => $val)
{
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
}
if (empty($action) && empty($id) && empty($ref)) $action = 'view';
@ -92,18 +92,18 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
$error = 0;
$error = 0;
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/bom/bom_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
}
}
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/bom/bom_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
}
}
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, delete or clone
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
@ -149,39 +149,39 @@ if (empty($reshook))
}
if ($object->fk_product == $idprod) {
setEventMessages($langs->trans('TheProductXIsAlreadyTheProductToProduce'), null, 'errors');
$error++;
setEventMessages($langs->trans('TheProductXIsAlreadyTheProductToProduce'), null, 'errors');
$error++;
}
if (!$error)
{
$lastposition = 0;
$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
$bomline->qty = $qty;
$bomline->qty_frozen = (int) $qty_frozen;
$bomline->disable_stock_change = (int) $disable_stock_change;
$bomline->efficiency = $efficiency;
$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
$bomline->qty = $qty;
$bomline->qty_frozen = (int) $qty_frozen;
$bomline->disable_stock_change = (int) $disable_stock_change;
$bomline->efficiency = $efficiency;
// Rang to use
// Rang to use
$rangmax = $object->line_max(0);
$ranktouse = $rangmax + 1;
$bomline->position = ($ranktouse + 1);
$result = $bomline->create($user);
if ($result <= 0)
{
setEventMessages($bomline->error, $bomline->errors, 'errors');
$action = '';
} else {
unset($_POST['idprod']);
unset($_POST['qty']);
unset($_POST['qty_frozen']);
unset($_POST['disable_stock_change']);
}
$result = $bomline->create($user);
if ($result <= 0)
{
setEventMessages($bomline->error, $bomline->errors, 'errors');
$action = '';
} else {
unset($_POST['idprod']);
unset($_POST['qty']);
unset($_POST['qty_frozen']);
unset($_POST['disable_stock_change']);
}
}
}
@ -218,9 +218,9 @@ if (empty($reshook))
unset($_POST['idprod']);
unset($_POST['qty']);
unset($_POST['qty_frozen']);
unset($_POST['disable_stock_change']);
unset($_POST['disable_stock_change']);
$object->fetchLines();
$object->fetchLines();
}
}
}
@ -290,7 +290,7 @@ if (($id || $ref) && $action == 'edit')
print load_fiche_titre($langs->trans("BillOfMaterials"), '', 'cubes');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
@ -321,7 +321,7 @@ if (($id || $ref) && $action == 'edit')
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
{
$res = $object->fetch_optionals();
$res = $object->fetch_optionals();
$head = bomPrepareHead($object);
dol_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom');
@ -331,7 +331,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation to delete
if ($action == 'delete')
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBillOfMaterials'), $langs->trans('ConfirmDeleteBillOfMaterials'), 'confirm_delete', '', 0, 1);
}
// Confirmation to delete line
if ($action == 'deleteline')
@ -451,7 +451,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$text = $langs->trans('ConfirmSetToDraft', $object->ref);
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
}
// Call Hook formConfirm
@ -543,129 +543,129 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (!empty($object->table_element_line))
{
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '').'" method="POST">
print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#addline' : '').'" method="POST">
<input type="hidden" name="token" value="' . newToken().'">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="' . $object->id.'">
';
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
}
if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
}
print '<div class="div-table-responsive-no-min">';
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{
print '<table id="tablelines" class="noborder noshadow" width="100%">';
}
print '<div class="div-table-responsive-no-min">';
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{
print '<table id="tablelines" class="noborder noshadow" width="100%">';
}
if (!empty($object->lines))
{
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
}
if (!empty($object->lines))
{
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/bom/tpl');
}
// Form to add new line
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines')
{
if ($action != 'editline')
{
// Add products/services form
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
// Form to add new line
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines')
{
if ($action != 'editline')
{
// Add products/services form
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
}
}
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
}
}
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{
print '</table>';
}
print '</div>';
if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline'))
{
print '</table>';
}
print '</div>';
print "</form>\n";
print "</form>\n";
}
// Buttons for actions
if ($action != 'presend' && $action != 'editline') {
print '<div class="tabsAction">'."\n";
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print '<div class="tabsAction">'."\n";
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
// Send
//if (empty($user->socid)) {
// print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
//}
if (empty($reshook))
{
// Send
//if (empty($user->socid)) {
// print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
//}
// Back to draft
if ($object->status == $object::STATUS_VALIDATED)
{
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>';
}
}
// Back to draft
if ($object->status == $object::STATUS_VALIDATED)
{
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft">'.$langs->trans("SetToDraft").'</a>';
}
}
// Modify
if ($object->status == $object::STATUS_DRAFT)
{
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
}
}
// Modify
if ($object->status == $object::STATUS_DRAFT)
{
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
}
}
// Validate
if ($object->status == $object::STATUS_DRAFT)
{
if ($permissiontoadd)
{
if (is_array($object->lines) && count($object->lines) > 0)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a>';
} else {
$langs->load("errors");
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
}
}
}
// Validate
if ($object->status == $object::STATUS_DRAFT)
{
if ($permissiontoadd)
{
if (is_array($object->lines) && count($object->lines) > 0)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=validate">'.$langs->trans("Validate").'</a>';
} else {
$langs->load("errors");
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
}
}
}
// Close / Cancel
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close">'.$langs->trans("Disable").'</a>';
}
// Close / Cancel
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close">'.$langs->trans("Disable").'</a>';
}
// Re-open
if ($permissiontoadd && $object->status == $object::STATUS_CANCELED)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
}
// Re-open
if ($permissiontoadd && $object->status == $object::STATUS_CANCELED)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
}
// Create MO
if ($conf->mrp->enabled)
{
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopageforcancel='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>';
}
}
// Create MO
if ($conf->mrp->enabled)
{
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write))
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopageforcancel='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>';
}
}
// Clone
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&object=bom">'.$langs->trans("ToClone").'</a>';
}
// Clone
if ($permissiontoadd)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&object=bom">'.$langs->trans("ToClone").'</a>';
}
/*
/*
if ($user->rights->bom->write)
{
if ($object->status == 1)
@ -679,14 +679,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
*/
if ($permissiontodelete)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
}
}
print '</div>'."\n";
if ($permissiontodelete)
{
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
}
}
print '</div>'."\n";
}
@ -697,41 +697,41 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action != 'presend')
{
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
// Documents
$objref = dol_sanitizeFileName($object->ref);
$relativepath = $objref.'/'.$objref.'.pdf';
$filedir = $conf->bom->dir_output.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
// Documents
$objref = dol_sanitizeFileName($object->ref);
$relativepath = $objref.'/'.$objref.'.pdf';
$filedir = $conf->bom->dir_output.'/'.$objref;
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->bom->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->bom->write; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('bom'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
$MAXEVENT = 10;
$MAXEVENT = 10;
$morehtmlright = '<a href="'.dol_buildpath('/bom/bom_agenda.php', 1).'?id='.$object->id.'">';
$morehtmlright .= $langs->trans("SeeAll");
$morehtmlright .= '</a>';
$morehtmlright = '<a href="'.dol_buildpath('/bom/bom_agenda.php', 1).'?id='.$object->id.'">';
$morehtmlright .= $langs->trans("SeeAll");
$morehtmlright .= '</a>';
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'bom', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$somethingshown = $formactions->showactions($object, 'bom', $socid, 1, '', $MAXEVENT, '', $morehtmlright);
print '</div></div></div>';
print '</div></div></div>';
}
//Select mail models is same action as presend
if (GETPOST('modelselected')) $action = 'presend';
if (GETPOST('modelselected')) $action = 'presend';
// Presend form
$modelmail = 'bom';

View File

@ -31,8 +31,8 @@
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error: this template page cannot be called directly as an URL";
exit;
print "Error: this template page cannot be called directly as an URL";
exit;
}
@ -52,34 +52,34 @@ print "<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->\n";
$nolinesbefore = (count($this->lines) == 0 || $forcetoshowtitlelines);
if ($nolinesbefore) {
print '<tr class="liste_titre nodrag nodrop">';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td class="linecolnum center"></td>';
}
print '<td class="linecoldescription minwidth500imp">';
print '<tr class="liste_titre nodrag nodrop">';
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td class="linecolnum center"></td>';
}
print '<td class="linecoldescription minwidth500imp">';
print '<div id="add"></div><span class="hideonsmartphone">'.$langs->trans('AddNewLine').'</span>';
print '</td>';
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
if ($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="linecoluseunit left">';
print '<span id="title_units">';
print $langs->trans('Unit');
print '</span></td>';
print '<td class="linecoluseunit left">';
print '<span id="title_units">';
print $langs->trans('Unit');
print '</span></td>';
}
print '<td class="linecolqtyfrozen right">'.$form->textwithpicto($langs->trans('QtyFrozen'), $langs->trans("QuantityConsumedInvariable")).'</td>';
print '<td class="linecoldisablestockchange right">'.$form->textwithpicto($langs->trans('DisableStockChange'), $langs->trans('DisableStockChangeHelp')).'</td>';
print '<td class="linecollost right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';
print '<td class="linecoledit" colspan="'.$colspan.'">&nbsp;</td>';
print '</tr>';
print '</tr>';
}
print '<tr class="pair nodrag nodrop nohoverpair'.(($nolinesbefore || $object->element == 'contrat') ? '' : ' liste_titre_create').'">';
$coldisplay = 0;
// Adds a line numbering column
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay++;
echo '<td class="bordertop nobottom linecolnum center"></td>';
$coldisplay++;
echo '<td class="bordertop nobottom linecolnum center"></td>';
}
$coldisplay++;
@ -111,7 +111,7 @@ print '</td>';
if ($conf->global->PRODUCT_USE_UNITS)
{
$coldisplay++;
$coldisplay++;
print '<td class="nobottom linecoluseunit left">';
print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, "units");
print '</td>';

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -58,23 +58,23 @@ $origin = GETPOST('origin', 'alpha');
$originid = GETPOST('originid', 'int');
$confirm = GETPOST('confirm', 'alpha');
$fulldayevent = GETPOST('fullday');
$fulldayevent = GETPOST('fullday', 'alpha');
$aphour = GETPOST('aphour');
$apmin = GETPOST('apmin');
$p2hour = GETPOST('p2hour');
$p2min = GETPOST('p2min');
$aphour = GETPOST('aphour', 'int');
$apmin = GETPOST('apmin', 'int');
$p2hour = GETPOST('p2hour', 'int');
$p2min = GETPOST('p2min', 'int');
$addreminder = GETPOST('addreminder');
$offsetvalue = GETPOST('offsetvalue');
$offsetunit = GETPOST('offsetunittype_duration');
$remindertype = GETPOST('selectremindertype');
$modelmail = GETPOST('actioncommsendmodel_mail');
$addreminder = GETPOST('addreminder', 'alpha');
$offsetvalue = GETPOST('offsetvalue', 'int');
$offsetunit = GETPOST('offsetunittype_duration', 'aZ09');
$remindertype = GETPOST('selectremindertype', 'aZ09');
$modelmail = GETPOST('actioncommsendmodel_mail', 'int');
//var_dump($_POST); exit;
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month"), GETPOST("p2day"), GETPOST("p2year"));
$datep = dol_mktime($fulldayevent ? '00' : $aphour, $fulldayevent ? '00' : $apmin, 0, GETPOST("apmonth", 'int'), GETPOST("apday", 'int'), GETPOST("apyear", 'int'));
$datef = dol_mktime($fulldayevent ? '23' : $p2hour, $fulldayevent ? '59' : $p2min, $fulldayevent ? '59' : '0', GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'));
// Security check
$socid = GETPOST('socid', 'int');
@ -391,19 +391,7 @@ if (empty($reshook) && $action == 'add')
if ($addreminder == 'on'){
$actionCommReminder = new ActionCommReminder($db);
if ($offsetunit == 'minute'){
$dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'i');
} elseif ($offsetunit == 'hour'){
$dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'h');
} elseif ($offsetunit == 'day') {
$dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'd');
} elseif ($offsetunit == 'week') {
$dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'w');
} elseif ($offsetunit == 'month') {
$dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'm');
} elseif ($offsetunit == 'year') {
$dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'y');
}
$dateremind = dol_time_plus_duree($datep, -$offsetvalue, 'i');
$actionCommReminder->dateremind = $dateremind;
$actionCommReminder->typeremind = $remindertype;
@ -418,15 +406,20 @@ if (empty($reshook) && $action == 'add')
if ($res <= 0){
// If error
$db->rollback();
$error++;
$langs->load("errors");
$error = $langs->trans('ErrorReminderActionCommCreation');
setEventMessages($error, null, 'errors');
$error = $langs->trans('ErrorReminderActionCommCreation').' '.$actionCommReminder->error;
setEventMessages($error, $actionCommReminder->errors, 'errors');
$action = 'create'; $donotclearsession = 1;
}
}
$db->commit();
if ($error) {
$db->rollback();
} else {
$db->commit();
}
if (!empty($backtopage))
{
dol_syslog("Back to ".$backtopage.($moreparam ? (preg_match('/\?/', $backtopage) ? '&'.$moreparam : '?'.$moreparam) : ''));
@ -929,9 +922,9 @@ if ($action == 'create')
print ' <span class="hideonsmartphone">&nbsp; &nbsp; - &nbsp; &nbsp;</span> ';
//print ' - ';
if (GETPOST("afaire") == 1) {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend');
} else {
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 2, 0, 'fulldayend');
print $form->selectDate($datef, 'p2', 1, 1, 1, "action", 1, 0, 0, 'fulldayend');
}
print '</td></tr>';
@ -1208,7 +1201,7 @@ if ($action == 'create')
//Time Type
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("TimeType").'</td><td colspan="3">';
print $form->selectTypeDuration('offsetunit');
print $form->selectTypeDuration('offsetunit', 'i');
print '</td></tr>';
//Reminder Type

File diff suppressed because it is too large Load Diff

View File

@ -50,6 +50,9 @@ class ActionCommReminder extends CommonObject
*/
public $picto = 'generic';
const STATUS_TODO = 0;
const STATUS_DONE = 1;
/**
* 'type' if the field format.
@ -79,7 +82,7 @@ class ActionCommReminder extends CommonObject
'typeremind' => array('type'=>'varchar(32)', 'label'=>'TypeRemind', 'visible'=>-1, 'enabled'=>1, 'position'=>55, 'notnull'=>1, 'comment'=>"email, browser, sms",),
'fk_user' => array('type'=>'integer', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>65, 'notnull'=>1, 'index'=>1,),
'offsetvalue' => array('type'=>'integer', 'label'=>'OffsetValue', 'visible'=>1, 'enabled'=>1, 'position'=>56, 'notnull'=>1,),
'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"m, h, d, w",),
'offsetunit' => array('type'=>'varchar(1)', 'label'=>'OffsetUnit', 'visible'=>1, 'enabled'=>1, 'position'=>57, 'notnull'=>1, 'comment'=>"y, m, d, w, h, i",),
'status' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>58, 'notnull'=>1, 'default'=>0, 'index'=>0, 'arrayofkeyval'=>array('0'=>'ToDo', '1'=>'Done')),
'fk_actioncomm' => array('type'=>'integer', 'label'=>'Project', 'visible'=>1, 'enabled'=>1, 'position'=>59, 'notnull'=>1, 'index'=>1,),
'fk_email_template' => array('type'=>'integer', 'label'=>'EmailTemplate', 'visible'=>1, 'enabled'=>1, 'position'=>60, 'notnull'=>0),
@ -121,9 +124,6 @@ class ActionCommReminder extends CommonObject
*/
public $fk_email_template;
const STATUS_TODO = 0;
const STATUS_DONE = 1;
// END MODULEBUILDER PROPERTIES

View File

@ -76,7 +76,7 @@ if (!$user->rights->agenda->myactions->read) accessforbidden();
if (!$user->rights->agenda->allactions->read) $canedit = 0;
if (!$user->rights->agenda->allactions->read || $filter == 'mine') // If no permission to see all, we show only affected to me
{
$filtert = $user->id;
$filtert = $user->id;
}
$action = GETPOST('action', 'alpha');
@ -91,19 +91,19 @@ $type = GETPOST("search_type", 'aZ09') ?GETPOST("search_type", 'aZ09') : GETPOST
$maxprint = (isset($_GET["maxprint"]) ?GETPOST("maxprint") : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
$dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int'));
if ($dateselect > 0)
{
$day=GETPOST('dateselectday', 'int');
$month=GETPOST('dateselectmonth', 'int');
$year=GETPOST('dateselectyear', 'int');
$day = GETPOST('dateselectday', 'int');
$month = GETPOST('dateselectmonth', 'int');
$year = GETPOST('dateselectyear', 'int');
}
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('search_actioncode', 'array'))
{
$actioncode = GETPOST('search_actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0';
$actioncode = GETPOST('search_actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0';
} else {
$actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE));
}
@ -119,13 +119,13 @@ if ($action == 'default') // When action is default, we want a calendar view and
$action = (($defaultview != 'show_list') ? $defaultview : 'show_month');
}
if (GETPOST('viewcal', 'none') && GETPOST('action', 'alpha') != 'show_day' && GETPOST('action', 'alpha') != 'show_week') {
$action = 'show_month'; $day = '';
$action = 'show_month'; $day = '';
} // View by month
if (GETPOST('viewweek', 'none') || GETPOST('action', 'alpha') == 'show_week') {
$action = 'show_week'; $week = ($week ? $week : date("W")); $day = ($day ? $day : date("d"));
$action = 'show_week'; $week = ($week ? $week : date("W")); $day = ($day ? $day : date("d"));
} // View by week
if (GETPOST('viewday', 'none') || GETPOST('action', 'alpha') == 'show_day') {
$action = 'show_day'; $day = ($day ? $day : date("d"));
$action = 'show_day'; $day = ($day ? $day : date("d"));
} // View by day
// Load translation files required by the page
@ -141,46 +141,46 @@ $hookmanager->initHooks(array('agenda'));
if (GETPOST("viewlist", 'alpha') || $action == 'show_list')
{
$param = '';
if (is_array($_POST))
{
foreach ($_POST as $key => $val)
{
if ($key == 'token') continue;
$param .= '&'.$key.'='.urlencode($val);
}
}
if (! preg_match('/action=/', $param)) $param .= ($param ? '&' : '').'action=show_list';
//print $param;
header("Location: ".DOL_URL_ROOT.'/comm/action/list.php?'.$param);
exit;
$param = '';
if (is_array($_POST))
{
foreach ($_POST as $key => $val)
{
if ($key == 'token') continue;
$param .= '&'.$key.'='.urlencode($val);
}
}
if (! preg_match('/action=/', $param)) $param .= ($param ? '&' : '').'action=show_list';
//print $param;
header("Location: ".DOL_URL_ROOT.'/comm/action/list.php?'.$param);
exit;
}
if (GETPOST("viewperuser", 'alpha') || $action == 'show_peruser')
{
$param = '';
if (is_array($_POST))
{
foreach ($_POST as $key => $val)
{
if ($key == 'token') continue;
$param .= '&'.$key.'='.urlencode($val);
}
}
//print $param;
header("Location: ".DOL_URL_ROOT.'/comm/action/peruser.php?'.$param);
exit;
$param = '';
if (is_array($_POST))
{
foreach ($_POST as $key => $val)
{
if ($key == 'token') continue;
$param .= '&'.$key.'='.urlencode($val);
}
}
//print $param;
header("Location: ".DOL_URL_ROOT.'/comm/action/peruser.php?'.$param);
exit;
}
if ($action == 'delete_action')
{
$event = new ActionComm($db);
$event->fetch($actionid);
$event->fetch_optionals();
$event->fetch_userassigned();
$event->oldcopy = clone $event;
$event = new ActionComm($db);
$event->fetch($actionid);
$event->fetch_optionals();
$event->fetch_userassigned();
$event->oldcopy = clone $event;
$result = $event->delete();
$result = $event->delete();
}
@ -226,21 +226,21 @@ $listofextcals = array();
// Define list of external calendars (global admin setup)
if (empty($conf->global->AGENDA_DISABLE_EXT))
{
$i = 0;
while ($i < $MAXAGENDA)
{
$i++;
$source = 'AGENDA_EXT_SRC'.$i;
$name = 'AGENDA_EXT_NAME'.$i;
$offsettz = 'AGENDA_EXT_OFFSETTZ'.$i;
$color = 'AGENDA_EXT_COLOR'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE'.$i;
if (!empty($conf->global->$source) && !empty($conf->global->$name))
{
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
$listofextcals[] = array('src'=>$conf->global->$source, 'name'=>$conf->global->$name, 'offsettz'=>$conf->global->$offsettz, 'color'=>$conf->global->$color, 'buggedfile'=>(isset($conf->global->buggedfile) ? $conf->global->buggedfile : 0));
}
}
$i = 0;
while ($i < $MAXAGENDA)
{
$i++;
$source = 'AGENDA_EXT_SRC'.$i;
$name = 'AGENDA_EXT_NAME'.$i;
$offsettz = 'AGENDA_EXT_OFFSETTZ'.$i;
$color = 'AGENDA_EXT_COLOR'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE'.$i;
if (!empty($conf->global->$source) && !empty($conf->global->$name))
{
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
$listofextcals[] = array('src'=>$conf->global->$source, 'name'=>$conf->global->$name, 'offsettz'=>$conf->global->$offsettz, 'color'=>$conf->global->$color, 'buggedfile'=>(isset($conf->global->buggedfile) ? $conf->global->buggedfile : 0));
}
}
}
// Define list of external calendars (user setup)
if (empty($user->conf->AGENDA_DISABLE_EXT))
@ -251,7 +251,7 @@ if (empty($user->conf->AGENDA_DISABLE_EXT))
$i++;
$source = 'AGENDA_EXT_SRC_'.$user->id.'_'.$i;
$name = 'AGENDA_EXT_NAME_'.$user->id.'_'.$i;
$offsettz = 'AGENDA_EXT_OFFSETTZ_'.$user->id.'_'.$i;
$offsettz = 'AGENDA_EXT_OFFSETTZ_'.$user->id.'_'.$i;
$color = 'AGENDA_EXT_COLOR_'.$user->id.'_'.$i;
$enabled = 'AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
$buggedfile = 'AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
@ -265,65 +265,65 @@ if (empty($user->conf->AGENDA_DISABLE_EXT))
if (empty($action) || $action == 'show_month')
{
$prev = dol_get_prev_month($month, $year);
$prev_year = $prev['year'];
$prev_month = $prev['month'];
$next = dol_get_next_month($month, $year);
$next_year = $next['year'];
$next_month = $next['month'];
$prev = dol_get_prev_month($month, $year);
$prev_year = $prev['year'];
$prev_month = $prev['month'];
$next = dol_get_next_month($month, $year);
$next_year = $next['year'];
$next_month = $next['month'];
$max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year)); // Nb of days in previous month
$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); // Nb of days in next month
// tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday)
$tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, true)) + 2; // date('w') is 0 fo sunday
$tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1);
if ($tmpday >= 1) $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week.
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year);
$next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7;
if ($next_day < 6) $next_day += 7;
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year);
$max_day_in_prev_month = date("t", dol_mktime(0, 0, 0, $prev_month, 1, $prev_year)); // Nb of days in previous month
$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year)); // Nb of days in next month
// tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday)
$tmpday = -date("w", dol_mktime(12, 0, 0, $month, 1, $year, true)) + 2; // date('w') is 0 fo sunday
$tmpday += ((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1) - 1);
if ($tmpday >= 1) $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week.
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $max_day_in_prev_month + $tmpday, $prev_year);
$next_day = 7 - ($max_day_in_month + 1 - $tmpday) % 7;
if ($next_day < 6) $next_day += 7;
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year);
}
if ($action == 'show_week')
{
$prev = dol_get_first_day_week($day, $month, $year);
$prev_year = $prev['prev_year'];
$prev_month = $prev['prev_month'];
$prev_day = $prev['prev_day'];
$first_day = $prev['first_day'];
$first_month = $prev['first_month'];
$first_year = $prev['first_year'];
$prev = dol_get_first_day_week($day, $month, $year);
$prev_year = $prev['prev_year'];
$prev_month = $prev['prev_month'];
$prev_day = $prev['prev_day'];
$first_day = $prev['first_day'];
$first_month = $prev['first_month'];
$first_year = $prev['first_year'];
$week = $prev['week'];
$week = $prev['week'];
$day = (int) $day;
$next = dol_get_next_week($first_day, $week, $first_month, $first_year);
$next_year = $next['year'];
$next_month = $next['month'];
$next_day = $next['day'];
$day = (int) $day;
$next = dol_get_next_week($first_day, $week, $first_month, $first_year);
$next_year = $next['year'];
$next_month = $next['month'];
$next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year);
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year);
$lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd');
$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year));
$max_day_in_month = date("t", dol_mktime(0, 0, 0, $month, 1, $year));
$tmpday = $first_day;
$tmpday = $first_day;
}
if ($action == 'show_day')
{
$prev = dol_get_prev_day($day, $month, $year);
$prev_year = $prev['year'];
$prev_month = $prev['month'];
$prev_day = $prev['day'];
$next = dol_get_next_day($day, $month, $year);
$next_year = $next['year'];
$next_month = $next['month'];
$next_day = $next['day'];
$prev = dol_get_prev_day($day, $month, $year);
$prev_year = $prev['year'];
$prev_month = $prev['month'];
$prev_day = $prev['day'];
$next = dol_get_next_day($day, $month, $year);
$next_year = $next['year'];
$next_month = $next['month'];
$next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year);
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year);
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $prev_month, $prev_day, $prev_year);
$lastdaytoshow = dol_mktime(0, 0, 0, $next_month, $next_day, $next_year);
}
//print 'xx'.$prev_year.'-'.$prev_month.'-'.$prev_day;
//print 'xx'.$next_year.'-'.$next_month.'-'.$next_day;
@ -356,30 +356,30 @@ $param .= "&maxprint=".urlencode($maxprint);
// Show navigation bar
if (empty($action) || $action == 'show_month')
{
$nav = "<a href=\"?year=".$prev_year."&amp;month=".$prev_month.$param."\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y");
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?year=".$next_year."&amp;month=".$next_month.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
$nav .= " &nbsp; <a href=\"?year=".$nowyear."&amp;month=".$nowmonth.$param."\">".$langs->trans("Today")."</a> ";
$picto = 'calendar';
$nav = "<a href=\"?year=".$prev_year."&amp;month=".$prev_month.$param."\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, 1, $year), "%b %Y");
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?year=".$next_year."&amp;month=".$next_month.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
$nav .= " &nbsp; <a href=\"?year=".$nowyear."&amp;month=".$nowmonth.$param."\">".$langs->trans("Today")."</a> ";
$picto = 'calendar';
}
if ($action == 'show_week')
{
$nav = "<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\" title=\"".dol_escape_htmltag($langs->trans("Previous"))."\"></i></a> &nbsp;\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
$nav .= " &nbsp; <a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
$picto = 'calendarweek';
$nav = "<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\" title=\"".dol_escape_htmltag($langs->trans("Previous"))."\"></i></a> &nbsp;\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_month, $first_day, $first_year), "%Y").", ".$langs->trans("Week")." ".$week;
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
$nav .= " &nbsp; <a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
$picto = 'calendarweek';
}
if ($action == 'show_day')
{
$nav = "<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "daytextshort");
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
$nav .= " &nbsp; <a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
$picto = 'calendarday';
$nav = "<a href=\"?year=".$prev_year."&amp;month=".$prev_month."&amp;day=".$prev_day.$param."\"><i class=\"fa fa-chevron-left\"></i></a> &nbsp;\n";
$nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "daytextshort");
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\"></i></a>\n";
$nav .= " &nbsp; <a href=\"?year=".$nowyear."&amp;month=".$nowmonth."&amp;day=".$nowday.$param."\">".$langs->trans("Today")."</a> ";
$picto = 'calendarday';
}
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);
@ -471,21 +471,21 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
$s .= 'jQuery(".family_birthday").toggle();'."\n";
if ($action == "show_week" || $action == "show_month" || empty($action))
{
// Code to enable drag and drop
// Code to enable drag and drop
$s .= 'jQuery( "div.sortable" ).sortable({connectWith: ".sortable", placeholder: "ui-state-highlight", items: "div.movable", receive: function( event, ui ) {'."\n";
// Code to submit form
// Code to submit form
$s .= 'console.log("submit form to record new event");'."\n";
//$s.='console.log(event.target);';
//$s.='console.log(event.target);';
$s .= 'var newval = jQuery(event.target).closest("div.dayevent").attr("id");'."\n";
$s .= 'console.log("found parent div.dayevent with id = "+newval);'."\n";
$s .= 'var frm=jQuery("#searchFormList");'."\n";
$s .= 'var newurl = ui.item.find("a.cal_event").attr("href");'."\n";
$s .= 'console.log(newurl);'."\n";
$s .= 'frm.attr("action", newurl).children("#newdate").val(newval);frm.submit();}'."\n";
$s .= '});'."\n";
}
$s .= '});'."\n";
$s .= '</script>'."\n";
$s .= '});'."\n";
}
$s .= '});'."\n";
$s .= '</script>'."\n";
// Local calendar
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' &nbsp; </div>';
@ -513,26 +513,26 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on
$s .= '<div class="nowrap inline-block"><input type="checkbox" id="check_birthday" name="check_birthday" class="check_birthday"> <span class="check_birthday_text">'.$langs->trans("AgendaShowBirthdayEvents").'</span> &nbsp; </div>';
// Calendars from hooks
$parameters = array(); $object = null;
$parameters = array(); $object = null;
$reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action);
if (empty($reshook))
{
$s .= $hookmanager->resPrint;
} elseif ($reshook > 1)
if (empty($reshook))
{
$s = $hookmanager->resPrint;
}
$s .= $hookmanager->resPrint;
} elseif ($reshook > 1)
{
$s = $hookmanager->resPrint;
}
} else // If javascript off
{
$newparam = $param; // newparam is for birthday links
$newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday='.(empty($showbirthday) ? 1 : 0), $newparam);
if (!preg_match('/showbirthday=/i', $newparam)) $newparam .= '&showbirthday=1';
$link = '<a href="'.dol_escape_htmltag($_SERVER['PHP_SELF']);
$link .= '?'.dol_escape_htmltag($newparam);
$link .= '">';
if (empty($showbirthday)) $link .= $langs->trans("AgendaShowBirthdayEvents");
else $link .= $langs->trans("AgendaHideBirthdayEvents");
$link .= '</a>';
$newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday='.(empty($showbirthday) ? 1 : 0), $newparam);
if (!preg_match('/showbirthday=/i', $newparam)) $newparam .= '&showbirthday=1';
$link = '<a href="'.dol_escape_htmltag($_SERVER['PHP_SELF']);
$link .= '?'.dol_escape_htmltag($newparam);
$link .= '">';
if (empty($showbirthday)) $link .= $langs->trans("AgendaShowBirthdayEvents");
else $link .= $langs->trans("AgendaHideBirthdayEvents");
$link .= '</a>';
}
// Load events from database into $eventarray
@ -561,26 +561,26 @@ $sql .= ' AND a.entity IN ('.getEntity('agenda').')';
// Condition on actioncode
if (!empty($actioncode))
{
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
if ($actioncode == 'AC_NON_AUTO') $sql .= " AND ca.type != 'systemauto'";
elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND ca.type = 'systemauto'";
else {
if ($actioncode == 'AC_OTH') $sql .= " AND ca.type != 'systemauto'";
if ($actioncode == 'AC_OTH_AUTO') $sql .= " AND ca.type = 'systemauto'";
}
} else {
if ($actioncode == 'AC_NON_AUTO') $sql .= " AND ca.type != 'systemauto'";
elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND ca.type = 'systemauto'";
else {
if (is_array($actioncode))
{
$sql .= " AND ca.code IN ('".implode("','", $actioncode)."')";
} else {
$sql .= " AND ca.code IN ('".implode("','", explode(',', $actioncode))."')";
}
}
}
if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
if ($actioncode == 'AC_NON_AUTO') $sql .= " AND ca.type != 'systemauto'";
elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND ca.type = 'systemauto'";
else {
if ($actioncode == 'AC_OTH') $sql .= " AND ca.type != 'systemauto'";
if ($actioncode == 'AC_OTH_AUTO') $sql .= " AND ca.type = 'systemauto'";
}
} else {
if ($actioncode == 'AC_NON_AUTO') $sql .= " AND ca.type != 'systemauto'";
elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND ca.type = 'systemauto'";
else {
if (is_array($actioncode))
{
$sql .= " AND ca.code IN ('".implode("','", $actioncode)."')";
} else {
$sql .= " AND ca.code IN ('".implode("','", explode(',', $actioncode))."')";
}
}
}
}
if ($resourceid > 0) $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid);
if ($pid) $sql .= " AND a.fk_project=".$db->escape($pid);
@ -590,28 +590,28 @@ if ($socid > 0) $sql .= ' AND a.fk_soc = '.$socid;
if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
if ($action == 'show_day')
{
$sql .= " AND (";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " OR ";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " OR ";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= ')';
$sql .= " AND (";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " OR ";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= " OR ";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')";
$sql .= ')';
} else {
// To limit array
$sql .= " AND (";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'"; // Start 7 days before
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')"; // End 7 days after + 3 to go from 28 to 31
$sql .= " OR ";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')";
$sql .= " OR ";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')";
$sql .= ')';
// To limit array
$sql .= " AND (";
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'"; // Start 7 days before
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')"; // End 7 days after + 3 to go from 28 to 31
$sql .= " OR ";
$sql .= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'";
$sql .= " AND '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')";
$sql .= " OR ";
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'";
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, 28, $year) + (60 * 60 * 24 * 10))."')";
$sql .= ')';
}
if ($type) $sql .= " AND ca.id = ".$type;
if ($status == '0') { $sql .= " AND a.percent = 0"; }
@ -622,10 +622,10 @@ if ($status == 'todo') { $sql .= " AND (a.percent >= 0 AND a.percent < 100)"; }
// We must filter on assignement table
if ($filtert > 0 || $usergroup > 0)
{
$sql .= " AND (";
if ($filtert > 0) $sql .= "ar.fk_element = ".$filtert;
if ($usergroup > 0) $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup;
$sql .= ")";
$sql .= " AND (";
if ($filtert > 0) $sql .= "ar.fk_element = ".$filtert;
if ($usergroup > 0) $sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".$usergroup;
$sql .= ")";
}
// Sort on date
$sql .= ' ORDER BY datep';
@ -1090,8 +1090,8 @@ if (count($listofextcals))
// Transparency (see https://www.kanzaki.com/docs/ical/transp.html)
if ($icalevent['TRANSP'])
{
if ($icalevent['TRANSP'] == "TRANSPARENT") $event->transparency = 0; // 0 = available / free
if ($icalevent['TRANSP'] == "OPAQUE") $event->transparency = 1; // 1 = busy
if ($icalevent['TRANSP'] == "TRANSPARENT") $event->transparency = 0; // 0 = available / free
if ($icalevent['TRANSP'] == "OPAQUE") $event->transparency = 1; // 1 = busy
// TODO: MS outlook states
// X-MICROSOFT-CDO-BUSYSTATUS:FREE + TRANSP:TRANSPARENT => Available / Free
@ -1156,12 +1156,12 @@ if (count($listofextcals))
$parameters = array(); $object = null;
$reshook = $hookmanager->executeHooks('getCalendarEvents', $parameters, $object, $action);
if (!empty($hookmanager->resArray['eventarray'])) {
foreach ($hookmanager->resArray['eventarray'] as $keyDate => $events) {
if (!isset($eventarray[$keyDate])) {
$eventarray[$keyDate] = array();
}
$eventarray[$keyDate] = array_merge($eventarray[$keyDate], $events);
}
foreach ($hookmanager->resArray['eventarray'] as $keyDate => $events) {
if (!isset($eventarray[$keyDate])) {
$eventarray[$keyDate] = array();
}
$eventarray[$keyDate] = array_merge($eventarray[$keyDate], $events);
}
}
// Sort events
@ -1180,7 +1180,7 @@ $cacheusers = array();
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/theme_vars.inc.php";
if (is_readable($color_file))
{
include_once $color_file;
include_once $color_file;
}
if (!is_array($theme_datacolor)) $theme_datacolor = array(array(120, 130, 150), array(200, 160, 180), array(190, 190, 220));
@ -1207,7 +1207,7 @@ if (empty($action) || $action == 'show_month') // View by month
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
print '</div>';
print '<div class="div-table-responsive-no-min">';
print '<div class="div-table-responsive-no-min sectioncalendarbymonth maxscreenheightless300">';
print '<table width="100%" class="noborder nocellnopadd cal_pannel cal_month">';
print ' <tr class="liste_titre">';
// Column title of weeks numbers
@ -1215,7 +1215,7 @@ if (empty($action) || $action == 'show_month') // View by month
$i = 0;
while ($i < 7)
{
print ' <td class="center bold uppercase">';
print ' <td class="center bold uppercase tdfordaytitle">';
$numdayinweek = (($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7);
if (!empty($conf->dol_optimize_smallscreen))
{
@ -1308,12 +1308,12 @@ if (empty($action) || $action == 'show_month') // View by month
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
print '</div></div>';
print '<div class="div-table-responsive-no-min">';
print '<div class="div-table-responsive-no-min sectioncalendarbyweek maxscreenheightless300">';
print '<table width="100%" class="noborder nocellnopadd cal_pannel cal_month">';
print ' <tr class="liste_titre">';
$i = 0;
while ($i < 7) {
echo ' <td class="center bold uppercase">'.$langs->trans("Day".(($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7))."</td>\n";
echo ' <td class="center bold uppercase tdfordaytitle">'.$langs->trans("Day".(($i + (isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : 1)) % 7))."</td>\n";
$i++;
}
echo " </tr>\n";
@ -1368,11 +1368,10 @@ if (empty($action) || $action == 'show_month') // View by month
print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid);
print '</div></div>';
print '<div class="div-table-responsive-no-min">';
print '<div class="div-table-responsive-no-min sectioncalendarbyday maxscreenheightless300">';
echo '<table class="tagtable centpercent noborder nocellnopadd cal_pannel cal_month noborderbottom" style="margin-bottom: 5px !important;">';
echo ' <tr class="tagtr liste_titre">';
echo ' <td class="tagtd width100"></td>';
echo ' <td class="tagtd center bold uppercase">'.$langs->trans("Day".$arraytimestamp['wday'])."</td>\n";
echo " </td>\n";
@ -1385,39 +1384,39 @@ if (empty($action) || $action == 'show_month') // View by month
echo " </div>\n";
*/
echo '</table>';
echo '</table>';
print '</div>';
/* WIP View per hour */
$useviewhour = 0;
if ($useviewhour)
{
print '<div class="div-table-responsive-no-min borderbottom">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
/* WIP View per hour */
$useviewhour = 0;
if ($useviewhour)
{
print '<div class="div-table-responsive-no-min borderbottom">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
$maxheightwin = (isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 500) ? ($_SESSION["dol_screenheight"] - 200) : 660; // Also into index.php file
$maxheightwin = (isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 500) ? ($_SESSION["dol_screenheight"] - 200) : 660; // Also into index.php file
echo '<div style="max-height: '.$maxheightwin.'px;">';
echo '<div style="max-height: '.$maxheightwin.'px;">';
echo '<div class="tagtable centpercent calendarviewcontainer">';
$maxnbofchar = 80;
$maxnbofchar = 80;
$tmp = explode('-', $conf->global->MAIN_DEFAULT_WORKING_HOURS);
$minhour = round($tmp[0], 0);
$maxhour = round($tmp[1], 0);
if ($minhour > 23) $minhour = 23;
if ($maxhour < 1) $maxhour = 1;
if ($maxhour <= $minhour) { $maxhour = $minhour + 1; }
$tmp = explode('-', $conf->global->MAIN_DEFAULT_WORKING_HOURS);
$minhour = round($tmp[0], 0);
$maxhour = round($tmp[1], 0);
if ($minhour > 23) $minhour = 23;
if ($maxhour < 1) $maxhour = 1;
if ($maxhour <= $minhour) { $maxhour = $minhour + 1; }
$i = 0;
$j = 0;
$i = 0;
$j = 0;
while ($i < 24)
{
echo ' <div class="tagtr calendarviewcontainertr">'."\n";
echo ' <div class="tagtd width100 tdtop">'.dol_print_date($i * 3600, 'hour', 'gmt').'</div>';
echo ' <div class="tagtd '.$style.' tdtop"></div>'."\n";
echo ' </div>'."\n";
$i++;
$j++;
echo ' <div class="tagtr calendarviewcontainertr">'."\n";
echo ' <div class="tagtd width100 tdtop">'.dol_print_date($i * 3600, 'hour', 'gmt').'</div>';
echo ' <div class="tagtd '.$style.' tdtop"></div>'."\n";
echo ' </div>'."\n";
$i++;
$j++;
}
echo '</div></div>';
@ -1425,13 +1424,13 @@ if (empty($action) || $action == 'show_month') // View by month
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1);
print '</div>';
} else {
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
} else {
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0);
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0);
print '</div>';
}
print '</div>';
}
}
print "\n".'</form>';
@ -1872,11 +1871,11 @@ function dol_color_minus($color, $minus, $minusunit = 16)
$newcolor = $color;
if ($minusunit == 16)
{
$newcolor[0] = dechex(max(min(hexdec($newcolor[0]) - $minus, 15), 0));
$newcolor[2] = dechex(max(min(hexdec($newcolor[2]) - $minus, 15), 0));
$newcolor[4] = dechex(max(min(hexdec($newcolor[4]) - $minus, 15), 0));
$newcolor[0] = dechex(max(min(hexdec($newcolor[0]) - $minus, 15), 0));
$newcolor[2] = dechex(max(min(hexdec($newcolor[2]) - $minus, 15), 0));
$newcolor[4] = dechex(max(min(hexdec($newcolor[4]) - $minus, 15), 0));
} else {
// Not yet implemented
// Not yet implemented
}
return $newcolor;
}
@ -1891,39 +1890,39 @@ function dol_color_minus($color, $minus, $minusunit = 16)
function sort_events_by_date($a, $b)
{
// Sort holidays at first
if ($a->type_code === 'HOLIDAY')
{
return -1;
}
if ($a->type_code === 'HOLIDAY')
{
return -1;
}
if ($b->type_code === 'HOLIDAY')
{
return 1;
}
if ($b->type_code === 'HOLIDAY')
{
return 1;
}
// datep => Event start time
// datef => Event end time
// datep => Event start time
// datef => Event end time
// Events have different start time
if ($a->datep !== $b->datep)
{
return $a->datep - $b->datep;
}
// Events have different start time
if ($a->datep !== $b->datep)
{
return $a->datep - $b->datep;
}
// Events have same start time and no end time
if ((!is_numeric($b->datef)) || (!is_numeric($a->datef)))
{
return sort_events_by_percentage($a, $b);
}
// Events have same start time and no end time
if ((!is_numeric($b->datef)) || (!is_numeric($a->datef)))
{
return sort_events_by_percentage($a, $b);
}
// Events have the same start time and same end time
if ($b->datef === $a->datef)
{
return sort_events_by_percentage($a, $b);
}
// Events have the same start time and same end time
if ($b->datef === $a->datef)
{
return sort_events_by_percentage($a, $b);
}
// Events have the same start time, but have different end time -> longest event first
return $b->datef - $a->datef;
// Events have the same start time, but have different end time -> longest event first
return $b->datef - $a->datef;
}
/**
@ -1935,18 +1934,18 @@ function sort_events_by_date($a, $b)
*/
function sort_events_by_percentage($a, $b)
{
// Sort events with no percentage before each other
// (usefull to sort holidays, sick days or similar on the top)
// Sort events with no percentage before each other
// (usefull to sort holidays, sick days or similar on the top)
if ($a->percentage < 0)
{
return -1;
}
if ($a->percentage < 0)
{
return -1;
}
if ($b->percentage < 0)
{
return 1;
}
if ($b->percentage < 0)
{
return 1;
}
return $b->percentage - $a->percentage;
return $b->percentage - $a->percentage;
}

View File

@ -160,7 +160,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
if (GETPOST('cancel', 'alpha'))
{
$action='list'; $massaction='';
$action = 'list'; $massaction = '';
}
if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
@ -708,7 +708,7 @@ if ($resql)
$labeltype = $langs->trans("Message");
} else {
if (!empty($arraylist[$labeltype])) $labeltype = $arraylist[$labeltype];
if ($obj->type_code == 'AC_OTH_AUTO' && ($obj->type_code != $obj->code) && $labeltype && !empty($arraylist[$obj->code])) $labeltype .= ' - '.$arraylist[$obj->code]; // Use code in priority on type_code
if ($obj->type_code == 'AC_OTH_AUTO' && ($obj->type_code != $obj->code) && $labeltype && !empty($arraylist[$obj->code])) $labeltype .= ' - '.$arraylist[$obj->code]; // Use code in priority on type_code
}
print dol_trunc($labeltype, 28);
print '</td>';

View File

@ -211,7 +211,6 @@ if (empty($reshook))
$substitutionarray['__OTHER4__'] = $other4;
$substitutionarray['__OTHER5__'] = $other5;
$substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
$substitutionarray['__SIGNATURE__'] = $signature; // For backward compatibility
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$obj->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
$substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.$obj->tag.'&unsuscrib=1&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>';

View File

@ -472,6 +472,8 @@ if ($resql)
'generate_doc'=>$langs->trans("ReGeneratePDF"),
'builddoc'=>$langs->trans("PDFMerge"),
'presend'=>$langs->trans("SendByMail"),
'prevalidate'=>$langs->trans("Validate"),
'presign'=>$langs->trans("Sign"),
);
if ($user->rights->propal->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
if ($user->rights->propal->cloturer) $arrayofmassactions['closed'] = $langs->trans("Close");
@ -502,6 +504,16 @@ if ($resql)
$trackid = 'pro'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($massaction == 'prevalidate')
{
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1);
}
if ($massaction == 'presign')
{
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassSignature"), $langs->trans("ConfirmMassSignatureQuestion"), "sign", null, '', 0, 200, 500, 1);
}
if ($sall)
{
foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
@ -1270,10 +1282,72 @@ if ($resql)
$delallowed = $user->rights->propal->creer;
print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
if ($action == 'validate') {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 0) {
if ($tmpproposal->valid($user)){
setEventMessage($tmpproposal->ref . " " . $langs->trans('PassedInOpenStatus'), 'mesgs');
} else {
setEventMessage($langs->trans('CantBeValidated'), 'errors');
$error++;
}
} else {
setEventMessage($tmpproposal->ref . " " . $langs->trans('IsNotADraft'), 'errors');
$error++;
}
}
dol_print_error($db);
$error++;
}
if ($error){
$db->rollback();
} else {
$db->commit();
}
}
}
if ($action == "sign") {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked)) {
if ($tmpproposal->statut == 1) {
$tmpproposal->statut = 2;
if ($tmpproposal->update($user)) {
setEventMessage($tmpproposal->ref . " " . $langs->trans('Signed'), 'mesgs');
} else {
dol_print_error($db);
$error++;
}
} else {
setEventMessage($tmpproposal->ref . " " . $langs->trans('CantBeSign'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error){
$db->rollback();
} else {
$db->commit();
}
}
}
} else {
dol_print_error($db);
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();
// End of page
llxFooter();
$db->close();

View File

@ -348,7 +348,8 @@ class Orders extends DolibarrApi
$request_data->fk_unit,
$request_data->origin,
$request_data->origin_id,
$request_data->multicurrency_subprice
$request_data->multicurrency_subprice,
$request_data->ref_ext
);
if ($updateRes > 0) {
@ -406,7 +407,9 @@ class Orders extends DolibarrApi
$request_data->special_code,
$request_data->array_options,
$request_data->fk_unit,
$request_data->multicurrency_subprice
$request_data->multicurrency_subprice,
0,
$request_data->ref_ext
);
if ($updateRes > 0) {
@ -456,6 +459,40 @@ class Orders extends DolibarrApi
}
}
/**
* Get contacts of given order
*
* Return an array with contact informations
*
* @param int $id ID of order
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER)
*
* @url GET {id}/contacts
*
* @return array data without useless information
*
* @throws RestException
*/
public function getContacts($id, $type = '')
{
if (! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401);
}
$result = $this->commande->fetch($id);
if ( ! $result ) {
throw new RestException(404, 'Order not found');
}
if ( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$contacts = $this->commande->liste_contact(-1, 'external', 0, $type);
return $this->_cleanObjectDatas($contacts);
}
/**
* Add a contact type of given order
*
@ -487,15 +524,24 @@ class Orders extends DolibarrApi
$result = $this->commande->add_contact($contactid, $type, 'external');
if (!$result) {
if ($result < 0) {
throw new RestException(500, 'Error when added the contact');
}
return $this->commande;
if ($result == 0) {
throw new RestException(304, 'contact already added');
}
return array(
'success' => array(
'code' => 200,
'message' => 'Contact linked to the order'
)
);
}
/**
* Delete a contact type of given order
* Unlink a contact type of given order
*
* @param int $id Id of order to update
* @param int $rowid Row key of the contact in the array contact_ids.
@ -510,26 +556,31 @@ class Orders extends DolibarrApi
*/
public function deleteContact($id, $rowid)
{
if (!DolibarrApiAccess::$user->rights->commande->creer) {
if (! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401);
}
$result = $this->commande->fetch($id);
if (!$result) {
if (! $result) {
throw new RestException(404, 'Order not found');
}
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->commande->delete_contact($rowid);
$result = $this->commande->delete_linked_contact($rowid);
if (!$result) {
throw new RestException(500, 'Error when deleted the contact');
}
return $this->commande;
return array(
'success' => array(
'code' => 200,
'message' => 'Contact unlinked from order'
)
);
}
/**

View File

@ -1004,6 +1004,11 @@ class Commande extends CommonOrder
$origintype = $this->element;
}
// ref_ext
if (empty($line->ref_ext)) {
$line->ref_ext = '';
}
$result = $this->addline(
$line->desc,
$line->subprice,
@ -1029,7 +1034,9 @@ class Commande extends CommonOrder
$line->array_options,
$line->fk_unit,
$origintype,
$originid
$originid,
0,
$line->ref_ext
);
if ($result < 0)
{
@ -1215,6 +1222,13 @@ class Commande extends CommonOrder
$this->date_validation = '';
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $this->ref_client = '';
// Do not clone ref_ext
$num = count($this->lines);
for ($i = 0; $i < $num; $i++)
{
$this->lines[$i]->ref_ext = '';
}
// Create clone
$this->context['createfromclone'] = 'createfromclone';
$result = $this->create($user);
@ -1423,6 +1437,7 @@ class Commande extends CommonOrder
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
* @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id
* @param double $pu_ht_devise Unit price in currency
* @param string $ref_ext line external reference
* @return int >0 if OK, <0 if KO
*
* @see add_product()
@ -1432,13 +1447,13 @@ class Commande extends CommonOrder
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*/
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0)
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $ref_ext = '')
{
global $mysoc, $conf, $langs, $user;
$logtext = "::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent";
$logtext .= ", info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start";
$logtext .= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise";
$logtext .= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise, ref_ext=$ref_ext";
dol_syslog(get_class($this).$logtext, LOG_DEBUG);
if ($this->statut == self::STATUS_DRAFT)
@ -1446,6 +1461,7 @@ class Commande extends CommonOrder
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent = 0;
if (empty($qty)) $qty = 0;
if (empty($info_bits)) $info_bits = 0;
@ -1455,6 +1471,7 @@ class Commande extends CommonOrder
if (empty($txlocaltax2)) $txlocaltax2 = 0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line = 0;
if (empty($this->fk_multicurrency)) $this->fk_multicurrency = 0;
if (empty($ref_ext)) $ref_ext = '';
$remise_percent = price2num($remise_percent);
$qty = price2num($qty);
@ -1570,6 +1587,7 @@ class Commande extends CommonOrder
$this->line->label = $label;
$this->line->desc = $desc;
$this->line->qty = $qty;
$this->line->ref_ext = $ref_ext;
$this->line->vat_src_code = $vat_src_code;
$this->line->tva_tx = $txtva;
@ -1977,7 +1995,7 @@ class Commande extends CommonOrder
// phpcs:enable
$this->lines = array();
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx,';
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx, l.ref_ext,';
$sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.fk_remise_except, l.remise_percent, l.subprice, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.info_bits, l.special_code,';
$sql .= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,';
$sql .= ' l.fk_unit,';
@ -2012,6 +2030,7 @@ class Commande extends CommonOrder
$line->description = $objp->description; // Description line
$line->product_type = $objp->product_type;
$line->qty = $objp->qty;
$line->ref_ext = $objp->ref_ext;
$line->vat_src_code = $objp->vat_src_code;
$line->tva_tx = $objp->tva_tx;
@ -2981,13 +3000,14 @@ class Commande extends CommonOrder
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Amount in currency
* @param int $notrigger disable line update trigger
* @param string $ref_ext external reference
* @return int < 0 if KO, > 0 if OK
*/
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '')
{
global $conf, $mysoc, $langs, $user;
dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code");
dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code, ref_ext=$ref_ext");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
if ($this->statut == Commande::STATUS_DRAFT)
@ -3000,6 +3020,7 @@ class Commande extends CommonOrder
if (empty($txlocaltax2)) $txlocaltax2 = 0;
if (empty($remise_percent)) $remise_percent = 0;
if (empty($special_code) || $special_code == 3) $special_code = 0;
if (empty($ref_ext)) $ref_ext = '';
if ($date_start && $date_end && $date_start > $date_end) {
$langs->load("errors");
@ -3104,6 +3125,7 @@ class Commande extends CommonOrder
$this->line->label = $label;
$this->line->desc = $desc;
$this->line->qty = $qty;
$this->line->ref_ext = $ref_ext;
$this->line->vat_src_code = $vat_src_code;
$this->line->tva_tx = $txtva;
@ -3970,6 +3992,8 @@ class OrderLine extends CommonOrderLine
*/
public $label;
public $ref_ext;
public $fk_remise_except;
public $rang = 0;
public $fk_fournprice;
@ -4014,7 +4038,7 @@ class OrderLine extends CommonOrderLine
public function fetch($rowid)
{
$sql = 'SELECT cd.rowid, cd.fk_commande, cd.fk_parent_line, cd.fk_product, cd.product_type, cd.label as custom_label, cd.description, cd.price, cd.qty, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx,';
$sql .= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice,';
$sql .= ' cd.remise, cd.remise_percent, cd.fk_remise_except, cd.subprice, cd.ref_ext,';
$sql .= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht, cd.rang, cd.special_code,';
$sql .= ' cd.fk_unit,';
$sql .= ' cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,';
@ -4036,6 +4060,7 @@ class OrderLine extends CommonOrderLine
$this->qty = $objp->qty;
$this->price = $objp->price;
$this->subprice = $objp->subprice;
$this->ref_ext = $objp->ref_ext;
$this->vat_src_code = $objp->vat_src_code;
$this->tva_tx = $objp->tva_tx;
$this->localtax1_tx = $objp->localtax1_tx;
@ -4205,6 +4230,7 @@ class OrderLine extends CommonOrderLine
if (empty($this->special_code)) $this->special_code = 0;
if (empty($this->fk_parent_line)) $this->fk_parent_line = 0;
if (empty($this->pa_ht)) $this->pa_ht = 0;
if (empty($this->ref_ext)) $this->ref_ext = '';
// if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
@ -4224,7 +4250,7 @@ class OrderLine extends CommonOrderLine
// Insertion dans base de la ligne
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'commandedet';
$sql .= ' (fk_commande, fk_parent_line, label, description, qty, ';
$sql .= ' (fk_commande, fk_parent_line, label, description, qty, ref_ext,';
$sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql .= ' fk_product, product_type, remise_percent, subprice, price, remise, fk_remise_except,';
$sql .= ' special_code, rang, fk_product_fournisseur_price, buy_price_ht,';
@ -4237,6 +4263,7 @@ class OrderLine extends CommonOrderLine
$sql .= " ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null").",";
$sql .= " '".$this->db->escape($this->desc)."',";
$sql .= " '".price2num($this->qty)."',";
$sql .= " '".$this->db->escape($this->ref_ext)."',";
$sql .= " ".(empty($this->vat_src_code) ? "''" : "'".$this->db->escape($this->vat_src_code)."'").",";
$sql .= " '".price2num($this->tva_tx)."',";
$sql .= " '".price2num($this->localtax1_tx)."',";
@ -4347,6 +4374,7 @@ class OrderLine extends CommonOrderLine
if (empty($this->product_type)) $this->product_type = 0;
if (empty($this->fk_parent_line)) $this->fk_parent_line = 0;
if (empty($this->pa_ht)) $this->pa_ht = 0;
if (empty($this->ref_ext)) $this->ref_ext = '';
// if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
@ -4372,6 +4400,7 @@ class OrderLine extends CommonOrderLine
$sql .= " , localtax1_type='".$this->db->escape($this->localtax1_type)."'";
$sql .= " , localtax2_type='".$this->db->escape($this->localtax2_type)."'";
$sql .= " , qty=".price2num($this->qty);
$sql .= " , ref_ext='".$this->db->escape($this->ref_ext)."'";
$sql .= " , subprice=".price2num($this->subprice)."";
$sql .= " , remise_percent=".price2num($this->remise_percent)."";
$sql .= " , price=".price2num($this->price).""; // TODO A virer

View File

@ -818,6 +818,11 @@ class Facture extends CommonInvoice
$origintype = $this->element;
}
// init ref_ext
if (empty($line->ref_ext)) {
$line->ref_ext = '';
}
$result = $this->addline(
$line->desc,
$line->subprice,
@ -847,7 +852,8 @@ class Facture extends CommonInvoice
$line->situation_percent,
$line->fk_prev_id,
$line->fk_unit,
$line->pu_ht_devise
$line->pu_ht_devise,
$line->ref_ext
);
if ($result < 0)
{
@ -1073,6 +1079,7 @@ class Facture extends CommonInvoice
$facture->lines[$i]->total_localtax1 = -$facture->lines[$i]->total_localtax1;
$facture->lines[$i]->total_localtax2 = -$facture->lines[$i]->total_localtax2;
$facture->lines[$i]->total_ttc = -$facture->lines[$i]->total_ttc;
$facture->lines[$i]->ref_ext = '';
}
}
@ -1190,6 +1197,8 @@ class Facture extends CommonInvoice
$object->lines[$i]->date_end = $newLast;
}
}
$object->lines[$i]->ref_ext = ''; // Do not clone ref_ext
}
// Create clone
@ -1658,7 +1667,7 @@ class Facture extends CommonInvoice
$this->lines = array();
$sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,';
$sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise_percent, l.fk_remise_except, l.subprice, l.ref_ext,';
$sql .= ' l.situation_percent, l.fk_prev_id,';
$sql .= ' l.rang, l.special_code,';
$sql .= ' l.date_start as date_start, l.date_end as date_end,';
@ -1697,6 +1706,7 @@ class Facture extends CommonInvoice
$line->fk_product_type = $objp->fk_product_type; // Type of product
$line->qty = $objp->qty;
$line->subprice = $objp->subprice;
$line->ref_ext = $objp->ref_ext; // line external ref
$line->vat_src_code = $objp->vat_src_code;
$line->tva_tx = $objp->tva_tx;
@ -1819,6 +1829,7 @@ class Facture extends CommonInvoice
// Clean parameters
if (empty($this->type)) $this->type = self::TYPE_STANDARD;
if (isset($this->ref)) $this->ref = trim($this->ref);
if (isset($this->ref_ext)) $this->ref_ext = trim($this->ref_ext);
if (isset($this->ref_client)) $this->ref_client = trim($this->ref_client);
if (isset($this->increment)) $this->increment = trim($this->increment);
if (isset($this->close_code)) $this->close_code = trim($this->close_code);
@ -1837,6 +1848,7 @@ class Facture extends CommonInvoice
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET";
$sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").",";
$sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").",";
$sql .= " type=".(isset($this->type) ? $this->db->escape($this->type) : "null").",";
$sql .= " ref_client=".(isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null").",";
$sql .= " increment=".(isset($this->increment) ? "'".$this->db->escape($this->increment)."'" : "null").",";
@ -2930,6 +2942,7 @@ class Facture extends CommonInvoice
* @param int $fk_prev_id Previous situation line id reference
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Unit price in currency
* @param string $ref_ext External reference of the line
* @return int <0 if KO, Id of line if OK
*/
public function addline(
@ -2961,7 +2974,8 @@ class Facture extends CommonInvoice
$situation_percent = 100,
$fk_prev_id = 0,
$fk_unit = null,
$pu_ht_devise = 0
$pu_ht_devise = 0,
$ref_ext = ''
) {
// Deprecation warning
if ($label) {
@ -2989,6 +3003,7 @@ class Facture extends CommonInvoice
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line = 0;
if (empty($fk_prev_id)) $fk_prev_id = 'null';
if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
if (empty($ref_ext)) $ref_ext = '';
$remise_percent = price2num($remise_percent);
$qty = price2num($qty);
@ -3082,6 +3097,7 @@ class Facture extends CommonInvoice
$this->line->fk_facture = $this->id;
$this->line->label = $label; // deprecated
$this->line->desc = $desc;
$this->line->ref_ext = $ref_ext;
$this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ?abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
$this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ?-abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise
@ -3157,7 +3173,7 @@ class Facture extends CommonInvoice
return -2;
}
} else {
dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR);
dol_syslog(get_class($this)."::addline status of invoice must be Draft to allow use of ->addline()", LOG_ERR);
return -3;
}
}
@ -3189,9 +3205,10 @@ class Facture extends CommonInvoice
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Unit price in currency
* @param int $notrigger disable line update trigger
* @param string $ref_ext External reference of the line
* @return int < 0 if KO, > 0 if OK
*/
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0)
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '')
{
global $conf, $user;
// Deprecation warning
@ -3229,6 +3246,7 @@ class Facture extends CommonInvoice
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line = 0;
if (empty($special_code) || $special_code == 3) $special_code = 0;
if (!isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
if (empty($ref_ext)) $ref_ext = '';
$remise_percent = price2num($remise_percent);
$qty = price2num($qty);
@ -3319,6 +3337,7 @@ class Facture extends CommonInvoice
$this->line->rowid = $rowid;
$this->line->label = $label;
$this->line->desc = $desc;
$this->line->ref_ext = $ref_ext;
$this->line->qty = ($this->type == self::TYPE_CREDIT_NOTE ?abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative
$this->line->vat_src_code = $vat_src_code;
@ -4722,6 +4741,7 @@ class FactureLigne extends CommonInvoiceLine
public $label;
//! Description ligne
public $desc;
public $ref_ext; // External reference of the line
public $localtax1_type; // Local tax 1 type
public $localtax2_type; // Local tax 2 type
@ -4792,7 +4812,7 @@ class FactureLigne extends CommonInvoiceLine
public function fetch($rowid)
{
$sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_parent_line, fd.fk_product, fd.product_type, fd.label as custom_label, fd.description, fd.price, fd.qty, fd.vat_src_code, fd.tva_tx,';
$sql .= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,';
$sql .= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice, fd.ref_ext,';
$sql .= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,';
$sql .= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,';
$sql .= ' fd.fk_code_ventilation,';
@ -4820,6 +4840,7 @@ class FactureLigne extends CommonInvoiceLine
$this->desc = $objp->description;
$this->qty = $objp->qty;
$this->subprice = $objp->subprice;
$this->ref_ext = $objp->ref_ext;
$this->vat_src_code = $objp->vat_src_code;
$this->tva_tx = $objp->tva_tx;
$this->localtax1_tx = $objp->localtax1_tx;
@ -4902,6 +4923,7 @@ class FactureLigne extends CommonInvoiceLine
if (empty($this->remise_percent)) $this->remise_percent = 0;
if (empty($this->info_bits)) $this->info_bits = 0;
if (empty($this->subprice)) $this->subprice = 0;
if (empty($this->ref_ext)) $this->ref_ext = '';
if (empty($this->special_code)) $this->special_code = 0;
if (empty($this->fk_parent_line)) $this->fk_parent_line = 0;
if (empty($this->fk_prev_id)) $this->fk_prev_id = 0;
@ -4948,7 +4970,7 @@ class FactureLigne extends CommonInvoiceLine
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet';
$sql .= ' (fk_facture, fk_parent_line, label, description, qty,';
$sql .= ' vat_src_code, tva_tx, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type,';
$sql .= ' fk_product, product_type, remise_percent, subprice, fk_remise_except,';
$sql .= ' fk_product, product_type, remise_percent, subprice, ref_ext, fk_remise_except,';
$sql .= ' date_start, date_end, fk_code_ventilation, ';
$sql .= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,';
$sql .= ' info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2,';
@ -4971,6 +4993,7 @@ class FactureLigne extends CommonInvoiceLine
$sql .= " ".((int) $this->product_type).",";
$sql .= " ".price2num($this->remise_percent).",";
$sql .= " ".price2num($this->subprice).",";
$sql .= " '".$this->db->escape($this->ref_ext)."',";
$sql .= ' '.(!empty($this->fk_remise_except) ? $this->fk_remise_except : "null").',';
$sql .= " ".(!empty($this->date_start) ? "'".$this->db->idate($this->date_start)."'" : "null").",";
$sql .= " ".(!empty($this->date_end) ? "'".$this->db->idate($this->date_end)."'" : "null").",";
@ -5097,6 +5120,7 @@ class FactureLigne extends CommonInvoiceLine
// Clean parameters
$this->desc = trim($this->desc);
if (empty($this->ref_ext)) $this->ref_ext = '';
if (empty($this->tva_tx)) $this->tva_tx = 0;
if (empty($this->localtax1_tx)) $this->localtax1_tx = 0;
if (empty($this->localtax2_tx)) $this->localtax2_tx = 0;
@ -5136,6 +5160,7 @@ class FactureLigne extends CommonInvoiceLine
// Mise a jour ligne en base
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET";
$sql .= " description='".$this->db->escape($this->desc)."'";
$sql .= " ref_ext='".$this->db->escape($this->ref_ext)."'";
$sql .= ", label=".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null");
$sql .= ", subprice=".price2num($this->subprice)."";
$sql .= ", remise_percent=".price2num($this->remise_percent)."";

View File

@ -159,8 +159,8 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
$reshook = $hookmanager->executeHooks('printFieldListWhereCustomerDraft', $parameters);
$sql .= $hookmanager->resPrint;
$sql.= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, ";
$sql.= "s.email, s.nom, s.rowid, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
$sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, ";
$sql .= "s.email, s.nom, s.rowid, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur";
// Add Group from hooks
$parameters = array();

View File

@ -81,38 +81,38 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook))
{
if ($action == 'confirm_delete')
{
$res = $object->delete($user);
if ($res > 0)
{
if ($object->type == 'bank-transfer') {
header("Location: ".DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php');
} else {
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/index.php');
}
exit;
}
}
if ($action == 'confirm_delete')
{
$res = $object->delete($user);
if ($res > 0)
{
if ($object->type == 'bank-transfer') {
header("Location: ".DOL_URL_ROOT.'/compta/paymentbybanktransfer/index.php');
} else {
header("Location: ".DOL_URL_ROOT.'/compta/prelevement/index.php');
}
exit;
}
}
// Seems to no be used and replaced with $action == 'infocredit'
if ($action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes')
{
$res = $object->set_credite();
if ($res >= 0)
{
header("Location: card.php?id=".$id);
exit;
}
}
// Seems to no be used and replaced with $action == 'infocredit'
if ($action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes')
{
$res = $object->set_credite();
if ($res >= 0)
{
header("Location: card.php?id=".$id);
exit;
}
}
if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
/*
/*
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
{
$dir = $conf->prelevement->dir_output.'/receipts';
@ -133,24 +133,24 @@ if (empty($reshook))
$error = $object->set_infotrans($user, $dt, GETPOST('methode', 'alpha'));
if ($error)
{
header("Location: card.php?id=".$id."&error=$error");
exit;
}
}
if ($error)
{
header("Location: card.php?id=".$id."&error=$error");
exit;
}
}
// Set direct debit order to credited, create payment and close invoices
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
{
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$error = $object->set_infocredit($user, $dt);
if ($error)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
$error = $object->set_infocredit($user, $dt);
if ($error)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
}

View File

@ -318,7 +318,7 @@ class BonPrelevement extends CommonObject
$this->type = $obj->type;
$this->status = $obj->status;
$this->statut = $obj->status; // For backward compatibility
$this->statut = $obj->status; // For backward compatibility
$this->fetched = 1;
@ -510,7 +510,7 @@ class BonPrelevement extends CommonObject
$paiement->num_paiement = $this->ref; // For backward compatibility
$paiement->id_prelevement = $this->id;
$paiement_id = $paiement->create($user); // This use ->paiementid, that is ID of payment mode
$paiement_id = $paiement->create($user); // This use ->paiementid, that is ID of payment mode
if ($paiement_id < 0)
{
$error++;
@ -540,7 +540,7 @@ class BonPrelevement extends CommonObject
// Update withdrawal line
// TODO: Translate to ligneprelevement.class.php
if (! $error) {
if (!$error) {
$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
$sql .= " SET statut = 2";
$sql .= " WHERE fk_prelevement_bons = ".$this->id;
@ -884,7 +884,7 @@ class BonPrelevement extends CommonObject
$sql .= " AND f.rowid = pfd.fk_facture_fourn";
}
$sql .= " AND s.rowid = f.fk_soc";
$sql .= " AND f.fk_statut = 1"; // Invoice validated
$sql .= " AND f.fk_statut = 1"; // Invoice validated
$sql .= " AND f.paye = 0";
$sql .= " AND pfd.traite = 0";
$sql .= " AND f.total_ttc > 0";
@ -1179,7 +1179,7 @@ class BonPrelevement extends CommonObject
/*
* Update total defined after generation of file
*/
if (! $error) {
if (!$error) {
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
$sql .= " SET amount = ".price2num($this->total);
$sql .= " WHERE rowid = ".$this->id;
@ -1542,7 +1542,7 @@ class BonPrelevement extends CommonObject
{
$obj = $this->db->fetch_object($resql);
if (! empty($cachearraytotestduplicate[$obj->idfac])) {
if (!empty($cachearraytotestduplicate[$obj->idfac])) {
$this->error = $langs->trans('ErrorCompanyHasDuplicateDefaultBAN', $obj->socid);
$this->invoice_in_error[$obj->idfac] = $this->error;
$result = -2;
@ -1657,7 +1657,7 @@ class BonPrelevement extends CommonObject
{
$obj = $this->db->fetch_object($resql);
if (! empty($cachearraytotestduplicate[$obj->idfac])) {
if (!empty($cachearraytotestduplicate[$obj->idfac])) {
$this->error = $langs->trans('ErrorCompanyHasDuplicateDefaultBAN', $obj->socid);
$this->invoice_in_error[$obj->idfac] = $this->error;
$result = -2;
@ -2192,7 +2192,7 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf;
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
$XML_SEPA_INFO .= ' <PrvtId>'.$CrLf;
@ -2254,7 +2254,7 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' <AdrLine>'.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.'</AdrLine>'.$CrLf;
$XML_SEPA_INFO .= ' </PstlAdr>'.$CrLf;
$XML_SEPA_INFO .= ' </UltmtCdtr>'.$CrLf;*/
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
$XML_SEPA_INFO .= ' <ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
/*$XML_SEPA_INFO .= ' <CdtrSchmeId>'.$CrLf;
$XML_SEPA_INFO .= ' <Id>'.$CrLf;
$XML_SEPA_INFO .= ' <PrvtId>'.$CrLf;

View File

@ -84,10 +84,10 @@ if (empty($reshook))
$conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS;
}
$bprev = new BonPrelevement($db);
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), (GETPOST('reday', 'int') + $delayindays), GETPOST('reyear', 'int'));
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), (GETPOST('reday', 'int') + $delayindays), GETPOST('reyear', 'int'));
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore)
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type);
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore)
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type);
if ($result < 0) {
setEventMessages($bprev->error, $bprev->errors, 'errors');
} elseif ($result == 0) {
@ -188,30 +188,30 @@ print '<form action="'.$_SERVER['PHP_SELF'].'?action=create" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="type" value="'.$type.'">';
if ($nb) {
if ($pricetowithdraw) {
print $langs->trans('ExecutionDate').' ';
$datere = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
print $form->selectDate($datere, 're');
if ($pricetowithdraw) {
print $langs->trans('ExecutionDate').' ';
$datere = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
print $form->selectDate($datere, 're');
if ($mysoc->isInEEC()) {
$title = $langs->trans("CreateForSepa");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreateSepaFileForPaymentByBankTransfer");
}
if ($mysoc->isInEEC()) {
$title = $langs->trans("CreateForSepa");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreateSepaFileForPaymentByBankTransfer");
}
if ($type != 'bank-transfer') {
print '<select name="format">';
print '<option value="FRST"'.(GETPOST('format', 'aZ09') == 'FRST' ? ' selected="selected"' : '').'>'.$langs->trans('SEPAFRST').'</option>';
print '<option value="RCUR"'.(GETPOST('format', 'aZ09') == 'RCUR' ? ' selected="selected"' : '').'>'.$langs->trans('SEPARCUR').'</option>';
print '</select>';
}
print '<input class="butAction" type="submit" value="'.$title.'"/>';
} else {
$title = $langs->trans("CreateAll");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreateFileForPaymentByBankTransfer");
}
print '<a class="butAction" type="submit" href="create.php?action=create&format=ALL&type='.$type.'">'.$title."</a>\n";
if ($type != 'bank-transfer') {
print '<select name="format">';
print '<option value="FRST"'.(GETPOST('format', 'aZ09') == 'FRST' ? ' selected="selected"' : '').'>'.$langs->trans('SEPAFRST').'</option>';
print '<option value="RCUR"'.(GETPOST('format', 'aZ09') == 'RCUR' ? ' selected="selected"' : '').'>'.$langs->trans('SEPARCUR').'</option>';
print '</select>';
}
print '<input class="butAction" type="submit" value="'.$title.'"/>';
} else {
$title = $langs->trans("CreateAll");
if ($type == 'bank-transfer') {
$title = $langs->trans("CreateFileForPaymentByBankTransfer");
}
print '<a class="butAction" type="submit" href="create.php?action=create&format=ALL&type='.$type.'">'.$title."</a>\n";
}
} else {
if ($mysoc->isInEEC())
@ -301,12 +301,12 @@ if ($resql)
$num = $db->num_rows($resql);
$i = 0;
$param = '';
$param = '';
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
if ($socid) $param .= '&socid='.urlencode($socid);
if ($option) $param .= "&option=".urlencode($option);
if ($option) $param .= "&option=".urlencode($option);
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="page" value="'.$page.'">';
if (!empty($limit)) {
@ -317,12 +317,12 @@ if ($resql)
if ($type == 'bank-transfer') {
$title = $langs->trans("InvoiceWaitingPaymentByBankTransfer");
}
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit);
$tradinvoice = "Invoice";
if ($type == 'bank-transfer') {
$tradinvoice = "SupplierInvoice";
}
$tradinvoice = "Invoice";
if ($type == 'bank-transfer') {
$tradinvoice = "SupplierInvoice";
}
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';

View File

@ -82,8 +82,8 @@ llxHeader('', $langs->trans("WithdrawalsReceipts"));
if ($id > 0 || $ref)
{
if ($object->fetch($id, $ref) >= 0)
{
$head = prelevement_prepare_head($object);
{
$head = prelevement_prepare_head($object);
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/bons.php'.($object->type != 'bank-transfer' ? '' : '?type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
@ -151,9 +151,9 @@ if ($id > 0 || $ref)
print '</div>';
dol_fiche_end();
} else {
dol_print_error($db);
}
} else {
dol_print_error($db);
}
}
@ -191,13 +191,13 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
}
$sql .= $db->plimit($limit + 1, $offset);
@ -212,13 +212,13 @@ if ($resql)
// Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="id" value="'.$id.'">';
@ -245,38 +245,38 @@ if ($resql)
$invoicetmpsupplier = new FactureFournisseur($db);
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($resql);
{
$obj = $db->fetch_object($resql);
if ($obj->type == 'bank-transfer') {
$invoicetmp = $invoicetmpsupplier;
} else {
$invoicetmp = $invoicetmpcustomer;
}
$invoicetmp->fetch($obj->facid);
if ($obj->type == 'bank-transfer') {
$invoicetmp = $invoicetmpsupplier;
} else {
$invoicetmp = $invoicetmpcustomer;
}
$invoicetmp->fetch($obj->facid);
$thirdpartytmp->fetch($obj->socid);
$thirdpartytmp->fetch($obj->socid);
print '<tr class="oddeven">';
print '<tr class="oddeven">';
print "<td>";
print $invoicetmp->getNomUrl(1);
print "</td>\n";
print "<td>";
print $invoicetmp->getNomUrl(1);
print "</td>\n";
print '<td>';
print $thirdpartytmp->getNomUrl(1);
print "</td>\n";
print '<td>';
print $thirdpartytmp->getNomUrl(1);
print "</td>\n";
// Amount of invoice
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
// Amount of invoice
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
// Amount requested
print '<td class="right">'.price($obj->amount_requested)."</td>\n";
// Amount requested
print '<td class="right">'.price($obj->amount_requested)."</td>\n";
// Status of requests
print '<td class="center">';
// Status of requests
print '<td class="center">';
if ($obj->statut == 0) {
if ($obj->statut == 0) {
print '-';
} elseif ($obj->statut == 2) {
if ($obj->type == 'bank-transfer') {
@ -288,34 +288,34 @@ if ($resql)
print '<b>'.$langs->trans("StatusRefused").'</b>';
}
print "</td>";
print "</td>";
print "<td></td>";
print "<td></td>";
print "</tr>\n";
print "</tr>\n";
$totalinvoices += $obj->total_ttc;
$totalamount_requested += $obj->amount_requested;
$totalinvoices += $obj->total_ttc;
$totalamount_requested += $obj->amount_requested;
$i++;
}
$i++;
}
if ($num > 0)
{
print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>';
print '<td>&nbsp;</td>';
print '<td class="right">';
{
print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>';
print '<td>&nbsp;</td>';
print '<td class="right">';
//if ($totalinvoices != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices"); // It is normal to have total that differs. For an amount of invoice of 100, request to pay may be 50 only.
if ($totalamount_requested != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices");
if ($totalamount_requested != $object->amount) print img_warning("AmountOfFileDiffersFromSumOfInvoices");
print "</td>\n";
print '<td class="right">';
print '<td class="right">';
print price($totalamount_requested);
print "</td>\n";
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
}
print "</td>\n";
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
}
print "</table>";
print '</div>';

View File

@ -76,8 +76,8 @@ llxHeader('', $langs->trans("WithdrawalsReceipts"));
if ($prev_id > 0 || $ref)
{
if ($object->fetch($prev_id, $ref) >= 0)
{
$head = prelevement_prepare_head($object);
{
$head = prelevement_prepare_head($object);
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/bons.php'.($object->type != 'bank-transfer' ? '' : '?type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
@ -145,9 +145,9 @@ if ($prev_id > 0 || $ref)
print '</div>';
dol_fiche_end();
} else {
dol_print_error($db);
}
} else {
dol_print_error($db);
}
}
@ -205,44 +205,44 @@ if ($resql)
if ($num > 0)
{
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td>';
print '<tr class="oddeven"><td>';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
print img_picto('', 'statut'.$obj->statut).' ';
print substr('000000'.$obj->rowid, -6);
print '</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->name."</a></td>\n";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
print img_picto('', 'statut'.$obj->statut).' ';
print substr('000000'.$obj->rowid, -6);
print '</a></td>';
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->name."</a></td>\n";
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td>'.$rej->motifs[$obj->motif].'</td>';
print '<td class="right">'.price($obj->amount)."</td>\n";
print '<td>'.$rej->motifs[$obj->motif].'</td>';
print '<td class="center">'.yn($obj->afacturer).'</td>';
print '<td class="center">'.$obj->fk_facture.'</td>';
print "</tr>\n";
print '<td class="center">'.yn($obj->afacturer).'</td>';
print '<td class="center">'.$obj->fk_facture.'</td>';
print "</tr>\n";
$total += $obj->amount;
$total += $obj->amount;
$i++;
}
$i++;
}
} else {
print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
if ($num > 0)
{
print '<tr class="liste_total"><td>&nbsp;</td>';
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="right">'.price($total)."</td>\n";
print '<td colspan="3">&nbsp;</td>';
print "</tr>\n";
}
print "</table>\n";
print '</div>';
{
print '<tr class="liste_total"><td>&nbsp;</td>';
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="right">'.price($total)."</td>\n";
print '<td colspan="3">&nbsp;</td>';
print "</tr>\n";
}
print "</table>\n";
print '</div>';
$db->free($resql);
} else {

File diff suppressed because it is too large Load Diff

View File

@ -184,7 +184,7 @@ $arrayfields = array(
'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'p.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
);
if (! empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
$arrayfields['p.fk_prospectcontactlevel'] = array('label'=>"ProspectLevelShort", 'checked'=>1, 'position'=>210);
$arrayfields['p.fk_stcommcontact'] = array('label'=>"StatusProsp", 'checked'=>1, 'position'=>215);
}
@ -270,8 +270,8 @@ if (empty($reshook))
}
}
$search_priv = "";
$search_stcomm='';
$search_level='';
$search_stcomm = '';
$search_level = '';
$search_status = -1;
$search_categ = '';
$search_categ_thirdparty = '';
@ -314,7 +314,7 @@ $formother = new FormOther($db);
$formcompany = new FormCompany($db);
$contactstatic = new Contact($db);
if (! empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
$contactstatic->loadCacheOfProspStatus();
}
@ -323,17 +323,17 @@ $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("C
// Select every potentiels, and note each potentiels which fit in search parameters
$tab_level = array();
$sql = "SELECT code, label, sortorder";
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
$sql.= " WHERE active > 0";
$sql.= " ORDER BY sortorder";
$sql .= " FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
$sql .= " WHERE active > 0";
$sql .= " ORDER BY sortorder";
$resql = $db->query($sql);
if ($resql)
{
while ($obj = $db->fetch_object($resql))
{
// Compute level text
$level=$langs->trans($obj->code);
if ($level == $obj->code) $level=$langs->trans($obj->label);
$level = $langs->trans($obj->code);
if ($level == $obj->code) $level = $langs->trans($obj->label);
$tab_level[$obj->code] = $level;
}
}
@ -343,7 +343,7 @@ $sql = "SELECT s.rowid as socid, s.nom as name,";
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email,";
$sql .= " p.socialnetworks, p.photo,";
$sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
$sql.= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,";
$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,";
$sql .= " co.label as country, co.code as country_code";
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
@ -357,7 +357,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_stcommcontact as st ON st.id = p.fk_stcommcontact";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_stcommcontact as st ON st.id = p.fk_stcommcontact";
if (!empty($search_categ)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cc ON p.rowid = cc.fk_socpeople"; // We need this table joined to the select in order to filter by categ
if (!empty($search_categ_thirdparty)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
if (!empty($search_categ_supplier)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ
@ -469,7 +469,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql);
if (! $resql)
if (!$resql)
{
dol_print_error($db);
exit;
@ -515,10 +515,10 @@ if ($search_email != '') $param .= '&amp;search_email='.urlencode($search_email)
if ($search_no_email != '') $param .= '&amp;search_no_email='.urlencode($search_no_email);
if ($search_status != '') $param .= '&amp;search_status='.urlencode($search_status);
if ($search_priv == '0' || $search_priv == '1') $param .= "&amp;search_priv=".urlencode($search_priv);
if ($search_stcomm != '') $param.='&search_stcomm='.urlencode($search_stcomm);
if ($search_stcomm != '') $param .= '&search_stcomm='.urlencode($search_stcomm);
if (is_array($search_level) && count($search_level)) {
foreach ($search_level as $slevel) {
$param.='&search_level[]='.urlencode($slevel);
$param .= '&search_level[]='.urlencode($slevel);
}
}
if ($search_import_key != '') $param .= '&amp;search_import_key='.urlencode($search_import_key);
@ -739,20 +739,20 @@ if (!empty($arrayfields['p.priv']['checked']))
print '</td>';
}
// Prospect level
if (! empty($arrayfields['p.fk_prospectcontactlevel']['checked']))
if (!empty($arrayfields['p.fk_prospectcontactlevel']['checked']))
{
print '<td class="liste_titre center">';
print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2);
print '</td>';
}
// Prospect status
if (! empty($arrayfields['p.fk_stcommcontact']['checked']))
if (!empty($arrayfields['p.fk_stcommcontact']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone center">';
$arraystcomm=array();
$arraystcomm = array();
foreach ($contactstatic->cacheprospectstatus as $key => $val)
{
$arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']);
$arraystcomm[$val['id']] = ($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']);
}
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0, '', 0, 0, 0, '', 'nowrap ');
print '</td>';
@ -877,7 +877,7 @@ while ($i < min($num, $limit))
$contactstatic->country_code = $obj->country_code;
$contactstatic->photo = $obj->photo;
$contactstatic->fk_prospectlevel=$obj->fk_prospectcontactlevel;
$contactstatic->fk_prospectlevel = $obj->fk_prospectcontactlevel;
print '<tr class="oddeven">';
@ -1007,7 +1007,7 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['p.fk_prospectcontactlevel']['checked']))
if (!empty($arrayfields['p.fk_prospectcontactlevel']['checked']))
{
// Prospect level
print '<td class="center">';
@ -1016,16 +1016,16 @@ while ($i < min($num, $limit))
if (!$i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['p.fk_stcommcontact']['checked']))
if (!empty($arrayfields['p.fk_stcommcontact']['checked']))
{
// Prospect status
print '<td class="center nowrap"><div class="nowrap">';
print '<div class="inline-block">' . $contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
print '<div class="inline-block">'.$contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
print '</div> - <div class="inline-block">';
foreach ($contactstatic->cacheprospectstatus as $key => $val) {
$titlealt = 'default';
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?stcommcontactid=' . $obj->rowid . '&stcomm=' . $val['code'] . '&action=setstcomm' . $param . ($page ? '&page=' . urlencode($page) : '') . '">' . img_action($titlealt, $val['code'], $val['picto']) . '</a>';
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommcontactid='.$obj->rowid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page ? '&page='.urlencode($page) : '').'">'.img_action($titlealt, $val['code'], $val['picto']).'</a>';
}
print '</div></div></td>';
if (!$i) $totalarray['nbfield']++;

View File

@ -85,7 +85,7 @@ if ($action == 'add' && !empty($permissiontoadd))
$object->$key = $value;
if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)')
{
$object->$key = '(PROV)';
$object->$key = '(PROV)';
}
if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default']))
{
@ -105,7 +105,7 @@ if ($action == 'add' && !empty($permissiontoadd))
$result = $object->create($user);
if ($result > 0)
{
// Creation OK
// Creation OK
$urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist;
$urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation
header("Location: ".$urltogo);
@ -154,7 +154,7 @@ if ($action == 'update' && !empty($permissiontoadd))
$value = '';
}
} elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) {
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
$value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup
} elseif ($object->fields[$key]['type'] == 'boolean') {
$value = ((GETPOST($key, 'aZ09') == 'on' || GETPOST($key, 'aZ09') == '1') ? 1 : 0);
} else {
@ -223,11 +223,11 @@ if ($action == "update_extras" && !empty($permissiontoadd))
// Action to delete
if ($action == 'confirm_delete' && !empty($permissiontodelete))
{
if (!($object->id > 0))
{
dol_print_error('', 'Error, object must be fetched before being deleted');
exit;
}
if (!($object->id > 0))
{
dol_print_error('', 'Error, object must be fetched before being deleted');
exit;
}
$result = $object->delete($user);
if ($result > 0)
@ -246,7 +246,7 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete))
if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissiontoadd))
{
if (method_exists('deleteline', $object)) {
$result = $object->deleteline($user, $lineid); // For backward compatibility
$result = $object->deleteline($user, $lineid); // For backward compatibility
} else {
$result = $object->deleteLine($user, $lineid);
}
@ -385,11 +385,11 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd))
{
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
} else {
$objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid.
$objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid.
//$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int'));
// ...
$result = $objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id));
if (is_object($result) || $result > 0)
// ...
$result = $objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id));
if (is_object($result) || $result > 0)
{
$newid = 0;
if (is_object($result)) $newid = $result->id;
@ -397,7 +397,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd))
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object
exit;
} else {
setEventMessages($objectutil->error, $objectutil->errors, 'errors');
setEventMessages($objectutil->error, $objectutil->errors, 'errors');
$action = '';
}
}

View File

@ -263,12 +263,12 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
if (dol_strlen($sendto))
{
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
// Define $urlwithroot
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$langs->load("commercial");
@ -419,7 +419,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
// Initialisation of datas of object to call trigger
if (is_object($object))
{
if (empty($actiontypecode)) $actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically
if (empty($actiontypecode)) $actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically
$object->socid = $sendtosocid; // To link to a company
$object->sendtoid = $sendtoid; // To link to contact-addresses. This is an array.
@ -456,7 +456,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST
if ($error) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
// End call of triggers
}

View File

@ -34,28 +34,28 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (!isset($mode) || $mode != 'noajax') // For ajax call
{
require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
$action = GETPOST('action', 'aZ09');
$file = urldecode(GETPOST('file', 'alpha'));
$section = GETPOST("section", 'alpha');
$module = GETPOST("module", 'alpha');
$urlsource = GETPOST("urlsource", 'alpha');
$search_doc_ref = GETPOST('search_doc_ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$file = urldecode(GETPOST('file', 'alpha'));
$section = GETPOST("section", 'alpha');
$module = GETPOST("module", 'alpha');
$urlsource = GETPOST("urlsource", 'alpha');
$search_doc_ref = GETPOST('search_doc_ref', 'alpha');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "name";
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "name";
$rootdirfordoc = $conf->ecm->dir_output;
@ -63,30 +63,30 @@ if (!isset($mode) || $mode != 'noajax') // For ajax call
$ecmdir = new EcmDirectory($db);
if ($section > 0) {
$result = $ecmdir->fetch($section);
if (!$result > 0)
{
//dol_print_error($db,$ecmdir->error);
//exit;
}
$result = $ecmdir->fetch($section);
if (!$result > 0)
{
//dol_print_error($db,$ecmdir->error);
//exit;
}
}
} else // For no ajax call
{
$rootdirfordoc = $conf->ecm->dir_output;
$ecmdir = new EcmDirectory($db);
$relativepath = '';
if ($section > 0)
{
$result = $ecmdir->fetch($section);
if (!$result > 0)
{
dol_print_error($db, $ecmdir->error);
exit;
}
$relativepath = '';
if ($section > 0)
{
$result = $ecmdir->fetch($section);
if (!$result > 0)
{
dol_print_error($db, $ecmdir->error);
exit;
}
$relativepath = $ecmdir->getRelativePath(); // Example 'mydir/'
} elseif (GETPOST('section_dir'))
$relativepath = $ecmdir->getRelativePath(); // Example 'mydir/'
} elseif (GETPOST('section_dir'))
{
$relativepath = GETPOST('section_dir');
}
@ -113,10 +113,10 @@ if ($user->socid > 0) $socid = $user->socid;
// On interdit les remontees de repertoire ainsi que les pipe dans les noms de fichiers.
if (preg_match('/\.\./', $upload_dir) || preg_match('/[<>|]/', $upload_dir))
{
dol_syslog("Refused to deliver file ".$upload_dir);
// Do no show plain path in shown error message
dol_print_error(0, $langs->trans("ErrorFileNameInvalid", $upload_dir));
exit;
dol_syslog("Refused to deliver file ".$upload_dir);
// Do no show plain path in shown error message
dol_print_error(0, $langs->trans("ErrorFileNameInvalid", $upload_dir));
exit;
}
// Check permissions
@ -145,10 +145,10 @@ if ($modulepart == 'medias')
if (!isset($mode) || $mode != 'noajax')
{
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
top_httphead();
top_httphead();
}
$type = 'directory';
@ -156,8 +156,8 @@ $type = 'directory';
// This test if file exists should be useless. We keep it to find bug more easily
if (!dol_is_dir($upload_dir))
{
//dol_mkdir($upload_dir);
/*$langs->load("install");
//dol_mkdir($upload_dir);
/*$langs->load("install");
dol_print_error(0,$langs->trans("ErrorDirDoesNotExists",$upload_dir));
exit;*/
}
@ -173,76 +173,76 @@ if (!empty($pageid)) $param .= '&pageid='.urlencode($pageid);
// Dir scan
if ($type == 'directory')
{
$formfile = new FormFile($db);
$formfile = new FormFile($db);
$maxlengthname = 40;
$excludefiles = array('^SPECIMEN\.pdf$', '^\.', '(\.meta|_preview.*\.png)$', '^temp$', '^payments$', '^CVS$', '^thumbs$');
$sorting = (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC);
$maxlengthname = 40;
$excludefiles = array('^SPECIMEN\.pdf$', '^\.', '(\.meta|_preview.*\.png)$', '^temp$', '^payments$', '^CVS$', '^thumbs$');
$sorting = (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC);
// Right area. If module is defined here, we are in automatic ecm.
$automodules = array(
'company',
'invoice',
'invoice_supplier',
'propal',
'supplier_proposal',
'order',
'order_supplier',
'contract',
'product',
'tax',
'project',
'fichinter',
'user',
'expensereport',
'holiday',
'recruitment-recruitmentcandidature',
'banque',
'mrp-mo'
);
// Right area. If module is defined here, we are in automatic ecm.
$automodules = array(
'company',
'invoice',
'invoice_supplier',
'propal',
'supplier_proposal',
'order',
'order_supplier',
'contract',
'product',
'tax',
'project',
'fichinter',
'user',
'expensereport',
'holiday',
'recruitment-recruitmentcandidature',
'banque',
'mrp-mo'
);
// TODO change for multicompany sharing
if ($module == 'company') $upload_dir = $conf->societe->dir_output;
elseif ($module == 'invoice') $upload_dir = $conf->facture->dir_output;
elseif ($module == 'invoice_supplier') $upload_dir = $conf->fournisseur->facture->dir_output;
elseif ($module == 'propal') $upload_dir = $conf->propal->dir_output;
elseif ($module == 'supplier_proposal') $upload_dir = $conf->supplier_proposal->dir_output;
elseif ($module == 'order') $upload_dir = $conf->commande->dir_output;
elseif ($module == 'order_supplier') $upload_dir = $conf->fournisseur->commande->dir_output;
elseif ($module == 'contract') $upload_dir = $conf->contrat->dir_output;
elseif ($module == 'product') $upload_dir = $conf->product->dir_output;
elseif ($module == 'tax') $upload_dir = $conf->tax->dir_output;
elseif ($module == 'project') $upload_dir = $conf->projet->dir_output;
elseif ($module == 'fichinter') $upload_dir = $conf->ficheinter->dir_output;
elseif ($module == 'user') $upload_dir = $conf->user->dir_output;
elseif ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output;
elseif ($module == 'holiday') $upload_dir = $conf->holiday->dir_output;
elseif ($module == 'recruitment-recruitmentcandidature') $upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
elseif ($module == 'banque') $upload_dir = $conf->bank->dir_output;
elseif ($module == 'mrp-mo') $upload_dir = $conf->mrp->dir_output.'/mo';
// TODO change for multicompany sharing
if ($module == 'company') $upload_dir = $conf->societe->dir_output;
elseif ($module == 'invoice') $upload_dir = $conf->facture->dir_output;
elseif ($module == 'invoice_supplier') $upload_dir = $conf->fournisseur->facture->dir_output;
elseif ($module == 'propal') $upload_dir = $conf->propal->dir_output;
elseif ($module == 'supplier_proposal') $upload_dir = $conf->supplier_proposal->dir_output;
elseif ($module == 'order') $upload_dir = $conf->commande->dir_output;
elseif ($module == 'order_supplier') $upload_dir = $conf->fournisseur->commande->dir_output;
elseif ($module == 'contract') $upload_dir = $conf->contrat->dir_output;
elseif ($module == 'product') $upload_dir = $conf->product->dir_output;
elseif ($module == 'tax') $upload_dir = $conf->tax->dir_output;
elseif ($module == 'project') $upload_dir = $conf->projet->dir_output;
elseif ($module == 'fichinter') $upload_dir = $conf->ficheinter->dir_output;
elseif ($module == 'user') $upload_dir = $conf->user->dir_output;
elseif ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output;
elseif ($module == 'holiday') $upload_dir = $conf->holiday->dir_output;
elseif ($module == 'recruitment-recruitmentcandidature') $upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
elseif ($module == 'banque') $upload_dir = $conf->bank->dir_output;
elseif ($module == 'mrp-mo') $upload_dir = $conf->mrp->dir_output.'/mo';
// Automatic list
if (in_array($module, $automodules))
{
$param .= '&module='.$module;
if (isset($search_doc_ref) && $search_doc_ref != '') $param .= '&search_doc_ref='.urlencode($search_doc_ref);
// Automatic list
if (in_array($module, $automodules))
{
$param .= '&module='.$module;
if (isset($search_doc_ref) && $search_doc_ref != '') $param .= '&search_doc_ref='.urlencode($search_doc_ref);
$textifempty = ($section ? $langs->trans("NoFileFound") : ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("NoFileFound")));
$textifempty = ($section ? $langs->trans("NoFileFound") : ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("NoFileFound")));
if ($module == 'company') $excludefiles[] = '^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty.
if ($module == 'company') $excludefiles[] = '^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty.
$filter = preg_quote($search_doc_ref, '/');
$filearray = dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting, 1);
$filter = preg_quote($search_doc_ref, '/');
$filearray = dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting, 1);
$perm = $user->rights->ecm->upload;
$perm = $user->rights->ecm->upload;
$formfile->list_of_autoecmfiles($upload_dir, $filearray, $module, $param, 1, '', $perm, 1, $textifempty, $maxlengthname, $url, 1);
}
// Manual list
else {
if ($module == 'medias')
{
/*
$formfile->list_of_autoecmfiles($upload_dir, $filearray, $module, $param, 1, '', $perm, 1, $textifempty, $maxlengthname, $url, 1);
}
// Manual list
else {
if ($module == 'medias')
{
/*
$_POST is array like
'token' => string '062380e11b7dcd009d07318b57b71750' (length=32)
'action' => string 'file_manager' (length=12)
@ -253,82 +253,82 @@ if ($type == 'directory')
'max_file_size' => string '2097152' (length=7)
'sendit' => string 'Envoyer fichier' (length=15)
*/
$relativepath = GETPOST('file', 'alpha') ?GETPOST('file', 'alpha') : GETPOST('section_dir', 'alpha');
if ($relativepath && $relativepath != '/') $relativepath .= '/';
$upload_dir = $dolibarr_main_data_root.'/'.$module.'/'.$relativepath;
if (GETPOSTISSET('website') || GETPOSTISSET('file_manager'))
{
$param .= '&file_manager=1';
if (!preg_match('/website=/', $param)) $param .= '&website='.urlencode(GETPOST('website', 'alpha'));
if (!preg_match('/pageid=/', $param)) $param .= '&pageid='.urlencode(GETPOST('pageid', 'int'));
//if (!preg_match('/backtopage=/',$param)) $param.='&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid);
}
} else {
$relativepath = $ecmdir->getRelativePath();
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
}
$relativepath = GETPOST('file', 'alpha') ?GETPOST('file', 'alpha') : GETPOST('section_dir', 'alpha');
if ($relativepath && $relativepath != '/') $relativepath .= '/';
$upload_dir = $dolibarr_main_data_root.'/'.$module.'/'.$relativepath;
if (GETPOSTISSET('website') || GETPOSTISSET('file_manager'))
{
$param .= '&file_manager=1';
if (!preg_match('/website=/', $param)) $param .= '&website='.urlencode(GETPOST('website', 'alpha'));
if (!preg_match('/pageid=/', $param)) $param .= '&pageid='.urlencode(GETPOST('pageid', 'int'));
//if (!preg_match('/backtopage=/',$param)) $param.='&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid);
}
} else {
$relativepath = $ecmdir->getRelativePath();
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
}
// If $section defined with value 0
// If $section defined with value 0
if (($section === '0' || empty($section)) && ($module != 'medias'))
{
$filearray = array();
} else {
$filearray = dol_dir_list($upload_dir, "files", 0, '', array('^\.', '(\.meta|_preview.*\.png)$', '^temp$', '^CVS$'), $sortfield, $sorting, 1);
}
{
$filearray = array();
} else {
$filearray = dol_dir_list($upload_dir, "files", 0, '', array('^\.', '(\.meta|_preview.*\.png)$', '^temp$', '^CVS$'), $sortfield, $sorting, 1);
}
if ($section)
{
$param .= '&section='.$section;
if (isset($search_doc_ref) && $search_doc_ref != '') $param .= '&search_doc_ref='.$search_doc_ref;
if ($section)
{
$param .= '&section='.$section;
if (isset($search_doc_ref) && $search_doc_ref != '') $param .= '&search_doc_ref='.$search_doc_ref;
$textifempty = $langs->trans('NoFileFound');
} elseif ($section === '0')
{
if ($module == 'ecm') $textifempty = '<br><div class="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
else $textifempty = $langs->trans('NoFileFound');
} else $textifempty = ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("ECMSelectASection"));
$textifempty = $langs->trans('NoFileFound');
} elseif ($section === '0')
{
if ($module == 'ecm') $textifempty = '<br><div class="center"><font class="warning">'.$langs->trans("DirNotSynchronizedSyncFirst").'</font></div><br>';
else $textifempty = $langs->trans('NoFileFound');
} else $textifempty = ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("ECMSelectASection"));
if ($module == 'medias')
{
$useinecm = 6;
$modulepart = 'medias';
$perm = ($user->rights->website->write || $user->rights->emailing->creer);
$title = 'none';
} elseif ($module == 'ecm') // DMS/ECM -> manual structure
{
if ($user->rights->ecm->read)
{
// Buttons: Preview
$useinecm = 2;
}
if ($module == 'medias')
{
$useinecm = 6;
$modulepart = 'medias';
$perm = ($user->rights->website->write || $user->rights->emailing->creer);
$title = 'none';
} elseif ($module == 'ecm') // DMS/ECM -> manual structure
{
if ($user->rights->ecm->read)
{
// Buttons: Preview
$useinecm = 2;
}
if ($user->rights->ecm->upload)
{
// Buttons: Preview + Delete
$useinecm = 4;
}
if ($user->rights->ecm->upload)
{
// Buttons: Preview + Delete
$useinecm = 4;
}
if ($user->rights->ecm->setup)
{
// Buttons: Preview + Delete + Edit
$useinecm = 5;
}
if ($user->rights->ecm->setup)
{
// Buttons: Preview + Delete + Edit
$useinecm = 5;
}
$perm = $user->rights->ecm->upload;
$modulepart = 'ecm';
$title = ''; // Use default
} else {
$useinecm = 5;
$modulepart = 'ecm';
$perm = $user->rights->ecm->upload;
$title = ''; // Use default
}
$perm = $user->rights->ecm->upload;
$modulepart = 'ecm';
$title = ''; // Use default
} else {
$useinecm = 5;
$modulepart = 'ecm';
$perm = $user->rights->ecm->upload;
$title = ''; // Use default
}
// When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param
// When we show list of files for a directory, $filearray ciontains file list, and directory is defined with modulepart + $relativepath
//var_dump("section=".$section." title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm=".$perm." relativepath=".$relativepath." param=".$param." url=".$url);
$formfile->list_of_documents($filearray, '', $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm);
}
// When we show list of files for ECM files, $filearray contains file list, and directory is defined with modulepart + section into $param
// When we show list of files for a directory, $filearray ciontains file list, and directory is defined with modulepart + $relativepath
//var_dump("section=".$section." title=".$title." modulepart=".$modulepart." useinecm=".$useinecm." perm=".$perm." relativepath=".$relativepath." param=".$param." url=".$url);
$formfile->list_of_documents($filearray, '', $modulepart, $param, 1, $relativepath, $perm, $useinecm, $textifempty, $maxlengthname, $title, $url, 0, $perm);
}
}

View File

@ -41,47 +41,47 @@ class CMailFile
public $sendmode;
public $sendsetup;
public $subject; // Topic: Subject of email
public $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>'). Note that with gmail smtps, value here is forced by google to account (but not the reply-to).
public $subject; // Topic: Subject of email
public $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>'). Note that with gmail smtps, value here is forced by google to account (but not the reply-to).
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain.
// Return-Path: Email where to send bounds.
public $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined)
public $errors_to; // Errors-To: Email where to send errors.
public $addr_to;
public $addr_cc;
public $addr_bcc;
public $trackid;
public $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined)
public $errors_to; // Errors-To: Email where to send errors.
public $addr_to;
public $addr_cc;
public $addr_bcc;
public $trackid;
public $mixed_boundary;
public $related_boundary;
public $alternative_boundary;
public $deliveryreceipt;
public $mixed_boundary;
public $related_boundary;
public $alternative_boundary;
public $deliveryreceipt;
public $eol;
public $eol2;
public $eol;
public $eol2;
/**
* @var string Error code (or message)
*/
public $error = '';
public $smtps; // Contains SMTPs object (if this method is used)
public $phpmailer; // Contains PHPMailer object (if this method is used)
public $smtps; // Contains SMTPs object (if this method is used)
public $phpmailer; // Contains PHPMailer object (if this method is used)
/**
* @var string CSS
*/
public $css;
//! Defined css style for body background
public $styleCSS;
public $styleCSS;
//! Defined background directly in body tag
public $bodyCSS;
public $bodyCSS;
public $msgid;
public $headers;
public $message;
/**
public $msgid;
public $headers;
public $message;
/**
* @var array fullfilenames list (full path of filename on file system)
*/
public $filename_list = array();
@ -95,21 +95,21 @@ class CMailFile
public $mimefilename_list = array();
// Image
public $html;
public $image_boundary;
public $atleastoneimage = 0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used).
public $html_images = array();
public $images_encoded = array();
public $image_types = array(
'gif' => 'image/gif',
public $html;
public $image_boundary;
public $atleastoneimage = 0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used).
public $html_images = array();
public $images_encoded = array();
public $image_types = array(
'gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'bmp' => 'image/bmp',
'png' => 'image/png',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
);
'tiff' => 'image/tiff',
);
/**
@ -147,7 +147,7 @@ class CMailFile
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
$this->subject = $subject;
$this->subject = $subject;
$this->addr_to = $to;
$this->addr_from = $from;
$this->msg = $msg;
@ -210,8 +210,8 @@ class CMailFile
}
if (empty($msg))
{
dol_syslog("CMailFile::CMailfile: Try to send an email with empty body");
$msg = '.'; // Avoid empty message (with empty message content, you will see a multipart structure)
dol_syslog("CMailFile::CMailfile: Try to send an email with empty body");
$msg = '.'; // Avoid empty message (with empty message content, you will see a multipart structure)
}
// Detect if message is HTML (use fast method)
@ -291,7 +291,7 @@ class CMailFile
// Add autocopy to (Note: Adding bcc for specific modules are also done from pages)
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
$addr_bcc.=($addr_bcc?', ':'').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
$addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
}
// We set all data according to choosed sending method.
@ -411,40 +411,40 @@ class CMailFile
$this->smtps = $smtps;
} elseif ($this->sendmode == 'swiftmailer') {
// Use Swift Mailer library
$host = dol_getprefix('email');
$host = dol_getprefix('email');
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php';
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php';
// egulias autoloader lib
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/autoload.php';
// egulias autoloader lib
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/autoload.php';
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
// Create the message
//$this->message = Swift_Message::newInstance();
$this->message = new Swift_Message();
//$this->message = new Swift_SignedMessage();
// Adding a trackid header to a message
$headers = $this->message->getHeaders();
$headers->addTextHeader('X-Dolibarr-TRACKID', $this->trackid.'@'.$host);
$this->msgid = time().'.swiftmailer-dolibarr-'.$this->trackid.'@'.$host;
$headerID = $this->msgid;
$msgid = $headers->get('Message-ID');
$msgid->setId($headerID);
$headers->addIdHeader('References', $headerID);
// TODO if (! empty($moreinheader)) ...
// Create the message
//$this->message = Swift_Message::newInstance();
$this->message = new Swift_Message();
//$this->message = new Swift_SignedMessage();
// Adding a trackid header to a message
$headers = $this->message->getHeaders();
$headers->addTextHeader('X-Dolibarr-TRACKID', $this->trackid.'@'.$host);
$this->msgid = time().'.swiftmailer-dolibarr-'.$this->trackid.'@'.$host;
$headerID = $this->msgid;
$msgid = $headers->get('Message-ID');
$msgid->setId($headerID);
$headers->addIdHeader('References', $headerID);
// TODO if (! empty($moreinheader)) ...
// Give the message a subject
try {
$result = $this->message->setSubject($this->subject);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
// Give the message a subject
try {
$result = $this->message->setSubject($this->subject);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
// Set the From address with an associative array
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
if (! empty($this->addr_from)) {
try {
// Set the From address with an associative array
//$this->message->setFrom(array('john@doe.com' => 'John Doe'));
if (! empty($this->addr_from)) {
try {
if (! empty($conf->global->MAIN_FORCE_DISABLE_MAIL_SPOOFING)) {
// Prevent email spoofing for smtp server with a strict configuration
$regexp = '/([a-z0-9_\.\-\+])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,4})+/i'; // This regular expression extracts all emails from a string
@ -459,35 +459,35 @@ class CMailFile
} else {
$result = $this->message->setFrom($this->getArrayAddress($this->addr_from));
}
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}
// Set the To addresses with an associative array
if (! empty($this->addr_to)) {
try {
$result = $this->message->setTo($this->getArrayAddress($this->addr_to));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}
// Set the To addresses with an associative array
if (! empty($this->addr_to)) {
try {
$result = $this->message->setTo($this->getArrayAddress($this->addr_to));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}
if (! empty($this->reply_to)) {
try {
$result = $this->message->SetReplyTo($this->getArrayAddress($this->reply_to));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}
if (! empty($this->reply_to)) {
try {
$result = $this->message->SetReplyTo($this->getArrayAddress($this->reply_to));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}
try {
$result = $this->message->setCharSet($conf->file->character_set_client);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
try {
$result = $this->message->setCharSet($conf->file->character_set_client);
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
if (!empty($this->html)) {
if (!empty($this->html)) {
if (!empty($css)) {
$this->css = $css;
$this->buildCSS();
@ -578,26 +578,26 @@ class CMailFile
$sendingmode = $this->sendmode;
if ($this->context == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail')
{
// List of sending methods
$listofmethods = array();
$listofmethods['mail'] = 'PHP mail function';
//$listofmethods['simplemail']='Simplemail class';
$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
// List of sending methods
$listofmethods = array();
$listofmethods['mail'] = 'PHP mail function';
//$listofmethods['simplemail']='Simplemail class';
$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
// You ensure that every user is using its own SMTP server when using the mass emailing module.
$linktoadminemailbefore = '<a href="'.DOL_URL_ROOT.'/admin/mails.php">';
$linktoadminemailend = '</a>';
$this->error = $langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]);
$this->errors[] = $langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]);
$this->error .= '<br>'.$langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']);
$this->errors[] = $langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']);
if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS))
{
$this->error .= '<br>'.$langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS);
$this->errors[] = $langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS);
}
return false;
// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
// You ensure that every user is using its own SMTP server when using the mass emailing module.
$linktoadminemailbefore = '<a href="'.DOL_URL_ROOT.'/admin/mails.php">';
$linktoadminemailend = '</a>';
$this->error = $langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]);
$this->errors[] = $langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]);
$this->error .= '<br>'.$langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']);
$this->errors[] = $langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']);
if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS))
{
$this->error .= '<br>'.$langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS);
$this->errors[] = $langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS);
}
return false;
}
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
@ -828,9 +828,9 @@ class CMailFile
}
} elseif ($this->sendmode == 'swiftmailer')
{
// Use Swift Mailer library
// ------------------------------------------
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
// Use Swift Mailer library
// ------------------------------------------
require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php';
// Clean parameters
if (empty($conf->global->$keyforsmtpserver)) $conf->global->$keyforsmtpserver = ini_get('SMTP');
@ -849,22 +849,22 @@ class CMailFile
//$smtps->_msgReplyTo = 'reply@web.com';
// Switch content encoding to base64 - avoid the doubledot issue with quoted-printable
$contentEncoderBase64 = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
$this->message->setEncoder($contentEncoderBase64);
$contentEncoderBase64 = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
$this->message->setEncoder($contentEncoderBase64);
// Create the Mailer using your created Transport
$this->mailer = new Swift_Mailer($this->transport);
// DKIM SIGN
if ($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED) {
$privateKey = $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY;
$domainName = $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
$selector = $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
$signer = new Swift_Signers_DKIMSigner($privateKey, $domainName, $selector);
$this->message->attachSigner($signer->ignoreHeader('Return-Path'));
}
// DKIM SIGN
if ($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED) {
$privateKey = $conf->global->MAIN_MAIL_EMAIL_DKIM_PRIVATE_KEY;
$domainName = $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
$selector = $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
$signer = new Swift_Signers_DKIMSigner($privateKey, $domainName, $selector);
$this->message->attachSigner($signer->ignoreHeader('Return-Path'));
}
if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
// To use the ArrayLogger
$this->logger = new Swift_Plugins_Loggers_ArrayLogger();
// Or to use the Echo Logger
@ -924,7 +924,7 @@ class CMailFile
return '=?'.$conf->file->character_set_client.'?B?'.base64_encode($stringtoencode).'?=';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Read a file on disk and return encoded content for emails (mode = 'mail')
*
@ -933,7 +933,7 @@ class CMailFile
*/
private function _encode_file($sourcefile)
{
// phpcs:enable
// phpcs:enable
$newsourcefile = dol_osencode($sourcefile);
if (is_readable($newsourcefile))
@ -949,7 +949,7 @@ class CMailFile
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Write content of a SMTP request into a dump file (mode = all)
* Used for debugging.
@ -959,7 +959,7 @@ class CMailFile
*/
public function dump_mail()
{
// phpcs:enable
// phpcs:enable
global $conf, $dolibarr_main_data_root;
if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir
@ -1040,7 +1040,7 @@ class CMailFile
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create SMTP headers (mode = 'mail')
*
@ -1048,7 +1048,7 @@ class CMailFile
*/
public function write_smtpheaders()
{
// phpcs:enable
// phpcs:enable
global $conf;
$out = "";
@ -1104,7 +1104,7 @@ class CMailFile
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create header MIME (mode = 'mail')
*
@ -1114,7 +1114,7 @@ class CMailFile
*/
public function write_mimeheaders($filename_list, $mimefilename_list)
{
// phpcs:enable
// phpcs:enable
$mimedone = 0;
$out = "";
@ -1135,7 +1135,7 @@ class CMailFile
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return email content (mode = 'mail')
*
@ -1144,7 +1144,7 @@ class CMailFile
*/
public function write_body($msgtext)
{
// phpcs:enable
// phpcs:enable
global $conf;
$out = '';
@ -1235,7 +1235,7 @@ class CMailFile
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Attach file to email (mode = 'mail')
*
@ -1246,7 +1246,7 @@ class CMailFile
*/
public function write_files($filename_list, $mimetype_list, $mimefilename_list)
{
// phpcs:enable
// phpcs:enable
$out = '';
$filename_list_size = count($filename_list);
@ -1282,7 +1282,7 @@ class CMailFile
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Attach an image to email (mode = 'mail')
*
@ -1291,7 +1291,7 @@ class CMailFile
*/
public function write_images($images_list)
{
// phpcs:enable
// phpcs:enable
$out = '';
if (is_array($images_list))
@ -1315,7 +1315,7 @@ class CMailFile
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Try to create a socket connection
*
@ -1325,7 +1325,7 @@ class CMailFile
*/
public function check_server_port($host, $port)
{
// phpcs:enable
// phpcs:enable
global $conf;
$_retVal = 0;
@ -1356,7 +1356,7 @@ class CMailFile
dol_syslog("Try socket connection to host=".$host." port=".$port);
//See if we can connect to the SMTP server
if ($socket = @fsockopen(
if ($socket = @fsockopen(
$host, // Host to test, IP or domain. Add ssl:// for SSL/TLS.
$port, // which Port number to use
$errno, // actual system level error
@ -1377,7 +1377,7 @@ class CMailFile
return $_retVal;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* This function has been modified as provided by SirSir to allow multiline responses when
* using SMTP Extensions.
@ -1388,7 +1388,7 @@ class CMailFile
*/
public function server_parse($socket, $response)
{
// phpcs:enable
// phpcs:enable
$_retVal = true; // Indicates if Object was created or not
$server_response = '';
@ -1512,8 +1512,8 @@ class CMailFile
* If format 2: 'john@doe.com'
* If format 3: '<john@doe.com>' or '"John Doe" <john@doe.com>' or '"=?UTF-8?B?Sm9obiBEb2U=?=" <john@doe.com>'
* If format 4: 'John Doe' or 'john@doe.com' if no label exists
* If format 5: <a href="mailto:john@doe.com">John Doe</a> or <a href="mailto:john@doe.com">john@doe.com</a> if no label exists
* @see getArrayAddress()
* If format 5: <a href="mailto:john@doe.com">John Doe</a> or <a href="mailto:john@doe.com">john@doe.com</a> if no label exists
* @see getArrayAddress()
*/
public static function getValidAddress($address, $format, $encode = 0, $maxnumberofemail = 0)
{
@ -1541,10 +1541,10 @@ class CMailFile
$i++;
$newemail = '';
if ($format == 5) {
$newemail = $name ? $name : $email;
$newemail = '<a href="mailto:'.$email.'">'.$newemail.'</a>';
}
if ($format == 5) {
$newemail = $name ? $name : $email;
$newemail = '<a href="mailto:'.$email.'">'.$newemail.'</a>';
}
if ($format == 4)
{
$newemail = $name ? $name : $email;

File diff suppressed because it is too large Load Diff

View File

@ -269,10 +269,10 @@ class CoreObject extends CommonObject
/**
* Function to create object in database
*
* @param User $user user object
* @param User $user User object
* @return int < 0 if KO, > 0 if OK
*/
public function create(User &$user)
public function create(User $user)
{
if ($this->id > 0) return $this->update($user);

View File

@ -1231,7 +1231,7 @@ class ExtraFields
} else {
if (!$notrans) {
$translabel = $langs->trans($obj->{$InfoFieldList[1]});
$labeltoshow = dol_trunc($translabel, 18);
$labeltoshow =$translabel;
}
if (empty($labeltoshow)) $labeltoshow = '(not defined)';

File diff suppressed because it is too large Load Diff

View File

@ -29,58 +29,58 @@
*/
class FormActions
{
/**
* @var DoliDB Database handler.
*/
public $db;
/**
* @var DoliDB Database handler.
*/
public $db;
/**
/**
* @var string Error code (or message)
*/
public $error = '';
/**
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
$this->db = $db;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show list of action status
*
* @param string $formname Name of form where select is included
* @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 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)
* @param string $morecss More css on select field
* @return void
*/
public function form_select_status_action($formname, $selected, $canedit = 1, $htmlname = 'complete', $showempty = 0, $onlyselect = 0, $morecss = 'maxwidth100')
{
// phpcs:enable
global $langs, $conf;
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show list of action status
*
* @param string $formname Name of form where select is included
* @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 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)
* @param string $morecss More css on select field
* @return void
*/
public function form_select_status_action($formname, $selected, $canedit = 1, $htmlname = 'complete', $showempty = 0, $onlyselect = 0, $morecss = 'maxwidth100')
{
// phpcs:enable
global $langs, $conf;
$listofstatus = array(
'-1' => $langs->trans("ActionNotApplicable"),
'0' => $langs->trans("ActionsToDoShort"),
'50' => $langs->trans("ActionRunningShort"),
'100' => $langs->trans("ActionDoneShort")
);
$listofstatus = array(
'-1' => $langs->trans("ActionNotApplicable"),
'0' => $langs->trans("ActionsToDoShort"),
'50' => $langs->trans("ActionRunningShort"),
'100' => $langs->trans("ActionDoneShort")
);
// +ActionUncomplete
if (!empty($conf->use_javascript_ajax))
{
print "\n";
print "<script type=\"text/javascript\">
if (!empty($conf->use_javascript_ajax))
{
print "\n";
print "<script type=\"text/javascript\">
var htmlname = '".$htmlname."';
$(document).ready(function () {
@ -124,142 +124,142 @@ class FormActions
}
}
</script>\n";
}
if (!empty($conf->use_javascript_ajax) || $onlyselect)
{
//var_dump($selected);
if ($selected == 'done') $selected = '100';
print '<select '.($canedit ? '' : 'disabled ').'name="'.$htmlname.'" id="select'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'">';
if ($showempty) print '<option value=""'.($selected == '' ? ' selected' : '').'></option>';
foreach ($listofstatus as $key => $val)
{
print '<option value="'.$key.'"'.(($selected == $key && strlen($selected) == strlen($key)) || (($selected > 0 && $selected < 100) && $key == '50') ? ' selected' : '').'>'.$val.'</option>';
if ($key == '50' && $onlyselect == 2)
{
print '<option value="todo"'.($selected == 'todo' ? ' selected' : '').'>'.$langs->trans("ActionUncomplete").' ('.$langs->trans("ActionsToDoShort")."+".$langs->trans("ActionRunningShort").')</option>';
}
}
print '</select>';
if ($selected == 0 || $selected == 100) $canedit = 0;
if (empty($onlyselect))
{
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat hideifna" value="'.($selected >= 0 ? $selected : '').'" size="2"'.($canedit && ($selected >= 0) ? '' : ' disabled').'>';
print '<span class="hideonsmartphone hideifna">%</span>';
}
} else {
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat" value="'.($selected >= 0 ? $selected : '').'" size="2"'.($canedit ? '' : ' disabled').'>%';
}
}
/**
* Show list of actions for element
*
* @param Object $object Object
* @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
* @param int $max Max number of record
* @param string $moreparambacktopage More param for the backtopage
* @param string $morehtmlcenter More html text on center of title line
* @return int <0 if KO, >=0 if OK
*/
public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0, $morecss = 'listactions', $max = 0, $moreparambacktopage = '', $morehtmlcenter = '')
{
global $langs, $conf, $user;
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$sortfield = 'a.datep,a.id';
$sortorder = 'DESC,DESC';
$listofactions = ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max ? ($max + 1) : 0));
if (!is_array($listofactions)) dol_print_error($this->db, 'FailedToGetActions');
$num = count($listofactions);
if ($num || $forceshowtitle)
{
if ($typeelement == 'invoice') $title = $langs->trans('ActionsOnBill');
elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') $title = $langs->trans('ActionsOnBill');
elseif ($typeelement == 'propal') $title = $langs->trans('ActionsOnPropal');
elseif ($typeelement == 'supplier_proposal') $title = $langs->trans('ActionsOnSupplierProposal');
elseif ($typeelement == 'order') $title = $langs->trans('ActionsOnOrder');
elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') $title = $langs->trans('ActionsOnOrder');
elseif ($typeelement == 'shipping') $title = $langs->trans('ActionsOnShipping');
elseif ($typeelement == 'fichinter') $title = $langs->trans('ActionsOnFicheInter');
elseif ($typeelement == 'project') $title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
elseif ($typeelement == 'task') $title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
elseif ($typeelement == 'member') $title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
else $title = $langs->trans("LatestLinkedEvents", $max ? $max : '');
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id.($moreparambacktopage ? '&'.$moreparambacktopage : '');
$projectid = $object->fk_project;
if ($typeelement == 'project') $projectid = $object->id;
$newcardbutton = '';
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create))
}
if (!empty($conf->use_javascript_ajax) || $onlyselect)
{
//var_dump($selected);
if ($selected == 'done') $selected = '100';
print '<select '.($canedit ? '' : 'disabled ').'name="'.$htmlname.'" id="select'.$htmlname.'" class="flat'.($morecss ? ' '.$morecss : '').'">';
if ($showempty) print '<option value=""'.($selected == '' ? ' selected' : '').'></option>';
foreach ($listofstatus as $key => $val)
{
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage));
print '<option value="'.$key.'"'.(($selected == $key && strlen($selected) == strlen($key)) || (($selected > 0 && $selected < 100) && $key == '50') ? ' selected' : '').'>'.$val.'</option>';
if ($key == '50' && $onlyselect == 2)
{
print '<option value="todo"'.($selected == 'todo' ? ' selected' : '').'>'.$langs->trans("ActionUncomplete").' ('.$langs->trans("ActionsToDoShort")."+".$langs->trans("ActionRunningShort").')</option>';
}
}
print '</select>';
if ($selected == 0 || $selected == 100) $canedit = 0;
if (empty($onlyselect))
{
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat hideifna" value="'.($selected >= 0 ? $selected : '').'" size="2"'.($canedit && ($selected >= 0) ? '' : ' disabled').'>';
print '<span class="hideonsmartphone hideifna">%</span>';
}
} else {
print ' <input type="text" id="val'.$htmlname.'" name="percentage" class="flat" value="'.($selected >= 0 ? $selected : '').'" size="2"'.($canedit ? '' : ' disabled').'>%';
}
}
/**
* Show list of actions for element
*
* @param Object $object Object
* @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
* @param int $max Max number of record
* @param string $moreparambacktopage More param for the backtopage
* @param string $morehtmlcenter More html text on center of title line
* @return int <0 if KO, >=0 if OK
*/
public function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0, $morecss = 'listactions', $max = 0, $moreparambacktopage = '', $morehtmlcenter = '')
{
global $langs, $conf, $user;
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$sortfield = 'a.datep,a.id';
$sortorder = 'DESC,DESC';
$listofactions = ActionComm::getActions($this->db, $socid, $object->id, $typeelement, '', $sortfield, $sortorder, ($max ? ($max + 1) : 0));
if (!is_array($listofactions)) dol_print_error($this->db, 'FailedToGetActions');
$num = count($listofactions);
if ($num || $forceshowtitle)
{
if ($typeelement == 'invoice') $title = $langs->trans('ActionsOnBill');
elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') $title = $langs->trans('ActionsOnBill');
elseif ($typeelement == 'propal') $title = $langs->trans('ActionsOnPropal');
elseif ($typeelement == 'supplier_proposal') $title = $langs->trans('ActionsOnSupplierProposal');
elseif ($typeelement == 'order') $title = $langs->trans('ActionsOnOrder');
elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') $title = $langs->trans('ActionsOnOrder');
elseif ($typeelement == 'shipping') $title = $langs->trans('ActionsOnShipping');
elseif ($typeelement == 'fichinter') $title = $langs->trans('ActionsOnFicheInter');
elseif ($typeelement == 'project') $title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
elseif ($typeelement == 'task') $title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
elseif ($typeelement == 'member') $title = $langs->trans('LatestLinkedEvents', $max ? $max : '');
else $title = $langs->trans("LatestLinkedEvents", $max ? $max : '');
$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id.($moreparambacktopage ? '&'.$moreparambacktopage : '');
$projectid = $object->fk_project;
if ($typeelement == 'project') $projectid = $object->id;
$newcardbutton = '';
if (!empty($conf->agenda->enabled) && !empty($user->rights->agenda->myactions->create))
{
$newcardbutton .= dolGetButtonTitle($langs->trans("AddEvent"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(), 'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid > 0 ? '&socid='.$object->socid : ($socid > 0 ? '&socid='.$socid : '')).($projectid > 0 ? '&projectid='.$projectid : '').'&backtopage='.urlencode($urlbacktopage));
}
print '<!-- formactions->showactions -->'."\n";
print load_fiche_titre($title, $newcardbutton, '', 0, 0, '', $morehtmlcenter);
print '<!-- formactions->showactions -->'."\n";
print load_fiche_titre($title, $newcardbutton, '', 0, 0, '', $morehtmlcenter);
$page = 0; $param = '';
$page = 0; $param = '';
print '<div class="div-table-responsive-no-min">';
print '<table class="centpercent noborder'.($morecss ? ' '.$morecss : '').'">';
print '<tr class="liste_titre">';
print getTitleFieldOfList('Ref', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('By', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Type', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Title', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', $page, $param, '', $sortfield, $sortorder, 'center ', 1);
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, 'right ', 1);
print '</tr>';
print "\n";
print '<div class="div-table-responsive-no-min">';
print '<table class="centpercent noborder'.($morecss ? ' '.$morecss : '').'">';
print '<tr class="liste_titre">';
print getTitleFieldOfList('Ref', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('By', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Type', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Title', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, '', 1);
print getTitleFieldOfList('Date', 0, $_SERVER["PHP_SELF"], 'a.datep', $page, $param, '', $sortfield, $sortorder, 'center ', 1);
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', $page, $param, '', $sortfield, $sortorder, 'right ', 1);
print '</tr>';
print "\n";
if (is_array($listofactions) && count($listofactions))
{
$cacheusers = array();
if (is_array($listofactions) && count($listofactions))
{
$cacheusers = array();
$cursorevent = 0;
foreach ($listofactions as $actioncomm)
{
if ($max && $cursorevent >= $max) break;
$cursorevent = 0;
foreach ($listofactions as $actioncomm)
{
if ($max && $cursorevent >= $max) break;
$ref = $actioncomm->getNomUrl(1, -1);
$label = $actioncomm->getNomUrl(0, 38);
$ref = $actioncomm->getNomUrl(1, -1);
$label = $actioncomm->getNomUrl(0, 38);
print '<tr class="oddeven">';
// Ref
print '<tr class="oddeven">';
// Ref
print '<td class="nowraponall">'.$ref.'</td>';
// Onwer
print '<td class="tdoverflowmax150">';
if (!empty($actioncomm->userownerid))
{
if (is_object($cacheusers[$actioncomm->userownerid]))
{
$tmpuser = $cacheusers[$actioncomm->userownerid];
} else {
$tmpuser = new User($this->db);
$tmpuser->fetch($actioncomm->userownerid);
$cacheusers[$actioncomm->userownerid] = $tmpuser;
}
if ($tmpuser->id > 0)
{
print $tmpuser->getNomUrl(-1, '', 0, 0, 16, 0, 'firstelselast', '');
}
}
print '</td>';
print '<td class="tdoverflowmax150">';
if (!empty($actioncomm->userownerid))
{
if (is_object($cacheusers[$actioncomm->userownerid]))
{
$tmpuser = $cacheusers[$actioncomm->userownerid];
} else {
$tmpuser = new User($this->db);
$tmpuser->fetch($actioncomm->userownerid);
$cacheusers[$actioncomm->userownerid] = $tmpuser;
}
if ($tmpuser->id > 0)
{
print $tmpuser->getNomUrl(-1, '', 0, 0, 16, 0, 'firstelselast', '');
}
}
print '</td>';
// Type
print '<td>';
// TODO Code common with code into comm/action/list.php
print '<td>';
// TODO Code common with code into comm/action/list.php
$imgpicto = '';
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
@ -281,100 +281,100 @@ class FormActions
} else {
print $actioncomm->type_short ? $actioncomm->type_short : $actioncomm->type;
}
print '</td>';
// Label
print '<td>'.$label.'</td>';
// Date
print '<td class="center">'.dol_print_date($actioncomm->datep, 'dayhour', 'tzuserrel');
if ($actioncomm->datef)
{
$tmpa = dol_getdate($actioncomm->datep);
$tmpb = dol_getdate($actioncomm->datef);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year'])
{
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) print '-'.dol_print_date($actioncomm->datef, 'hour', 'tzuserrel');
} else print '-'.dol_print_date($actioncomm->datef, 'dayhour', 'tzuserrel');
}
print '</td>';
print '<td class="right">';
print $actioncomm->getLibStatut(3);
print '</td>';
print '</tr>';
print '</td>';
// Label
print '<td>'.$label.'</td>';
// Date
print '<td class="center">'.dol_print_date($actioncomm->datep, 'dayhour', 'tzuserrel');
if ($actioncomm->datef)
{
$tmpa = dol_getdate($actioncomm->datep);
$tmpb = dol_getdate($actioncomm->datef);
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year'])
{
if ($tmpa['hours'] != $tmpb['hours'] || $tmpa['minutes'] != $tmpb['minutes'] && $tmpa['seconds'] != $tmpb['seconds']) print '-'.dol_print_date($actioncomm->datef, 'hour', 'tzuserrel');
} else print '-'.dol_print_date($actioncomm->datef, 'dayhour', 'tzuserrel');
}
print '</td>';
print '<td class="right">';
print $actioncomm->getLibStatut(3);
print '</td>';
print '</tr>';
$cursorevent++;
}
} else {
print '<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$cursorevent++;
}
} else {
print '<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
if ($max && $num > $max)
{
print '<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans("More").'...</td></tr>';
}
if ($max && $num > $max)
{
print '<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans("More").'...</td></tr>';
}
print '</table>';
print '</div>';
}
print '</table>';
print '</div>';
}
return $num;
}
return $num;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output html select list of type of event
*
* @param array|string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx'). Can be an array too.
* @param string $htmlname Name of select field
* @param string $excludetype A type to exclude ('systemauto', 'system', '')
* @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual"
* @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
* @param int $nooutput 1=No output
* @param string $morecss More css to add to SELECT component.
* @return string
*/
public function select_type_actions($selected = '', $htmlname = 'actioncode', $excludetype = '', $onlyautoornot = 0, $hideinfohelp = 0, $multiselect = 0, $nooutput = 0, $morecss = '')
{
// phpcs:enable
global $langs, $user, $form, $conf;
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output html select list of type of event
*
* @param array|string $selected Type pre-selected (can be 'manual', 'auto' or 'AC_xxx'). Can be an array too.
* @param string $htmlname Name of select field
* @param string $excludetype A type to exclude ('systemauto', 'system', '')
* @param integer $onlyautoornot 1=Group all type AC_XXX into 1 line AC_MANUAL. 0=Keep details of type, -1=Keep details and add a combined line "All manual"
* @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
* @param int $nooutput 1=No output
* @param string $morecss More css to add to SELECT component.
* @return string
*/
public function select_type_actions($selected = '', $htmlname = 'actioncode', $excludetype = '', $onlyautoornot = 0, $hideinfohelp = 0, $multiselect = 0, $nooutput = 0, $morecss = '')
{
// phpcs:enable
global $langs, $user, $form, $conf;
if (!is_object($form)) $form = new Form($this->db);
if (!is_object($form)) $form = new Form($this->db);
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$caction = new CActionComm($this->db);
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
$caction = new CActionComm($this->db);
// Suggest a list with manual events or all auto events
$arraylist = $caction->liste_array(1, 'code', $excludetype, $onlyautoornot);
if (empty($multiselect)) {
// Add empty line at start only if no multiselect
array_unshift($arraylist, '&nbsp;');
}
//asort($arraylist);
// Suggest a list with manual events or all auto events
$arraylist = $caction->liste_array(1, 'code', $excludetype, $onlyautoornot);
if (empty($multiselect)) {
// Add empty line at start only if no multiselect
array_unshift($arraylist, '&nbsp;');
}
//asort($arraylist);
if ($selected == 'manual') $selected = 'AC_OTH';
if ($selected == 'auto') $selected = 'AC_OTH_AUTO';
if ($selected == 'manual') $selected = 'AC_OTH';
if ($selected == 'auto') $selected = 'AC_OTH_AUTO';
if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO)) unset($arraylist['AC_OTH_AUTO']);
if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO)) unset($arraylist['AC_OTH_AUTO']);
$out = '';
$out = '';
if (!empty($multiselect))
{
if (!is_array($selected) && !empty($selected)) $selected = explode(',', $selected);
if (!is_array($selected) && !empty($selected)) $selected = explode(',', $selected);
$out .= $form->multiselectarray($htmlname, $arraylist, $selected, 0, 0, 'centpercent', 0, 0);
} else {
$out .= $form->selectarray($htmlname, $arraylist, $selected, 0, 0, 0, '', 0, 0, 0, '', 'minwidth200'.($morecss ? ' '.$morecss : ''), 1);
}
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0)
{
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup").($hideinfohelp == -1 ? ". ".$langs->trans("YouCanSetDefaultValueInModuleSetup") : ''), 1);
}
if ($user->admin && empty($onlyautoornot) && $hideinfohelp <= 0)
{
$out .= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup").($hideinfohelp == -1 ? ". ".$langs->trans("YouCanSetDefaultValueInModuleSetup") : ''), 1);
}
if ($nooutput) return $out;
else print $out;
return '';
}
if ($nooutput) return $out;
else print $out;
return '';
}
}

View File

@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
class FormCompany extends Form
{
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of labels (translated) of third parties type
*
@ -50,7 +50,7 @@ class FormCompany extends Form
*/
public function typent_array($mode = 0, $filter = '')
{
// phpcs:enable
// phpcs:enable
global $langs, $mysoc;
$effs = array();
@ -83,7 +83,7 @@ class FormCompany extends Form
return $effs;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie la liste des types d'effectifs possibles (pas de traduction car nombre)
*
@ -93,7 +93,7 @@ class FormCompany extends Form
*/
public function effectif_array($mode = 0, $filter = '')
{
// phpcs:enable
// phpcs:enable
$effs = array();
$sql = "SELECT id, code, libelle";
@ -123,7 +123,7 @@ class FormCompany extends Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Affiche formulaire de selection des modes de reglement
*
@ -135,7 +135,7 @@ class FormCompany extends Form
*/
public function form_prospect_level($page, $selected = '', $htmlname = 'prospect_level_id', $empty = 0)
{
// phpcs:enable
// phpcs:enable
global $user, $langs;
print '<form method="post" action="'.$page.'">';
@ -225,12 +225,12 @@ class FormCompany extends Form
print '</form>';
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
* In the case of an all-country list, the display breaks on the country.
* The key of the list is the code (there can be several entries for a given code but in this case, the country field differs).
* Thus the links with the departments are done on a department independently of its name.
* In the case of an all-country list, the display breaks on the country.
* The key of the list is the code (there can be several entries for a given code but in this case, the country field differs).
* Thus the links with the departments are done on a department independently of its name.
*
* @param string $selected Code state preselected
* @param int $country_codeid 0=list for all countries, otherwise country code or country rowid to show
@ -239,16 +239,16 @@ class FormCompany extends Form
*/
public function select_departement($selected = '', $country_codeid = 0, $htmlname = 'state_id')
{
// phpcs:enable
// phpcs:enable
print $this->select_state($selected, $country_codeid, $htmlname);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
* In the case of an all-country list, the display breaks on the country.
* The key of the list is the code (there can be several entries for a given code but in this case, the country field differs).
* Thus the links with the departments are done on a department independently of its name.
* In the case of an all-country list, the display breaks on the country.
* The key of the list is the code (there can be several entries for a given code but in this case, the country field differs).
* Thus the links with the departments are done on a department independently of its name.
*
* @param int $selected Code state preselected (mus be state id)
* @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
@ -258,7 +258,7 @@ class FormCompany extends Form
*/
public function select_state($selected = 0, $country_codeid = 0, $htmlname = 'state_id')
{
// phpcs:enable
// phpcs:enable
global $conf, $langs, $user;
dol_syslog(get_class($this)."::select_departement selected=".$selected.", country_codeid=".$country_codeid, LOG_DEBUG);
@ -349,7 +349,7 @@ class FormCompany extends Form
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne la liste deroulante des regions actives dont le pays est actif
* La cle de la liste est le code (il peut y avoir plusieurs entree pour
@ -362,7 +362,7 @@ class FormCompany extends Form
*/
public function select_region($selected = '', $htmlname = 'region_id')
{
// phpcs:enable
// phpcs:enable
global $conf, $langs;
$langs->load("dict");
@ -412,7 +412,7 @@ class FormCompany extends Form
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return combo list with people title
*
@ -424,7 +424,7 @@ class FormCompany extends Form
*/
public function select_civility($selected = '', $htmlname = 'civility_id', $morecss = 'maxwidth150', $addjscombo = 0)
{
// phpcs:enable
// phpcs:enable
global $conf, $langs, $user;
$langs->load("dict");
@ -473,7 +473,7 @@ class FormCompany extends Form
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne.
* Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays.
@ -487,25 +487,25 @@ class FormCompany extends Form
*/
public function select_forme_juridique($selected = '', $country_codeid = 0, $filter = '')
{
// phpcs:enable
// phpcs:enable
print $this->select_juridicalstatus($selected, $country_codeid, $filter);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne.
* Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays
*
* @param string $selected Preselected code of juridical type
* @param int $country_codeid 0=list for all countries, otherwise list only country requested
* @param string $filter Add a SQL filter on list
* @param string $htmlname HTML name of select
* @param string $morecss More CSS
* @return string String with HTML select
* @param string $filter Add a SQL filter on list
* @param string $htmlname HTML name of select
* @param string $morecss More CSS
* @return string String with HTML select
*/
public function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code', $morecss = '')
{
// phpcs:enable
// phpcs:enable
global $conf, $langs, $user;
$langs->load("dict");
@ -578,9 +578,9 @@ class FormCompany extends Form
$out .= '</select>';
if ($user->admin) $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
// Make select dynamic
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
// Make select dynamic
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
$out .= '</div>';
} else {
@ -600,8 +600,8 @@ class FormCompany extends Form
* @param string $htmlname Name of HTML form
* @param array $limitto Disable answers that are not id in this array list
* @param int $forceid This is to force another object id than object->id
* @param string $moreparam String with more param to add into url when noajax search is used.
* @param string $morecss More CSS on select component
* @param string $moreparam String with more param to add into url when noajax search is used.
* @param string $morecss More CSS on select component
* @return int The selected third party ID
*/
public function selectCompaniesForNewContact($object, $var_id, $selected = '', $htmlname = 'newcompany', $limitto = '', $forceid = 0, $moreparam = '', $morecss = '')
@ -746,21 +746,21 @@ class FormCompany extends Form
}
}
/**
* Return a select list with types of contacts
*
* @param object $object Object to use to find type of contact
* @param string $selected Default selected value
* @param string $htmlname HTML select name
* @param string $source Source ('internal' or 'external')
* @param string $sortorder Sort criteria ('position', 'code', ...)
* @param int $showempty 1=Add en empty line
* @param string $morecss Add more css to select component
* @return void
*/
public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '')
/**
* Return a select list with types of contacts
*
* @param object $object Object to use to find type of contact
* @param string $selected Default selected value
* @param string $htmlname HTML select name
* @param string $source Source ('internal' or 'external')
* @param string $sortorder Sort criteria ('position', 'code', ...)
* @param int $showempty 1=Add en empty line
* @param string $morecss Add more css to select component
* @return void
*/
public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '')
{
global $user, $langs;
global $user, $langs;
if (is_object($object) && method_exists($object, 'liste_type_contact'))
{
@ -822,7 +822,7 @@ class FormCompany extends Form
return 'ErrorBadValueForParameterRenderMode'; // Should not happened
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a select list with zip codes and their town
*
@ -837,7 +837,7 @@ class FormCompany extends Form
*/
public function select_ziptown($selected = '', $htmlname = 'zipcode', $fields = '', $fieldsize = 0, $disableautocomplete = 0, $moreattrib = '', $morecss = '')
{
// phpcs:enable
// phpcs:enable
global $conf;
$out = '';
@ -855,155 +855,155 @@ class FormCompany extends Form
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return HTML string to use as input of professional id into a HTML page (siren, siret, etc...)
*
* @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm)
* @param string $htmlname Name of HTML select
* @param string $preselected Default value to show
* @param string $country_code FR, IT, ...
* @param string $morecss More css
* @return string HTML string with prof id
*/
public function get_input_id_prof($idprof, $htmlname, $preselected, $country_code, $morecss = 'maxwidth100onsmartphone quatrevingtpercent')
{
// phpcs:enable
global $conf, $langs, $hookmanager;
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return HTML string to use as input of professional id into a HTML page (siren, siret, etc...)
*
* @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm)
* @param string $htmlname Name of HTML select
* @param string $preselected Default value to show
* @param string $country_code FR, IT, ...
* @param string $morecss More css
* @return string HTML string with prof id
*/
public function get_input_id_prof($idprof, $htmlname, $preselected, $country_code, $morecss = 'maxwidth100onsmartphone quatrevingtpercent')
{
// phpcs:enable
global $conf, $langs, $hookmanager;
$formlength = 0;
if (empty($conf->global->MAIN_DISABLEPROFIDRULES)) {
if ($country_code == 'FR')
{
if (isset($idprof)) {
if ($idprof == 1) $formlength = 9;
elseif ($idprof == 2) $formlength = 14;
elseif ($idprof == 3) $formlength = 5; // 4 chiffres et 1 lettre depuis janvier
elseif ($idprof == 4) $formlength = 32; // No maximum as we need to include a town name in this id
}
} elseif ($country_code == 'ES')
{
if ($idprof == 1) $formlength = 9; //CIF/NIF/NIE 9 digits
if ($idprof == 2) $formlength = 12; //NASS 12 digits without /
if ($idprof == 3) $formlength = 5; //CNAE 5 digits
if ($idprof == 4) $formlength = 32; //depend of college
}
}
$formlength = 0;
if (empty($conf->global->MAIN_DISABLEPROFIDRULES)) {
if ($country_code == 'FR')
{
if (isset($idprof)) {
if ($idprof == 1) $formlength = 9;
elseif ($idprof == 2) $formlength = 14;
elseif ($idprof == 3) $formlength = 5; // 4 chiffres et 1 lettre depuis janvier
elseif ($idprof == 4) $formlength = 32; // No maximum as we need to include a town name in this id
}
} elseif ($country_code == 'ES')
{
if ($idprof == 1) $formlength = 9; //CIF/NIF/NIE 9 digits
if ($idprof == 2) $formlength = 12; //NASS 12 digits without /
if ($idprof == 3) $formlength = 5; //CNAE 5 digits
if ($idprof == 4) $formlength = 32; //depend of college
}
}
$selected = $preselected;
if (!$selected && isset($idprof)) {
if ($idprof == 1 && !empty($this->idprof1)) $selected = $this->idprof1;
elseif ($idprof == 2 && !empty($this->idprof2)) $selected = $this->idprof2;
elseif ($idprof == 3 && !empty($this->idprof3)) $selected = $this->idprof3;
elseif ($idprof == 4 && !empty($this->idprof4)) $selected = $this->idprof4;
}
$selected = $preselected;
if (!$selected && isset($idprof)) {
if ($idprof == 1 && !empty($this->idprof1)) $selected = $this->idprof1;
elseif ($idprof == 2 && !empty($this->idprof2)) $selected = $this->idprof2;
elseif ($idprof == 3 && !empty($this->idprof3)) $selected = $this->idprof3;
elseif ($idprof == 4 && !empty($this->idprof4)) $selected = $this->idprof4;
}
$maxlength = $formlength;
if (empty($formlength)) { $formlength = 24; $maxlength = 128; }
$maxlength = $formlength;
if (empty($formlength)) { $formlength = 24; $maxlength = 128; }
$out = '';
$out = '';
// Execute hook getInputIdProf to complete or replace $out
$parameters = array('formlength'=>$formlength, 'selected'=>$preselected, 'idprof'=>$idprof, 'htmlname'=>$htmlname, 'country_code'=>$country_code);
$reshook = $hookmanager->executeHooks('getInputIdProf', $parameters);
if (empty($reshook))
{
$out .= '<input type="text" '.($morecss ? 'class="'.$morecss.'" ' : '').'name="'.$htmlname.'" id="'.$htmlname.'" maxlength="'.$maxlength.'" value="'.$selected.'">';
}
$out .= $hookmanager->resPrint;
// Execute hook getInputIdProf to complete or replace $out
$parameters = array('formlength'=>$formlength, 'selected'=>$preselected, 'idprof'=>$idprof, 'htmlname'=>$htmlname, 'country_code'=>$country_code);
$reshook = $hookmanager->executeHooks('getInputIdProf', $parameters);
if (empty($reshook))
{
$out .= '<input type="text" '.($morecss ? 'class="'.$morecss.'" ' : '').'name="'.$htmlname.'" id="'.$htmlname.'" maxlength="'.$maxlength.'" value="'.$selected.'">';
}
$out .= $hookmanager->resPrint;
return $out;
}
return $out;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a HTML select with localtax values for thirdparties
*
* @param int $local LocalTax
* @param int $selected Preselected value
* @param string $htmlname HTML select name
* @return void
*/
public function select_localtax($local, $selected, $htmlname)
{
// phpcs:enable
$tax = get_localtax_by_third($local);
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a HTML select with localtax values for thirdparties
*
* @param int $local LocalTax
* @param int $selected Preselected value
* @param string $htmlname HTML select name
* @return void
*/
public function select_localtax($local, $selected, $htmlname)
{
// phpcs:enable
$tax = get_localtax_by_third($local);
$num = $this->db->num_rows($tax);
$i = 0;
if ($num)
{
$valors = explode(":", $tax);
$num = $this->db->num_rows($tax);
$i = 0;
if ($num)
{
$valors = explode(":", $tax);
if (count($valors) > 1)
{
//montar select
print '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
while ($i <= (count($valors)) - 1)
{
if ($selected == $valors[$i])
{
print '<option value="'.$valors[$i].'" selected>';
} else {
print '<option value="'.$valors[$i].'">';
}
print $valors[$i];
print '</option>';
$i++;
}
print'</select>';
}
}
}
if (count($valors) > 1)
{
//montar select
print '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
while ($i <= (count($valors)) - 1)
{
if ($selected == $valors[$i])
{
print '<option value="'.$valors[$i].'" selected>';
} else {
print '<option value="'.$valors[$i].'">';
}
print $valors[$i];
print '</option>';
$i++;
}
print'</select>';
}
}
}
/**
* Return a HTML select for thirdparty type
*
* @param int $selected selected value
* @param string $htmlname HTML select name
* @param string $htmlidname HTML select id
* @param string $typeinput HTML output
* @param string $morecss More css
* @return string HTML string
*/
public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '')
{
/**
* Return a HTML select for thirdparty type
*
* @param int $selected selected value
* @param string $htmlname HTML select name
* @param string $htmlidname HTML select id
* @param string $typeinput HTML output
* @param string $morecss More css
* @return string HTML string
*/
public function selectProspectCustomerType($selected, $htmlname = 'client', $htmlidname = 'customerprospect', $typeinput = 'form', $morecss = '')
{
global $conf, $langs;
global $conf, $langs;
$out = '<select class="flat '.$morecss.'" name="'.$htmlname.'" id="'.$htmlidname.'">';
if ($typeinput == 'form') {
if ($selected == '' || $selected == '-1') $out .= '<option value="-1">&nbsp;</option>';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
$out .= '<option value="2"'.($selected == 2 ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
}
$out .= '<option value="0"'.((string) $selected == '0' ? ' selected' : '').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
} elseif ($typeinput == 'list') {
$out .= '<option value="-1"'.(($selected == '' || $selected == '-1') ? ' selected' : '').'>&nbsp;</option>';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
$out .= '<option value="2,3"'.($selected == '2,3' ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$out .= '<option value="1,3"'.($selected == '1,3' ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
}
$out .= '<option value="4"'.($selected == '4' ? ' selected' : '').'>'.$langs->trans('Supplier').'</option>';
$out .= '<option value="0"'.($selected == '0' ? ' selected' : '').'>'.$langs->trans('Other').'</option>';
} elseif ($typeinput == 'admin') {
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
}
}
$out .= '</select>';
$out = '<select class="flat '.$morecss.'" name="'.$htmlname.'" id="'.$htmlidname.'">';
if ($typeinput == 'form') {
if ($selected == '' || $selected == '-1') $out .= '<option value="-1">&nbsp;</option>';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
$out .= '<option value="2"'.($selected == 2 ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
}
$out .= '<option value="0"'.((string) $selected == '0' ? ' selected' : '').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
} elseif ($typeinput == 'list') {
$out .= '<option value="-1"'.(($selected == '' || $selected == '-1') ? ' selected' : '').'>&nbsp;</option>';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
$out .= '<option value="2,3"'.($selected == '2,3' ? ' selected' : '').'>'.$langs->trans('Prospect').'</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$out .= '<option value="1,3"'.($selected == '1,3' ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
}
$out .= '<option value="4"'.($selected == '4' ? ' selected' : '').'>'.$langs->trans('Supplier').'</option>';
$out .= '<option value="0"'.($selected == '0' ? ' selected' : '').'>'.$langs->trans('Other').'</option>';
} elseif ($typeinput == 'admin') {
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
$out .= '<option value="3"'.($selected == 3 ? ' selected' : '').'>'.$langs->trans('ProspectCustomer').'</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$out .= '<option value="1"'.($selected == 1 ? ' selected' : '').'>'.$langs->trans('Customer').'</option>';
}
}
$out .= '</select>';
return $out;
}
return $out;
}
}

View File

@ -58,7 +58,7 @@ class FormFile
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show form to upload a new file.
*
@ -70,8 +70,8 @@ class FormFile
* @param int $size Length of input file area. Deprecated.
* @param Object $object Object to use (when attachment is done on an element)
* @param string $options Add an option column
* @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option).
* Deprecated 2 should never be used and if 1 is used, option should no be enabled.
* @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option).
* Deprecated 2 should never be used and if 1 is used, option should no be enabled.
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
* @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 ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM)
@ -83,14 +83,14 @@ class FormFile
*/
public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '', $usewithoutform = 0, $capture = 0)
{
// phpcs:enable
// phpcs:enable
global $conf, $langs, $hookmanager;
$hookmanager->initHooks(array('formfile'));
// Deprecation warning
if ($useajax == 2) {
dol_syslog(__METHOD__.": using 2 for useajax is deprecated and should be not used", LOG_WARNING);
}
// Deprecation warning
if ($useajax == 2) {
dol_syslog(__METHOD__.": using 2 for useajax is deprecated and should be not used", LOG_WARNING);
}
if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic') $useajax = 0;
@ -114,12 +114,12 @@ class FormFile
if (empty($usewithoutform)) // Try to avoid this and set instead the form by the caller.
{
$out .= '<form name="'.$htmlname.'" id="'.$htmlname.'" action="'.$url.'" enctype="multipart/form-data" method="POST">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
$out .= '<input type="hidden" id="'.$htmlname.'_section_dir" name="section_dir" value="'.$sectiondir.'">';
$out .= '<input type="hidden" id="'.$htmlname.'_section_id" name="section_id" value="'.$sectionid.'">';
$out .= '<input type="hidden" name="sortfield" value="'.GETPOST('sortfield', 'alpha').'">';
$out .= '<input type="hidden" name="sortorder" value="'.GETPOST('sortorder', 'aZ09').'">';
$out .= '<form name="'.$htmlname.'" id="'.$htmlname.'" action="'.$url.'" enctype="multipart/form-data" method="POST">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
$out .= '<input type="hidden" id="'.$htmlname.'_section_dir" name="section_dir" value="'.$sectiondir.'">';
$out .= '<input type="hidden" id="'.$htmlname.'_section_id" name="section_id" value="'.$sectionid.'">';
$out .= '<input type="hidden" name="sortfield" value="'.GETPOST('sortfield', 'alpha').'">';
$out .= '<input type="hidden" name="sortorder" value="'.GETPOST('sortorder', 'aZ09').'">';
}
$out .= '<table class="nobordernopadding centpercent">';
@ -201,24 +201,24 @@ class FormFile
$out .= "</td></tr>";
if ($savingdocmask)
{
//add a global variable for disable the auto renaming on upload
$rename = (empty($conf->global->MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT) ? 'checked' : '');
{
//add a global variable for disable the auto renaming on upload
$rename = (empty($conf->global->MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT) ? 'checked' : '');
$out .= '<tr>';
if (!empty($options)) $out .= '<td>'.$options.'</td>';
$out .= '<td valign="middle" class="nowrap">';
$out .= '<tr>';
if (!empty($options)) $out .= '<td>'.$options.'</td>';
$out .= '<td valign="middle" class="nowrap">';
$out .= '<input type="checkbox" '.$rename.' class="savingdocmask" name="savingdocmask" value="'.dol_escape_js($savingdocmask).'"> '.$langs->trans("SaveUploadedFileWithMask", preg_replace('/__file__/', $langs->transnoentitiesnoconv("OriginFileName"), $savingdocmask), $langs->transnoentitiesnoconv("OriginFileName"));
$out .= '</td>';
$out .= '</tr>';
}
$out .= '</td>';
$out .= '</tr>';
}
$out .= "</table>";
if (empty($usewithoutform))
{
$out .= '</form>';
if (empty($sectionid)) $out .= '<br>';
$out .= '</form>';
if (empty($sectionid)) $out .= '<br>';
}
$out .= "\n</div><!-- End form attach new file -->\n";
@ -232,10 +232,10 @@ class FormFile
if (empty($usewithoutform))
{
$out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">'."\n";
$out .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">'."\n";
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">'."\n";
$out .= '<form name="'.$htmlname.'_link" id="'.$htmlname.'_link" action="'.$url.'" method="POST">'."\n";
$out .= '<input type="hidden" name="token" value="'.newToken().'">'."\n";
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_dir" name="link_section_dir" value="">'."\n";
$out .= '<input type="hidden" id="'.$htmlname.'_link_section_id" name="link_section_id" value="'.$sectionid.'">'."\n";
}
$out .= '<div class="valignmiddle">';
@ -257,8 +257,8 @@ class FormFile
$out .= '</div>';
if (empty($usewithoutform))
{
$out .= '<div class="clearboth"></div>';
$out .= '</form><br>';
$out .= '<div class="clearboth"></div>';
$out .= '</form><br>';
}
$out .= "\n</div><!-- End form link new url -->\n";
@ -268,7 +268,7 @@ class FormFile
$res = $hookmanager->executeHooks('formattachOptions', $parameters, $object);
if (empty($res))
{
print '<div class="'.($usewithoutform ? 'inline-block valignmiddle' : 'attacharea attacharea'.$htmlname).'">';
print '<div class="'.($usewithoutform ? 'inline-block valignmiddle' : 'attacharea attacharea'.$htmlname).'">';
print $out;
print '</div>';
}
@ -278,7 +278,7 @@ class FormFile
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show the box with list of available documents for object
*
@ -303,7 +303,7 @@ class FormFile
*/
public function show_documents($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '')
{
// phpcs:enable
// phpcs:enable
$this->numoffiles = 0;
print $this->showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed, $modelselected, $allowgenifempty, $forcenomultilang, $iconPDF, $notused, $noform, $param, $title, $buttonlabel, $codelang);
return $this->numoffiles;
@ -454,13 +454,13 @@ class FormFile
$modellist = ModelePDFExpedition::liste_modeles($this->db);
}
} elseif ($modulepart == 'reception')
{
if (is_array($genallowed)) $modellist = $genallowed;
else {
{
if (is_array($genallowed)) $modellist = $genallowed;
else {
include_once DOL_DOCUMENT_ROOT.'/core/modules/reception/modules_reception.php';
$modellist = ModelePdfReception::liste_modeles($this->db);
}
} elseif ($modulepart == 'livraison')
} elseif ($modulepart == 'livraison')
{
if (is_array($genallowed)) $modellist = $genallowed;
else {
@ -611,16 +611,16 @@ class FormFile
$modellist = ModelePDFUserGroup::liste_modeles($this->db);
}
} else {
$submodulepart = $modulepart;
$submodulepart = $modulepart;
// modulepart = 'nameofmodule' or 'nameofmodule:NameOfObject'
$tmp = explode(':', $modulepart);
if (!empty($tmp[1])) {
$modulepart = $tmp[0];
$submodulepart = $tmp[1];
}
// modulepart = 'nameofmodule' or 'nameofmodule:NameOfObject'
$tmp = explode(':', $modulepart);
if (!empty($tmp[1])) {
$modulepart = $tmp[0];
$submodulepart = $tmp[1];
}
// For normalized standard modules
// For normalized standard modules
$file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
if (file_exists($file))
{
@ -628,7 +628,7 @@ class FormFile
}
// For normalized external modules.
else {
$file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
$file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0);
$res = include_once $file;
}
@ -992,7 +992,7 @@ class FormFile
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show list of documents in $filearray (may be they are all in same directory but may not)
* This also sync database if $upload_dir is defined.
@ -1027,7 +1027,7 @@ class FormFile
*/
public function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0, $disablecrop = -1)
{
// phpcs:enable
// phpcs:enable
global $user, $conf, $langs, $hookmanager;
global $sortfield, $sortorder, $maxheightmini;
global $dolibarr_main_url_root;
@ -1049,7 +1049,7 @@ class FormFile
// For backward compatiblity, we detect file stored into an old path
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && $filearray[0]['level1name'] == 'photos')
{
$relativepath = preg_replace('/^.*\/produit\//', '', $filearray[0]['path']).'/';
$relativepath = preg_replace('/^.*\/produit\//', '', $filearray[0]['path']).'/';
}
// Defined relative dir to DOL_DATA_ROOT
$relativedir = '';
@ -1233,13 +1233,13 @@ class FormFile
print '<td class="center">';
if (image_format_supported($file['name']) >= 0)
{
if ($useinecm == 5 || $useinecm == 6)
{
$smallfile = getImageFileNameForSize($file['name'], ''); // There is no thumb for ECM module and Media filemanager, so we use true image. TODO Change this it is slow on image dir.
} else {
$smallfile = getImageFileNameForSize($file['name'], '_small'); // For new thumbs using same ext (in lower case however) than original
}
if (!dol_is_file($file['path'].'/'.$smallfile)) $smallfile = getImageFileNameForSize($file['name'], '_small', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension
if ($useinecm == 5 || $useinecm == 6)
{
$smallfile = getImageFileNameForSize($file['name'], ''); // There is no thumb for ECM module and Media filemanager, so we use true image. TODO Change this it is slow on image dir.
} else {
$smallfile = getImageFileNameForSize($file['name'], '_small'); // For new thumbs using same ext (in lower case however) than original
}
if (!dol_is_file($file['path'].'/'.$smallfile)) $smallfile = getImageFileNameForSize($file['name'], '_small', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension
//print $file['path'].'/'.$smallfile.'<br>';
$urlforhref = getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity));
@ -1353,7 +1353,7 @@ class FormFile
print '<td'.(($conf->browser->layout != 'phone' && empty($disablemove)) ? ' class="linecolmove tdlineupdown center"' : ' class="linecolmove center"').'>';
print '</td>';
}
}
}
} else {
print '<td class="right">';
print '<input type="hidden" name="ecmfileid" value="'.$filearray[$key]['rowid'].'">';
@ -1398,7 +1398,7 @@ class FormFile
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show list of documents in a directory
*
@ -1419,7 +1419,7 @@ class FormFile
*/
public function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permissiontodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0)
{
// phpcs:enable
// phpcs:enable
global $user, $conf, $langs, $form;
global $sortfield, $sortorder;
global $search_doc_ref;
@ -1532,8 +1532,8 @@ class FormFile
$object_instance = new RecruitmentCandidature($this->db);
} elseif ($modulepart == 'banque')
{
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$object_instance = new Account($this->db);
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$object_instance = new Account($this->db);
} elseif ($modulepart == 'mrp-mo')
{
include_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php';
@ -1574,7 +1574,7 @@ class FormFile
'banque'))) {
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : '');
} else {
//print 'Error: Value for modulepart = '.$modulepart.' is not yet implemented in function list_of_autoecmfiles'."\n";
//print 'Error: Value for modulepart = '.$modulepart.' is not yet implemented in function list_of_autoecmfiles'."\n";
}
if (!$id && !$ref) continue;
@ -1733,7 +1733,7 @@ class FormFile
print '<table width="100%" class="liste noborder nobottom">';
print '<tr class="liste_titre">';
print_liste_field_titre(
print_liste_field_titre(
$langs->trans("Links"),
$_SERVER['PHP_SELF'],
"name",
@ -1742,20 +1742,20 @@ class FormFile
'',
$sortfield,
$sortorder,
''
''
);
print_liste_field_titre(
print_liste_field_titre(
"",
"",
"",
"",
"",
'',
'',
'',
'right '
'',
'',
'right '
);
print_liste_field_titre(
print_liste_field_titre(
$langs->trans("Date"),
$_SERVER['PHP_SELF'],
"date",
@ -1764,18 +1764,18 @@ class FormFile
'',
$sortfield,
$sortorder,
'center '
'center '
);
print_liste_field_titre(
print_liste_field_titre(
'',
$_SERVER['PHP_SELF'],
"",
"",
$param,
'',
'',
'',
'center '
'',
'',
'center '
);
print_liste_field_titre('', '', '');
print '</tr>';

View File

@ -37,75 +37,75 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
class FormMail extends Form
{
/**
* @var DoliDB Database handler.
*/
public $db;
* @var DoliDB Database handler.
*/
public $db;
/**
* @var int 1 = Include HTML form tag and show submit button
* 0 = Do not include form tag and submit button
* -1 = Do not include form tag but include submit button
*/
/**
* @var int 1 = Include HTML form tag and show submit button
* 0 = Do not include form tag and submit button
* -1 = Do not include form tag but include submit button
*/
public $withform;
/**
* @var string name from
*/
/**
* @var string name from
*/
public $fromname;
/**
* @var string email from
*/
/**
* @var string email from
*/
public $frommail;
/**
* @var string user, company, robot
*/
public $fromtype;
/**
* @var string user, company, robot
*/
public $fromtype;
/**
* @var int from ID
*/
public $fromid;
/**
* @var int from ID
*/
public $fromid;
/**
* @var int also from robot
*/
public $fromalsorobot;
/**
* @var int also from robot
*/
public $fromalsorobot;
/**
* @var string thirdparty etc
*/
public $totype;
/**
* @var string thirdparty etc
*/
public $totype;
/**
* @var int ID
*/
public $toid;
/**
* @var int ID
*/
public $toid;
/**
* @var string replyto name
*/
public $replytoname;
/**
* @var string replyto name
*/
public $replytoname;
/**
* @var string replyto email
*/
/**
* @var string replyto email
*/
public $replytomail;
/**
* @var string to name
*/
/**
* @var string to name
*/
public $toname;
/**
* @var string to email
*/
/**
* @var string to email
*/
public $tomail;
/**
* @var string trackid
*/
/**
* @var string trackid
*/
public $trackid;
public $withsubstit; // Show substitution array
@ -180,7 +180,7 @@ class FormMail extends Form
$this->withfckeditor = -1; // -1 = Auto
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Clear list of attached files in send mail form (also stored in session)
*
@ -188,7 +188,7 @@ class FormMail extends Form
*/
public function clear_attached_files()
{
// phpcs:enable
// phpcs:enable
global $conf, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -203,7 +203,7 @@ class FormMail extends Form
unset($_SESSION["listofmimes".$keytoavoidconflict]);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Add a file into the list of attached files (stored in SECTION array)
*
@ -214,7 +214,7 @@ class FormMail extends Form
*/
public function add_attached_files($path, $file = '', $type = '')
{
// phpcs:enable
// phpcs:enable
$listofpaths = array();
$listofnames = array();
$listofmimes = array();
@ -237,7 +237,7 @@ class FormMail extends Form
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Remove a file from the list of attached files (stored in SECTION array)
*
@ -246,7 +246,7 @@ class FormMail extends Form
*/
public function remove_attached_files($keytodelete)
{
// phpcs:enable
// phpcs:enable
$listofpaths = array();
$listofnames = array();
$listofmimes = array();
@ -267,7 +267,7 @@ class FormMail extends Form
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of attached files (stored in SECTION array)
*
@ -275,7 +275,7 @@ class FormMail extends Form
*/
public function get_attached_files()
{
// phpcs:enable
// phpcs:enable
$listofpaths = array();
$listofnames = array();
$listofmimes = array();
@ -287,7 +287,7 @@ class FormMail extends Form
return array('paths'=>$listofpaths, 'names'=>$listofnames, 'mimes'=>$listofmimes);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Show the form to input an email
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
@ -299,11 +299,11 @@ class FormMail extends Form
*/
public function show_form($addfileaction = 'addfile', $removefileaction = 'removefile')
{
// phpcs:enable
// phpcs:enable
print $this->get_form($addfileaction, $removefileaction);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get the form to input an email
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
@ -316,17 +316,17 @@ class FormMail extends Form
*/
public function get_form($addfileaction = 'addfile', $removefileaction = 'removefile')
{
// phpcs:enable
// phpcs:enable
global $conf, $langs, $user, $hookmanager, $form;
// Required to show preview of mail attachments
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$formfile = new Formfile($this->db);
// Required to show preview of mail attachments
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
$formfile = new Formfile($this->db);
if (!is_object($form)) $form = new Form($this->db);
// Load translation files required by the page
$langs->loadLangs(array('other', 'mails'));
$langs->loadLangs(array('other', 'mails'));
// Clear temp files. Must be done at beginning, before call of triggers
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1'))
@ -464,7 +464,7 @@ class FormMail extends Form
'propal_send', 'order_send', 'facture_send',
'shipping_send', 'fichinter_send', 'supplier_proposal_send', 'order_supplier_send',
'invoice_supplier_send', 'thirdparty', 'contract', 'user', 'recruitmentcandidature_send', 'all'
)))
)))
{
// If list of template is empty
$out .= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
@ -486,7 +486,7 @@ class FormMail extends Form
if (is_array($this->substit) && count($this->substit)) $helpforsubstitution .= $langs->trans('AvailableVariables').' :<br>'."\n";
foreach ($this->substit as $key => $val)
{
$helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag($val)).'<br>';
$helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag(dolGetFirstLineOfText($val))).'<br>';
}
if (!empty($this->withsubstit)) // Unset or set ->withsubstit=0 to disable this.
{
@ -733,7 +733,7 @@ class FormMail extends Form
{
$out .= (!is_array($this->withtocc) && !is_numeric($this->withtocc)) ? $this->withtocc : "";
} else {
$out .= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.(GETPOST("sendtocc", "alpha") ? GETPOST("sendtocc", "alpha") : ((!is_array($this->withtocc) && !is_numeric($this->withtocc)) ? $this->withtocc : '')).'" />';
$out .= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.(GETPOST("sendtocc", "alpha") ? GETPOST("sendtocc", "alpha") : ((!is_array($this->withtocc) && !is_numeric($this->withtocc)) ? $this->withtocc : '')).'" />';
if (!empty($this->withtocc) && is_array($this->withtocc))
{
$out .= " ".$langs->trans("and")."/".$langs->trans("or")." ";
@ -854,10 +854,10 @@ class FormMail extends Form
foreach ($listofpaths as $key => $val)
{
$out .= '<div id="attachfile_'.$key.'">';
// Preview of attachment
preg_match('#^(/)(\w+)(/)(.+)$#', substr($val, (strlen(DOL_DATA_ROOT)-strlen($val))), $formfile_params);
// Preview of attachment
preg_match('#^(/)(\w+)(/)(.+)$#', substr($val, (strlen(DOL_DATA_ROOT)-strlen($val))), $formfile_params);
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
$out .= $formfile->showPreview(array(), $formfile_params[2], $formfile_params[4]);
$out .= $formfile->showPreview(array(), $formfile_params[2], $formfile_params[4]);
if (!$this->withfilereadonly)
{
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
@ -1060,7 +1060,7 @@ class FormMail extends Form
if (!empty($this->withtocccreadonly)) {
$out .= (!is_array($this->withtoccc) && !is_numeric($this->withtoccc)) ? $this->withtoccc : "";
} else {
$out .= '<input class="minwidth200" id="sendtoccc" name="sendtoccc" value="'.(GETPOST("sendtoccc", "alpha") ? GETPOST("sendtoccc", "alpha") : ((!is_array($this->withtoccc) && !is_numeric($this->withtoccc)) ? $this->withtoccc : '')).'" />';
$out .= '<input class="minwidth200" id="sendtoccc" name="sendtoccc" value="'.(GETPOST("sendtoccc", "alpha") ? GETPOST("sendtoccc", "alpha") : ((!is_array($this->withtoccc) && !is_numeric($this->withtoccc)) ? $this->withtoccc : '')).'" />';
if (!empty($this->withtoccc) && is_array($this->withtoccc)) {
$out .= " ".$langs->trans("and")."/".$langs->trans("or")." ";
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
@ -1185,7 +1185,7 @@ class FormMail extends Form
*/
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
{
$ret = new ModelMail();
$ret = new ModelMail();
if ($id == -2 && empty($label)) {
$this->error = 'LabelIsMandatoryWhenIdIs-2';
@ -1513,9 +1513,9 @@ class ModelMail
public $id;
/**
* @var string Model mail label
*/
public $label;
* @var string Model mail label
*/
public $label;
public $topic;
public $content;

View File

@ -200,17 +200,17 @@ class FormTicket
// Type
print '<tr><td class="titlefield"><span class="fieldrequired"><label for="selecttype_code">'.$langs->trans("TicketTypeRequest").'</span></label></td><td>';
$this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', '2', 0, 0, 0, 'minwidth150');
print '</td></tr>';
// Severity
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">'.$langs->trans("TicketSeverity").'</span></label></td><td>';
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2');
$this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', 2, 0, 0, 0, 'minwidth200');
print '</td></tr>';
// Group
print '<tr><td><span class="fieldrequired"><label for="selectcategory_code">'.$langs->trans("TicketCategory").'</span></label></td><td>';
$this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2');
$this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', 2, 0, 0, 0, 'minwidth200');
print '</td></tr>';
// Severity
print '<tr><td><span class="fieldrequired"><label for="selectseverity_code">'.$langs->trans("TicketSeverity").'</span></label></td><td>';
$this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, 0);
print '</td></tr>';
// Subject
@ -247,6 +247,59 @@ class FormTicket
$doleditor->Create();
print '</td></tr>';
// Attached files
if (!empty($this->withfile)) {
// Define list of attached files
$listofpaths = array();
$listofnames = array();
$listofmimes = array();
if (!empty($_SESSION["listofpaths"])) {
$listofpaths = explode(';', $_SESSION["listofpaths"]);
}
if (!empty($_SESSION["listofnames"])) {
$listofnames = explode(';', $_SESSION["listofnames"]);
}
if (!empty($_SESSION["listofmimes"])) {
$listofmimes = explode(';', $_SESSION["listofmimes"]);
}
$out = '<tr>';
$out .= '<td>'.$langs->trans("MailFile").'</td>';
$out .= '<td>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript" language="javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
$out .= ' });';
$out .= '})';
$out .= '</script>'."\n";
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$out .= '<div id="attachfile_'.$key.'">';
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
if (!$this->withfilereadonly) {
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
}
$out .= '<br></div>';
}
} else {
$out .= $langs->trans("NoAttachedFiles").'<br>';
}
if ($this->withfile == 2) { // Can add other files
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
$out .= ' ';
$out .= '<input type="submit" class="button" id="addfile" name="addfile" value="'.$langs->trans("MailingAddFile").'" />';
}
$out .= "</td></tr>\n";
print $out;
}
// User of creation
if ($this->withusercreate > 0 && $this->fk_user_create) {
print '<tr><td class="titlefield">'.$langs->trans("CreatedBy").'</td><td>';
@ -359,58 +412,6 @@ class FormTicket
print '</td></tr>';
}
// Attached files
if (!empty($this->withfile)) {
// Define list of attached files
$listofpaths = array();
$listofnames = array();
$listofmimes = array();
if (!empty($_SESSION["listofpaths"])) {
$listofpaths = explode(';', $_SESSION["listofpaths"]);
}
if (!empty($_SESSION["listofnames"])) {
$listofnames = explode(';', $_SESSION["listofnames"]);
}
if (!empty($_SESSION["listofmimes"])) {
$listofmimes = explode(';', $_SESSION["listofmimes"]);
}
$out = '<tr>';
$out .= '<td>'.$langs->trans("MailFile").'</td>';
$out .= '<td>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript" language="javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
$out .= ' });';
$out .= '})';
$out .= '</script>'."\n";
if (count($listofpaths)) {
foreach ($listofpaths as $key => $val) {
$out .= '<div id="attachfile_'.$key.'">';
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
if (!$this->withfilereadonly) {
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
}
$out .= '<br></div>';
}
} else {
$out .= $langs->trans("NoAttachedFiles").'<br>';
}
if ($this->withfile == 2) { // Can add other files
$out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
$out .= ' ';
$out .= '<input type="submit" class="button" id="addfile" name="addfile" value="'.$langs->trans("MailingAddFile").'" />';
}
$out .= "</td></tr>\n";
print $out;
}
// Other attributes
$parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $this->action); // Note that $action and $object may have been modified by hook
@ -993,9 +994,9 @@ class FormTicket
$defaultmessage = str_replace('\n', "\n", $defaultmessage);
// Deal with format differences between message and signature (text / HTML)
if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) {
$this->substit['__SIGNATURE__'] = dol_nl2br($this->substit['__SIGNATURE__']);
} elseif (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__SIGNATURE__'])) {
if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__USER_SIGNATURE__'])) {
$this->substit['__USER_SIGNATURE__'] = dol_nl2br($this->substit['__USER_SIGNATURE__']);
} elseif (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) {
$defaultmessage = dol_nl2br($defaultmessage);
}
if (isset($_POST["message"]) && !$_POST['modelselected']) {

View File

@ -750,7 +750,7 @@ class Lessc {
if ($suffix !== null &&
$subProp[0] == "assign" &&
is_string($subProp[1]) &&
$subProp[1]{0} != $this->vPrefix
$subProp[1][0] != $this->vPrefix
) {
$subProp[2] = array(
'list', ' ',

View File

@ -184,7 +184,7 @@ class Menubase
$this->position = (int) $this->position;
$this->url = trim($this->url);
$this->target = trim($this->target);
$this->titre = trim($this->titre);
$this->title = trim($this->title);
$this->langs = trim($this->langs);
$this->perms = trim($this->perms);
$this->enabled = trim($this->enabled);
@ -264,7 +264,7 @@ class Menubase
$sql .= " ".((int) $this->position).",";
$sql .= " '".$this->db->escape($this->url)."',";
$sql .= " '".$this->db->escape($this->target)."',";
$sql .= " '".$this->db->escape($this->titre)."',";
$sql .= " '".$this->db->escape($this->title)."',";
$sql .= " '".$this->db->escape($this->langs)."',";
$sql .= " '".$this->db->escape($this->perms)."',";
$sql .= " '".$this->db->escape($this->enabled)."',";
@ -317,7 +317,7 @@ class Menubase
$this->position = (int) $this->position;
$this->url = trim($this->url);
$this->target = trim($this->target);
$this->titre = trim($this->titre);
$this->title = trim($this->title);
$this->langs = trim($this->langs);
$this->perms = trim($this->perms);
$this->enabled = trim($this->enabled);
@ -339,7 +339,7 @@ class Menubase
$sql .= " position=".($this->position > 0 ? $this->position : 0).",";
$sql .= " url='".$this->db->escape($this->url)."',";
$sql .= " target='".$this->db->escape($this->target)."',";
$sql .= " titre='".$this->db->escape($this->titre)."',";
$sql .= " titre='".$this->db->escape($this->title)."',";
$sql .= " langs='".$this->db->escape($this->langs)."',";
$sql .= " perms='".$this->db->escape($this->perms)."',";
$sql .= " enabled='".$this->db->escape($this->enabled)."',";
@ -383,7 +383,7 @@ class Menubase
$sql .= " t.position,";
$sql .= " t.url,";
$sql .= " t.target,";
$sql .= " t.titre,";
$sql .= " t.titre as title,";
$sql .= " t.langs,";
$sql .= " t.perms,";
$sql .= " t.enabled,";
@ -414,7 +414,7 @@ class Menubase
$this->position = $obj->position;
$this->url = $obj->url;
$this->target = $obj->target;
$this->titre = $obj->titre;
$this->title = $obj->title;
$this->langs = $obj->langs;
$this->perms = $obj->perms;
$this->enabled = str_replace("\"", "'", $obj->enabled);
@ -475,10 +475,8 @@ class Menubase
$this->position = '';
$this->url = 'http://dummy';
$this->target = '';
$this->titre = 'Specimen menu'; // deprecated
$this->title = 'Specimen menu';
$this->langs = '';
$this->level = '';
$this->leftmenu = '';
$this->perms = '';
$this->enabled = '';

View File

@ -243,3 +243,63 @@ function journalHead($nom, $variante, $period, $periodlink, $description, $build
print "\n<!-- end banner journal -->\n\n";
}
/**
* Return Default dates for transfer based on periodicity option in accountancy setup
*
* @return array Dates of periodicity by default
*/
function getDefaultDatesForTransfer()
{
global $db, $conf;
// Period by default on transfer (0: previous month | 1: current month | 2: fiscal year)
$periodbydefaultontransfer = $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER;
isset($periodbydefaultontransfer)?$periodbydefaultontransfer:0;
if ($periodbydefaultontransfer == 2) {
$sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
$sql .= $db->plimit(1);
$res = $db->query($sql);
if ($res->num_rows > 0) {
$fiscalYear = $db->fetch_object($res);
$date_start = strtotime($fiscalYear->date_start);
$date_end = strtotime($fiscalYear->date_end);
} else {
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
$year_start = dol_print_date(dol_now(), '%Y');
$year_end = $year_start + 1;
$month_end = $month_start - 1;
if ($month_end < 1)
{
$month_end = 12;
$year_end--;
}
$date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
$date_end = dol_get_last_day($year_end, $month_end);
}
} elseif ($periodbydefaultontransfer == 1) {
$year_current = strftime("%Y", dol_now());
$pastmonth = strftime("%m", dol_now());
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
$pastmonthyear --;
}
} else {
$year_current = strftime("%Y", dol_now());
$pastmonth = strftime("%m", dol_now())-1;
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
$pastmonthyear --;
}
}
return array(
'date_start' => $date_start,
'date_end' => $date_end,
'pastmonthyear' => $pastmonthyear,
'pastmonth' => $pastmonth
);
}

View File

@ -46,16 +46,16 @@
*/
function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLength = 2, $autoselect = 0, $ajaxoptions = array(), $moreparams = '')
{
if (empty($minLength)) $minLength = 1;
if (empty($minLength)) $minLength = 1;
$dataforrenderITem = 'ui-autocomplete';
$dataforitem = 'ui-autocomplete-item';
// Allow two constant to use other values for backward compatibility
if (defined('JS_QUERY_AUTOCOMPLETE_RENDERITEM')) $dataforrenderITem = constant('JS_QUERY_AUTOCOMPLETE_RENDERITEM');
if (defined('JS_QUERY_AUTOCOMPLETE_ITEM')) $dataforitem = constant('JS_QUERY_AUTOCOMPLETE_ITEM');
$dataforrenderITem = 'ui-autocomplete';
$dataforitem = 'ui-autocomplete-item';
// Allow two constant to use other values for backward compatibility
if (defined('JS_QUERY_AUTOCOMPLETE_RENDERITEM')) $dataforrenderITem = constant('JS_QUERY_AUTOCOMPLETE_RENDERITEM');
if (defined('JS_QUERY_AUTOCOMPLETE_ITEM')) $dataforitem = constant('JS_QUERY_AUTOCOMPLETE_ITEM');
// Input search_htmlname is original field
// Input htmlname is a second input field used when using ajax autocomplete.
// Input search_htmlname is original field
// Input htmlname is a second input field used when using ajax autocomplete.
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" '.($moreparams ? $moreparams : '').' />';
$script .= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n";
@ -348,7 +348,7 @@ function ajax_dialog($title, $message, $w = 350, $h = 150)
$msg = '<div id="dialog-info" title="'.dol_escape_htmltag($newtitle).'">';
$msg .= $message;
$msg .= '</div>'."\n";
$msg .= '<script>
$msg .= '<script>
jQuery(function() {
jQuery("#dialog-info").dialog({
resizable: false,
@ -364,9 +364,9 @@ function ajax_dialog($title, $message, $w = 350, $h = 150)
});
</script>';
$msg .= "\n";
$msg .= "\n";
return $msg;
return $msg;
}
@ -397,8 +397,8 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete = 0;
$tmpplugin = 'select2';
$msg = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
$tmpplugin = 'select2';
$msg = "\n".'<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
<script>
$(document).ready(function () {
$(\''.(preg_match('/^\./', $htmlname) ? $htmlname : '#'.$htmlname).'\').'.$tmpplugin.'({
@ -477,9 +477,9 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
}
$msg .= '});'."\n";
$msg .= "</script>\n";
$msg .= "</script>\n";
return $msg;
return $msg;
}
/**
@ -500,7 +500,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
global $conf, $langs, $user;
$entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
if (! isset($input)) $input = array();
if (!isset($input)) $input = array();
if (empty($conf->use_javascript_ajax) || $forcenoajax)
{
@ -566,9 +566,9 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
*/
function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array())
{
global $langs;
global $langs;
$out = '<script>
$out = '<script>
$(function() {
var input = '.json_encode($input).';
@ -633,8 +633,8 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input =
});
});
</script>';
$out .= '<span id="set_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').'">'.img_picto($langs->trans($text_off), 'switch_off').'</span>';
$out .= '<span id="del_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').'">'.img_picto($langs->trans($text_on), 'switch_on').'</span>';
$out .= '<span id="set_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? 'hideobject' : '').'">'.img_picto($langs->trans($text_off), 'switch_off').'</span>';
$out .= '<span id="del_'.$code.'_'.$object->id.'" class="linkobject '.($object->$code == 1 ? '' : 'hideobject').'">'.img_picto($langs->trans($text_on), 'switch_on').'</span>';
return $out;
return $out;
}

File diff suppressed because it is too large Load Diff

View File

@ -615,23 +615,6 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
$mois = date("m", $timestampStart);
$annee = date("Y", $timestampStart);
// Check into var $conf->global->HOLIDAY_MORE_DAYS MM-DD,YYYY-MM-DD, ...
// Do not use this anymore, use instead the dictionary of public holidays.
if (!empty($conf->global->HOLIDAY_MORE_PUBLIC_HOLIDAYS))
{
$arrayofdaystring = explode(',', $conf->global->HOLIDAY_MORE_PUBLIC_HOLIDAYS);
foreach ($arrayofdaystring as $daystring)
{
$tmp = explode('-', $daystring);
if ($tmp[2])
{
if ($tmp[0] == $annee && $tmp[1] == $mois && $tmp[2] == $jour) $ferie = true;
} else {
if ($tmp[0] == $mois && $tmp[1] == $jour) $ferie = true;
}
}
}
$country_id = dol_getIdFromCode($db, $country_code, 'c_country', 'code', 'rowid');
// Loop on public holiday defined into hrm_public_holiday

View File

@ -60,9 +60,9 @@ function expedition_prepare_head(Expedition $object)
complete_head_from_modules($conf, $langs, $object, $head, $h, 'order');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'remove');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'remove');
return $head;
return $head;
}
/**
@ -95,18 +95,18 @@ function expedition_admin_prepare_head()
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
{
$head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes_shipment';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/expedition_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes_shipment';
$h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_EXPEDITION))
{
$head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$head[$h][2] = 'attributeslines_shipment';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/expeditiondet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$head[$h][2] = 'attributeslines_shipment';
$h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_LIVRAISON))

View File

@ -133,14 +133,6 @@ function expensereport_admin_prepare_head()
$head[$h][2] = 'expensereport';
$h++;
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
{
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_ik.php";
$head[$h][1] = $langs->trans("ExpenseReportsIk");
$head[$h][2] = 'expenseik';
$h++;
}
if (!empty($conf->global->MAIN_USE_EXPENSE_RULE))
{
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_rules.php";
@ -149,6 +141,14 @@ function expensereport_admin_prepare_head()
$h++;
}
if (!empty($conf->global->MAIN_USE_EXPENSE_IK))
{
$head[$h][0] = DOL_URL_ROOT."/admin/expensereport_ik.php";
$head[$h][1] = $langs->trans("ExpenseReportsIk");
$head[$h][2] = 'expenseik';
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -958,11 +958,11 @@ function dolCheckVirus($src_file)
if (!class_exists('AntiVir')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/antivir.class.php';
}
$antivir=new AntiVir($db);
$antivir = new AntiVir($db);
$result = $antivir->dol_avscan_file($src_file);
if ($result < 0) // If virus or error, we stop here
{
$reterrors=$antivir->errors;
$reterrors = $antivir->errors;
return $reterrors;
}
}
@ -1049,7 +1049,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
{
// $upload_dir ends with a slash, so be must be sure the medias dir to compare to ends with slash too.
$publicmediasdirwithslash = $conf->medias->multidir_output[$conf->entity];
if (! preg_match('/\/$/', $publicmediasdirwithslash)) $publicmediasdirwithslash.='/';
if (!preg_match('/\/$/', $publicmediasdirwithslash)) $publicmediasdirwithslash .= '/';
if (strpos($upload_dir, $publicmediasdirwithslash) !== 0) { // We never add .noexe on files into media directory
$file_name .= '.noexe';
@ -2771,7 +2771,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if (preg_match('/^specimen/i', $original_file)) $accessallowed = 1; // If link to a file called specimen. Test must be done before changing $original_file int full path.
if ($fuser->admin) $accessallowed = 1; // If user is admin
$tmpmodulepart = explode('-', $modulepart);
if (! empty($tmpmodulepart[1])) {
if (!empty($tmpmodulepart[1])) {
$modulepart = $tmpmodulepart[0];
$original_file = $tmpmodulepart[1].'/'.$original_file;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -259,7 +259,7 @@ function hundreds2text($hundreds, $tens, $units)
$decenas = array("", "", "TREINTA ", "CUARENTA ", "CINCUENTA ", "SESENTA ", "SETENTA ", "OCHENTA ", "NOVENTA ");
$veintis = array("VEINTE", "VEINTIUN", "VEINTID&OacuteS", "VEINTITR&EacuteS", "VEINTICUATRO", "VEINTICINCO", "VEINTIS&EacuteIS", "VEINTISIETE", "VEINTIOCHO", "VEINTINUEVE");
$diecis = array("DIEZ", "ONCE", "DOCE", "TRECE", "CATORCE", "QUINCE", "DIECIS&EacuteIS", "DIECISIETE", "DIECIOCHO", "DIECINUEVE");
$unidades = array("UN", "DOS", "TRES", "CUATRO", "CINCO", "SEIS", "SIETE", "OCHO", "NUEVE");
$unidades = array("UN", "DOS", "TRES", "CUATRO", "CINCO", "SEIS", "SIETE", "OCHO", "NUEVE");
$entexto = "";
if ($hundreds != 0) {
$entexto .= $centenas[$hundreds - 1];

View File

@ -43,8 +43,8 @@ function establishment_prepare_head($object)
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'establishment');
$head[$h][0] = DOL_URL_ROOT.'/hrm/establishment/info.php?id='.$object->id;
@ -64,30 +64,30 @@ function establishment_prepare_head($object)
*/
function hrm_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user;
$langs->load('hrm');
$langs->load('hrm');
$h = 0;
$head = array();
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_hrm.php';
$head[$h][1] = $langs->trans("Parameters");
$head[$h][2] = 'parameters';
$h++;
$head[$h][1] = $langs->trans("Parameters");
$head[$h][2] = 'parameters';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/hrm/admin/admin_establishment.php';
$head[$h][1] = $langs->trans("Establishments");
$head[$h][2] = 'establishments';
$h++;
$head[$h][1] = $langs->trans("Establishments");
$head[$h][2] = 'establishments';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin');
complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin', 'remove');
complete_head_from_modules($conf, $langs, null, $head, $h, 'hrm_admin', 'remove');
return $head;
return $head;
}

View File

@ -40,39 +40,39 @@ function image_format_supported($file, $acceptsvg = 0)
{
global $conf;
$regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into product.class.php
if ($acceptsvg || ! empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)) {
$regeximgext .= '|\.svg'; // Not allowed by default. SVG can contains javascript
}
$regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.webp|\.xpm|\.xbm'; // See also into product.class.php
if ($acceptsvg || ! empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)) {
$regeximgext .= '|\.svg'; // Not allowed by default. SVG can contains javascript
}
// Case filename is not a format image
$reg = array();
if (!preg_match('/('.$regeximgext.')$/i', $file, $reg)) return -1;
// Case filename is not a format image
$reg = array();
if (!preg_match('/('.$regeximgext.')$/i', $file, $reg)) return -1;
// Case filename is a format image but not supported by this PHP
$imgfonction = '';
if (strtolower($reg[1]) == '.gif') $imgfonction = 'imagecreatefromgif';
if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg';
if (strtolower($reg[1]) == '.jpeg') $imgfonction = 'imagecreatefromjpeg';
if (strtolower($reg[1]) == '.png') $imgfonction = 'imagecreatefrompng';
if (strtolower($reg[1]) == '.bmp') $imgfonction = 'imagecreatefromwbmp';
if (strtolower($reg[1]) == '.webp') $imgfonction = 'imagecreatefromwebp';
if (strtolower($reg[1]) == '.xpm') $imgfonction = 'imagecreatefromxpm';
if (strtolower($reg[1]) == '.xbm') $imgfonction = 'imagecreatefromxbm';
if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available
if ($imgfonction)
{
if (!function_exists($imgfonction))
{
// Fonctions of conversion not available in this PHP
return 0;
}
// Case filename is a format image but not supported by this PHP
$imgfonction = '';
if (strtolower($reg[1]) == '.gif') $imgfonction = 'imagecreatefromgif';
if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg';
if (strtolower($reg[1]) == '.jpeg') $imgfonction = 'imagecreatefromjpeg';
if (strtolower($reg[1]) == '.png') $imgfonction = 'imagecreatefrompng';
if (strtolower($reg[1]) == '.bmp') $imgfonction = 'imagecreatefromwbmp';
if (strtolower($reg[1]) == '.webp') $imgfonction = 'imagecreatefromwebp';
if (strtolower($reg[1]) == '.xpm') $imgfonction = 'imagecreatefromxpm';
if (strtolower($reg[1]) == '.xbm') $imgfonction = 'imagecreatefromxbm';
if (strtolower($reg[1]) == '.svg') $imgfonction = 'imagecreatefromsvg'; // Never available
if ($imgfonction)
{
if (!function_exists($imgfonction))
{
// Fonctions of conversion not available in this PHP
return 0;
}
// Filename is a format image and supported for conversion by this PHP
return 1;
}
// Filename is a format image and supported for conversion by this PHP
return 1;
}
return 0;
return 0;
}
@ -97,9 +97,9 @@ function dol_getImageSize($file, $url = false)
if ($filetoread)
{
$infoImg = getimagesize($filetoread); // Recuperation des infos de l'image
$ret['width'] = $infoImg[0]; // Largeur de l'image
$ret['height'] = $infoImg[1]; // Hauteur de l'image
$infoImg = getimagesize($filetoread); // Recuperation des infos de l'image
$ret['width'] = $infoImg[0]; // Largeur de l'image
$ret['height'] = $infoImg[1]; // Hauteur de l'image
}
return $ret;
@ -305,7 +305,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
// Free memory. This does not delete image.
imagedestroy($img);
imagedestroy($img);
imagedestroy($imgThumb);
clearstatcache(); // File was replaced by a modified one, so we clear file caches.
@ -441,20 +441,20 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
} elseif (!file_exists($file))
{
// Si le fichier passe en parametre n'existe pas
dol_syslog($langs->trans("ErrorFileNotFound", $file), LOG_ERR);
return $langs->trans("ErrorFileNotFound", $file);
dol_syslog($langs->trans("ErrorFileNotFound", $file), LOG_ERR);
return $langs->trans("ErrorFileNotFound", $file);
} elseif (image_format_supported($file) < 0)
{
dol_syslog('This file '.$file.' does not seem to be an image format file name.', LOG_WARNING);
return 'ErrorBadImageFormat';
dol_syslog('This file '.$file.' does not seem to be an image format file name.', LOG_WARNING);
return 'ErrorBadImageFormat';
} elseif (!is_numeric($maxWidth) || empty($maxWidth) || $maxWidth < -1) {
// Si la largeur max est incorrecte (n'est pas numerique, est vide, ou est inferieure a 0)
dol_syslog('Wrong value for parameter maxWidth', LOG_ERR);
return 'Error: Wrong value for parameter maxWidth';
dol_syslog('Wrong value for parameter maxWidth', LOG_ERR);
return 'Error: Wrong value for parameter maxWidth';
} elseif (!is_numeric($maxHeight) || empty($maxHeight) || $maxHeight < -1) {
// Si la hauteur max est incorrecte (n'est pas numerique, est vide, ou est inferieure a 0)
dol_syslog('Wrong value for parameter maxHeight', LOG_ERR);
return 'Error: Wrong value for parameter maxHeight';
dol_syslog('Wrong value for parameter maxHeight', LOG_ERR);
return 'Error: Wrong value for parameter maxHeight';
}
$filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image
@ -495,7 +495,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
$imgfonction = 'imagecreatefrompng';
break;
case IMAGETYPE_BMP: // 6
// Not supported by PHP GD
// Not supported by PHP GD
break;
case IMAGETYPE_WBMP: // 15
$imgfonction = 'imagecreatefromwbmp';
@ -531,7 +531,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
$extImg = '.png';
break;
case IMAGETYPE_BMP: // 6
// Not supported by PHP GD
// Not supported by PHP GD
$extImg = '.bmp';
break;
case IMAGETYPE_WBMP: // 15
@ -540,14 +540,14 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
break;
}
if (!is_resource($img))
{
dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING);
return 0;
}
if (!is_resource($img))
{
dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING);
return 0;
}
$exifAngle = false;
if ($ort && !empty($conf->global->MAIN_USE_EXIF_ROTATION)) {
if ($ort && !empty($conf->global->MAIN_USE_EXIF_ROTATION)) {
switch ($ort)
{
case 3: // 180 rotate left
@ -568,12 +568,12 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
}
}
if ($exifAngle)
{
if ($exifAngle)
{
$rotated = false;
if ($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case
{
if ($infoImg[2] === 'IMAGETYPE_PNG') // In fact there is no exif on PNG but just in case
{
imagealphablending($img, false);
imagesavealpha($img, true);
$rotated = imagerotate($img, $exifAngle, imageColorAllocateAlpha($img, 0, 0, 0, 127));
@ -583,9 +583,9 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
$rotated = imagerotate($img, $exifAngle, 0);
}
// replace image with good orientation
if (!empty($rotated)) {
$img = $rotated;
// replace image with good orientation
if (!empty($rotated)) {
$img = $rotated;
$imgWidth = $trueImgWidth;
$imgHeight = $trueImgHeight;
}
@ -612,8 +612,8 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
$thumbHeight = round($thumbHeight);
$thumbWidth = round($thumbWidth);
// Define target format
if (empty($targetformat)) $targetformat = $infoImg[2];
// Define target format
if (empty($targetformat)) $targetformat = $infoImg[2];
// Create empty image
if ($targetformat == IMAGETYPE_GIF)
@ -643,31 +643,31 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
case IMAGETYPE_GIF: // 1
$trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF
imagecolortransparent($imgThumb, $trans_colour);
$extImgTarget = '.gif';
$newquality = 'NU';
break;
$extImgTarget = '.gif';
$newquality = 'NU';
break;
case IMAGETYPE_JPEG: // 2
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
$extImgTarget = (preg_match('/\.jpeg$/i', $file) ? '.jpeg' : '.jpg');
$newquality = $quality;
break;
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
$extImgTarget = (preg_match('/\.jpeg$/i', $file) ? '.jpeg' : '.jpg');
$newquality = $quality;
break;
case IMAGETYPE_PNG: // 3
imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
$extImgTarget = '.png';
$newquality = $quality - 100;
$newquality = round(abs($quality - 100) * 9 / 100);
break;
$extImgTarget = '.png';
$newquality = $quality - 100;
$newquality = round(abs($quality - 100) * 9 / 100);
break;
case IMAGETYPE_BMP: // 6
// Not supported by PHP GD
$extImgTarget = '.bmp';
$newquality = 'NU';
break;
// Not supported by PHP GD
$extImgTarget = '.bmp';
$newquality = 'NU';
break;
case IMAGETYPE_WBMP: // 15
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
$extImgTarget = '.bmp';
$newquality = 'NU';
break;
$extImgTarget = '.bmp';
$newquality = 'NU';
break;
}
if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour);
@ -698,7 +698,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
imagepng($imgThumb, $imgThumbName, $newquality);
break;
case IMAGETYPE_BMP: // 6
// Not supported by PHP GD
// Not supported by PHP GD
break;
case IMAGETYPE_WBMP: // 15
imagewbmp($imgThumb, $imgThumbName);
@ -708,9 +708,9 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
// Set permissions on file
if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
// Free memory. This does not delete image.
imagedestroy($img);
imagedestroy($imgThumb);
// Free memory. This does not delete image.
imagedestroy($img);
imagedestroy($imgThumb);
return $imgThumbName;
}

View File

@ -63,46 +63,46 @@ function member_prepare_head(Adherent $object)
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member');
$nbNote = 0;
if (!empty($object->note)) $nbNote++;
if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$object->id;
$nbNote = 0;
if (!empty($object->note)) $nbNote++;
if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$object->id;
$head[$h][1] = $langs->trans("Note");
$head[$h][2] = 'note';
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
$h++;
// Attachments
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'member');
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
$head[$h][2] = 'document';
$h++;
// Attachments
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'member');
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
$head[$h][2] = 'document';
$h++;
// Show agenda tab
if (!empty($conf->agenda->enabled))
{
$head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id;
$head[$h][1] = $langs->trans("Events");
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
{
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
}
$head[$h][2] = 'agenda';
$h++;
$head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id;
$head[$h][1] = $langs->trans("Events");
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
{
$head[$h][1] .= '/';
$head[$h][1] .= $langs->trans("Agenda");
}
$head[$h][2] = 'agenda';
$h++;
}
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member', 'remove');
@ -148,11 +148,11 @@ function member_type_prepare_head(AdherentType $object)
$h++;
}
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'membertype');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'membertype');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'membertype', 'remove');
@ -166,45 +166,45 @@ function member_type_prepare_head(AdherentType $object)
*/
function member_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user;
$h = 0;
$head = array();
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent.php';
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'general';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent.php';
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'general';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_emails.php';
$head[$h][1] = $langs->trans("EMails");
$head[$h][2] = 'emails';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_emails.php';
$head[$h][1] = $langs->trans("EMails");
$head[$h][2] = 'emails';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'member_admin');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'member_admin');
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsMember");
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsMember");
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_type_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsMemberType");
$head[$h][2] = 'attributes_type';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_type_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsMemberType");
$head[$h][2] = 'attributes_type';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/website.php';
$head[$h][1] = $langs->trans("BlankSubscriptionForm");
$head[$h][2] = 'website';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/website.php';
$head[$h][1] = $langs->trans("BlankSubscriptionForm");
$head[$h][2] = 'website';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'member_admin', 'remove');
complete_head_from_modules($conf, $langs, null, $head, $h, 'member_admin', 'remove');
return $head;
return $head;
}
@ -216,50 +216,50 @@ function member_admin_prepare_head()
*/
function member_stats_prepare_head($object)
{
global $langs, $conf, $user;
global $langs, $conf, $user;
$h = 0;
$head = array();
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/index.php';
$head[$h][1] = $langs->trans("Subscriptions");
$head[$h][2] = 'statssubscription';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/index.php';
$head[$h][1] = $langs->trans("Subscriptions");
$head[$h][2] = 'statssubscription';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbycountry';
$head[$h][1] = $langs->trans("Country");
$head[$h][2] = 'statscountry';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbycountry';
$head[$h][1] = $langs->trans("Country");
$head[$h][2] = 'statscountry';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbyregion';
$head[$h][1] = $langs->trans("Region");
$head[$h][2] = 'statsregion';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbyregion';
$head[$h][1] = $langs->trans("Region");
$head[$h][2] = 'statsregion';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbystate';
$head[$h][1] = $langs->trans("State");
$head[$h][2] = 'statsstate';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbystate';
$head[$h][1] = $langs->trans("State");
$head[$h][2] = 'statsstate';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbytown';
$head[$h][1] = $langs->trans('Town');
$head[$h][2] = 'statstown';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/geo.php?mode=memberbytown';
$head[$h][1] = $langs->trans('Town');
$head[$h][2] = 'statstown';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/byproperties.php';
$head[$h][1] = $langs->trans('ByProperties');
$head[$h][2] = 'statsbyproperties';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/adherents/stats/byproperties.php';
$head[$h][1] = $langs->trans('ByProperties');
$head[$h][2] = 'statsbyproperties';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member_stats');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member_stats');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member_stats', 'remove');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'member_stats', 'remove');
return $head;
return $head;
}
/**

View File

@ -30,21 +30,21 @@
*/
function multicurrencyAdminPrepareHead()
{
global $langs, $conf;
global $langs, $conf;
$h = 0;
$head = array();
$h = 0;
$head = array();
$head[$h][0] = dol_buildpath("/admin/multicurrency.php", 1);
$head[$h][1] = $langs->trans("Parameters");
$head[$h][2] = 'settings';
$h++;
$head[$h][0] = dol_buildpath("/admin/multicurrency.php", 1);
$head[$h][1] = $langs->trans("Parameters");
$head[$h][2] = 'settings';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'multicurrency');
complete_head_from_modules($conf, $langs, null, $head, $h, 'multicurrency');
complete_head_from_modules($conf, $langs, null, $head, $h, 'multicurrency', 'remove');
return $head;
return $head;
}
/**

View File

@ -49,18 +49,18 @@ function reception_prepare_head(Reception $object)
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$objectsrc = $object;
if ($object->origin == 'commande' && $object->origin_id > 0)
{
$objectsrc = new Commande($db);
$objectsrc->fetch($object->origin_id);
}
$nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT."/reception/contact.php?id=".$object->id;
$head[$h][1] = $langs->trans("ContactsAddresses");
$objectsrc = $object;
if ($object->origin == 'commande' && $object->origin_id > 0)
{
$objectsrc = new Commande($db);
$objectsrc->fetch($object->origin_id);
}
$nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT."/reception/contact.php?id=".$object->id;
$head[$h][1] = $langs->trans("ContactsAddresses");
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
$head[$h][2] = 'contact';
$h++;
}
// Show more tabs from modules
@ -69,18 +69,18 @@ function reception_prepare_head(Reception $object)
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'reception');
$nbNote = 0;
if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++;
$nbNote = 0;
if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT."/reception/note.php?id=".$object->id;
$head[$h][1] = $langs->trans("Notes");
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
$head[$h][2] = 'note';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'reception', 'remove');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'reception', 'remove');
return $head;
return $head;
}
/**
@ -105,18 +105,18 @@ function reception_admin_prepare_head()
if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION))
{
$head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes_reception';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes_reception';
$h++;
}
if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION))
{
$head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$head[$h][2] = 'attributeslines_reception';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines");
$head[$h][2] = 'attributeslines_reception';
$h++;
}
complete_head_from_modules($conf, $langs, null, $head, $h, 'reception_admin', 'remove');

View File

@ -37,13 +37,13 @@ function resource_prepare_head($object)
$head[$h][0] = dol_buildpath('/resource/card.php', 1).'?id='.$object->id;
$head[$h][1] = $langs->trans("ResourceCard");
$head[$h][2] = 'resource';
$head[$h][2] = 'resource';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && (empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_USER) || empty($conf->global->RESOURCE_HIDE_ADD_CONTACT_THIPARTY)))
{
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id;
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
$head[$h][2] = 'contact';

View File

@ -27,41 +27,41 @@
*/
function salaries_prepare_head($object)
{
global $db, $langs, $conf;
global $db, $langs, $conf;
$h = 0;
$head = array();
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/salaries/card.php?id='.$object->id;
$head[$h][1] = $langs->trans("SalaryPayment");
$head[$h][2] = 'card';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/salaries/card.php?id='.$object->id;
$head[$h][1] = $langs->trans("SalaryPayment");
$head[$h][2] = 'card';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->salaries->dir_output."/".dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/salaries/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge ">'.($nbFiles + $nbLinks).'</span>';
$head[$h][2] = 'documents';
$h++;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
$upload_dir = $conf->salaries->dir_output."/".dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks = Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/salaries/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge ">'.($nbFiles + $nbLinks).'</span>';
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/salaries/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/salaries/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'remove');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'remove');
return $head;
return $head;
}
/**
@ -71,28 +71,28 @@ function salaries_prepare_head($object)
*/
function salaries_admin_prepare_head()
{
global $langs, $conf, $user;
global $langs, $conf, $user;
$h = 0;
$head = array();
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries.php';
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'general';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries.php';
$head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'general';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'salaries_admin');
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'salaries_admin');
$head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSalaries");
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsSalaries");
$head[$h][2] = 'attributes';
$h++;
complete_head_from_modules($conf, $langs, null, $head, $h, 'salaries_admin', 'remove');
complete_head_from_modules($conf, $langs, null, $head, $h, 'salaries_admin', 'remove');
return $head;
return $head;
}

View File

@ -309,7 +309,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
break;
}
}
} elseif (!empty($feature)) { // This is for permissions on 2 levels ('creer' or 'write')
} elseif (!empty($feature)) { // This is for permissions on 2 levels ('creer' or 'write')
//print '<br>feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write; exit;
if (empty($user->rights->$feature->creer)
&& empty($user->rights->$feature->write)
@ -541,7 +541,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
if ($feature == 'agenda')// Also check owner or attendee for users without allactions->read
{
if ($objectid > 0 && empty($user->rights->agenda->allactions->read)) {
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$action = new ActionComm($db);
$action->fetch($objectid);
if ($action->authorid != $user->id && $action->userownerid != $user->id && !(array_key_exists($user->id, $action->userassigned))) {

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