Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop_NEW_InventoryProduct_AddPage
This commit is contained in:
commit
229cd53fa8
10
.travis.yml
10
.travis.yml
@ -50,7 +50,7 @@ jobs:
|
|||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
- stage: PHP 5.6-7.4
|
- stage: PHP 5.6-7.4
|
||||||
if: type = pull_request OR type = push
|
if: type = pull_request OR type = push
|
||||||
php: '7.4'
|
php: '7.4.22'
|
||||||
env: DB=mysql
|
env: DB=mysql
|
||||||
- stage: PHP Dev
|
- stage: PHP Dev
|
||||||
if: type = push AND branch = develop
|
if: type = push AND branch = develop
|
||||||
@ -106,7 +106,7 @@ install:
|
|||||||
php-parallel-lint/php-console-highlighter ^0 \
|
php-parallel-lint/php-console-highlighter ^0 \
|
||||||
squizlabs/php_codesniffer ^3
|
squizlabs/php_codesniffer ^3
|
||||||
fi
|
fi
|
||||||
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
|
if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then
|
||||||
composer -n require phpunit/phpunit ^7 \
|
composer -n require phpunit/phpunit ^7 \
|
||||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||||
php-parallel-lint/php-console-highlighter ^0 \
|
php-parallel-lint/php-console-highlighter ^0 \
|
||||||
@ -241,7 +241,7 @@ before_script:
|
|||||||
# enable php-fpm
|
# enable php-fpm
|
||||||
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||||
- |
|
- |
|
||||||
if [ "$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' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
if [ "$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' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
|
||||||
# Copy the included pool
|
# Copy the included pool
|
||||||
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
|
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
|
||||||
fi
|
fi
|
||||||
@ -276,7 +276,7 @@ script:
|
|||||||
set -e
|
set -e
|
||||||
#parallel-lint --exclude htdocs/includes --blame .
|
#parallel-lint --exclude htdocs/includes --blame .
|
||||||
# Exclusions are defined in the ruleset.xml file
|
# Exclusions are defined in the ruleset.xml file
|
||||||
if [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then
|
if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then
|
||||||
parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
|
parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
|
||||||
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
|
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
|
||||||
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
|
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
|
||||||
@ -291,7 +291,7 @@ script:
|
|||||||
# Ensure we catch errors
|
# Ensure we catch errors
|
||||||
set -e
|
set -e
|
||||||
# Exclusions are defined in the ruleset.xml file
|
# Exclusions are defined in the ruleset.xml file
|
||||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then
|
if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then
|
||||||
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
|
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
|
||||||
fi
|
fi
|
||||||
set +e
|
set +e
|
||||||
|
|||||||
10
COPYRIGHT
10
COPYRIGHT
@ -28,7 +28,7 @@ CKEditor 4.12.1 LGPL-2.1+ Yes
|
|||||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||||
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||||
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
||||||
Mobiledetect 2.8.34 MIT License Yes Detect mobile devices browsers
|
Mobiledetect 2.8.39 MIT License Yes Detect mobile devices browsers
|
||||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
NuSoap 0.9.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
|
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||||
ParseDown 1.6 MIT License Yes Markdown parser
|
ParseDown 1.6 MIT License Yes Markdown parser
|
||||||
@ -48,10 +48,10 @@ TCPDF 6.3.2 LGPL-3+ Yes
|
|||||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||||
|
|
||||||
JS libraries:
|
JS libraries:
|
||||||
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||||
ChartJS 2.9.4 MIT License Yes JS library for graph
|
ChartJS 3.7.1 MIT License Yes JS library for graph
|
||||||
jQuery 3.5.1 MIT License Yes JS library
|
jQuery 3.6.0 MIT License Yes JS library
|
||||||
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
jQuery UI 1.13.1 GPL and MIT License Yes JS library plugin UI
|
||||||
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
|
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
|
||||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||||
|
|||||||
42
ChangeLog
42
ChangeLog
@ -3,12 +3,14 @@ English Dolibarr ChangeLog
|
|||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 16.0.0 compared to 15.0.0 *****
|
***** ChangeLog for 16.0.0 compared to 15.0.0 *****
|
||||||
|
|
||||||
For users:
|
For users:
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
NEW: ...
|
NEW: PHP 8.0 compatibility
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Modules
|
Modules
|
||||||
@ -20,13 +22,46 @@ NEW: Experimental module Partnership Management
|
|||||||
For developers:
|
For developers:
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
NEW:
|
NEW: A lot of addition of hooks.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
|
* The default value for MAIN_SECURITY_CSRF_WITH_TOKEN has been set to 2. It means any POST and any GET request that contains the "action" or "massaction"
|
||||||
|
with a value of a sensitive action must also a valid token parameter (With previous value 1, only POST was concerned). Note: With value 3, any URL
|
||||||
|
with parameter "action" or "massaction" need the token, whatever is the value of the action.
|
||||||
* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true.
|
* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true.
|
||||||
|
* The deprecated method thirdparty_doc_create() has been removed. You can use the generateDocument() instead.
|
||||||
|
* All triggers with a name XXX_UPDATE have been rename with name XXX_MODIFY for code consistency purpose.
|
||||||
|
* Rename build_path_from_id_categ() into buildPathFromId() and set method to private
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 15.0.1 compared to 15.0.0 *****
|
||||||
|
FIX: #19777 #20281
|
||||||
|
FIX: bad position of extrafields for interventions
|
||||||
|
FIX: Blocking situation when a payment was deleted in bank.
|
||||||
|
FIX: creation of the shipment if order contains services
|
||||||
|
FIX: Drag and drop line of files on join files tab
|
||||||
|
FIX: Error management on mass action "Approve holiday"
|
||||||
|
FIX: error with php8
|
||||||
|
FIX: in case of VAT refund, negative amount must be allowed
|
||||||
|
FIX: invoice pdf: lines originating from deposits were not detailed anymore
|
||||||
|
FIX: Invoice - When you create an invoice for a given thirdparty, fk_account is not retrieved from company card
|
||||||
|
FIX: list of visible type of event was not correctly filtered
|
||||||
|
FIX: Missing or bad permissions
|
||||||
|
FIX: Missing the field date start/end in export supplier invoice/order
|
||||||
|
FIX: On large proposal or invoice, fix n(n+1) sql into a n sql.
|
||||||
|
FIX: options should not exists on invoices
|
||||||
|
FIX: payment not completed when using Paypal.
|
||||||
|
FIX: permission to download files of expense report with readall.
|
||||||
|
FIX- Preview icon in documents list PDF in the admin page third-party
|
||||||
|
FIX: shipping list, e.shipping_method_id should be e.fk_shipping_method.
|
||||||
|
FIX: Show product photo on Supplier order Cornas model.
|
||||||
|
FIX: User name in ManufacturingOrder
|
||||||
|
FIX: viewimage.php blocks requests with multicompany from other enties
|
||||||
|
FIX: #yogosha9048
|
||||||
|
FIX: #yogosha9054
|
||||||
|
FIX: #yogosha9095
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 15.0.0 compared to 14.0.0 *****
|
***** ChangeLog for 15.0.0 compared to 14.0.0 *****
|
||||||
@ -36,6 +71,7 @@ For users:
|
|||||||
|
|
||||||
NEW: Online proposal signature
|
NEW: Online proposal signature
|
||||||
NEW: Can define some max limit on expense report (per period, per type or expense, ...)
|
NEW: Can define some max limit on expense report (per period, per type or expense, ...)
|
||||||
|
NEW: Provide a special pages for bookmarks and multicompany for a better use of some mobile applications (like DoliDroid)
|
||||||
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
|
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
|
||||||
NEW: Add option to disable globaly some notifications emails.
|
NEW: Add option to disable globaly some notifications emails.
|
||||||
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
|
NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
|
||||||
|
|||||||
@ -17,7 +17,7 @@ Alternatively send an email to security@dolibarr.org (for everybody)
|
|||||||
|
|
||||||
## Hunting vulnerabilities on Dolibarr
|
## Hunting vulnerabilities on Dolibarr
|
||||||
|
|
||||||
We believe that future of software is online SaaS. This means software are more and more critical and no technology is perfect. Working with skilled security researchers is crucial in identifying weaknesses in our technology.
|
We believe that the future of software is online SaaS. This means software are more and more critical and no technology is perfect. Working with skilled security researchers is crucial in identifying weaknesses in our technology.
|
||||||
|
|
||||||
If you believe you've found a security bug in our service, we are happy to work with you to resolve the issue promptly and ensure you are fairly rewarded for your discovery.
|
If you believe you've found a security bug in our service, we are happy to work with you to resolve the issue promptly and ensure you are fairly rewarded for your discovery.
|
||||||
|
|
||||||
@ -35,13 +35,13 @@ You can install the web application yourself on your own platform/server so you
|
|||||||
|
|
||||||
## Eligibility and Responsible Disclosure
|
## Eligibility and Responsible Disclosure
|
||||||
|
|
||||||
We are happy to thank everyone who submits valid reports which help us improve the security of Dolibarr however, only those that meet the following eligibility requirements will be "validated reports" (if not, we may close the report without any answer):
|
We are happy to thank everyone who submits valid reports which help us improve the security of Dolibarr, however only those that meet the following eligibility requirements will be "validated reports" (if not, we may close the report without any answer):
|
||||||
|
|
||||||
You must be the first reporter of the vulnerability (duplicate reports are closed).
|
You must be the first reporter of the vulnerability (duplicate reports are closed).
|
||||||
|
|
||||||
You must send a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary.
|
You must send a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary.
|
||||||
|
|
||||||
You must avoid tests that could cause degradation or interruption of our service (refrain from using automated tools, and limit yourself about requests per second), that's why we recommand to install softwate on your own platform.
|
You must avoid tests that could cause degradation or interruption of our service (refrain from using automated tools, and limit yourself about requests per second), that's why we recommand to install software on your own platform.
|
||||||
|
|
||||||
You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability.
|
You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability.
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us
|
|||||||
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
|
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
|
||||||
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
|
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
|
||||||
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
|
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
|
||||||
* The web server setup must be done so only the documents directory is in write mode. The root directory called htdocs must be readonly.
|
* The web server setup must be done so that only the documents directory is in write mode. The root directory called htdocs must be read-only.
|
||||||
* CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
|
* CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
|
||||||
* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user.
|
* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user.
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
"ext-curl" : "*",
|
"ext-curl" : "*",
|
||||||
"ckeditor/ckeditor" : "4.12.1",
|
"ckeditor/ckeditor" : "4.12.1",
|
||||||
"mike42/escpos-php" : "2.2",
|
"mike42/escpos-php" : "2.2",
|
||||||
"mobiledetect/mobiledetectlib" : "2.8.34",
|
"mobiledetect/mobiledetectlib" : "2.8.39",
|
||||||
"phpoffice/phpexcel" : "1.8.2",
|
"phpoffice/phpexcel" : "1.8.2",
|
||||||
"restler/framework" : "3.0.0-RC6",
|
"restler/framework" : "3.0.0-RC6",
|
||||||
"tecnickcom/tcpdf" : "6.3.2",
|
"tecnickcom/tcpdf" : "6.3.2",
|
||||||
@ -59,4 +59,4 @@
|
|||||||
"ext-zip" : "ODT, Excel and file compression support",
|
"ext-zip" : "ODT, Excel and file compression support",
|
||||||
"ext-xml" : "Excel support"
|
"ext-xml" : "Excel support"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
2349
composer.lock
generated
2349
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,10 @@ https://en.wikipedia.org/wiki/EPC_QR_code#Generators
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
* For ZATCA QR Code format (Saudi Arabia)
|
* For ZATCA QR Code format (Saudi Arabia). Used when INVOICE_ADD_ZATCA_QR_CODE is set
|
||||||
-----------------------------------------
|
-------------------------------------------------------------------------------------
|
||||||
https://www.pwc.com/m1/en/services/tax/me-tax-legal-news/2021/saudi-arabia-guide-to-develop-compliant-qr-code-for-simplified-einvoices.html
|
https://www.pwc.com/m1/en/services/tax/me-tax-legal-news/2021/saudi-arabia-guide-to-develop-compliant-qr-code-for-simplified-einvoices.html
|
||||||
|
|
||||||
|
https://www.tecklenborgh.com/post/ksa-zatca-publishes-guide-on-how-to-develop-a-fatoora-compliant-qr-code
|
||||||
|
|
||||||
|
Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.php
|
||||||
|
|||||||
@ -16,57 +16,57 @@ Voici la liste des codes pays ou systeme :
|
|||||||
|
|
||||||
EN
|
EN
|
||||||
==
|
==
|
||||||
Meaning of the numbers.
|
Meaning of the numbers:
|
||||||
|
|
||||||
- 2 digits for the country code or system code
|
- first 2-3 digits for the country code or system code
|
||||||
- 5 digits for the company identifier
|
- 5 digits for the company identifier
|
||||||
- 5 digits for item identifier
|
- 5 digits for item identifier
|
||||||
- 1 digit for checksum
|
- 1 digit for checksum
|
||||||
|
|
||||||
This rule has been twisted many times to improve the use of the available numbers.
|
This rule has been twisted many times to improve the use of the available numbers.
|
||||||
Here is the list of country codes or system:
|
|
||||||
|
|
||||||
|
Here is the list of country codes or system:
|
||||||
|
|
||||||
|
|
||||||
List
|
List
|
||||||
====
|
====
|
||||||
|
|
||||||
00 <EFBFBD> 13 UCC (Etats-Unis et Canada)
|
00 - 13 UCC (U.S.A / États-Unis & Canada)
|
||||||
20 <EFBFBD> 29 Codification interne en magasin
|
20 - 29 Flag for internal numbering / Codification interne en magasin
|
||||||
30 <EFBFBD> 37 GENCOD-EAN France
|
30 - 37 GENCOD-EAN France
|
||||||
380 BCCI (Bulgarie)
|
380 BCCI (Bulgaria)
|
||||||
383 SANA (Slovenie)
|
383 SANA (Slovenia)
|
||||||
385 CRO-EAN (Croatie)
|
385 CRO-EAN (Croatia)
|
||||||
387 EAN-BIH (Bosnie-Herzegovine)
|
387 EAN-BIH (Bosnia-Herzegovina)
|
||||||
400 <20> 440 CCG (Allemagne)
|
400-440 CCG (Allemagne/Germany)
|
||||||
45 + 49 Distribution Code Center <20> DCC (Japon)
|
45 + 49 Distribution Code Center - DCC (Japan)
|
||||||
460 <20> 469 UNISCAN - EAN Russie (Federation de Russie)
|
460-469 UNISCAN - EAN Russia (Federation de Russie)
|
||||||
471 CAN (Taiwan)
|
471 CAN Taiwan
|
||||||
474 EAN Estonie
|
474 EAN Estonia
|
||||||
475 EAN Lettonie
|
475 EAN Latvia
|
||||||
476 EAN Azerba<62> djan
|
476 EAN Azerbaijan
|
||||||
477 EAN Lituanie
|
477 EAN Lithuania
|
||||||
478 EAN Ouzbekistan
|
478 EAN Uzbekistan
|
||||||
479 EAN Sri Lanka
|
479 EAN Sri Lanka
|
||||||
480 PANC (Philippines)
|
480 PANC Philippines
|
||||||
481 EAN Bielorussie
|
481 EAN Belarus
|
||||||
482 EAN Ukraine
|
482 EAN Ukraine
|
||||||
484 EAN Moldavie
|
484 EAN Moldova
|
||||||
485 EAN Armenie
|
485 EAN Armenia
|
||||||
486 EAN Georgie
|
486 EAN Georgia
|
||||||
487 EAN Kazakhstan
|
487 EAN Kazakhstan
|
||||||
489 HKANA (Hong Kong)
|
489 HKANA Hong Kong
|
||||||
50 E Centre UK
|
50 E Centre UK - United Kingdom
|
||||||
520 HELLCAN-EAN HELLAS (Grece)
|
520 HELLCAN-EAN HELLAS (Grece)
|
||||||
528 EAN Liban
|
528 EAN Liban
|
||||||
529 EAN Chypre
|
529 EAN Chypre
|
||||||
531 EAN-MAC (FYR Mac<EFBFBD>donie)
|
531 EAN-MAC (FYR Macedonie)
|
||||||
535 EAN Malte
|
535 EAN Malte
|
||||||
539 EAN Irlande
|
539 EAN Irlande
|
||||||
54 ICODIF/EAN Belgique. Luxembourg
|
54 ICODIF/EAN Belgique. Luxembourg
|
||||||
560 CODIPOR (Portugal)
|
560 CODIPOR (Portugal)
|
||||||
569 EAN Islande
|
569 EAN Islande
|
||||||
57 EAN Danemark
|
57 EAN Danemark
|
||||||
590 EAN Pologne
|
590 EAN Pologne
|
||||||
594 EAN Roumanie
|
594 EAN Roumanie
|
||||||
599 H.A.P.M.H. (Hongrie)
|
599 H.A.P.M.H. (Hongrie)
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
# File of all ISO-4217 currencies codes
|
# File of all ISO-4217 currencies codes
|
||||||
# http://en.wikipedia.org/wiki/ISO_4217
|
|
||||||
# http://fx.sauder.ubc.ca/currency_table.html for symbols for 2 letter code
|
|
||||||
#
|
#
|
||||||
# Code,Name,Nb decimals
|
# https://en.wikipedia.org/wiki/ISO_4217
|
||||||
|
# https://en.wikipedia.org/wiki/Currency_symbol for symbols for 2 letter code
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# Code, Currency Name, Nb decimals
|
||||||
|
|
||||||
AED,UAE Dirham,2
|
AED,UAE Dirham,2
|
||||||
AFN,Afghanistan Afghani,2
|
AFN,Afghanistan Afghani,2
|
||||||
ALL,Albanian Lek,2
|
ALL,Albanian Lek,2
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/admin/export.php
|
* \file htdocs/accountancy/admin/export.php
|
||||||
* \ingroup Accountancy (Double entries)
|
* \ingroup Accountancy (Double entries)
|
||||||
* \brief Setup page to configure accounting expert module
|
* \brief Setup page to configure accounting export module
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
|
|||||||
@ -1,325 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
|
||||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
|
||||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
|
|
||||||
* \ingroup accountancy
|
|
||||||
* \brief Tab to manage customer lettering
|
|
||||||
*/
|
|
||||||
require '../../main.inc.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|
||||||
|
|
||||||
// Load translation files required by the page
|
|
||||||
$langs->loadLangs(array("compta", "accountancy"));
|
|
||||||
|
|
||||||
$action = GETPOST('action', 'aZ09');
|
|
||||||
$massaction = GETPOST('massaction', 'alpha');
|
|
||||||
$show_files = GETPOST('show_files', 'int');
|
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
|
||||||
$toselect = GETPOST('toselect', 'array');
|
|
||||||
// $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
|
|
||||||
// Security check
|
|
||||||
$socid = GETPOSTINT("socid");
|
|
||||||
// if ($user->socid) $socid=$user->socid;
|
|
||||||
|
|
||||||
$limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
|
||||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
|
||||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
|
||||||
$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 = "bk.doc_date";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
|
||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
|
||||||
//$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
|
||||||
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
|
|
||||||
*/
|
|
||||||
|
|
||||||
$lettering = GETPOST('lettering', 'alpha');
|
|
||||||
if (!empty($lettering)) {
|
|
||||||
$action = $lettering;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
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_date_start = '';
|
|
||||||
$search_date_end = '';
|
|
||||||
//$search_doc_type = '';
|
|
||||||
$search_doc_ref = '';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$lettering = new Lettering($db);
|
|
||||||
$object = new Societe($db);
|
|
||||||
$object->id = $socid;
|
|
||||||
$result = $object->fetch($socid);
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($conf->accounting->enabled)) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
if ($user->socid > 0) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Action
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($action == 'lettering') {
|
|
||||||
$result = $lettering->updateLettering($toselect);
|
|
||||||
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages('', $lettering->errors, 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ($action == 'autolettrage') {
|
|
||||||
|
|
||||||
$result = $lettering->letteringThirdparty($socid);
|
|
||||||
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages('', $lettering->errors, 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
$form = new Form($db);
|
|
||||||
$formaccounting = new FormAccounting($db);
|
|
||||||
|
|
||||||
$title = $object->name." - ".$langs->trans('TabLetteringCustomer');
|
|
||||||
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
|
|
||||||
llxHeader('', $title, $help_url);
|
|
||||||
|
|
||||||
$head = societe_prepare_head($object);
|
|
||||||
|
|
||||||
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'lettering_customer', $langs->trans("ThirdParty"), 0, 'company');
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
|
||||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
|
||||||
$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )";
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
|
||||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($search_date_start) . "' AND '" . $db->idate($search_date_end) . "' )";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sql .= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
|
||||||
|
|
||||||
$debit = 0;
|
|
||||||
$credit = 0;
|
|
||||||
$solde = 0;
|
|
||||||
// Count total nb of records and calc total sum
|
|
||||||
$nbtotalofrecords = '';
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if (!$resql) {
|
|
||||||
dol_print_error($db);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
$nbtotalofrecords = $db->num_rows($resql);
|
|
||||||
|
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
|
||||||
$debit += $obj->debit;
|
|
||||||
$credit += $obj->credit;
|
|
||||||
|
|
||||||
$solde += ($obj->credit - $obj->debit);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
|
||||||
|
|
||||||
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG);
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if (!$resql) {
|
|
||||||
dol_print_error($db);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$param = '';
|
|
||||||
$param .= "&socid=".urlencode($socid);
|
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
|
|
||||||
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG);
|
|
||||||
if ($resql) {
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
$param = "&socid=".$socid;
|
|
||||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
|
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
|
||||||
|
|
||||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
|
||||||
print '<table class="liste centpercent">'."\n";
|
|
||||||
|
|
||||||
/*
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
|
||||||
|
|
||||||
// Date
|
|
||||||
print '<td class="liste_titre center">';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('From') . ' ';
|
|
||||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('to') . ' ';
|
|
||||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Piece
|
|
||||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
|
||||||
print '<td colspan="6"> </td>';
|
|
||||||
print '<td class="right">';
|
|
||||||
$searchpicto = $form->showFilterButtons();
|
|
||||||
print $searchpicto;
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$solde = 0;
|
|
||||||
$tmp = '';
|
|
||||||
|
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
|
||||||
if ($tmp != $obj->lettering_code || empty($tmp)) {
|
|
||||||
$tmp = $obj->lettering_code;
|
|
||||||
}
|
|
||||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->doc_date), 'day').'</td>';
|
|
||||||
print '<td>'.$obj->doc_ref.'</td>';
|
|
||||||
print '<td>'.$obj->label_compte.'</td>';
|
|
||||||
print '<td class="nowrap right">'.price($obj->debit).'</td>';
|
|
||||||
print '<td class="nowrap right">'.price($obj->credit).'</td>';
|
|
||||||
print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
|
|
||||||
|
|
||||||
// Journal
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
|
||||||
$result = $accountingjournal->fetch('', $obj->code_journal);
|
|
||||||
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
|
|
||||||
print '<td class="center">'.$journaltoshow.'</td>';
|
|
||||||
|
|
||||||
if (empty($obj->lettering_code) && empty($obj->date_validated)) {
|
|
||||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
|
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
|
|
||||||
print img_edit();
|
|
||||||
print '</a></td>'."\n";
|
|
||||||
} else {
|
|
||||||
print '<td class="center">'.$obj->lettering_code.'</td>';
|
|
||||||
print '<td></td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>'."\n";
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($debit).'</strong></td>';
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($credit).'</strong></td>';
|
|
||||||
print '<td colspan="4"></td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>'."\n";
|
|
||||||
print '<td colspan="2"> </td>';
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($credit - $debit).'</strong></td>';
|
|
||||||
print '<td colspan="6"></td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
|
||||||
print $letteringbutton;
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print "</form>";
|
|
||||||
$db->free($resql);
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
// End of page
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
@ -1,322 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
|
||||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
|
||||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php
|
|
||||||
* \ingroup Accountancy (Double entries)
|
|
||||||
* \brief Tab to setup lettering
|
|
||||||
*/
|
|
||||||
require '../../main.inc.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|
||||||
|
|
||||||
// Load translation files required by the page
|
|
||||||
$langs->loadLangs(array("compta", "accountancy"));
|
|
||||||
|
|
||||||
$action = GETPOST('action', 'aZ09');
|
|
||||||
$massaction = GETPOST('massaction', 'alpha');
|
|
||||||
$show_files = GETPOST('show_files', 'int');
|
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
|
||||||
$toselect = GETPOST('toselect', 'array');
|
|
||||||
// $socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int'));
|
|
||||||
// Security check
|
|
||||||
$socid = GETPOSTINT("socid");
|
|
||||||
// if ($user->socid) $socid=$user->socid;
|
|
||||||
|
|
||||||
|
|
||||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
|
||||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
|
||||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
|
||||||
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 = "bk.doc_date";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
|
||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
|
||||||
//$search_doc_type = GETPOST("search_doc_type",'alpha');
|
|
||||||
$search_doc_ref = GETPOST("search_doc_ref",'alpha');
|
|
||||||
*/
|
|
||||||
|
|
||||||
$lettering = GETPOST('lettering', 'alpha');
|
|
||||||
if (!empty($lettering)) {
|
|
||||||
$action = $lettering;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
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_date_start = '';
|
|
||||||
$search_date_end = '';
|
|
||||||
//$search_doc_type='';
|
|
||||||
$search_doc_ref='';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$lettering = new Lettering($db);
|
|
||||||
$object = new Societe($db);
|
|
||||||
$object->id = $socid;
|
|
||||||
$result = $object->fetch($socid);
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($conf->accounting->enabled)) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
if ($user->socid > 0) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Action
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($action == 'lettering') {
|
|
||||||
$result = $lettering->updateLettering($toselect);
|
|
||||||
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages('', $lettering->errors, 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ($action == 'autolettrage') {
|
|
||||||
|
|
||||||
$result = $lettering->letteringThirdparty($socid);
|
|
||||||
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages('', $lettering->errors, 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
$form = new Form($db);
|
|
||||||
$formaccounting = new FormAccounting($db);
|
|
||||||
|
|
||||||
$title = $object->name." - ".$langs->trans('TabLetteringSupplier');
|
|
||||||
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
|
|
||||||
llxHeader('', $title, $help_url);
|
|
||||||
|
|
||||||
$head = societe_prepare_head($object);
|
|
||||||
|
|
||||||
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'lettering_supplier', $langs->trans("ThirdParty"), 0, 'company');
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
|
||||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
|
||||||
$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code, bk.date_validated ";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta_fournisseur)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)."' )";
|
|
||||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
|
||||||
$sql .= " AND (bk.doc_date BETWEEN '".$db->idate($search_date_start)."' AND '".$db->idate($search_date_end)."' )";
|
|
||||||
}
|
|
||||||
$sql .= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
|
||||||
|
|
||||||
$debit = 0;
|
|
||||||
$credit = 0;
|
|
||||||
$solde = 0;
|
|
||||||
// Count total nb of records and calc total sum
|
|
||||||
$nbtotalofrecords = '';
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if (!$resql) {
|
|
||||||
dol_print_error($db);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$nbtotalofrecords = $db->num_rows($resql);
|
|
||||||
|
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
|
||||||
$debit += $obj->debit;
|
|
||||||
$credit += $obj->credit;
|
|
||||||
|
|
||||||
$solde += ($obj->credit - $obj->debit);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
|
||||||
|
|
||||||
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG);
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if (!$resql) {
|
|
||||||
dol_print_error($db);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$param = '';
|
|
||||||
$param .= "&socid=".urlencode($socid);
|
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
|
|
||||||
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG);
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if ($resql) {
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
$param = "&socid=".$socid;
|
|
||||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
|
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
|
||||||
|
|
||||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
|
||||||
print '<table class="liste centpercent">'."\n";
|
|
||||||
|
|
||||||
/*
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
|
||||||
|
|
||||||
// Date
|
|
||||||
print '<td class="liste_titre center">';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('From') . ' ';
|
|
||||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('to') . ' ';
|
|
||||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Piece
|
|
||||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
|
||||||
print '<td colspan="6"> </td>';
|
|
||||||
print '<td class="right">';
|
|
||||||
$searchpicto = $form->showFilterButtons();
|
|
||||||
print $searchpicto;
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$solde = 0;
|
|
||||||
$tmp = '';
|
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
|
||||||
if ($tmp != $obj->lettering_code || empty($tmp)) {
|
|
||||||
$tmp = $obj->lettering_code;
|
|
||||||
}
|
|
||||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->doc_date), 'day').'</td>';
|
|
||||||
print '<td>'.$obj->doc_ref.'</td>';
|
|
||||||
print '<td>'.$obj->label_compte.'</td>';
|
|
||||||
print '<td class="nowrap right">'.price($obj->debit).'</td>';
|
|
||||||
print '<td class="nowrap right">'.price($obj->credit).'</td>';
|
|
||||||
print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
|
|
||||||
|
|
||||||
// Journal
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
|
||||||
$result = $accountingjournal->fetch('', $obj->code_journal);
|
|
||||||
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
|
|
||||||
print '<td class="center">'.$journaltoshow.'</td>';
|
|
||||||
|
|
||||||
if (empty($obj->lettering_code) && empty($obj->date_validated)) {
|
|
||||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
|
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
|
|
||||||
print img_edit();
|
|
||||||
print '</a></td>'."\n";
|
|
||||||
} else {
|
|
||||||
print '<td class="center">'.$obj->lettering_code.'</td>';
|
|
||||||
print '<td></td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>'."\n";
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($debit).'</strong></td>';
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($credit).'</strong></td>';
|
|
||||||
print '<td colspan="6"></td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>'."\n";
|
|
||||||
print '<td colspan="2"> </td>';
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($credit - $debit).'</strong></td>';
|
|
||||||
print '<td colspan="4"></td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
|
||||||
print $letteringbutton;
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print "</form>";
|
|
||||||
$db->free($resql);
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
// End of page
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
@ -64,6 +64,10 @@ class AccountancyExport
|
|||||||
public static $EXPORT_TYPE_FEC = 1000;
|
public static $EXPORT_TYPE_FEC = 1000;
|
||||||
public static $EXPORT_TYPE_FEC2 = 1010;
|
public static $EXPORT_TYPE_FEC2 = 1010;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var DoliDB Database handler
|
||||||
|
*/
|
||||||
|
public $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[] Error codes (or messages)
|
* @var string[] Error codes (or messages)
|
||||||
|
|||||||
@ -29,7 +29,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/class/accountancyimport.class.php
|
* \file htdocs/accountancy/class/accountancyimport.class.php
|
||||||
* \ingroup Accountancy (Double entries)
|
* \ingroup Accountancy (Double entries)
|
||||||
* \brief Class accountancy import
|
* \brief Class with methods for accountancy import
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -39,63 +39,104 @@
|
|||||||
*/
|
*/
|
||||||
class AccountancyImport
|
class AccountancyImport
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var DoliDB Database handler
|
||||||
|
*/
|
||||||
|
public $db;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDb $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct(DoliDB $db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean amount
|
||||||
|
*
|
||||||
|
* @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
||||||
|
* @param array $listfields Fields list to add
|
||||||
|
* @param int $record_key Record key
|
||||||
|
* @return mixed Value
|
||||||
|
*/
|
||||||
|
public function cleanAmount(&$arrayrecord, $listfields, $record_key)
|
||||||
|
{
|
||||||
|
$value_trim = trim($arrayrecord[$record_key]['val']);
|
||||||
|
return floatval($value_trim);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean value with trim
|
||||||
|
*
|
||||||
|
* @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
||||||
|
* @param array $listfields Fields list to add
|
||||||
|
* @param int $record_key Record key
|
||||||
|
* @return mixed Value
|
||||||
|
*/
|
||||||
|
public function cleanValue(&$arrayrecord, $listfields, $record_key)
|
||||||
|
{
|
||||||
|
return trim($arrayrecord[$record_key]['val']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute amount
|
* Compute amount
|
||||||
*
|
*
|
||||||
* @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
* @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
||||||
* @param string $fieldname Field name with alias
|
|
||||||
* @param array $listfields Fields list to add
|
* @param array $listfields Fields list to add
|
||||||
* @param array $listvalues Values list to add
|
* @param int $record_key Record key
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return mixed Value
|
||||||
*/
|
*/
|
||||||
public function computeAmount(&$arrayrecord, $fieldname, &$listfields, &$listvalues)
|
public function computeAmount(&$arrayrecord, $listfields, $record_key)
|
||||||
{
|
{
|
||||||
$fieldArr = explode('.', $fieldname);
|
// get fields indexes
|
||||||
if (count($fieldArr) > 0) {
|
$field_index_list = array_flip($listfields);
|
||||||
$fieldname = $fieldArr[1];
|
if (isset($field_index_list['debit']) && isset($field_index_list['credit'])) {
|
||||||
|
$debit_index = $field_index_list['debit'];
|
||||||
|
$credit_index = $field_index_list['credit'];
|
||||||
|
|
||||||
|
$debit = floatval($arrayrecord[$debit_index]['val']);
|
||||||
|
$credit = floatval($arrayrecord[$credit_index]['val']);
|
||||||
|
if (!empty($debit)) {
|
||||||
|
$amount = $debit;
|
||||||
|
} else {
|
||||||
|
$amount = $credit;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "'" . $this->db->escape(abs($amount)) . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$debit = floatval(trim($arrayrecord[11]['val']));
|
return "''";
|
||||||
$credit = floatval(trim($arrayrecord[12]['val']));
|
|
||||||
if (!empty($debit)) {
|
|
||||||
$amount = $debit;
|
|
||||||
} else {
|
|
||||||
$amount = $credit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$listfields[] = $fieldname;
|
|
||||||
$listvalues[] = "'" . abs($amount) . "'";
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute sens
|
* Compute direction
|
||||||
*
|
*
|
||||||
* @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
* @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
||||||
* @param string $fieldname Field name with alias
|
|
||||||
* @param array $listfields Fields list to add
|
* @param array $listfields Fields list to add
|
||||||
* @param array $listvalues Values list to add
|
* @param int $record_key Record key
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return mixed Value
|
||||||
*/
|
*/
|
||||||
public function computeDirection(&$arrayrecord, $fieldname, &$listfields, &$listvalues)
|
public function computeDirection(&$arrayrecord, $listfields, $record_key)
|
||||||
{
|
{
|
||||||
$fieldArr = explode('.', $fieldname);
|
$field_index_list = array_flip($listfields);
|
||||||
if (count($fieldArr) > 0) {
|
if (isset($field_index_list['debit'])) {
|
||||||
$fieldname = $fieldArr[1];
|
$debit_index = $field_index_list['debit'];
|
||||||
|
|
||||||
|
$debit = floatval($arrayrecord[$debit_index]['val']);
|
||||||
|
if (!empty($debit)) {
|
||||||
|
$sens = 'D';
|
||||||
|
} else {
|
||||||
|
$sens = 'C';
|
||||||
|
}
|
||||||
|
|
||||||
|
return "'" . $this->db->escape($sens) . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$debit = floatval(trim($arrayrecord[11]['val']));
|
return "''";
|
||||||
if (!empty($debit)) {
|
|
||||||
$sens = 'D';
|
|
||||||
} else {
|
|
||||||
$sens = 'C';
|
|
||||||
}
|
|
||||||
|
|
||||||
$listfields[] = $fieldname;
|
|
||||||
$listvalues[] = "'" . $sens . "'";
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,7 +68,7 @@ $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
|||||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusonPour le détail de la facture ref…e') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
if (empty($page) || $page < 0) {
|
if (empty($page) || $page < 0) {
|
||||||
$page = 0;
|
$page = 0;
|
||||||
}
|
}
|
||||||
@ -137,9 +137,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as l";
|
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||||
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||||
$sql1 .= ' WHERE l.rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
$sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||||
|
|
||||||
dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1);
|
dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1);
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
@ -496,8 +496,8 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="tdoverflowonsmartphone">';
|
print '<td class="tdoverflowonsmartphone small">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -637,7 +637,7 @@ if ($result) {
|
|||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<td class="tdoverflowonsmartphone small">';
|
print '<td class="tdoverflowonsmartphone small">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1));
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc);
|
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -405,7 +405,7 @@ if ($result) {
|
|||||||
|
|
||||||
// Fees description -- Can be null
|
// Fees description -- Can be null
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments, 1));
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -481,7 +481,7 @@ if ($result) {
|
|||||||
|
|
||||||
// Fees description -- Can be null
|
// Fees description -- Can be null
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments, 1));
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -117,77 +117,79 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
|||||||
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
||||||
print "<br>\n"; print "<br>\n";
|
if (!empty($user->rights->accounting->chartofaccount)) {
|
||||||
|
print "<br>\n"; print "<br>\n";
|
||||||
|
|
||||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||||
print '<hr>';
|
print '<hr>';
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
// STEPS
|
// STEPS
|
||||||
$step++;
|
|
||||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
|
|
||||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
|
|
||||||
print $s;
|
|
||||||
print "<br>\n";
|
|
||||||
$step++;
|
|
||||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
|
|
||||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
|
|
||||||
print $s;
|
|
||||||
print "<br>\n";
|
|
||||||
$step++;
|
|
||||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
|
|
||||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
|
|
||||||
print $s;
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
print "<br>\n";
|
|
||||||
print $langs->trans("AccountancyAreaDescActionOnceBis");
|
|
||||||
print "<br>\n";
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
$step++;
|
|
||||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
|
|
||||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
|
|
||||||
print $s;
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
$step++;
|
|
||||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
|
|
||||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
|
|
||||||
print $s;
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
$step++;
|
|
||||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
|
|
||||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
|
|
||||||
$s = str_replace('{s}', $textlink, $s);
|
|
||||||
print $s;
|
|
||||||
print "<br>\n";
|
|
||||||
if (!empty($conf->tax->enabled)) {
|
|
||||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
|
|
||||||
$step++;
|
$step++;
|
||||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
|
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
|
||||||
|
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
|
||||||
|
print $s;
|
||||||
|
print "<br>\n";
|
||||||
|
$step++;
|
||||||
|
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
|
||||||
|
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
|
||||||
|
print $s;
|
||||||
|
print "<br>\n";
|
||||||
|
$step++;
|
||||||
|
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
|
||||||
|
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
|
||||||
|
print $s;
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
print "<br>\n";
|
||||||
|
print $langs->trans("AccountancyAreaDescActionOnceBis");
|
||||||
|
print "<br>\n";
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
|
||||||
|
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
|
||||||
|
print $s;
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
|
||||||
|
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
|
||||||
|
print $s;
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
$step++;
|
||||||
|
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
|
||||||
|
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
|
||||||
$s = str_replace('{s}', $textlink, $s);
|
$s = str_replace('{s}', $textlink, $s);
|
||||||
print $s;
|
print $s;
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
}
|
|
||||||
if (!empty($conf->expensereport->enabled)) {
|
if (!empty($conf->tax->enabled)) {
|
||||||
|
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
|
||||||
|
$step++;
|
||||||
|
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
|
||||||
|
$s = str_replace('{s}', $textlink, $s);
|
||||||
|
print $s;
|
||||||
|
print "<br>\n";
|
||||||
|
}
|
||||||
|
if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
||||||
|
$step++;
|
||||||
|
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
|
||||||
|
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
|
||||||
|
print $s;
|
||||||
|
print "<br>\n";
|
||||||
|
}
|
||||||
|
|
||||||
$step++;
|
$step++;
|
||||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
|
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
|
||||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
|
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
|
||||||
print $s;
|
print $s;
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$step++;
|
|
||||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
|
|
||||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
|
|
||||||
print $s;
|
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
// Step A - E
|
// Step A - E
|
||||||
|
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|||||||
@ -117,7 +117,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
|||||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.amount_main_currency, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
||||||
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
||||||
$sql .= " soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
|
$sql .= " soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
|
||||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||||
@ -142,7 +142,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
|||||||
}
|
}
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
|
||||||
$sql .= " WHERE ba.fk_accountancy_journal=".((int) $id_journal);
|
$sql .= " WHERE ba.fk_accountancy_journal=".((int) $id_journal);
|
||||||
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
$sql .= ' AND b.amount <> 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||||
if ($date_start && $date_end) {
|
if ($date_start && $date_end) {
|
||||||
$sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
|
$sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
@ -282,6 +282,7 @@ if ($result) {
|
|||||||
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
||||||
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
|
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
|
||||||
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
|
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
|
||||||
|
$reg = array();
|
||||||
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
|
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
|
||||||
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
|
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
|
||||||
} else {
|
} else {
|
||||||
@ -296,6 +297,12 @@ if ($result) {
|
|||||||
$tabtype[$obj->rowid] = 'unknown';
|
$tabtype[$obj->rowid] = 'unknown';
|
||||||
$tabmoreinfo[$obj->rowid] = array();
|
$tabmoreinfo[$obj->rowid] = array();
|
||||||
|
|
||||||
|
$amounttouse = $obj->amount;
|
||||||
|
if (!empty($obj->amount_main_currency)) {
|
||||||
|
// If $obj->amount_main_currency is set, it means that $obj->amount is not in same currency, we must use $obj->amount_main_currency
|
||||||
|
$amounttouse = $obj->amount_main_currency;
|
||||||
|
}
|
||||||
|
|
||||||
// get_url may return -1 which is not traversable
|
// get_url may return -1 which is not traversable
|
||||||
if (is_array($links) && count($links) > 0) {
|
if (is_array($links) && count($links) > 0) {
|
||||||
// Now loop on each link of record in bank (code similar to bankentries_list.php)
|
// Now loop on each link of record in bank (code similar to bankentries_list.php)
|
||||||
@ -334,7 +341,7 @@ if ($result) {
|
|||||||
$societestatic->email = $tabcompany[$obj->rowid]['email'];
|
$societestatic->email = $tabcompany[$obj->rowid]['email'];
|
||||||
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
||||||
if ($compta_soc) {
|
if ($compta_soc) {
|
||||||
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
|
||||||
}
|
}
|
||||||
} elseif ($links[$key]['type'] == 'user') {
|
} elseif ($links[$key]['type'] == 'user') {
|
||||||
$userstatic->id = $links[$key]['url_id'];
|
$userstatic->id = $links[$key]['url_id'];
|
||||||
@ -350,7 +357,7 @@ if ($result) {
|
|||||||
$tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
|
$tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
|
||||||
}
|
}
|
||||||
if ($compta_user) {
|
if ($compta_user) {
|
||||||
$tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
$tabtp[$obj->rowid][$compta_user] += $amounttouse;
|
||||||
}
|
}
|
||||||
} elseif ($links[$key]['type'] == 'sc') {
|
} elseif ($links[$key]['type'] == 'sc') {
|
||||||
$chargestatic->id = $links[$key]['url_id'];
|
$chargestatic->id = $links[$key]['url_id'];
|
||||||
@ -383,7 +390,7 @@ if ($result) {
|
|||||||
$resultmid = $db->query($sqlmid);
|
$resultmid = $db->query($sqlmid);
|
||||||
if ($resultmid) {
|
if ($resultmid) {
|
||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
|
$tabtp[$obj->rowid][$objmid->accountancy_code] += $amounttouse;
|
||||||
}
|
}
|
||||||
} elseif ($links[$key]['type'] == 'payment_donation') {
|
} elseif ($links[$key]['type'] == 'payment_donation') {
|
||||||
$paymentdonstatic->id = $links[$key]['url_id'];
|
$paymentdonstatic->id = $links[$key]['url_id'];
|
||||||
@ -391,7 +398,7 @@ if ($result) {
|
|||||||
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
|
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2);
|
||||||
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
|
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
|
||||||
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
|
$tabtp[$obj->rowid][$account_pay_donation] += $amounttouse;
|
||||||
} elseif ($links[$key]['type'] == 'member') {
|
} elseif ($links[$key]['type'] == 'member') {
|
||||||
$paymentsubscriptionstatic->id = $links[$key]['url_id'];
|
$paymentsubscriptionstatic->id = $links[$key]['url_id'];
|
||||||
$paymentsubscriptionstatic->ref = $links[$key]['url_id'];
|
$paymentsubscriptionstatic->ref = $links[$key]['url_id'];
|
||||||
@ -399,14 +406,14 @@ if ($result) {
|
|||||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2);
|
||||||
$tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id;
|
$tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id;
|
||||||
$paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id);
|
$paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id);
|
||||||
$tabtp[$obj->rowid][$account_pay_subscription] += $obj->amount;
|
$tabtp[$obj->rowid][$account_pay_subscription] += $amounttouse;
|
||||||
} elseif ($links[$key]['type'] == 'payment_vat') { // Payment VAT
|
} elseif ($links[$key]['type'] == 'payment_vat') { // Payment VAT
|
||||||
$paymentvatstatic->id = $links[$key]['url_id'];
|
$paymentvatstatic->id = $links[$key]['url_id'];
|
||||||
$paymentvatstatic->ref = $links[$key]['url_id'];
|
$paymentvatstatic->ref = $links[$key]['url_id'];
|
||||||
$paymentvatstatic->label = $links[$key]['label'];
|
$paymentvatstatic->label = $links[$key]['label'];
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2);
|
||||||
$tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id;
|
$tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id;
|
||||||
$tabtp[$obj->rowid][$account_pay_vat] += $obj->amount;
|
$tabtp[$obj->rowid][$account_pay_vat] += $amounttouse;
|
||||||
} elseif ($links[$key]['type'] == 'payment_salary') {
|
} elseif ($links[$key]['type'] == 'payment_salary') {
|
||||||
$paymentsalstatic->id = $links[$key]['url_id'];
|
$paymentsalstatic->id = $links[$key]['url_id'];
|
||||||
$paymentsalstatic->ref = $links[$key]['url_id'];
|
$paymentsalstatic->ref = $links[$key]['url_id'];
|
||||||
@ -438,7 +445,7 @@ if ($result) {
|
|||||||
if (empty($obj->typeop_user)) { // Add test to avoid to add amount twice if a link already exists also on user.
|
if (empty($obj->typeop_user)) { // Add test to avoid to add amount twice if a link already exists also on user.
|
||||||
$compta_user = $userstatic->accountancy_code;
|
$compta_user = $userstatic->accountancy_code;
|
||||||
if ($compta_user) {
|
if ($compta_user) {
|
||||||
$tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
$tabtp[$obj->rowid][$compta_user] += $amounttouse;
|
||||||
$tabuser[$obj->rowid] = array(
|
$tabuser[$obj->rowid] = array(
|
||||||
'id' => $userstatic->id,
|
'id' => $userstatic->id,
|
||||||
'name' => dolGetFirstLastname($userstatic->firstname, $userstatic->lastname),
|
'name' => dolGetFirstLastname($userstatic->firstname, $userstatic->lastname),
|
||||||
@ -465,14 +472,14 @@ if ($result) {
|
|||||||
$account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
|
$account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
|
||||||
$account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
|
$account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
|
||||||
$tabpay[$obj->rowid]["account_various"] = $account_various;
|
$tabpay[$obj->rowid]["account_various"] = $account_various;
|
||||||
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
|
$tabtp[$obj->rowid][$account_subledger] += $amounttouse;
|
||||||
} elseif ($links[$key]['type'] == 'payment_loan') {
|
} elseif ($links[$key]['type'] == 'payment_loan') {
|
||||||
$paymentloanstatic->id = $links[$key]['url_id'];
|
$paymentloanstatic->id = $links[$key]['url_id'];
|
||||||
$paymentloanstatic->ref = $links[$key]['url_id'];
|
$paymentloanstatic->ref = $links[$key]['url_id'];
|
||||||
$paymentloanstatic->fk_loan = $links[$key]['url_id'];
|
$paymentloanstatic->fk_loan = $links[$key]['url_id'];
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2);
|
||||||
$tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id;
|
$tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id;
|
||||||
//$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount;
|
//$tabtp[$obj->rowid][$account_pay_loan] += $amounttouse;
|
||||||
$sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest';
|
$sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest';
|
||||||
$sqlmid .= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
|
$sqlmid .= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
|
||||||
$sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.((int) $obj->rowid);
|
$sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.((int) $obj->rowid);
|
||||||
@ -488,14 +495,14 @@ if ($result) {
|
|||||||
} elseif ($links[$key]['type'] == 'banktransfert') {
|
} elseif ($links[$key]['type'] == 'banktransfert') {
|
||||||
$accountLinestatic->fetch($links[$key]['url_id']);
|
$accountLinestatic->fetch($links[$key]['url_id']);
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1);
|
$tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1);
|
||||||
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
|
$tabtp[$obj->rowid][$account_transfer] += $amounttouse;
|
||||||
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
|
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
|
||||||
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
$tabbq[$obj->rowid][$compta_bank] += $amounttouse;
|
||||||
|
|
||||||
// If no links were found to know the amount on thirdparty, we try to guess it.
|
// If no links were found to know the amount on thirdparty, we try to guess it.
|
||||||
// This may happens on bank entries without the links lines to 'company'.
|
// This may happens on bank entries without the links lines to 'company'.
|
||||||
@ -542,7 +549,7 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -412,8 +412,13 @@ if ($action == 'writebookkeeping') {
|
|||||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||||
|
|
||||||
$bookkeeping->subledger_account = '';
|
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||||
$bookkeeping->subledger_label = '';
|
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||||
|
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||||
|
} else {
|
||||||
|
$bookkeeping->subledger_account = '';
|
||||||
|
$bookkeeping->subledger_label = '';
|
||||||
|
}
|
||||||
|
|
||||||
$bookkeeping->numero_compte = $k;
|
$bookkeeping->numero_compte = $k;
|
||||||
$bookkeeping->label_compte = $label_account;
|
$bookkeeping->label_compte = $label_account;
|
||||||
@ -886,6 +891,13 @@ if (empty($action) || $action == 'view') {
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
// Subledger account
|
// Subledger account
|
||||||
print "<td>";
|
print "<td>";
|
||||||
|
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||||
|
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
|
||||||
|
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
|
||||||
|
} else {
|
||||||
|
print length_accounta($tabcompany[$key]['code_compta']);
|
||||||
|
}
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
$companystatic->id = $tabcompany[$key]['id'];
|
$companystatic->id = $tabcompany[$key]['id'];
|
||||||
$companystatic->name = $tabcompany[$key]['name'];
|
$companystatic->name = $tabcompany[$key]['name'];
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -49,6 +49,7 @@ $search_societe = GETPOST('search_societe', 'alpha');
|
|||||||
$search_lineid = GETPOST('search_lineid', 'int');
|
$search_lineid = GETPOST('search_lineid', 'int');
|
||||||
$search_ref = GETPOST('search_ref', 'alpha');
|
$search_ref = GETPOST('search_ref', 'alpha');
|
||||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||||
|
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
|
||||||
$search_label = GETPOST('search_label', 'alpha');
|
$search_label = GETPOST('search_label', 'alpha');
|
||||||
$search_desc = GETPOST('search_desc', 'alpha');
|
$search_desc = GETPOST('search_desc', 'alpha');
|
||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
@ -112,6 +113,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
$search_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
$search_invoice = '';
|
$search_invoice = '';
|
||||||
|
$search_ref_supplier = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
$search_desc = '';
|
$search_desc = '';
|
||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
@ -140,9 +142,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as l";
|
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||||
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||||
$sql1 .= ' WHERE l.rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
$sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||||
|
|
||||||
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1);
|
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1);
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
@ -236,6 +238,9 @@ if ($search_lineid) {
|
|||||||
if (strlen(trim($search_invoice))) {
|
if (strlen(trim($search_invoice))) {
|
||||||
$sql .= natural_search("f.ref", $search_invoice);
|
$sql .= natural_search("f.ref", $search_invoice);
|
||||||
}
|
}
|
||||||
|
if (strlen(trim($search_ref_supplier))) {
|
||||||
|
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
|
||||||
|
}
|
||||||
if (strlen(trim($search_label))) {
|
if (strlen(trim($search_label))) {
|
||||||
$sql .= natural_search("f.libelle", $search_label);
|
$sql .= natural_search("f.libelle", $search_label);
|
||||||
}
|
}
|
||||||
@ -328,6 +333,9 @@ if ($result) {
|
|||||||
if ($search_ref) {
|
if ($search_ref) {
|
||||||
$param .= "&search_ref=".urlencode($search_ref);
|
$param .= "&search_ref=".urlencode($search_ref);
|
||||||
}
|
}
|
||||||
|
if ($search_ref_supplier) {
|
||||||
|
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||||
|
}
|
||||||
if ($search_label) {
|
if ($search_label) {
|
||||||
$param .= "&search_label=".urlencode($search_label);
|
$param .= "&search_label=".urlencode($search_label);
|
||||||
}
|
}
|
||||||
@ -392,6 +400,7 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
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 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"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||||
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
@ -420,6 +429,7 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
@ -446,6 +456,9 @@ if ($result) {
|
|||||||
|
|
||||||
$facturefournisseur_static->ref = $objp->ref;
|
$facturefournisseur_static->ref = $objp->ref;
|
||||||
$facturefournisseur_static->id = $objp->facid;
|
$facturefournisseur_static->id = $objp->facid;
|
||||||
|
$facturefournisseur_static->type = $objp->ftype;
|
||||||
|
$facturefournisseur_static->ref_supplier = $objp->ref_supplier;
|
||||||
|
$facturefournisseur_static->label = $objp->invoice_label;
|
||||||
|
|
||||||
$thirdpartystatic->id = $objp->socid;
|
$thirdpartystatic->id = $objp->socid;
|
||||||
$thirdpartystatic->name = $objp->name;
|
$thirdpartystatic->name = $objp->name;
|
||||||
@ -465,8 +478,8 @@ if ($result) {
|
|||||||
$productstatic->status = $objp->tosell;
|
$productstatic->status = $objp->tosell;
|
||||||
$productstatic->status_buy = $objp->tobuy;
|
$productstatic->status_buy = $objp->tobuy;
|
||||||
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
|
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
|
||||||
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy;
|
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy_intra;
|
||||||
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy;
|
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy_export;
|
||||||
|
|
||||||
$accountingaccountstatic->rowid = $objp->fk_compte;
|
$accountingaccountstatic->rowid = $objp->fk_compte;
|
||||||
$accountingaccountstatic->label = $objp->label_account;
|
$accountingaccountstatic->label = $objp->label_account;
|
||||||
@ -481,7 +494,13 @@ if ($result) {
|
|||||||
// Ref Invoice
|
// Ref Invoice
|
||||||
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1).'</td>';
|
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1).'</td>';
|
||||||
|
|
||||||
print '<td class="tdoverflowonsmartphone">';
|
// Ref supplier invoice
|
||||||
|
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
|
||||||
|
print $objp->ref_supplier;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Supplier invoice label
|
||||||
|
print '<td class="tdoverflowonsmartphone small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
|
||||||
print $objp->invoice_label;
|
print $objp->invoice_label;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -501,8 +520,8 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="tdoverflowonsmartphone">';
|
print '<td class="tdoverflowonsmartphone small">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -55,6 +55,7 @@ $mesCasesCochees = GETPOST('toselect', 'array');
|
|||||||
$search_societe = GETPOST('search_societe', 'alpha');
|
$search_societe = GETPOST('search_societe', 'alpha');
|
||||||
$search_lineid = GETPOST('search_lineid', 'int');
|
$search_lineid = GETPOST('search_lineid', 'int');
|
||||||
$search_ref = GETPOST('search_ref', 'alpha');
|
$search_ref = GETPOST('search_ref', 'alpha');
|
||||||
|
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
|
||||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||||
$search_label = GETPOST('search_label', 'alpha');
|
$search_label = GETPOST('search_label', 'alpha');
|
||||||
$search_desc = GETPOST('search_desc', 'alpha');
|
$search_desc = GETPOST('search_desc', 'alpha');
|
||||||
@ -137,6 +138,7 @@ if (empty($reshook)) {
|
|||||||
$search_societe = '';
|
$search_societe = '';
|
||||||
$search_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
|
$search_ref_supplier = '';
|
||||||
$search_invoice = '';
|
$search_invoice = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
$search_desc = '';
|
$search_desc = '';
|
||||||
@ -290,6 +292,9 @@ if (strlen(trim($search_invoice))) {
|
|||||||
if (strlen(trim($search_ref))) {
|
if (strlen(trim($search_ref))) {
|
||||||
$sql .= natural_search("p.ref", $search_ref);
|
$sql .= natural_search("p.ref", $search_ref);
|
||||||
}
|
}
|
||||||
|
if (strlen(trim($search_ref_supplier))) {
|
||||||
|
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
|
||||||
|
}
|
||||||
if (strlen(trim($search_label))) {
|
if (strlen(trim($search_label))) {
|
||||||
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
|
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
|
||||||
}
|
}
|
||||||
@ -413,6 +418,9 @@ if ($result) {
|
|||||||
if ($search_ref) {
|
if ($search_ref) {
|
||||||
$param .= '&search_ref='.urlencode($search_ref);
|
$param .= '&search_ref='.urlencode($search_ref);
|
||||||
}
|
}
|
||||||
|
if ($search_ref_supplier) {
|
||||||
|
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||||
|
}
|
||||||
if ($search_label) {
|
if ($search_label) {
|
||||||
$param .= '&search_label='.urlencode($search_label);
|
$param .= '&search_label='.urlencode($search_label);
|
||||||
}
|
}
|
||||||
@ -469,7 +477,8 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
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 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"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||||
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||||
@ -499,7 +508,8 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
//print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||||
@ -566,6 +576,7 @@ if ($result) {
|
|||||||
$facturefourn_static->ref = $objp->ref;
|
$facturefourn_static->ref = $objp->ref;
|
||||||
$facturefourn_static->id = $objp->facid;
|
$facturefourn_static->id = $objp->facid;
|
||||||
$facturefourn_static->type = $objp->ftype;
|
$facturefourn_static->type = $objp->ftype;
|
||||||
|
$facturefourn_static->ref_supplier = $objp->ref_supplier;
|
||||||
$facturefourn_static->label = $objp->invoice_label;
|
$facturefourn_static->label = $objp->invoice_label;
|
||||||
$facturefourn_static->date = $db->jdate($objp->datef);
|
$facturefourn_static->date = $db->jdate($objp->datef);
|
||||||
|
|
||||||
@ -625,15 +636,21 @@ if ($result) {
|
|||||||
// Ref Invoice
|
// Ref Invoice
|
||||||
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
|
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
|
||||||
|
|
||||||
/*print '<td class="tdoverflowonsmartphone">';
|
// Ref supplier invoice
|
||||||
|
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
|
||||||
|
print $objp->ref_supplier;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Supplier invoice label
|
||||||
|
print '<td class="tdoverflowmax125 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
|
||||||
print $objp->invoice_label;
|
print $objp->invoice_label;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
*/
|
|
||||||
|
|
||||||
|
// Date
|
||||||
print '<td class="center">'.dol_print_date($facturefourn_static->date, 'day').'</td>';
|
print '<td class="center">'.dol_print_date($facturefourn_static->date, 'day').'</td>';
|
||||||
|
|
||||||
// Ref Product
|
// Ref Product
|
||||||
print '<td class="tdoverflowmax150">';
|
print '<td class="tdoverflowmax100">';
|
||||||
if ($product_static->id > 0) {
|
if ($product_static->id > 0) {
|
||||||
print $product_static->getNomUrl(1);
|
print $product_static->getNomUrl(1);
|
||||||
}
|
}
|
||||||
@ -644,7 +661,7 @@ if ($result) {
|
|||||||
|
|
||||||
// Description
|
// Description
|
||||||
print '<td class="tdoverflowonsmartphone small">';
|
print '<td class="tdoverflowonsmartphone small">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
|
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|||||||
@ -1719,8 +1719,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
|
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dol_escape_htmltag($object->company).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dol_escape_htmltag($object->company).'</td></tr>';
|
||||||
|
|
||||||
@ -1737,9 +1735,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
if ($user->admin) {
|
if ($user->admin) {
|
||||||
print '<!-- '.$langs->trans("Crypted").': '.$object->pass_indatabase_crypted.' -->';
|
print '<!-- '.$langs->trans("Crypted").': '.$object->pass_indatabase_crypted.' -->';
|
||||||
}
|
}
|
||||||
print '<span class="opacitymedium"'.$langs->trans("Hidden").'</span>';
|
print '<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
|
||||||
}
|
}
|
||||||
if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) {
|
if (!empty($object->pass_indatabase) && empty($object->user_id)) { // Show warning only for old password still in clear (does not happen anymore)
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
|
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
|
||||||
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
|
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
|
||||||
@ -1778,7 +1776,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '<div class="fichehalfright">';
|
print '<div class="fichehalfright">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border tableforfield tableforfield centpercent">';
|
print '<table class="border tableforfield centpercent">';
|
||||||
|
|
||||||
// Tags / Categories
|
// Tags / Categories
|
||||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||||
@ -1853,18 +1851,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// VCard
|
|
||||||
/*
|
|
||||||
print '<tr><td>';
|
|
||||||
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', 'vcard.png', 'class="paddingrightonly"');
|
|
||||||
print $langs->trans("Download");
|
|
||||||
print img_picto($langs->trans("Download").' vcard', 'download', 'class="paddingleft"');
|
|
||||||
print '</a>';
|
|
||||||
print '</td></tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
print "</div></div>\n";
|
print "</div></div>\n";
|
||||||
|
|||||||
@ -1534,9 +1534,9 @@ class Adherent extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $date Date of effect of subscription
|
* @param int $date Date of effect of subscription
|
||||||
* @param double $amount Amount of subscription (0 accepted for some members)
|
* @param double $amount Amount of subscription (0 accepted for some members)
|
||||||
* @param int $accountid Id bank account
|
* @param int $accountid Id bank account. NOT USED.
|
||||||
* @param string $operation Type of payment (if Id bank account provided). Example: 'CB', ...
|
* @param string $operation Code of payment mode (if Id bank account provided). Example: 'CB', ... NOT USED.
|
||||||
* @param string $label Label operation (if Id bank account provided)
|
* @param string $label Label operation (if Id bank account provided).
|
||||||
* @param string $num_chq Numero cheque (if Id bank account provided)
|
* @param string $num_chq Numero cheque (if Id bank account provided)
|
||||||
* @param string $emetteur_nom Name of cheque writer
|
* @param string $emetteur_nom Name of cheque writer
|
||||||
* @param string $emetteur_banque Name of bank of cheque
|
* @param string $emetteur_banque Name of bank of cheque
|
||||||
|
|||||||
@ -271,7 +271,7 @@ class AdherentType extends CommonObject
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('ADHERENT_TYPE_DEL_MULTILANGS', $user);
|
$result = $this->call_trigger('MEMBER_TYPE_DEL_MULTILANGS', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
|
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
|
||||||
|
|||||||
@ -358,7 +358,7 @@ class Members extends DolibarrApi
|
|||||||
if ($member->update(DolibarrApiAccess::$user) >= 0) {
|
if ($member->update(DolibarrApiAccess::$user) >= 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
} else {
|
} else {
|
||||||
throw new RestException(500, $member->error);
|
throw new RestException(500, 'Error when updating member: '.$member->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -204,7 +204,7 @@ class MembersTypes extends DolibarrApi
|
|||||||
if ($membertype->update(DolibarrApiAccess::$user) >= 0) {
|
if ($membertype->update(DolibarrApiAccess::$user) >= 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
} else {
|
} else {
|
||||||
throw new RestException(500, $membertype->error);
|
throw new RestException(500, 'Error when updating member type: '.$membertype->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -159,7 +159,7 @@ class Subscriptions extends DolibarrApi
|
|||||||
$subscription->$field = $value;
|
$subscription->$field = $value;
|
||||||
}
|
}
|
||||||
if ($subscription->create(DolibarrApiAccess::$user) < 0) {
|
if ($subscription->create(DolibarrApiAccess::$user) < 0) {
|
||||||
throw new RestException(500, 'Error when creating subscription', array_merge(array($subscription->error), $subscription->errors));
|
throw new RestException(500, 'Error when creating contribution', array_merge(array($subscription->error), $subscription->errors));
|
||||||
}
|
}
|
||||||
return $subscription->id;
|
return $subscription->id;
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ class Subscriptions extends DolibarrApi
|
|||||||
if ($subscription->update(DolibarrApiAccess::$user) > 0) {
|
if ($subscription->update(DolibarrApiAccess::$user) > 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
} else {
|
} else {
|
||||||
throw new RestException(500, $subscription->error);
|
throw new RestException(500, 'Error when updating contribution: '.$subscription->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -358,7 +358,7 @@ class Subscription extends CommonObject
|
|||||||
$result = $member->update_end_date($user);
|
$result = $member->update_end_date($user);
|
||||||
|
|
||||||
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) { // If we found bank account line (this means this->fk_bank defined)
|
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) { // If we found bank account line (this means this->fk_bank defined)
|
||||||
$result = $accountline->delete($user); // Return false if refused because line is conciliated
|
$result = $accountline->delete($user); // Return false if refused because line is reconciled
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -177,8 +177,8 @@ if ($conf->use_javascript_ajax) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($AdherentType as $key => $adhtype) {
|
foreach ($AdherentType as $key => $adhtype) {
|
||||||
$dataval['draft'][] = array($i, isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0);
|
$dataval['draft'][] = array($i, isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0);
|
||||||
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0);
|
|
||||||
$dataval['uptodate'][] = array($i, isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0);
|
$dataval['uptodate'][] = array($i, isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0);
|
||||||
|
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0);
|
||||||
$dataval['excluded'][] = array($i, isset($MembersExcluded[$key]) ? $MembersExcluded[$key] : 0);
|
$dataval['excluded'][] = array($i, isset($MembersExcluded[$key]) ? $MembersExcluded[$key] : 0);
|
||||||
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
|
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
|
||||||
|
|
||||||
@ -191,18 +191,18 @@ if ($conf->use_javascript_ajax) {
|
|||||||
}
|
}
|
||||||
$total = $SumToValidate + $SumValidated + $SumUpToDate + $SumExcluded + $SumResiliated;
|
$total = $SumToValidate + $SumValidated + $SumUpToDate + $SumExcluded + $SumResiliated;
|
||||||
$dataseries = array();
|
$dataseries = array();
|
||||||
$dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), round($SumValidated));
|
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SumToValidate)); // Draft, not yet validated
|
||||||
$dataseries[] = array($langs->transnoentitiesnoconv("UpToDate"), round($SumUpToDate));
|
$dataseries[] = array($langs->transnoentitiesnoconv("UpToDate"), round($SumUpToDate));
|
||||||
|
$dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), round($SumValidated));
|
||||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), round($SumExcluded));
|
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), round($SumExcluded));
|
||||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SumResiliated));
|
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SumResiliated));
|
||||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SumToValidate));
|
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||||
$dolgraph = new DolGraph();
|
$dolgraph = new DolGraph();
|
||||||
$dolgraph->SetData($dataseries);
|
$dolgraph->SetData($dataseries);
|
||||||
$dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, '-'.$badgeStatus8, $badgeStatus6, '-'.$badgeStatus0));
|
$dolgraph->SetDataColor(array('-'.$badgeStatus0, $badgeStatus4, '-'.$badgeStatus1, '-'.$badgeStatus8, $badgeStatus6));
|
||||||
$dolgraph->setShowLegend(2);
|
$dolgraph->setShowLegend(2);
|
||||||
$dolgraph->setShowPercent(1);
|
$dolgraph->setShowPercent(1);
|
||||||
$dolgraph->SetType(array('pie'));
|
$dolgraph->SetType(array('pie'));
|
||||||
|
|||||||
@ -482,7 +482,7 @@ if (GETPOSTISSET("search_status")) {
|
|||||||
$titre = $langs->trans("MembersListToValid");
|
$titre = $langs->trans("MembersListToValid");
|
||||||
}
|
}
|
||||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == '') {
|
if ($search_status == Adherent::STATUS_VALIDATED && $filter == '') {
|
||||||
$titre = $langs->trans("MembersValidated");
|
$titre = $langs->trans("MenuMembersValidated");
|
||||||
}
|
}
|
||||||
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'withoutsubscription') {
|
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'withoutsubscription') {
|
||||||
$titre = $langs->trans("MembersWithSubscriptionToReceive");
|
$titre = $langs->trans("MembersWithSubscriptionToReceive");
|
||||||
@ -505,7 +505,7 @@ if (GETPOSTISSET("search_status")) {
|
|||||||
|
|
||||||
if ($search_type > 0) {
|
if ($search_type > 0) {
|
||||||
$membertype = new AdherentType($db);
|
$membertype = new AdherentType($db);
|
||||||
$result = $membertype->fetch(GETPOST("type", 'int'));
|
$result = $membertype->fetch($search_type);
|
||||||
$titre .= " (".$membertype->label.")";
|
$titre .= " (".$membertype->label.")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,7 +767,7 @@ if (!empty($arrayfields['d.email']['checked'])) {
|
|||||||
}
|
}
|
||||||
// End of subscription date
|
// End of subscription date
|
||||||
if (!empty($arrayfields['d.datefin']['checked'])) {
|
if (!empty($arrayfields['d.datefin']['checked'])) {
|
||||||
print '<td class="liste_titre left">';
|
print '<td class="liste_titre center">';
|
||||||
$selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
|
$selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
|
||||||
print $form->selectarray('search_filter', $selectarray, $search_filter);
|
print $form->selectarray('search_filter', $selectarray, $search_filter);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -858,7 +858,7 @@ if (!empty($arrayfields['state.nom']['checked'])) {
|
|||||||
print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['d.phone']['checked'])) {
|
if (!empty($arrayfields['d.phone']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['d.phone']['label'], $_SERVER["PHP_SELF"], 'd.phone', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['d.phone']['label'], $_SERVER["PHP_SELF"], 'd.phone', '', $param, '', $sortfield, $sortorder);
|
||||||
@ -873,7 +873,7 @@ if (!empty($arrayfields['d.email']['checked'])) {
|
|||||||
print_liste_field_titre($arrayfields['d.email']['label'], $_SERVER["PHP_SELF"], 'd.email', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['d.email']['label'], $_SERVER["PHP_SELF"], 'd.email', '', $param, '', $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['d.datefin']['checked'])) {
|
if (!empty($arrayfields['d.datefin']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin', '', $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
@ -1110,16 +1110,14 @@ while ($i < min($num, $limit)) {
|
|||||||
// End of subscription date
|
// End of subscription date
|
||||||
$datefin = $db->jdate($obj->datefin);
|
$datefin = $db->jdate($obj->datefin);
|
||||||
if (!empty($arrayfields['d.datefin']['checked'])) {
|
if (!empty($arrayfields['d.datefin']['checked'])) {
|
||||||
|
print '<td class="nowrap center">';
|
||||||
if ($datefin) {
|
if ($datefin) {
|
||||||
print '<td class="nowrap center">';
|
|
||||||
print dol_print_date($datefin, 'day');
|
print dol_print_date($datefin, 'day');
|
||||||
if ($memberstatic->hasDelay()) {
|
if ($memberstatic->hasDelay()) {
|
||||||
$textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')';
|
$textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')';
|
||||||
print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
|
print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
|
||||||
}
|
}
|
||||||
print '</td>';
|
|
||||||
} else {
|
} else {
|
||||||
print '<td class="nowrap left">';
|
|
||||||
if (!empty($obj->subscription)) {
|
if (!empty($obj->subscription)) {
|
||||||
print $langs->trans("SubscriptionNotReceived");
|
print $langs->trans("SubscriptionNotReceived");
|
||||||
if ($obj->statut > 0) {
|
if ($obj->statut > 0) {
|
||||||
@ -1128,8 +1126,8 @@ while ($i < min($num, $limit)) {
|
|||||||
} else {
|
} else {
|
||||||
print ' ';
|
print ' ';
|
||||||
}
|
}
|
||||||
print '</td>';
|
|
||||||
}
|
}
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||||
|
|||||||
@ -501,7 +501,7 @@ if ($rowid > 0) {
|
|||||||
|
|
||||||
// Login
|
// Login
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.' </td></tr>';
|
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.dol_escape_htmltag($object->login).'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
@ -512,25 +512,24 @@ if ($rowid > 0) {
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
|
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dol_escape_htmltag($object->company).'</td></tr>';
|
||||||
|
|
||||||
// Civility
|
// Civility
|
||||||
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().' </td>';
|
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Password
|
// Password
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||||
print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $object->pass);
|
print '<tr><td>'.$langs->trans("Password").'</td><td>';
|
||||||
if ($object->pass) {
|
if ($object->pass) {
|
||||||
print preg_replace('/./i', '*', $object->pass);
|
print preg_replace('/./i', '*', $object->pass);
|
||||||
} else {
|
} else {
|
||||||
if ($user->admin) {
|
if ($user->admin) {
|
||||||
print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
|
print '<!-- '.$langs->trans("Crypted").': '.$object->pass_indatabase_crypted.' -->';
|
||||||
} else {
|
|
||||||
print $langs->trans("Hidden");
|
|
||||||
}
|
}
|
||||||
|
print '<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
|
||||||
}
|
}
|
||||||
if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) {
|
if (!empty($object->pass_indatabase) && empty($object->user_id)) { // Show warning only for old password still in clear (does not happen anymore)
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
|
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
|
||||||
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
|
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
|
||||||
@ -546,15 +545,17 @@ if ($rowid > 0) {
|
|||||||
print " ".img_warning($langs->trans("Late"));
|
print " ".img_warning($langs->trans("Late"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!$adht->subscription) {
|
if ($object->need_subscription == 0) {
|
||||||
|
print $langs->trans("SubscriptionNotNeeded");
|
||||||
|
} elseif (!$adht->subscription) {
|
||||||
print $langs->trans("SubscriptionNotRecorded");
|
print $langs->trans("SubscriptionNotRecorded");
|
||||||
if ($object->statut > 0) {
|
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||||
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
|
print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print $langs->trans("SubscriptionNotReceived");
|
print $langs->trans("SubscriptionNotReceived");
|
||||||
if ($object->statut > 0) {
|
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||||
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
|
print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -563,18 +564,13 @@ if ($rowid > 0) {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="fichehalfright">';
|
|
||||||
|
|
||||||
|
print '<div class="fichehalfright">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border tableforfield centpercent">';
|
print '<table class="border tableforfield centpercent">';
|
||||||
|
|
||||||
// Birthday
|
// Tags / Categories
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
|
|
||||||
|
|
||||||
// Public
|
|
||||||
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
|
|
||||||
|
|
||||||
// Categories
|
|
||||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
@ -582,6 +578,12 @@ if ($rowid > 0) {
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Birth Date
|
||||||
|
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
|
||||||
|
|
||||||
|
// Public
|
||||||
|
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$cols = 2;
|
$cols = 2;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||||
@ -663,8 +665,6 @@ if ($rowid > 0) {
|
|||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action bar
|
* Action bar
|
||||||
|
|||||||
@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "<!-- BEGIN PHP TEMPLATE adherents/tpl/linkedopjectblock.tpl.php -->\n";
|
echo "<!-- BEGIN PHP TEMPLATE adherents/tpl/linkedobjectblock.tpl.php -->\n";
|
||||||
|
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
|
|||||||
@ -125,6 +125,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
|
|||||||
$object->duration_value = $duration_value;
|
$object->duration_value = $duration_value;
|
||||||
$object->duration_unit = $duration_unit;
|
$object->duration_unit = $duration_unit;
|
||||||
$object->note = trim($comment);
|
$object->note = trim($comment);
|
||||||
|
$object->note_public = trim($comment);
|
||||||
$object->mail_valid = trim($mail_valid);
|
$object->mail_valid = trim($mail_valid);
|
||||||
$object->vote = (int) $vote;
|
$object->vote = (int) $vote;
|
||||||
|
|
||||||
@ -176,6 +177,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
|
|||||||
$object->duration_value = $duration_value;
|
$object->duration_value = $duration_value;
|
||||||
$object->duration_unit = $duration_unit;
|
$object->duration_unit = $duration_unit;
|
||||||
$object->note = trim($comment);
|
$object->note = trim($comment);
|
||||||
|
$object->note_public = trim($comment);
|
||||||
$object->mail_valid = trim($mail_valid);
|
$object->mail_valid = trim($mail_valid);
|
||||||
$object->vote = (boolean) trim($vote);
|
$object->vote = (boolean) trim($vote);
|
||||||
|
|
||||||
@ -358,7 +360,7 @@ if ($action == 'create') {
|
|||||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
|
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||||
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1);
|
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Morphy
|
// Morphy
|
||||||
@ -375,7 +377,7 @@ if ($action == 'create') {
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>';
|
print '<tr><td>'.$langs->trans("Amount").'</td><td>';
|
||||||
print '<input name="amount" size="5" value="'.price($amount).'">';
|
print '<input name="amount" size="5" value="'.(GETPOSTISSET('amount') ? GETPOST('amount') : price($amount)).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||||
@ -389,12 +391,12 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor = new DolEditor('comment', $object->note, '', 200, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
|
$doleditor = new DolEditor('comment', (GETPOSTISSET('comment') ? GETPOST('comment', 'restricthtml') : $object->note_public), '', 200, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
|
$doleditor = new DolEditor('mail_valid', GETPOSTISSET('mail_valid') ? GETPOST('mail_valid') : $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -783,7 +785,7 @@ if ($rowid > 0) {
|
|||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth300" name="label" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth300" name="label" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||||
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status);
|
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Morphy
|
// Morphy
|
||||||
|
|||||||
@ -369,7 +369,7 @@ $form = new Form($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
|
|
||||||
$countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</span>';
|
$countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' <a href="#trzipbeforecountry">('.$langs->trans("SeeAbove").')</a></span>';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
|
print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
|
||||||
|
|
||||||
@ -410,10 +410,10 @@ print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->
|
|||||||
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('MAIN_INFO_SOCIETE_ADDRESS') ? GETPOST('MAIN_INFO_SOCIETE_ADDRESS', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS) ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : '')).'</textarea></td></tr>'."\n";
|
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('MAIN_INFO_SOCIETE_ADDRESS') ? GETPOST('MAIN_INFO_SOCIETE_ADDRESS', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS) ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : '')).'</textarea></td></tr>'."\n";
|
||||||
|
|
||||||
// Zip
|
// Zip
|
||||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
|
print '<tr class="oddeven" id="trzipbeforecountry"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
|
||||||
print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_ZIP') ? GETPOST('MAIN_INFO_SOCIETE_ZIP', 'alpha') : (!empty($conf->global->MAIN_INFO_SOCIETE_ZIP) ? $conf->global->MAIN_INFO_SOCIETE_ZIP : ''))).'"></td></tr>'."\n";
|
print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_ZIP') ? GETPOST('MAIN_INFO_SOCIETE_ZIP', 'alpha') : (!empty($conf->global->MAIN_INFO_SOCIETE_ZIP) ? $conf->global->MAIN_INFO_SOCIETE_ZIP : ''))).'"></td></tr>'."\n";
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
|
print '<tr class="oddeven" id="trtownbeforecountry"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
|
||||||
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_TOWN) ? $conf->global->MAIN_INFO_SOCIETE_TOWN : ''))).'"></td></tr>'."\n";
|
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_TOWN) ? $conf->global->MAIN_INFO_SOCIETE_TOWN : ''))).'"></td></tr>'."\n";
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2017 Oscss-Shop <support@oscss-shop.fr>.
|
/* Copyright (C) 2017 Oscss-Shop <support@oscss-shop.fr>.
|
||||||
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modifyion 2.0 (the "License");
|
* This program is free software; you can redistribute it and/or modifyion 2.0 (the "License");
|
||||||
* it under the terms of the GNU General Public License as published bypliance with the License.
|
* it under the terms of the GNU General Public License as published bypliance with the License.
|
||||||
@ -17,9 +17,6 @@
|
|||||||
* or see https://www.gnu.org/
|
* or see https://www.gnu.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('REQUIRE_JQUERY_BLOCKUI')) {
|
|
||||||
define('REQUIRE_JQUERY_BLOCKUI', 1);
|
|
||||||
}
|
|
||||||
if (!defined('NOTOKENRENEWAL')) {
|
if (!defined('NOTOKENRENEWAL')) {
|
||||||
define('NOTOKENRENEWAL', 1);
|
define('NOTOKENRENEWAL', 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,9 +67,6 @@ div.divsearchfield {
|
|||||||
.tree li:last-child:after{
|
.tree li:last-child:after{
|
||||||
display: none
|
display: none
|
||||||
}
|
}
|
||||||
.blockUI {
|
|
||||||
cursor: auto!important;
|
|
||||||
}
|
|
||||||
.newAppParent{
|
.newAppParent{
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
@ -220,8 +220,9 @@ if ($action == 'edit') {
|
|||||||
foreach ($arrayofparameters as $constname => $val) {
|
foreach ($arrayofparameters as $constname => $val) {
|
||||||
if ($val['enabled']==1) {
|
if ($val['enabled']==1) {
|
||||||
$setupnotempty++;
|
$setupnotempty++;
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>aa';
|
||||||
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
||||||
|
$tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\n".$langs->trans($constname . 'Tooltip2') : '');
|
||||||
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
|
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
|
|
||||||
@ -314,6 +315,7 @@ if ($action == 'edit') {
|
|||||||
$setupnotempty++;
|
$setupnotempty++;
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
||||||
|
$tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\n".$langs->trans($constname . 'Tooltip2') : '');
|
||||||
print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
|
print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
|
|
||||||
|
|||||||
@ -38,169 +38,178 @@ if (!$user->admin) {
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Init error
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$error = false;
|
$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
|
||||||
$message = false;
|
|
||||||
|
|
||||||
$action = GETPOST('action', 'aZ09');
|
|
||||||
$id = GETPOST('id', 'int');
|
|
||||||
|
|
||||||
$apply_to = GETPOST('apply_to');
|
$parameters = array();
|
||||||
$fk_user = GETPOST('fk_user', 'int');
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
$fk_usergroup = GETPOST('fk_usergroup', 'int');
|
if ($reshook < 0) {
|
||||||
|
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
$fk_c_type_fees = GETPOST('fk_c_type_fees');
|
|
||||||
$code_expense_rules_type = GETPOST('code_expense_rules_type');
|
|
||||||
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
|
|
||||||
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
|
||||||
$amount = GETPOST('amount');
|
|
||||||
|
|
||||||
$object = new ExpenseReportRule($db);
|
|
||||||
if (!empty($id)) {
|
|
||||||
$result = $object->fetch($id);
|
|
||||||
if ($result < 0) {
|
|
||||||
dol_print_error('', $object->error, $object->errors);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO do action
|
if (empty($reshook)) {
|
||||||
if ($action == 'save') {
|
//Init error
|
||||||
$error = 0;
|
$error = false;
|
||||||
|
$message = false;
|
||||||
|
|
||||||
// check parameters
|
$action = GETPOST('action', 'aZ09');
|
||||||
if (empty($apply_to)) {
|
$id = GETPOST('id', 'int');
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportApplyTo")), null, 'errors');
|
|
||||||
}
|
|
||||||
if (empty($fk_c_type_fees)) {
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDomain")), null, 'errors');
|
|
||||||
}
|
|
||||||
if (empty($code_expense_rules_type)) {
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitOn")), null, 'errors');
|
|
||||||
}
|
|
||||||
if (empty($dates)) {
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateStart")), null, 'errors');
|
|
||||||
}
|
|
||||||
if (empty($datee)) {
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateEnd")), null, 'errors');
|
|
||||||
}
|
|
||||||
if (empty($amount)) {
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitAmount")), null, 'errors');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($error)) {
|
$apply_to = GETPOST('apply_to');
|
||||||
$object->setValues($_POST);
|
$fk_user = GETPOST('fk_user', 'int');
|
||||||
|
$fk_usergroup = GETPOST('fk_usergroup', 'int');
|
||||||
|
|
||||||
if ($apply_to == 'U') {
|
$fk_c_type_fees = GETPOST('fk_c_type_fees');
|
||||||
$object->fk_user = (int) $fk_user;
|
$code_expense_rules_type = GETPOST('code_expense_rules_type');
|
||||||
$object->fk_usergroup = 0;
|
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
|
||||||
$object->is_for_all = 0;
|
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
|
||||||
} elseif ($apply_to == 'G') {
|
$amount = GETPOST('amount');
|
||||||
$object->fk_usergroup = (int) $fk_usergroup;
|
|
||||||
$object->fk_user = 0;
|
$object = new ExpenseReportRule($db);
|
||||||
$object->is_for_all = 0;
|
if (!empty($id)) {
|
||||||
} elseif ($apply_to == 'A') {
|
$result = $object->fetch($id);
|
||||||
$object->is_for_all = 1;
|
if ($result < 0) {
|
||||||
$object->fk_user = 0;
|
dol_print_error('', $object->error, $object->errors);
|
||||||
$object->fk_usergroup = 0;
|
}
|
||||||
|
}
|
||||||
|
// TODO do action
|
||||||
|
if ($action == 'save') {
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
// check parameters
|
||||||
|
if (empty($apply_to)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportApplyTo")), null, 'errors');
|
||||||
|
}
|
||||||
|
if (empty($fk_c_type_fees)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDomain")), null, 'errors');
|
||||||
|
}
|
||||||
|
if (empty($code_expense_rules_type)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitOn")), null, 'errors');
|
||||||
|
}
|
||||||
|
if (empty($dates)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateStart")), null, 'errors');
|
||||||
|
}
|
||||||
|
if (empty($datee)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateEnd")), null, 'errors');
|
||||||
|
}
|
||||||
|
if (empty($amount)) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitAmount")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
$object->dates = $dates;
|
if (empty($error)) {
|
||||||
$object->datee = $datee;
|
$object->setValues($_POST);
|
||||||
|
|
||||||
$object->entity = $conf->entity;
|
if ($apply_to == 'U') {
|
||||||
|
$object->fk_user = (int) $fk_user;
|
||||||
|
$object->fk_usergroup = 0;
|
||||||
|
$object->is_for_all = 0;
|
||||||
|
} elseif ($apply_to == 'G') {
|
||||||
|
$object->fk_usergroup = (int) $fk_usergroup;
|
||||||
|
$object->fk_user = 0;
|
||||||
|
$object->is_for_all = 0;
|
||||||
|
} elseif ($apply_to == 'A') {
|
||||||
|
$object->is_for_all = 1;
|
||||||
|
$object->fk_user = 0;
|
||||||
|
$object->fk_usergroup = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$res = $object->create($user);
|
$object->dates = $dates;
|
||||||
if ($res > 0) {
|
$object->datee = $datee;
|
||||||
setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
|
|
||||||
} else {
|
$object->entity = $conf->entity;
|
||||||
|
|
||||||
|
$res = $object->create($user);
|
||||||
|
if ($res > 0) {
|
||||||
|
setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
|
||||||
|
} else {
|
||||||
|
dol_print_error($object->db);
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} elseif ($action == 'delete') {
|
||||||
|
// TODO add confirm
|
||||||
|
$res = $object->delete($user);
|
||||||
|
|
||||||
|
if ($res < 0) {
|
||||||
dol_print_error($object->db);
|
dol_print_error($object->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: '.$_SERVER['PHP_SELF']);
|
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
} elseif ($action == 'delete') {
|
|
||||||
// TODO add confirm
|
|
||||||
$res = $object->delete($user);
|
|
||||||
|
|
||||||
if ($res < 0) {
|
$rules = $object->getAllRule();
|
||||||
dol_print_error($object->db);
|
|
||||||
}
|
|
||||||
|
|
||||||
header('Location: '.$_SERVER['PHP_SELF']);
|
$tab_apply = array(
|
||||||
exit;
|
'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
|
||||||
|
*/
|
||||||
|
|
||||||
$rules = $object->getAllRule();
|
llxHeader('', $langs->trans("ExpenseReportsSetup"));
|
||||||
|
|
||||||
$tab_apply = array(
|
$form = new Form($db);
|
||||||
'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')
|
|
||||||
);
|
|
||||||
|
|
||||||
|
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
|
||||||
|
print load_fiche_titre($langs->trans("ExpenseReportsSetup"), $linkback, 'title_setup');
|
||||||
|
|
||||||
/*
|
$head = expensereport_admin_prepare_head();
|
||||||
* View
|
print dol_get_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRules"), -1, 'trip');
|
||||||
*/
|
|
||||||
|
|
||||||
llxHeader('', $langs->trans("ExpenseReportsSetup"));
|
echo '<span class="opacitymedium">' . $langs->trans('ExpenseReportRulesDesc') . '</span>';
|
||||||
|
print '<br><br>';
|
||||||
$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("ExpenseReportsSetup"), $linkback, 'title_setup');
|
|
||||||
|
|
||||||
$head = expensereport_admin_prepare_head();
|
|
||||||
print dol_get_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRules"), -1, 'trip');
|
|
||||||
|
|
||||||
echo '<span class="opacitymedium">'.$langs->trans('ExpenseReportRulesDesc').'</span>';
|
|
||||||
print '<br><br>';
|
|
||||||
|
|
||||||
if ($action != 'edit') {
|
if ($action != 'edit') {
|
||||||
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
|
||||||
echo '<input type="hidden" name="token" value="'.newToken().'" />';
|
echo '<input type="hidden" name="token" value="' . newToken() . '" />';
|
||||||
echo '<input type="hidden" name="action" value="save" />';
|
echo '<input type="hidden" name="action" value="save" />';
|
||||||
|
|
||||||
echo '<table class="noborder centpercent">';
|
echo '<table class="noborder centpercent">';
|
||||||
|
|
||||||
echo '<tr class="liste_titre">';
|
echo '<tr class="liste_titre headerexpensereportrules">';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
|
echo '<th class="linecolapplyto">' . $langs->trans('ExpenseReportApplyTo') . '</th>';
|
||||||
echo '<th>'.$langs->trans('Type').'</th>';
|
echo '<th class="linecoltype">' . $langs->trans('Type') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
|
echo '<th class="linecollimiton">' . $langs->trans('ExpenseReportLimitOn') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
|
echo '<th class="linecoldatestart">' . $langs->trans('ExpenseReportDateStart') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
|
echo '<th class="linecoldateend">' . $langs->trans('ExpenseReportDateEnd') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
|
echo '<th class="linecollimitamount">' . $langs->trans('ExpenseReportLimitAmount') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
|
echo '<th class="linecolrestrictive">' . $langs->trans('ExpenseReportRestrictive') . '</th>';
|
||||||
echo '<th> </th>';
|
echo '<th> </th>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
echo '<tr class="oddeven">';
|
echo '<tr class="oddeven">';
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, '', 0).'</div>';
|
echo '<div class="float linecolapplyto">' . $form->selectarray('apply_to', $tab_apply, '', 0) . '</div>';
|
||||||
echo '<div id="user" class="float">'.$form->select_dolusers('', 'fk_user').'</div>';
|
echo '<div id="user" class="float linecoluser">' . $form->select_dolusers('', 'fk_user') . '</div>';
|
||||||
echo '<div id="group" class="float">'.$form->select_dolgroups('', 'fk_usergroup').'</div>';
|
echo '<div id="group" class="float linecolgroup">' . $form->select_dolgroups('', 'fk_usergroup') . '</div>';
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
echo '<td>'.$form->selectExpense('', 'fk_c_type_fees', 0, 1, 1).'</td>';
|
echo '<td class="linecoltype">' . $form->selectExpense('', 'fk_c_type_fees', 0, 1, 1) . '</td>';
|
||||||
echo '<td>'.$form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0).'</td>';
|
echo '<td class="linecoltyperule">' . $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 class="linecoldatestart">' . $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 class="linecoldateend>' . $form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0) . '</td>';
|
||||||
echo '<td><input type="text" value="" class="maxwidth100" name="amount" class="amount" /> '.$conf->currency.'</td>';
|
echo '<td class="linecolamount"><input type="text" value="" class="maxwidth100" name="amount" class="amount" /> ' . $conf->currency . '</td>';
|
||||||
echo '<td>'.$form->selectyesno('restrictive', 0, 1).'</td>';
|
echo '<td class="linecolrestrictive">' . $form->selectyesno('restrictive', 0, 1) . '</td>';
|
||||||
echo '<td class="right"><input type="submit" class="button button-add" value="'.$langs->trans('Add').'" /></td>';
|
echo '<td class="right linecolbutton"><input type="submit" class="button button-add" value="' . $langs->trans('Add') . '" /></td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
@ -208,60 +217,60 @@ if ($action != 'edit') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
|
||||||
echo '<input type="hidden" name="token" value="'.newToken().'" />';
|
echo '<input type="hidden" name="token" value="' . newToken() . '" />';
|
||||||
|
|
||||||
if ($action == 'edit') {
|
if ($action == 'edit') {
|
||||||
echo '<input type="hidden" name="id" value="'.$object->id.'" />';
|
echo '<input type="hidden" name="id" value="' . $object->id . '" />';
|
||||||
echo '<input type="hidden" name="action" value="save" />';
|
echo '<input type="hidden" name="action" value="save" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<table class="noborder centpercent">';
|
echo '<table class="noborder centpercent">';
|
||||||
|
|
||||||
echo '<tr class="liste_titre">';
|
echo '<tr class="liste_titre expensereportrules">';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
|
echo '<th class="linecolapplyto">' . $langs->trans('ExpenseReportApplyTo') . '</th>';
|
||||||
echo '<th>'.$langs->trans('Type').'</th>';
|
echo '<th class="linecoltype">' . $langs->trans('Type') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
|
echo '<th class="linecollimiton">' . $langs->trans('ExpenseReportLimitOn') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
|
echo '<th class="linecoldatestart">' . $langs->trans('ExpenseReportDateStart') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
|
echo '<th class="linecoldateend">' . $langs->trans('ExpenseReportDateEnd') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
|
echo '<th class="linecollimitamount">' . $langs->trans('ExpenseReportLimitAmount') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
|
echo '<th class="linecolrestrictive">' . $langs->trans('ExpenseReportRestrictive') . '</th>';
|
||||||
echo '<th> </th>';
|
echo '<th> </th>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
echo '<tr class="oddeven">';
|
echo '<tr class="oddeven linetrdata" id="'.$rule->id.'">';
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecolusergroup">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
$selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U');
|
$selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U');
|
||||||
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, $selected, 0).'</div>';
|
echo '<div class="float">' . $form->selectarray('apply_to', $tab_apply, $selected, 0) . '</div>';
|
||||||
echo '<div id="user" class="float">'.$form->select_dolusers($object->fk_user, 'fk_user').'</div>';
|
echo '<div id="user" class="float">' . $form->select_dolusers($object->fk_user, 'fk_user') . '</div>';
|
||||||
echo '<div id="group" class="float">'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'</div>';
|
echo '<div id="group" class="float">' . $form->select_dolgroups($object->fk_usergroup, 'fk_usergroup') . '</div>';
|
||||||
} else {
|
} else {
|
||||||
if ($rule->is_for_all > 0) {
|
if ($rule->is_for_all > 0) {
|
||||||
echo $tab_apply['A'];
|
echo $tab_apply['A'];
|
||||||
} elseif ($rule->fk_usergroup > 0) {
|
} elseif ($rule->fk_usergroup > 0) {
|
||||||
echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
|
echo $tab_apply['G'] . ' (' . $rule->getGroupLabel() . ')';
|
||||||
} elseif ($rule->fk_user > 0) {
|
} elseif ($rule->fk_user > 0) {
|
||||||
echo $tab_apply['U'].' ('.$rule->getUserName().')';
|
echo $tab_apply['U'] . ' (' . $rule->getUserName() . ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecoltype">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
|
echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
|
||||||
} else {
|
} else {
|
||||||
if ($rule->fk_c_type_fees == -1) {
|
if ($rule->fk_c_type_fees == -1) {
|
||||||
echo $langs->trans('AllExpenseReport');
|
echo $langs->trans('AllExpenseReport');
|
||||||
} else {
|
} else {
|
||||||
$key = getDictionaryValue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
|
$key = getDictionaryValue(MAIN_DB_PREFIX . 'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
|
||||||
if ($key && $key != $langs->trans($key)) {
|
if ($key && $key != $langs->trans($key)) {
|
||||||
echo $langs->trans($key);
|
echo $langs->trans($key);
|
||||||
} else {
|
} else {
|
||||||
$value = getDictionaryValue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id');
|
$value = getDictionaryValue(MAIN_DB_PREFIX . 'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id');
|
||||||
echo $langs->trans($value ? $value : 'Undefined'); // TODO check to return trans of 'code'
|
echo $langs->trans($value ? $value : 'Undefined'); // TODO check to return trans of 'code'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,7 +278,7 @@ foreach ($rules as $rule) {
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecoltyperule">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
|
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -278,7 +287,7 @@ foreach ($rules as $rule) {
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecoldatestart">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0);
|
print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -287,7 +296,7 @@ foreach ($rules as $rule) {
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecoldateend">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0);
|
print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -296,16 +305,16 @@ foreach ($rules as $rule) {
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecolamount">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
echo '<input type="text" value="'.price2num($object->amount).'" name="amount" class="amount" />'.$conf->currency;
|
echo '<input type="text" value="' . price2num($object->amount) . '" name="amount" class="amount" />' . $conf->currency;
|
||||||
} else {
|
} else {
|
||||||
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
|
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
|
||||||
}
|
}
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecolrestrictive">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
echo $form->selectyesno('restrictive', $object->restrictive, 1);
|
echo $form->selectyesno('restrictive', $object->restrictive, 1);
|
||||||
} else {
|
} else {
|
||||||
@ -316,11 +325,11 @@ foreach ($rules as $rule) {
|
|||||||
|
|
||||||
echo '<td class="center">';
|
echo '<td class="center">';
|
||||||
if ($object->id != $rule->id) {
|
if ($object->id != $rule->id) {
|
||||||
echo '<a class="editfielda paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$rule->id.'">'.img_edit().'</a> ';
|
echo '<a class="editfielda paddingright paddingleft" href="' . $_SERVER['PHP_SELF'] . '?action=edit&token=' . newToken() . '&id=' . $rule->id . '">' . img_edit() . '</a> ';
|
||||||
echo '<a class="paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$rule->id.'">'.img_delete().'</a>';
|
echo '<a class="paddingright paddingleft" href="' . $_SERVER['PHP_SELF'] . '?action=delete&token=' . newToken() . '&id=' . $rule->id . '">' . img_delete() . '</a>';
|
||||||
} else {
|
} else {
|
||||||
echo '<input type="submit" class="button button-edit" value="'.$langs->trans('Update').'" /> ';
|
echo '<input type="submit" class="button button-edit" value="' . $langs->trans('Update') . '" /> ';
|
||||||
echo '<a href="'.$_SERVER['PHP_SELF'].'" class="button button-cancel">'.$langs->trans("Cancel").'</a>';
|
echo '<a href="' . $_SERVER['PHP_SELF'] . '" class="button button-cancel">' . $langs->trans("Cancel") . '</a>';
|
||||||
}
|
}
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
@ -328,10 +337,10 @@ foreach ($rules as $rule) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
echo '</form>';
|
echo '</form>';
|
||||||
|
|
||||||
echo '<script type="text/javascript"> $(function() {
|
echo '<script type="text/javascript"> $(function() {
|
||||||
$("#apply_to").change(function() {
|
$("#apply_to").change(function() {
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
if (value == "A") {
|
if (value == "A") {
|
||||||
@ -349,6 +358,7 @@ echo '<script type="text/javascript"> $(function() {
|
|||||||
|
|
||||||
}); </script>';
|
}); </script>';
|
||||||
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -225,6 +225,12 @@ if ($action == 'updateMask') {
|
|||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} elseif ($action == 'set_INVOICE_CHECK_POSTERIOR_DATE') {
|
||||||
|
$check_posterior_date = GETPOST('INVOICE_CHECK_POSTERIOR_DATE', 'int');
|
||||||
|
$res = dolibarr_set_const($db, 'INVOICE_CHECK_POSTERIOR_DATE', $check_posterior_date, 'chaine', 0, '', $conf->entity);
|
||||||
|
if (!($res > 0)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -761,6 +767,25 @@ print '<input type="submit" class="button button-edit" value="'.$langs->trans("M
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("InvoiceCheckPosteriorDate"). ' ' ;
|
||||||
|
print $form->textwithpicto('', $langs->trans("InvoiceCheckPosteriorDateHelp"), 1, 'help') . '</td>';
|
||||||
|
print '<td class="left">';
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print ajax_constantonoff('INVOICE_CHECK_POSTERIOR_DATE');
|
||||||
|
} else {
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||||
|
print '<input type="hidden" name="action" value="set_INVOICE_CHECK_POSTERIOR_DATE" />';
|
||||||
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
|
print $form->selectarray("INVOICE_CHECK_POSTERIOR_DATE", $arrval, $conf->global->INVOICE_CHECK_POSTERIOR_DATE);
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|||||||
@ -110,7 +110,8 @@ if (GETPOST('save', 'alpha')) {
|
|||||||
|
|
||||||
$fckeditor_skin = GETPOST('fckeditor_skin', 'alpha');
|
$fckeditor_skin = GETPOST('fckeditor_skin', 'alpha');
|
||||||
if (!empty($fckeditor_skin)) {
|
if (!empty($fckeditor_skin)) {
|
||||||
if (!dolibarr_set_const($db, 'FCKEDITOR_SKIN', $fckeditor_skin, 'chaine', 0, '', $conf->entity)) {
|
$result = dolibarr_set_const($db, 'FCKEDITOR_SKIN', $fckeditor_skin, 'chaine', 0, '', $conf->entity);
|
||||||
|
if ($result <= 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -119,7 +120,8 @@ if (GETPOST('save', 'alpha')) {
|
|||||||
|
|
||||||
$fckeditor_test = GETPOST('formtestfield', 'restricthtml');
|
$fckeditor_test = GETPOST('formtestfield', 'restricthtml');
|
||||||
if (!empty($fckeditor_test)) {
|
if (!empty($fckeditor_test)) {
|
||||||
if (!dolibarr_set_const($db, 'FCKEDITOR_TEST', $fckeditor_test, 'chaine', 0, '', $conf->entity)) {
|
$result = dolibarr_set_const($db, 'FCKEDITOR_TEST', $fckeditor_test, 'chaine', 0, '', $conf->entity);
|
||||||
|
if ($result <= 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -129,7 +131,7 @@ if (GETPOST('save', 'alpha')) {
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error").' '.$db->lasterror(), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,11 +46,12 @@ if ($action == 'test' || $action == 'send') {
|
|||||||
|
|
||||||
$substitutionarrayfortest = array(
|
$substitutionarrayfortest = array(
|
||||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||||
|
'__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '',
|
||||||
|
'__USER_LOGIN__' => $user->login,
|
||||||
|
'__USER_EMAIL__' => $user->email,
|
||||||
|
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
||||||
'__ID__' => 'RecipientIdRecord',
|
'__ID__' => 'RecipientIdRecord',
|
||||||
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
|
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
|
||||||
'__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '',
|
|
||||||
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
|
||||||
'__LOGIN__' => 'RecipientLogin',
|
|
||||||
'__LASTNAME__' => 'RecipientLastname',
|
'__LASTNAME__' => 'RecipientLastname',
|
||||||
'__FIRSTNAME__' => 'RecipientFirstname',
|
'__FIRSTNAME__' => 'RecipientFirstname',
|
||||||
'__ADDRESS__'=> 'RecipientAddress',
|
'__ADDRESS__'=> 'RecipientAddress',
|
||||||
@ -662,7 +663,7 @@ if ($action == 'edit') {
|
|||||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
|
||||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))) {
|
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))) {
|
||||||
if (function_exists('openssl_open')) {
|
if (function_exists('openssl_open')) {
|
||||||
print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED);
|
print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_DKIM_ENABLED'));
|
||||||
} else {
|
} else {
|
||||||
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||||
}
|
}
|
||||||
@ -762,9 +763,18 @@ if ($action == 'edit') {
|
|||||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
|
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
|
||||||
print $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
$listofemail = explode(',', $conf->global->MAIN_MAIL_AUTOCOPY_TO);
|
||||||
if (!isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
|
$i = 0;
|
||||||
print img_warning($langs->trans("ErrorBadEMail"));
|
foreach ($listofemail as $key => $val) {
|
||||||
|
if ($i) {
|
||||||
|
print ', ';
|
||||||
|
}
|
||||||
|
$val = trim($val);
|
||||||
|
print $val;
|
||||||
|
if (!isValidEmail($val, 0, 1)) {
|
||||||
|
print img_warning($langs->trans("ErrorBadEMail", $val));
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print ' ';
|
print ' ';
|
||||||
@ -887,7 +897,6 @@ if ($action == 'edit') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setEventMessages($errormsg, null, 'errors');
|
setEventMessages($errormsg, null, 'errors');
|
||||||
print $errormsg;
|
|
||||||
}
|
}
|
||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|||||||
$langs->loadLangs(array('companies', 'products', 'admin', 'mails', 'other', 'errors'));
|
$langs->loadLangs(array('companies', 'products', 'admin', 'mails', 'other', 'errors'));
|
||||||
|
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
$cancel = GETPOST('cancel', 'alpha');
|
$cancel = GETPOST('cancel', 'aZ09');
|
||||||
|
|
||||||
if (!$user->admin) {
|
if (!$user->admin) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -40,17 +40,22 @@ if (!$user->admin) {
|
|||||||
$usersignature = $user->signature;
|
$usersignature = $user->signature;
|
||||||
// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
|
// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
|
||||||
if ($action == 'test' || $action == 'send') {
|
if ($action == 'test' || $action == 'send') {
|
||||||
$usersignature = dol_string_nohtmltag($usersignature);
|
$usersignature = dol_string_nohtmltag($usersignature, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$substitutionarrayfortest = array(
|
$substitutionarrayfortest = array(
|
||||||
'__LOGIN__' => $user->login,
|
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||||
'__ID__' => 'TESTIdRecord',
|
'__ID__' => 'RecipientIdRecord',
|
||||||
'__EMAIL__' => 'TESTEMail',
|
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
|
||||||
'__LASTNAME__' => 'TESTLastname',
|
'__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '',
|
||||||
'__FIRSTNAME__' => 'TESTFirstname',
|
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
|
||||||
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''),
|
'__LOGIN__' => $user->login,
|
||||||
//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet
|
'__LASTNAME__' => 'RecipientLastname',
|
||||||
|
'__FIRSTNAME__' => 'RecipientFirstname',
|
||||||
|
'__ADDRESS__'=> 'RecipientAddress',
|
||||||
|
'__ZIP__'=> 'RecipientZip',
|
||||||
|
'__TOWN_'=> 'RecipientTown',
|
||||||
|
'__COUNTRY__'=> 'RecipientCountry'
|
||||||
);
|
);
|
||||||
complete_substitutions_array($substitutionarrayfortest, $langs);
|
complete_substitutions_array($substitutionarrayfortest, $langs);
|
||||||
|
|
||||||
@ -86,10 +91,10 @@ $trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
|||||||
$sendcontext = 'emailing'; // Force to use dedicated context of setup for emailing
|
$sendcontext = 'emailing'; // Force to use dedicated context of setup for emailing
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
|
|
||||||
if ($action == 'presend' && GETPOST('trackid') == 'test') {
|
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') {
|
||||||
$action = 'test';
|
$action = 'test';
|
||||||
}
|
}
|
||||||
if ($action == 'presend' && GETPOST('trackid') == 'testhtml') {
|
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') {
|
||||||
$action = 'testhtml';
|
$action = 'testhtml';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,12 +276,15 @@ if ($action == 'edit') {
|
|||||||
|
|
||||||
// Host server
|
// Host server
|
||||||
|
|
||||||
print '<tr class="oddeven hideifdefault"><td>';
|
print '<tr class="oddeven hideifdefault">';
|
||||||
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') {
|
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') {
|
||||||
|
print '<td>';
|
||||||
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
|
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print $langs->trans("SeeLocalSendMailSetup");
|
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||||
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
|
print '<td>';
|
||||||
$mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '');
|
$mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '');
|
||||||
$smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
|
$smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
|
||||||
if ($linuxlike) {
|
if ($linuxlike) {
|
||||||
@ -287,17 +295,19 @@ if ($action == 'edit') {
|
|||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
// SuperAdministrator access only
|
// SuperAdministrator access only
|
||||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||||
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="'.$mainserver.'">';
|
print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="'.$mainserver.'">';
|
||||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" name="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" value="'.$mainserver.'">';
|
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" name="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" value="'.$mainserver.'">';
|
||||||
print '<span id="smtp_server_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||||
|
print ' <span class="opacitymedium smtp_method">'.$langs->trans("SeeLinkToOnlineDocumentation").'</span>';
|
||||||
} else {
|
} else {
|
||||||
$text = !empty($mainserver) ? $mainserver : $smtpserver;
|
$text = !empty($mainserver) ? $mainserver : $smtpserver;
|
||||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||||
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
|
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
|
||||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" value="'.$mainserver.'">';
|
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" value="'.$mainserver.'">';
|
||||||
}
|
}
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Port
|
// Port
|
||||||
|
|
||||||
@ -305,7 +315,7 @@ if ($action == 'edit') {
|
|||||||
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') {
|
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') {
|
||||||
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
|
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print $langs->trans("SeeLocalSendMailSetup");
|
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||||
} else {
|
} else {
|
||||||
$mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '');
|
$mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '');
|
||||||
$smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
|
$smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
|
||||||
@ -319,7 +329,7 @@ if ($action == 'edit') {
|
|||||||
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
|
||||||
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" size="3" value="'.$mainport.'">';
|
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" size="3" value="'.$mainport.'">';
|
||||||
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING_sav" name="MAIN_MAIL_SMTP_PORT_EMAILING_sav" value="'.$mainport.'">';
|
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING_sav" name="MAIN_MAIL_SMTP_PORT_EMAILING_sav" value="'.$mainport.'">';
|
||||||
print '<span id="smtp_port_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||||
} else {
|
} else {
|
||||||
$text = (!empty($mainport) ? $mainport : $smtpport);
|
$text = (!empty($mainport) ? $mainport : $smtpport);
|
||||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||||
@ -360,7 +370,6 @@ if ($action == 'edit') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TLS
|
// TLS
|
||||||
|
|
||||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
|
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
|
||||||
if (function_exists('openssl_open')) {
|
if (function_exists('openssl_open')) {
|
||||||
@ -374,7 +383,6 @@ if ($action == 'edit') {
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// STARTTLS
|
// STARTTLS
|
||||||
|
|
||||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
|
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
|
||||||
if (function_exists('openssl_open')) {
|
if (function_exists('openssl_open')) {
|
||||||
@ -388,7 +396,6 @@ if ($action == 'edit') {
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// SMTP_ALLOW_SELF_SIGNED_EMAILING
|
// SMTP_ALLOW_SELF_SIGNED_EMAILING
|
||||||
|
|
||||||
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
|
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
|
||||||
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
|
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
|
||||||
if (function_exists('openssl_open')) {
|
if (function_exists('openssl_open')) {
|
||||||
@ -414,6 +421,7 @@ if ($action == 'edit') {
|
|||||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
|
||||||
print "<br><br>\n";
|
print "<br><br>\n";
|
||||||
|
|
||||||
|
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
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
@ -460,7 +468,7 @@ if ($action == 'edit') {
|
|||||||
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print yn(0).' ('.$langs->trans("NotSupported").')';
|
print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -492,6 +500,7 @@ if ($action == 'edit') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
@ -543,6 +552,7 @@ if ($action == 'edit') {
|
|||||||
|
|
||||||
// Run the test to connect
|
// Run the test to connect
|
||||||
if ($action == 'testconnect') {
|
if ($action == 'testconnect') {
|
||||||
|
print '<div id="formmailaftertstconnect" name="formmailaftertstconnect"></div>';
|
||||||
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
|
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
@ -573,16 +583,18 @@ if ($action == 'edit') {
|
|||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||||
$formmail = new FormMail($db);
|
$formmail = new FormMail($db);
|
||||||
|
$formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
||||||
$formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
|
$formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||||
$formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
|
$formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
|
||||||
$formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
$formmail->fromid = $user->id;
|
||||||
|
$formmail->fromalsorobot = 1;
|
||||||
$formmail->withfromreadonly = 0;
|
$formmail->withfromreadonly = 0;
|
||||||
$formmail->withsubstit = 0;
|
$formmail->withsubstit = 0;
|
||||||
$formmail->withfrom = 1;
|
$formmail->withfrom = 1;
|
||||||
$formmail->witherrorsto = 1;
|
$formmail->witherrorsto = 1;
|
||||||
$formmail->withto = (!GETPOST('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
|
$formmail->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
|
||||||
$formmail->withtocc = (!GETPOST(['sendtocc']) ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty
|
$formmail->withtocc = (GETPOSTISSET(['sendtocc']) ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty
|
||||||
$formmail->withtoccc = (!GETPOST(['sendtoccc']) ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty
|
$formmail->withtoccc = (GETPOSTISSET(['sendtoccc']) ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty
|
||||||
$formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test"));
|
$formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test"));
|
||||||
$formmail->withtopicreadonly = 0;
|
$formmail->withtopicreadonly = 0;
|
||||||
$formmail->withfile = 2;
|
$formmail->withfile = 2;
|
||||||
@ -601,7 +613,7 @@ if ($action == 'edit') {
|
|||||||
$formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
|
$formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
|
||||||
|
|
||||||
// Init list of files
|
// Init list of files
|
||||||
if (GETPOST("mode") == 'init') {
|
if (GETPOST("mode", "aZ09") == 'init') {
|
||||||
$formmail->clear_attached_files();
|
$formmail->clear_attached_files();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -205,7 +205,7 @@ if (!empty($conf->expedition->enabled)) {
|
|||||||
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
|
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
|
||||||
}
|
}
|
||||||
if (!empty($conf->reception->enabled)) {
|
if (!empty($conf->reception->enabled)) {
|
||||||
$elementList['reception_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception'));
|
$elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception'));
|
||||||
}
|
}
|
||||||
if (!empty($conf->ficheinter->enabled)) {
|
if (!empty($conf->ficheinter->enabled)) {
|
||||||
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
|
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
|
||||||
@ -769,7 +769,7 @@ if ($action == 'add') {
|
|||||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||||
$okforextended = false;
|
$okforextended = false;
|
||||||
}
|
}
|
||||||
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 180, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 180, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_4, '90%');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -1000,7 +1000,7 @@ if ($resql) {
|
|||||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||||
$okforextended = false;
|
$okforextended = false;
|
||||||
}
|
}
|
||||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_6, '90%');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
}
|
}
|
||||||
if ($tmpfieldlist == 'content_lines') {
|
if ($tmpfieldlist == 'content_lines') {
|
||||||
@ -1152,6 +1152,7 @@ if ($resql) {
|
|||||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -481,9 +481,9 @@ $deschelp = '';
|
|||||||
if ($mode == 'common' || $mode == 'commonkanban') {
|
if ($mode == 'common' || $mode == 'commonkanban') {
|
||||||
$desc = $langs->trans("ModulesDesc", '{picto}');
|
$desc = $langs->trans("ModulesDesc", '{picto}');
|
||||||
$desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}');
|
$desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}');
|
||||||
$desc = str_replace('{picto}', img_picto('', 'switch_off'), $desc);
|
$desc = str_replace('{picto}', img_picto('', 'switch_off', 'class="size15x"'), $desc);
|
||||||
$desc = str_replace('{picto2}', img_picto('', 'setup'), $desc);
|
$desc = str_replace('{picto2}', img_picto('', 'setup', 'class="size15x"'), $desc);
|
||||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled
|
if (!count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled
|
||||||
$deschelp = '<div class="info hideonsmartphone">'.$desc."<br></div><br>\n";
|
$deschelp = '<div class="info hideonsmartphone">'.$desc."<br></div><br>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -332,8 +332,8 @@ foreach ($TCurrency as &$currency) {
|
|||||||
print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">';
|
print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">';
|
||||||
print '1 '.$conf->currency.' = ';
|
print '1 '.$conf->currency.' = ';
|
||||||
print '<input type="text" name="rate" class="width75 right" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13"> '.$currency->code.' ';
|
print '<input type="text" name="rate" class="width75 right" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13"> '.$currency->code.' ';
|
||||||
print '<input type="submit" name="updatecurrency" class="button button-edit" value="'.$langs->trans("Modify").'"> ';
|
print '<input type="submit" name="updatecurrency" class="button button-edit smallpaddingimp" value="'.$langs->trans("Modify").'"> ';
|
||||||
print '<input type="submit" name="deletecurrency" class="button" value="'.$langs->trans("Delete").'">';
|
print '<input type="submit" name="deletecurrency" class="button smallpaddingimp" value="'.$langs->trans("Delete").'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.org>
|
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Bahfir Abbes <contact@dolibarrpar.org>
|
* Copyright (C) 2015 Bahfir Abbes <contact@dolibarrpar.org>
|
||||||
* Copyright (C) 2020 Thibault FOUCART <suport@ptibogxiv.net>
|
* Copyright (C) 2020 Thibault FOUCART <suport@ptibogxiv.net>
|
||||||
|
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -268,6 +269,8 @@ foreach ($listofnotifiedevents as $notifiedevent) {
|
|||||||
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||||
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
|
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
|
||||||
|
|
||||||
|
$model = $notifiedevent['elementtype'];
|
||||||
|
|
||||||
if ($notifiedevent['elementtype'] == 'order_supplier') {
|
if ($notifiedevent['elementtype'] == 'order_supplier') {
|
||||||
$elementLabel = $langs->trans('SupplierOrder');
|
$elementLabel = $langs->trans('SupplierOrder');
|
||||||
} elseif ($notifiedevent['elementtype'] == 'propal') {
|
} elseif ($notifiedevent['elementtype'] == 'propal') {
|
||||||
|
|||||||
@ -309,7 +309,7 @@ print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Par
|
|||||||
|
|
||||||
// Show sender name
|
// Show sender name
|
||||||
|
|
||||||
/* Set option as hidden because no need of this for 99.99% of users.
|
/* Set option as hidden because no need of this for 99.99% of users. Having it as hidden feature is enough.
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_SENDER_NAME").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_SENDER_NAME").'</td><td>';
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('MAIN_PDF_HIDE_SENDER_NAME');
|
print ajax_constantonoff('MAIN_PDF_HIDE_SENDER_NAME');
|
||||||
@ -321,7 +321,7 @@ print '</td></tr>';
|
|||||||
|
|
||||||
// Hide VAT Intra on address
|
// Hide VAT Intra on address
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").' - <span class="opacitymedium">'.$langs->trans("ThirdPartyAddress").'</span></td><td>';
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('MAIN_TVAINTRA_NOT_IN_ADDRESS');
|
print ajax_constantonoff('MAIN_TVAINTRA_NOT_IN_ADDRESS');
|
||||||
} else {
|
} else {
|
||||||
@ -340,7 +340,7 @@ for ($i = 1; $i <= 6; $i++) {
|
|||||||
$pid = img_warning().' <span class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</span>';
|
$pid = img_warning().' <span class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</span>';
|
||||||
}
|
}
|
||||||
if ($pid) {
|
if ($pid) {
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.'</td><td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.' - <span class="opacitymedium">'.$langs->trans("ThirdPartyAddress").'</span></td><td>';
|
||||||
$keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
|
$keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff($keyforconstant);
|
print ajax_constantonoff($keyforconstant);
|
||||||
|
|||||||
@ -198,6 +198,37 @@ if ($action == 'updateMask') {
|
|||||||
// par appel methode canBeActivated
|
// par appel methode canBeActivated
|
||||||
|
|
||||||
dolibarr_set_const($db, "PROPALE_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "PROPALE_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
||||||
|
} elseif (preg_match('/set_(.*)/', $action, $reg)) {
|
||||||
|
$code = $reg[1];
|
||||||
|
$value = (GETPOST($code) ? GETPOST($code) : 1);
|
||||||
|
|
||||||
|
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
|
||||||
|
if (!($res > 0)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
setEventMessages($langs->trans('Error'), null, 'errors');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
|
||||||
|
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
} elseif (preg_match('/del_(.*)/', $action, $reg)) {
|
||||||
|
$code = $reg[1];
|
||||||
|
$res = dolibarr_del_const($db, $code, $conf->entity);
|
||||||
|
|
||||||
|
if (!($res > 0)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
setEventMessages($langs->trans('Error'), null, 'errors');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
|
||||||
|
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -593,6 +624,28 @@ print '<td class="right"><input type="submit" class="button button-edit" value="
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
// default update prices on cloning a proposal
|
||||||
|
/*
|
||||||
|
print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
|
print '<input type="hidden" name="token" value="' . newToken() .'">';
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>' . $langs->trans('DefaultPuttingPricesUpToDate').'</td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td class="right">';
|
||||||
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
|
print ajax_constantonoff('PROPOSAL_CLONE_UPDATE_PRICES', array(), $conf->entity, 0, 0, 1, 0);
|
||||||
|
} else {
|
||||||
|
if (empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES)) {
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_PROPOSAL_CLONE_UPDATE_PRICES">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
|
||||||
|
} else {
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_PROPOSAL_CLONE_UPDATE_PRICES">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</form>';
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
|||||||
@ -36,6 +36,14 @@ if (!$user->admin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$action = GETPOST('action', 'aZ09');
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
$sortfield = GETPOST('sortfield', 'aZ09');
|
||||||
|
$sortorder = GETPOST('sortorder', 'aZ09');
|
||||||
|
if (empty($sortfield)) {
|
||||||
|
$sortfield = 'date';
|
||||||
|
}
|
||||||
|
if (empty($sortorder)) {
|
||||||
|
$sortorder = 'desc';
|
||||||
|
}
|
||||||
|
|
||||||
$upload_dir = $conf->admin->dir_temp;
|
$upload_dir = $conf->admin->dir_temp;
|
||||||
|
|
||||||
@ -73,8 +81,6 @@ if ($action == 'updateform') {
|
|||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile', 'alpha')), null, 'errors');
|
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile', 'alpha')), null, 'errors');
|
||||||
}
|
}
|
||||||
Header('Location: '.$_SERVER["PHP_SELF"]);
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -190,7 +196,7 @@ $formfile = new FormFile($db);
|
|||||||
$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0);
|
$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0);
|
||||||
|
|
||||||
// List of document
|
// List of document
|
||||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1);
|
$filearray = dol_dir_list($upload_dir, "files", 0, '', '', $sortfield, $sortorder == 'desc' ? SORT_DESC : SORT_ASC, 1);
|
||||||
$formfile->list_of_documents($filearray, null, 'admin_temp', '');
|
$formfile->list_of_documents($filearray, null, 'admin_temp', '');
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -266,10 +266,20 @@ print '<br>';
|
|||||||
|
|
||||||
print '<strong>$dolibarr_main_restrict_ip</strong>: ';
|
print '<strong>$dolibarr_main_restrict_ip</strong>: ';
|
||||||
if (empty($dolibarr_main_restrict_ip)) {
|
if (empty($dolibarr_main_restrict_ip)) {
|
||||||
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
|
print $langs->trans("None");
|
||||||
//print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
|
//print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
|
||||||
|
} else {
|
||||||
|
print $dolibarr_main_restrict_ip;
|
||||||
}
|
}
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<strong>$dolibarr_main_restrict_os_commands</strong>: ';
|
||||||
|
if (empty($dolibarr_main_restrict_os_commands)) {
|
||||||
|
print $langs->trans("None");
|
||||||
|
} else {
|
||||||
|
print $dolibarr_main_restrict_os_commands;
|
||||||
|
}
|
||||||
|
print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'mysqldump, mysql, pg_dump, pgrestore').')</span>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) {
|
if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) {
|
||||||
|
|||||||
@ -26,6 +26,7 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||||
require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
|
require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
|
||||||
require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
|
require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
|
||||||
|
require_once DOL_DOCUMENT_ROOT."/core/class/html.formcategory.class.php";
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("admin", "ticket"));
|
$langs->loadLangs(array("admin", "ticket"));
|
||||||
@ -157,6 +158,14 @@ if ($action == 'setvarworkflow') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'setvarworkflowother' || $action == 'setvarworkflow') {
|
||||||
|
$param_ticket_product_category = GETPOST('product_category_id', 'int');
|
||||||
|
$res = dolibarr_set_const($db, 'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category, 'chaine', 0, '', $conf->entity);
|
||||||
|
if (!($res > 0)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'setvarother') {
|
if ($action == 'setvarother') {
|
||||||
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
|
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
|
||||||
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
|
||||||
@ -203,6 +212,12 @@ if ($action == 'setvarother') {
|
|||||||
if (!($res > 0)) {
|
if (!($res > 0)) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$param_auto_notify_close = GETPOST('TICKET_NOTIFY_AT_CLOSING', 'alpha');
|
||||||
|
$res = dolibarr_set_const($db, 'TICKET_NOTIFY_AT_CLOSING', $param_auto_notify_close, 'chaine', 0, '', $conf->entity);
|
||||||
|
if (!($res > 0)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -213,7 +228,7 @@ if ($action == 'setvarother') {
|
|||||||
|
|
||||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
$form = new Form($db);
|
$formcategory = new FormCategory($db);
|
||||||
|
|
||||||
$help_url = "FR:Module_Ticket";
|
$help_url = "FR:Module_Ticket";
|
||||||
$page_name = "TicketSetup";
|
$page_name = "TicketSetup";
|
||||||
@ -320,7 +335,7 @@ foreach ($dirmodels as $reldir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
print $formcategory->textwithpicto('', $htmltooltip, 1, 0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -458,7 +473,7 @@ foreach ($dirmodels as $reldir) {
|
|||||||
|
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
print $formcategory->textwithpicto('', $htmltooltip, 1, 0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Preview
|
// Preview
|
||||||
@ -483,8 +498,7 @@ foreach ($dirmodels as $reldir) {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div><br>';
|
print '</div><br>';
|
||||||
|
|
||||||
|
if (empty($conf->use_javascript_ajax)) {
|
||||||
if (!$conf->use_javascript_ajax) {
|
|
||||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="setvarworkflow">';
|
print '<input type="hidden" name="action" value="setvarworkflow">';
|
||||||
@ -506,11 +520,11 @@ if ($conf->use_javascript_ajax) {
|
|||||||
print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND');
|
print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND');
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND);
|
print $formcategory->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -522,17 +536,47 @@ if ($conf->use_javascript_ajax) {
|
|||||||
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
|
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
|
print $formcategory->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if (!$conf->use_javascript_ajax) {
|
// Auto notify contacts when closing the ticket
|
||||||
print '</form>';
|
print '<tr class="oddeven"><td>'.$langs->trans("TicketsAutoNotifyClose").'</td>';
|
||||||
|
print '<td class="left">';
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print ajax_constantonoff('TICKET_NOTIFY_AT_CLOSING');
|
||||||
|
} else {
|
||||||
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
|
print $formcategory->selectarray("TICKET_NOTIFY_AT_CLOSING", $arrval, $conf->global->TICKET_NOTIFY_AT_CLOSING);
|
||||||
}
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print $formcategory->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp"), 1, 'help');
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Choose which product category is used for tickets
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||||
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
print '<input type="hidden" name="action" value="setvarworkflowother">';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("TicketChooseProductCategory").'</td>';
|
||||||
|
print '<td class="left">';
|
||||||
|
$formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id');
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print ajax_combobox('select_'.$htmlname);
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print $formcategory->textwithpicto('', $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help');
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Define wanted maximum time elapsed before answers to tickets
|
// Define wanted maximum time elapsed before answers to tickets
|
||||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||||
@ -545,7 +589,7 @@ print '<td class="left">
|
|||||||
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
|
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
|
||||||
</td>';
|
</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -556,14 +600,18 @@ print '<td class="left">
|
|||||||
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
|
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
|
||||||
</td>';
|
</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
|
|
||||||
|
print '<div class="center">';
|
||||||
|
print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
// Admin var of module
|
// Admin var of module
|
||||||
print load_fiche_titre($langs->trans("Notification"), '', '');
|
print load_fiche_titre($langs->trans("Notification"), '', '');
|
||||||
@ -591,7 +639,7 @@ print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationFrom").'<
|
|||||||
print '<td class="left">';
|
print '<td class="left">';
|
||||||
print '<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_FROM" value="'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'"></td>';
|
print '<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_FROM" value="'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'"></td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -600,7 +648,7 @@ print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationTo").' ('
|
|||||||
print '<td class="left">';
|
print '<td class="left">';
|
||||||
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : '').'"></td>';
|
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : '').'"></td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -612,11 +660,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
|||||||
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
|
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
|
print $formcategory->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
@ -630,7 +678,7 @@ $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120
|
|||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Texte de signature
|
// Texte de signature
|
||||||
@ -642,12 +690,12 @@ $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '10
|
|||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print $form->buttonsSaveCancel("Save", '');
|
print $formcategory->buttonsSaveCancel("Save", '');
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|||||||
@ -327,33 +327,6 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
|||||||
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
|
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Activate email creation to user
|
|
||||||
print '<tr class="pair"><td>'.$langs->trans("TicketsDisableCustomerEmail").'</td>';
|
|
||||||
print '<td class="left">';
|
|
||||||
if ($conf->use_javascript_ajax) {
|
|
||||||
print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
|
|
||||||
} else {
|
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
|
||||||
print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="center">';
|
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Texte de création d'un ticket
|
|
||||||
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
|
|
||||||
print '<tr><td>'.$langs->trans("TicketNewEmailBodyLabel").'</label>';
|
|
||||||
print '</td><td>';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|
||||||
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
|
|
||||||
$doleditor->Create();
|
|
||||||
print '</td>';
|
|
||||||
print '<td class="center">';
|
|
||||||
print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Url public interface
|
// Url public interface
|
||||||
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
|
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
|
||||||
print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
|
print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
|
||||||
@ -364,8 +337,45 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
|||||||
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
|
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '<br><br>';
|
||||||
|
|
||||||
|
print_fiche_titre($langs->trans("Emails"));
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
|
// Activate email creation to user
|
||||||
|
print '<tr class="pair"><td>';
|
||||||
|
print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="left">';
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
|
||||||
|
} else {
|
||||||
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
|
print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Text of email after creatio of a ticket
|
||||||
|
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
|
||||||
|
print '<tr><td>';
|
||||||
|
print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
|
||||||
|
print '</label>';
|
||||||
|
print '</td><td>';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
|
||||||
|
$doleditor->Create();
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Activate email notification when a new message is added
|
// Activate email notification when a new message is added
|
||||||
print '<tr class="pair"><td>'.$langs->trans("TicketsPublicNotificationNewMessage").'</td>';
|
print '<tr class="pair"><td>';
|
||||||
|
print $form->textwithpicto($langs->trans("TicketsPublicNotificationNewMessage"), $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
|
||||||
|
print '</td>';
|
||||||
print '<td class="left">';
|
print '<td class="left">';
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
|
print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED');
|
||||||
@ -374,19 +384,15 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
|||||||
print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED);
|
print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="center">';
|
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Send notification when a new message is added to a email if a user is not assigned to the ticket
|
// Send notification when a new message is added to a email if a user is not assigned to the ticket
|
||||||
print '<tr><td>'.$langs->trans("TicketPublicNotificationNewMessageDefaultEmail").'</label>';
|
print '<tr><td>';
|
||||||
|
print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL.'" size="40" ></td>';
|
print '<input type="text" name="TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL" value="'.$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL.'" size="40" ></td>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="center">';
|
print '</tr>';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -214,10 +214,6 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<fieldset><legend>'.$langs->trans("ExportOptions").'</legend>';
|
print '<fieldset><legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||||
print '<div class="formelementrow">';
|
|
||||||
print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" />';
|
|
||||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||||
print '<div class="formelementrow">';
|
print '<div class="formelementrow">';
|
||||||
@ -239,14 +235,35 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||||||
print '<option value="ORACLE">ORACLE</option>';
|
print '<option value="ORACLE">ORACLE</option>';
|
||||||
print '<option value="POSTGRESQL">POSTGRESQL</option>';
|
print '<option value="POSTGRESQL">POSTGRESQL</option>';
|
||||||
print '</select>';
|
print '</select>';
|
||||||
print '<br>';
|
print '<br><br>';
|
||||||
|
|
||||||
print '<input type="checkbox" name="use_mysql_quick_param" value="yes" id="checkbox_use_quick" />';
|
print '<div class="formelementrow">';
|
||||||
|
print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" checked="checked" />';
|
||||||
|
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '<input type="checkbox" name="use_mysql_quick_param" value="yes" id="checkbox_use_quick" checked="checked" />';
|
||||||
print '<label for="checkbox_use_quick">';
|
print '<label for="checkbox_use_quick">';
|
||||||
print $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter'), $langs->trans('ExportUseMySQLQuickParameterHelp'));
|
print $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter'), $langs->trans('ExportUseMySQLQuickParameterHelp'));
|
||||||
print '</label>';
|
print '</label>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
$execmethod = 0;
|
||||||
|
if (!empty($conf->global->MAIN_EXEC_USE_POPEN)) {
|
||||||
|
$execmethod = $conf->global->MAIN_EXEC_USE_POPEN;
|
||||||
|
}
|
||||||
|
if (empty($execmethod)) {
|
||||||
|
$execmethod = 1;
|
||||||
|
}
|
||||||
|
if ($execmethod == 1) {
|
||||||
|
// If we use the "exec" method for shell, we ask if we need to use the alternative low memory exec mode.
|
||||||
|
print '<input type="checkbox" name="lowmemorydump" value="yes" id="lowmemorydump"'.(GETPOSTISSET('lowmemorydump') ? GETPOST('lowmemorydump', 'alpha') : getDolGlobalString('MAIN_LOW_MEMORY_DUMP') ? ' checked="checked"' : '').'" />';
|
||||||
|
print '<label for="lowmemorydump">';
|
||||||
|
print $form->textwithpicto($langs->trans('ExportUseLowMemoryMode'), $langs->trans('ExportUseLowMemoryModeHelp'));
|
||||||
|
print '</label>';
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
||||||
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||||
print '-->';
|
print '-->';
|
||||||
|
|||||||
@ -137,7 +137,8 @@ $dirtocompress = basename($fulldirtocompress);
|
|||||||
|
|
||||||
if ($compression == 'zip') {
|
if ($compression == 'zip') {
|
||||||
$file .= '.zip';
|
$file .= '.zip';
|
||||||
$excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i';
|
|
||||||
|
$excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|[\/\\\]admin[\/\\\]documents[\/\\\])/i';
|
||||||
|
|
||||||
//var_dump($fulldirtocompress);
|
//var_dump($fulldirtocompress);
|
||||||
//var_dump($outputdir."/".$file);exit;
|
//var_dump($outputdir."/".$file);exit;
|
||||||
|
|||||||
@ -71,6 +71,12 @@ $workflowcodes = array(
|
|||||||
'enabled'=>(!empty($conf->commande->enabled) && !empty($conf->facture->enabled)),
|
'enabled'=>(!empty($conf->commande->enabled) && !empty($conf->facture->enabled)),
|
||||||
'picto'=>'bill'
|
'picto'=>'bill'
|
||||||
),
|
),
|
||||||
|
'WORKFLOW_TICKET_CREATE_INTERVENTION' => array (
|
||||||
|
'family'=>'create',
|
||||||
|
'position'=>25,
|
||||||
|
'enabled'=>(!empty($conf->ticket->enabled) && !empty($conf->ficheinter->enabled)),
|
||||||
|
'picto'=>'ticket'
|
||||||
|
),
|
||||||
|
|
||||||
'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>''),
|
'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>''),
|
||||||
|
|
||||||
@ -161,7 +167,21 @@ $workflowcodes = array(
|
|||||||
'position' => 90,
|
'position' => 90,
|
||||||
'enabled' => ! empty($conf->expedition->enabled) && ! empty($conf->facture->enabled),
|
'enabled' => ! empty($conf->expedition->enabled) && ! empty($conf->facture->enabled),
|
||||||
'picto' => 'shipment'
|
'picto' => 'shipment'
|
||||||
)
|
),
|
||||||
|
|
||||||
|
// Automatic link ticket -> contract
|
||||||
|
'WORKFLOW_TICKET_LINK_CONTRACT' => array(
|
||||||
|
'family' => 'link_ticket',
|
||||||
|
'position' => 75,
|
||||||
|
'enabled' => ! empty($conf->ticket->enabled) && ! empty($conf->contract->enabled),
|
||||||
|
'picto' => 'ticket'
|
||||||
|
),
|
||||||
|
'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array(
|
||||||
|
'family' => 'link_ticket',
|
||||||
|
'position' => 76,
|
||||||
|
'enabled' => ! empty($conf->ticket->enabled) && ! empty($conf->contract->enabled),
|
||||||
|
'picto' => 'ticket'
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) {
|
if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) {
|
||||||
@ -237,6 +257,11 @@ foreach ($workflowcodes as $key => $params) {
|
|||||||
if ($reg[1] == 'shipping') {
|
if ($reg[1] == 'shipping') {
|
||||||
$header .= ' - '.$langs->trans('Shipment');
|
$header .= ' - '.$langs->trans('Shipment');
|
||||||
}
|
}
|
||||||
|
} elseif (preg_match('/link_(.*)/', $params['family'], $reg)) {
|
||||||
|
$header = $langs->trans("AutomaticLinking");
|
||||||
|
if ($reg[1] == 'ticket') {
|
||||||
|
$header .= ' - '.$langs->trans('Ticket');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$header = $langs->trans("Description");
|
$header = $langs->trans("Description");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ https://**yourdolibarr.tld**/mydolibarr/api/index.php/otherservice?DOLAPIKEY=**a
|
|||||||
Develop an API
|
Develop an API
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples http://help.luracast.com/restler/examples/
|
The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples https://restler3.luracast.com/examples/index.html
|
||||||
|
|
||||||
Github contains also useful information : https://github.com/Luracast/Restler
|
Github contains also useful information : https://github.com/Luracast/Restler
|
||||||
|
|
||||||
|
|||||||
@ -126,7 +126,7 @@ class Documents extends DolibarrApi
|
|||||||
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
|
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
|
||||||
* @return array List of documents
|
* @return array List of documents
|
||||||
*
|
*
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
* @throws RestException 501
|
* @throws RestException 501
|
||||||
* @throws RestException 400
|
* @throws RestException 400
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
@ -249,7 +249,7 @@ class Documents extends DolibarrApi
|
|||||||
* @throws RestException 400
|
* @throws RestException 400
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
* @url GET /
|
* @url GET /
|
||||||
*/
|
*/
|
||||||
@ -458,6 +458,20 @@ class Documents extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||||
|
} elseif ($modulepart == 'knowledgemanagement') {
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php';
|
||||||
|
|
||||||
|
if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$object = new KnowledgeRecord($this->db);
|
||||||
|
$result = $object->fetch($id, $ref);
|
||||||
|
if (!$result) {
|
||||||
|
throw new RestException(404, 'KM article not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$upload_dir = $conf->knowledgemanagement->dir_output.'/knowledgerecord/'.dol_sanitizeFileName($object->ref);
|
||||||
} elseif ($modulepart == 'categorie' || $modulepart == 'category') {
|
} elseif ($modulepart == 'categorie' || $modulepart == 'category') {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
|
||||||
@ -546,7 +560,7 @@ class Documents extends DolibarrApi
|
|||||||
* @throws RestException 400
|
* @throws RestException 400
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
* @url POST /upload
|
* @url POST /upload
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -158,6 +158,25 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $
|
|||||||
$api = new DolibarrApi($db, '', $refreshcache);
|
$api = new DolibarrApi($db, '', $refreshcache);
|
||||||
//var_dump($api->r->apiVersionMap);
|
//var_dump($api->r->apiVersionMap);
|
||||||
|
|
||||||
|
// If MAIN_API_DEBUG is set to 1, we save logs into file "dolibarr_api.log"
|
||||||
|
if (!empty($conf->global->MAIN_API_DEBUG)) {
|
||||||
|
$r = $api->r;
|
||||||
|
$r->onCall(function () use ($r) {
|
||||||
|
// Don't log Luracast Restler Explorer recources calls
|
||||||
|
//if (!preg_match('/^explorer/', $r->url)) {
|
||||||
|
// 'method' => $api->r->requestMethod,
|
||||||
|
// 'url' => $api->r->url,
|
||||||
|
// 'route' => $api->r->apiMethodInfo->className.'::'.$api->r->apiMethodInfo->methodName,
|
||||||
|
// 'version' => $api->r->getRequestedApiVersion(),
|
||||||
|
// 'data' => $api->r->getRequestData(),
|
||||||
|
//dol_syslog("Debug API input ".var_export($r, true), LOG_DEBUG, 0, '_api');
|
||||||
|
dol_syslog("Debug API url ".var_export($r->url, true), LOG_DEBUG, 0, '_api');
|
||||||
|
dol_syslog("Debug API input ".var_export($r->getRequestData(), true), LOG_DEBUG, 0, '_api');
|
||||||
|
//}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Enable the Restler API Explorer.
|
// Enable the Restler API Explorer.
|
||||||
// See https://github.com/Luracast/Restler-API-Explorer for more info.
|
// See https://github.com/Luracast/Restler-API-Explorer for more info.
|
||||||
$api->r->addAPIClass('Luracast\\Restler\\Explorer');
|
$api->r->addAPIClass('Luracast\\Restler\\Explorer');
|
||||||
|
|||||||
@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedopjectblock.tpl.php -->\n";
|
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedobjectblock.tpl.php -->\n";
|
||||||
|
|
||||||
global $user;
|
global $user;
|
||||||
global $noMoreLinkedObjectBlockAfter;
|
global $noMoreLinkedObjectBlockAfter;
|
||||||
|
|||||||
@ -519,7 +519,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$keyforbreak = 'duration';
|
$keyforbreak = 'duration';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
$object->calculateCosts();
|
$object->calculateCosts();
|
||||||
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td>'.price($object->total_cost).'</td></tr>';
|
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td><span class="amount">'.price($object->total_cost).'</span></td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
|
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
|
|||||||
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("mrp", "other"));
|
$langs->loadLangs(array("mrp", "other", "stocks"));
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
@ -170,7 +170,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$keyforbreak = 'duration';
|
$keyforbreak = 'duration';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
|
|
||||||
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td>'.price($object->total_cost).'</td></tr>';
|
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td><span class="amount">'.price($object->total_cost).'</span></td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
|
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
@ -211,9 +211,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a> ';
|
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a> ';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="linecolqty">'.$langs->trans('Quantity').'</td>';
|
print '<td class="linecolqty right">'.$langs->trans('Quantity').'</td>';
|
||||||
print '<td class="linecolstock">'.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).'</td>';
|
print '<td class="linecolstock right">'.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).'</td>';
|
||||||
print '<td class="linecoltheoricalstock">'.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'</td>';
|
print '<td class="linecoltheoricalstock right">'.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
if (! empty($TChildBom)) {
|
if (! empty($TChildBom)) {
|
||||||
if ($action == 'treeview') {
|
if ($action == 'treeview') {
|
||||||
@ -227,9 +227,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print img_picto('', 'folder-open');
|
print img_picto('', 'folder-open');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="linecolqty">'.$TProduct['qty'].'</td>';
|
print '<td class="linecolqty right">'.$TProduct['qty'].'</td>';
|
||||||
print '<td class="linecolstock"></td>';
|
print '<td class="linecolstock right"></td>';
|
||||||
print '<td class="linecoltheoricalstock"></td>';
|
print '<td class="linecoltheoricalstock right"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
if (! empty($TProduct['product'])) {
|
if (! empty($TProduct['product'])) {
|
||||||
@ -241,9 +241,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
if ($fk_bom != $object->id) print '<tr class="sub_bom_lines oddeven" parentid="'.$fk_bom.'">';
|
if ($fk_bom != $object->id) print '<tr class="sub_bom_lines oddeven" parentid="'.$fk_bom.'">';
|
||||||
else print '<tr class="oddeven">';
|
else print '<tr class="oddeven">';
|
||||||
print '<td class="linecoldescription">'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).'</td>';
|
print '<td class="linecoldescription">'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).'</td>';
|
||||||
print '<td class="linecolqty">'.$TInfos['qty'].'</td>';
|
print '<td class="linecolqty right">'.$TInfos['qty'].'</td>';
|
||||||
print '<td class="linecolstock">'.$prod->stock_reel.'</td>';
|
print '<td class="linecolstock right">'.price2num($prod->stock_reel, 'MS').'</td>';
|
||||||
print '<td class="linecoltheoricalstock">'.$prod->stock_theorique.'</td>';
|
print '<td class="linecoltheoricalstock right">'.$prod->stock_theorique.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,9 +256,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
if (empty($prod->stock_reel)) $prod->stock_reel = 0;
|
if (empty($prod->stock_reel)) $prod->stock_reel = 0;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="linecoldescription">'.$prod->getNomUrl(1).'</td>';
|
print '<td class="linecoldescription">'.$prod->getNomUrl(1).'</td>';
|
||||||
print '<td class="linecolqty">'.$qty.'</td>';
|
print '<td class="linecolqty right">'.$qty.'</td>';
|
||||||
print '<td class="linecolstock">'.$prod->stock_reel.'</td>';
|
print '<td class="linecolstock right">'.price2num($prod->stock_reel, 'MS').'</td>';
|
||||||
print '<td class="linecoltheoricalstock">'.$prod->stock_theorique.'</td>';
|
print '<td class="linecoltheoricalstock right">'.$prod->stock_theorique.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ class BOM extends CommonObject
|
|||||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||||
* 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200'
|
* 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200'
|
||||||
* 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
|
* 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
|
||||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||||
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||||
@ -97,7 +97,7 @@ class BOM extends CommonObject
|
|||||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
|
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
|
||||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
|
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
|
||||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'),
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'minwidth300 maxwidth400', 'csslist'=>'tdoverflowmax200'),
|
||||||
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'),
|
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'),
|
||||||
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
|
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
|
||||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),
|
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),
|
||||||
@ -1103,6 +1103,23 @@ class BOM extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to replace a product id with another one.
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param int $origin_id Old product id
|
||||||
|
* @param int $dest_id New product id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id)
|
||||||
|
{
|
||||||
|
$tables = array(
|
||||||
|
'bom_bomline'
|
||||||
|
);
|
||||||
|
|
||||||
|
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Net needs by product
|
* Get Net needs by product
|
||||||
*
|
*
|
||||||
|
|||||||
@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<!-- BEGIN PHP TEMPLATE bom/tpl/linkedopjectblock.tpl.php -->\n";
|
print "<!-- BEGIN PHP TEMPLATE bom/tpl/linkedobjectblock.tpl.php -->\n";
|
||||||
|
|
||||||
global $user, $db;
|
global $user, $db;
|
||||||
global $noMoreLinkedObjectBlockAfter;
|
global $noMoreLinkedObjectBlockAfter;
|
||||||
|
|||||||
@ -126,7 +126,7 @@ print '</td>';
|
|||||||
$total_cost = 0;
|
$total_cost = 0;
|
||||||
print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">';
|
print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">';
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
echo price($line->total_cost);
|
echo '<span class="amount">'.price($line->total_cost).'</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
|
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
|
||||||
@ -152,12 +152,12 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
|
|||||||
print '<td class="linecolmove tdlineupdown center">';
|
print '<td class="linecolmove tdlineupdown center">';
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
if ($i > 0) {
|
if ($i > 0) {
|
||||||
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id.'">';
|
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&token='.newToken().'&rowid='.$line->id.'">';
|
||||||
echo img_up('default', 0, 'imgupforline');
|
echo img_up('default', 0, 'imgupforline');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
if ($i < $num - 1) {
|
if ($i < $num - 1) {
|
||||||
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id.'">';
|
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&token='.newToken().'&rowid='.$line->id.'">';
|
||||||
echo img_down('default', 0, 'imgdownforline');
|
echo img_down('default', 0, 'imgdownforline');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@ -236,15 +236,16 @@ if ($resql) {
|
|||||||
// Efficiency
|
// Efficiency
|
||||||
print '<td class="linecolefficiency nowrap right" id="sub_bom_efficiency_'.$sub_bom_line->id.'">'.$sub_bom_line->efficiency.'</td>';
|
print '<td class="linecolefficiency nowrap right" id="sub_bom_efficiency_'.$sub_bom_line->id.'">'.$sub_bom_line->efficiency.'</td>';
|
||||||
|
|
||||||
|
// Cost
|
||||||
if (!empty($sub_bom->id)) {
|
if (!empty($sub_bom->id)) {
|
||||||
$sub_bom->calculateCosts();
|
$sub_bom->calculateCosts();
|
||||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).'</td>';
|
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).'</span></td>';
|
||||||
$total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty;
|
$total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty;
|
||||||
} elseif ($sub_bom_product->cost_price > 0) {
|
} elseif ($sub_bom_product->cost_price > 0) {
|
||||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).'</td>';
|
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).'</span></td>';
|
||||||
$total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty;
|
$total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty;
|
||||||
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
|
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
|
||||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).'</td>';
|
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).'</span></td>';
|
||||||
$total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty;
|
$total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty;
|
||||||
} else { // Minimum purchase price if cost price and PMP aren't defined
|
} else { // Minimum purchase price if cost price and PMP aren't defined
|
||||||
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
||||||
@ -254,7 +255,7 @@ if ($resql) {
|
|||||||
$obj = $object->db->fetch_object($resql_supplier_price);
|
$obj = $object->db->fetch_object($resql_supplier_price);
|
||||||
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
|
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
|
||||||
|
|
||||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($line_cost).'</td>';
|
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($line_cost).'</span></td>';
|
||||||
$total_cost+= $line_cost;
|
$total_cost+= $line_cost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,11 +267,12 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace of the total_cost value by the sum of all sub-BOM lines total_cost
|
// Replace of the total_cost value by the sum of all sub-BOM lines total_cost
|
||||||
|
// TODO Remove this bad practice. We should not replace content of ouput using javascript but value should be good during generation of output.
|
||||||
if ($total_cost > 0) {
|
if ($total_cost > 0) {
|
||||||
$line->total_cost = price($total_cost);
|
$line->total_cost = price($total_cost);
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
$('#costline_<?php echo $line->id?>').html("<?php echo "".price($total_cost)?>");
|
$('#costline_<?php echo $line->id?>').html('<?php echo "<span class=\"amount\">".price($total_cost)."</span>"; ?>');
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
CACHE MANIFEST
|
|
||||||
# version 2013-05-21 13:30:21
|
|
||||||
# Note: If this file is dynamic, it must return MIME text/cache-manifest
|
|
||||||
# Note: Order of CACHE, NETWORK and FALLBACK section does not change behaviour
|
|
||||||
" Note:
|
|
||||||
|
|
||||||
|
|
||||||
# Files listed under CACHE will be ALWAYS cached after they are loaded.
|
|
||||||
# And they will be always used from Cache after (even after refresh).
|
|
||||||
CACHE:
|
|
||||||
theme/dolibarr_logo.svg
|
|
||||||
support/
|
|
||||||
support/index.php
|
|
||||||
|
|
||||||
support/default.css
|
|
||||||
support/helpcenter.png
|
|
||||||
support/internet.png
|
|
||||||
support/mail.png
|
|
||||||
support/pagemaster.png
|
|
||||||
support/redstar.png
|
|
||||||
support/star.png
|
|
||||||
support/who.png
|
|
||||||
|
|
||||||
|
|
||||||
# The NETWORK section contains the path to a folder to ensure that requests
|
|
||||||
# to load resources will use internet.
|
|
||||||
# CACHE has priority on NETWORK, so usage is useless
|
|
||||||
NETWORK:
|
|
||||||
/
|
|
||||||
|
|
||||||
# The FALLBACK section contains entries that provide a backup strategy.
|
|
||||||
# If the browser is unable to retrieve the original content, the fallback resource will be used.
|
|
||||||
# In the example above, we display a static image in case the dynamic one is unavailable.
|
|
||||||
FALLBACK:
|
|
||||||
#/ public/notice.php
|
|
||||||
#theme/eldy/img/* theme/md/img/*
|
|
||||||
@ -1141,10 +1141,10 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We add the fullpath property to each elements of first level (no parent exists)
|
// We add the fullpath property to each elements of first level (no parent exists)
|
||||||
dol_syslog(get_class($this)."::get_full_arbo call to build_path_from_id_categ", LOG_DEBUG);
|
dol_syslog(get_class($this)."::get_full_arbo call to buildPathFromId", LOG_DEBUG);
|
||||||
foreach ($this->cats as $key => $val) {
|
foreach ($this->cats as $key => $val) {
|
||||||
//print 'key='.$key.'<br>'."\n";
|
//print 'key='.$key.'<br>'."\n";
|
||||||
$this->build_path_from_id_categ($key, 0); // Process a branch from the root category key (this category has no parent)
|
$this->buildPathFromId($key, 0); // Process a branch from the root category key (this category has no parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include or exclude leaf including $markafterid from tree
|
// Include or exclude leaf including $markafterid from tree
|
||||||
@ -1174,7 +1174,6 @@ class Categorie extends CommonObject
|
|||||||
return $this->cats;
|
return $this->cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
|
||||||
/**
|
/**
|
||||||
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel.
|
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel.
|
||||||
* It is called by get_full_arbo()
|
* It is called by get_full_arbo()
|
||||||
@ -1185,19 +1184,18 @@ class Categorie extends CommonObject
|
|||||||
* @return void
|
* @return void
|
||||||
* @see get_full_arbo()
|
* @see get_full_arbo()
|
||||||
*/
|
*/
|
||||||
public function build_path_from_id_categ($id_categ, $protection = 1000)
|
private function buildPathFromId($id_categ, $protection = 1000)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
//dol_syslog(get_class($this)."::buildPathFromId id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
|
||||||
dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
|
|
||||||
|
|
||||||
if (!empty($this->cats[$id_categ]['fullpath'])) {
|
if (!empty($this->cats[$id_categ]['fullpath'])) {
|
||||||
// Already defined
|
// Already defined
|
||||||
dol_syslog(get_class($this)."::build_path_from_id_categ fullpath and fulllabel already defined", LOG_WARNING);
|
dol_syslog(get_class($this)."::buildPathFromId fullpath and fulllabel already defined", LOG_WARNING);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First build full array $motherof
|
// First build full array $motherof
|
||||||
//$this->load_motherof(); // Disabled because already done by caller of build_path_from_id_categ
|
//$this->load_motherof(); // Disabled because already done by caller of buildPathFromId
|
||||||
|
|
||||||
// $this->cats[$id_categ] is supposed to be already an array. We just want to complete it with property fullpath and fulllabel
|
// $this->cats[$id_categ] is supposed to be already an array. We just want to complete it with property fullpath and fulllabel
|
||||||
|
|
||||||
|
|||||||
@ -133,7 +133,9 @@ if (empty($nosearch)) {
|
|||||||
print '</span>';
|
print '</span>';
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "\t\t<td>";
|
print "\t\t<td>";
|
||||||
print dolGetFirstLineOfText($cat->description);
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($cat->description, 1));
|
||||||
|
$trunclength = 48;
|
||||||
|
print $form->textwithtooltip(dol_trunc($text, $trunclength), $cat->description);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "\t</tr>\n";
|
print "\t</tr>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -701,7 +701,7 @@ if (empty($reshook) && $action == 'update') {
|
|||||||
$categories = GETPOST('categories', 'array');
|
$categories = GETPOST('categories', 'array');
|
||||||
$object->setCategories($categories);
|
$object->setCategories($categories);
|
||||||
|
|
||||||
$object->loadReminders();
|
$object->loadReminders($remindertype, 0, false);
|
||||||
if (!empty($object->reminders) && $object->datep > dol_now()) {
|
if (!empty($object->reminders) && $object->datep > dol_now()) {
|
||||||
foreach ($object->reminders as $reminder) {
|
foreach ($object->reminders as $reminder) {
|
||||||
$reminder->delete($user);
|
$reminder->delete($user);
|
||||||
@ -1491,6 +1491,10 @@ if ($id > 0) {
|
|||||||
$("#fullday").change(function() {
|
$("#fullday").change(function() {
|
||||||
setdatefields();
|
setdatefields();
|
||||||
});
|
});
|
||||||
|
$("#actioncode").change(function() {
|
||||||
|
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
|
||||||
|
else $("#dateend").removeClass("fieldrequired");
|
||||||
|
});
|
||||||
})';
|
})';
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
@ -1535,22 +1539,26 @@ if ($id > 0) {
|
|||||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
|
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
|
||||||
|
|
||||||
// Date start - end
|
// Date start - end
|
||||||
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").'</span></td><td colspan="3">';
|
print '<tr><td class="nowrap">';
|
||||||
|
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||||
|
print ' - ';
|
||||||
|
print '<span id="dateend"'.($object->type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||||
|
print '</td><td td colspan="3">';
|
||||||
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
||||||
if (GETPOST("afaire") == 1) {
|
if (GETPOST("afaire") == 1) {
|
||||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
} elseif (GETPOST("afaire") == 2) {
|
} elseif (GETPOST("afaire") == 2) {
|
||||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
} else {
|
} else {
|
||||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
}
|
}
|
||||||
print ' - ';
|
print ' - ';
|
||||||
if (GETPOST("afaire") == 1) {
|
if (GETPOST("afaire") == 1) {
|
||||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
} elseif (GETPOST("afaire") == 2) {
|
} elseif (GETPOST("afaire") == 2) {
|
||||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
} else {
|
} else {
|
||||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -1988,11 +1996,15 @@ if ($id > 0) {
|
|||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>';
|
||||||
|
// Test a date before the 27 march and one after
|
||||||
|
//print dol_print_date($object->datep, 'dayhour', 'gmt');
|
||||||
|
//print dol_print_date($object->datep, 'dayhour', 'tzuser');
|
||||||
|
//print dol_print_date($object->datep, 'dayhour', 'tzuserrel');
|
||||||
if (empty($object->fulldayevent)) {
|
if (empty($object->fulldayevent)) {
|
||||||
print dol_print_date($object->datep, 'dayhour', 'tzuser');
|
print dol_print_date($object->datep, 'dayhour', 'tzuserrel');
|
||||||
} else {
|
} else {
|
||||||
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
||||||
print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser'));
|
print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuserrel'));
|
||||||
}
|
}
|
||||||
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) {
|
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) {
|
||||||
print img_warning($langs->trans("Late"));
|
print img_warning($langs->trans("Late"));
|
||||||
@ -2003,10 +2015,10 @@ if ($id > 0) {
|
|||||||
// Date end
|
// Date end
|
||||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
|
||||||
if (empty($object->fulldayevent)) {
|
if (empty($object->fulldayevent)) {
|
||||||
print dol_print_date($object->datef, 'dayhour', 'tzuser');
|
print dol_print_date($object->datef, 'dayhour', 'tzuserrel');
|
||||||
} else {
|
} else {
|
||||||
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
||||||
print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser'));
|
print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuserrel'));
|
||||||
}
|
}
|
||||||
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) {
|
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) {
|
||||||
print img_warning($langs->trans("Late"));
|
print img_warning($langs->trans("Late"));
|
||||||
|
|||||||
@ -778,7 +778,7 @@ class ActionComm extends CommonObject
|
|||||||
$sql .= " a.fk_contact, a.percent as percentage,";
|
$sql .= " a.fk_contact, a.percent as percentage,";
|
||||||
$sql .= " a.fk_element as elementid, a.elementtype,";
|
$sql .= " a.fk_element as elementid, a.elementtype,";
|
||||||
$sql .= " a.priority, a.fulldayevent, a.location, a.transparency,";
|
$sql .= " a.priority, a.fulldayevent, a.location, a.transparency,";
|
||||||
$sql .= " a.email_msgid, a.email_subject, a.email_from, a.email_to, a.email_tocc, a.email_tobcc, a.errors_to,";
|
$sql .= " a.email_msgid, a.email_subject, a.email_from, a.email_sender, a.email_to, a.email_tocc, a.email_tobcc, a.errors_to,";
|
||||||
$sql .= " c.id as type_id, c.type as type_type, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,";
|
$sql .= " c.id as type_id, c.type as type_type, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,";
|
||||||
$sql .= " s.nom as socname,";
|
$sql .= " s.nom as socname,";
|
||||||
$sql .= " u.firstname, u.lastname as lastname,";
|
$sql .= " u.firstname, u.lastname as lastname,";
|
||||||
@ -868,6 +868,16 @@ class ActionComm extends CommonObject
|
|||||||
$this->event_paid = $obj->event_paid;
|
$this->event_paid = $obj->event_paid;
|
||||||
$this->status = $obj->status;
|
$this->status = $obj->status;
|
||||||
|
|
||||||
|
//email information
|
||||||
|
$this->email_msgid=$obj->email_msgid;
|
||||||
|
$this->email_from=$obj->email_from;
|
||||||
|
$this->email_sender=$obj->email_sender;
|
||||||
|
$this->email_to=$obj->email_to;
|
||||||
|
$this->email_tocc=$obj->email_tocc;
|
||||||
|
$this->email_tobcc=$obj->email_tobcc;
|
||||||
|
$this->email_subject=$obj->email_subject;
|
||||||
|
$this->errors_to=$obj->errors_to;
|
||||||
|
|
||||||
$this->fetch_optionals();
|
$this->fetch_optionals();
|
||||||
|
|
||||||
if ($loadresources) {
|
if ($loadresources) {
|
||||||
@ -1582,8 +1592,25 @@ class ActionComm extends CommonObject
|
|||||||
if (isset($this->transparency)) {
|
if (isset($this->transparency)) {
|
||||||
$tooltip .= '<br><b>'.$langs->trans('Busy').':</b> '.yn($this->transparency);
|
$tooltip .= '<br><b>'.$langs->trans('Busy').':</b> '.yn($this->transparency);
|
||||||
}
|
}
|
||||||
|
if (!empty($this->email_msgid)) {
|
||||||
|
$langs->load("mails");
|
||||||
|
$tooltip .= '<br>';
|
||||||
|
//$tooltip .= '<br><b>'.img_picto('', 'email').' '.$langs->trans("Email").'</b>';
|
||||||
|
$tooltip .= '<br><b>'.$langs->trans('MailTopic').':</b> '.$this->email_subject;
|
||||||
|
$tooltip .= '<br><b>'.$langs->trans('MailFrom').':</b> '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_from);
|
||||||
|
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b>, '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_to);
|
||||||
|
if (!empty($this->email_tocc)) {
|
||||||
|
$tooltip .= '<br><b>'.$langs->trans('MailCC').':</b> '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_tocc);
|
||||||
|
}
|
||||||
|
/* Disabled because bcc must remain by defintion not visible
|
||||||
|
if (!empty($this->email_tobcc)) {
|
||||||
|
$tooltip .= '<br><b>'.$langs->trans('MailCCC').':</b> '.$this->email_tobcc;
|
||||||
|
} */
|
||||||
|
}
|
||||||
if (!empty($this->note_private)) {
|
if (!empty($this->note_private)) {
|
||||||
$tooltip .= '<br><b>'.$langs->trans('Note').':</b> '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), '<br>', $this->note_private));
|
$tooltip .= '<br><br><b>'.$langs->trans('Description').':</b><br>';
|
||||||
|
$texttoshow = dolGetFirstLineOfText($this->note_private, 10);
|
||||||
|
$tooltip .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '<br>', $texttoshow));
|
||||||
}
|
}
|
||||||
$linkclose = '';
|
$linkclose = '';
|
||||||
//if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
//if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
||||||
@ -1594,9 +1621,8 @@ class ActionComm extends CommonObject
|
|||||||
$label = $langs->trans("ShowAction");
|
$label = $langs->trans("ShowAction");
|
||||||
$linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1).'"';
|
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, 0, '', 1).'"';
|
||||||
$linkclose .= ' class="'.$classname.' classfortooltip"';
|
$linkclose .= ' class="'.$classname.' classfortooltip"';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$hookmanager->initHooks(array('actiondao'));
|
$hookmanager->initHooks(array('actiondao'));
|
||||||
$parameters=array('id'=>$this->id);
|
$parameters=array('id'=>$this->id);
|
||||||
@ -2210,6 +2236,26 @@ class ActionComm extends CommonObject
|
|||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to replace a product id with another one.
|
||||||
|
*
|
||||||
|
* @param DoliDB $dbs Database handler
|
||||||
|
* @param int $origin_id Old product id
|
||||||
|
* @param int $dest_id New product id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function replaceProduct(DoliDB $dbs, $origin_id, $dest_id)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'actioncomm SET fk_element = ' . ((int) $dest_id) . ' WHERE elementtype="product" AND fk_element = '.((int) $origin_id);
|
||||||
|
// using $dbs, not $this->db because function is static
|
||||||
|
if (!$dbs->query($sql)) {
|
||||||
|
//$this->errors = $dbs->lasterror();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the action delayed?
|
* Is the action delayed?
|
||||||
*
|
*
|
||||||
|
|||||||
@ -186,35 +186,55 @@ class CActionComm
|
|||||||
|
|
||||||
$qualified = 1;
|
$qualified = 1;
|
||||||
|
|
||||||
// $obj->type can be system, systemauto, module, moduleauto, xxx, xxxauto
|
// $obj->type can be 'system', 'systemauto', 'module', 'moduleauto', 'xxx', 'xxxauto'
|
||||||
|
// Note: type = system... than type of event is added among other standard events.
|
||||||
|
// type = module... then type of event is grouped into module defined into module = myobject@mymodule. Example: Event organization or external modules
|
||||||
|
// type = xxx... then type of event is added into list as a new flat value (not grouped). Example: Agefod external module
|
||||||
if ($qualified && $onlyautoornot > 0 && preg_match('/^system/', $obj->type) && !preg_match('/^AC_OTH/', $obj->code)) {
|
if ($qualified && $onlyautoornot > 0 && preg_match('/^system/', $obj->type) && !preg_match('/^AC_OTH/', $obj->code)) {
|
||||||
$qualified = 0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
|
$qualified = 0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($qualified && !empty($obj->module)) {
|
if ($qualified && !empty($obj->module)) {
|
||||||
if ($obj->module == 'invoice' && empty($conf->facture->enabled) && empty($user->facture->lire)) {
|
//var_dump($obj->type.' '.$obj->module.' '); var_dump($user->rights->facture->lire);
|
||||||
$qualified = 0;
|
$qualified = 0;
|
||||||
|
// Special cases
|
||||||
|
if ($obj->module == 'invoice' && !empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
|
||||||
|
$qualified = 1;
|
||||||
}
|
}
|
||||||
if ($obj->module == 'order' && empty($conf->commande->enabled) && empty($user->commande->lire)) {
|
if ($obj->module == 'order' && !empty($conf->commande->enabled) && empty($user->rights->commande->lire)) {
|
||||||
$qualified = 0;
|
$qualified = 1;
|
||||||
}
|
}
|
||||||
if ($obj->module == 'propal' && empty($conf->propal->enabled) && empty($user->propale->lire)) {
|
if ($obj->module == 'propal' && !empty($conf->propal->enabled) && !empty($user->rights->propale->lire)) {
|
||||||
$qualified = 0;
|
$qualified = 1;
|
||||||
}
|
}
|
||||||
if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && empty($user->fournisseur->facture->lire)) || (!empty($conf->supplier_invoice->enabled) && empty($user->supplier_invoice->lire)))) {
|
if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && !empty($user->rights->fournisseur->facture->lire)) || (!empty($conf->rights->supplier_invoice->enabled) && !empty($user->rights->supplier_invoice->lire)))) {
|
||||||
$qualified = 0;
|
$qualified = 1;
|
||||||
}
|
}
|
||||||
if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && empty($user->fournisseur->commande->lire)) || (empty($conf->supplier_order->enabled) && empty($user->supplier_order->lire)))) {
|
if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && !empty($user->rights->fournisseur->commande->lire)) || (empty($conf->rights->supplier_order->enabled) && !empty($user->rights->supplier_order->lire)))) {
|
||||||
$qualified = 0;
|
$qualified = 1;
|
||||||
}
|
}
|
||||||
if ($obj->module == 'shipping' && empty($conf->expedition->enabled) && empty($user->expedition->lire)) {
|
if ($obj->module == 'shipping' && !empty($conf->expedition->enabled) && !empty($user->rights->expedition->lire)) {
|
||||||
$qualified = 0;
|
$qualified = 1;
|
||||||
}
|
}
|
||||||
if (preg_match('/@eventorganization/', $obj->module) && empty($conf->eventorganization->enabled) && empty($user->eventorganization->read)) {
|
// For the generic case with type = 'module...' and module = 'myobject@mymodule'
|
||||||
$qualified = 0;
|
$regs = array();
|
||||||
|
if (preg_match('/^module/', $obj->type)) {
|
||||||
|
if (preg_match('/^(.+)@(.+)$/', $obj->module, $regs)) {
|
||||||
|
$tmpobject = $regs[1];
|
||||||
|
$tmpmodule = $regs[2];
|
||||||
|
//var_dump($user->$tmpmodule);
|
||||||
|
if ($tmpmodule && isset($conf->$tmpmodule) && !empty($conf->$tmpmodule->enabled) && (!empty($user->rights->$tmpmodule->read) || !empty($user->rights->$tmpmodule->lire) || !empty($user->rights->$tmpmodule->$tmpobject->read) || !empty($user->rights->$tmpmodule->$tmpobject->lire))) {
|
||||||
|
$qualified = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!preg_match('/^system/', $obj->type) && isset($conf->{$obj->module}) && empty($conf->{$obj->module}->enabled)) {
|
// For the case type is not 'system...' neither 'module', we just check module is on
|
||||||
$qualified = 0;
|
if (! in_array($obj->type, array('system', 'systemauto', 'module', 'moduleauto'))) {
|
||||||
|
$tmpmodule = $obj->module;
|
||||||
|
//var_dump($tmpmodule);
|
||||||
|
if ($tmpmodule && isset($conf->$tmpmodule) && !empty($conf->$tmpmodule->enabled)) {
|
||||||
|
$qualified = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,10 +49,11 @@ if (empty($conf->global->AGENDA_EXT_NB)) {
|
|||||||
}
|
}
|
||||||
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
|
$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
|
||||||
|
|
||||||
$filter = GETPOST("search_filter", 'alpha', 3) ?GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
$check_holiday = GETPOST('check_holiday', 'int');
|
||||||
$filtert = GETPOST("search_filtert", "int", 3) ?GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||||
$usergroup = GETPOST("search_usergroup", "int", 3) ?GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
|
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
||||||
$showbirthday = empty($conf->use_javascript_ajax) ?GETPOST("showbirthday", "int") : 1;
|
$usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3);
|
||||||
|
$showbirthday = empty($conf->use_javascript_ajax) ? GETPOST("showbirthday", "int") : 1;
|
||||||
|
|
||||||
// If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user.
|
// If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user.
|
||||||
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) {
|
if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) {
|
||||||
@ -207,16 +208,16 @@ if (GETPOST("viewperuser", 'alpha') || $mode == 'show_peruser') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ($action == 'delete_action' && $user->rights->agenda->delete) {
|
if ($action == 'delete_action' && $user->rights->agenda->delete) {
|
||||||
$event = new ActionComm($db);
|
$event = new ActionComm($db);
|
||||||
$event->fetch($actionid);
|
$event->fetch($actionid);
|
||||||
$event->fetch_optionals();
|
$event->fetch_optionals();
|
||||||
$event->fetch_userassigned();
|
$event->fetch_userassigned();
|
||||||
$event->oldcopy = clone $event;
|
$event->oldcopy = clone $event;
|
||||||
|
|
||||||
$result = $event->delete();
|
$result = $event->delete();
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -579,10 +580,10 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
|
|||||||
$s .= '</script>'."\n";
|
$s .= '</script>'."\n";
|
||||||
|
|
||||||
// Local calendar
|
// Local calendar
|
||||||
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> '.$langs->trans("LocalAgenda").' </div>';
|
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_mytasks" name="check_mytasks" value="1" checked disabled> '.$langs->trans("LocalAgenda").' </div>';
|
||||||
|
|
||||||
// Holiday calendar
|
// Holiday calendar
|
||||||
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" class="check_holiday"><label for="check_holiday"> <span class="check_holiday_text">'.$langs->trans("Holidays").'</span></label> </div>';
|
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_holiday" name="check_holiday" value="1" class="check_holiday"'.($check_holiday ? ' checked' : '').'><label for="check_holiday"> <span class="check_holiday_text">'.$langs->trans("Holidays").'</span></label> </div>';
|
||||||
|
|
||||||
// External calendars
|
// External calendars
|
||||||
if (is_array($showextcals) && count($showextcals) > 0) {
|
if (is_array($showextcals) && count($showextcals) > 0) {
|
||||||
@ -607,13 +608,13 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
|
|||||||
foreach ($showextcals as $val) {
|
foreach ($showextcals as $val) {
|
||||||
$htmlname = md5($val['name']);
|
$htmlname = md5($val['name']);
|
||||||
|
|
||||||
if (!empty($val['default'])) {
|
if (!empty($val['default']) || GETPOST('check_ext'.$htmlname, 'int')) {
|
||||||
$default = "checked";
|
$default = "checked";
|
||||||
} else {
|
} else {
|
||||||
$default = '';
|
$default = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" '.$default.'> <label for="check_ext'.$htmlname.'">'.$val['name'].'</label> </div>';
|
$s .= '<div class="nowrap inline-block minheight30"><input type="checkbox" id="check_ext'.$htmlname.'" name="check_ext'.$htmlname.'" value="1" '.$default.'> <label for="check_ext'.$htmlname.'">'.$val['name'].'</label> </div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -848,6 +849,7 @@ if ($resql) {
|
|||||||
$event->fk_project = $obj->fk_project;
|
$event->fk_project = $obj->fk_project;
|
||||||
|
|
||||||
$event->socid = $obj->fk_soc;
|
$event->socid = $obj->fk_soc;
|
||||||
|
$event->thirdparty_id = $obj->fk_soc;
|
||||||
$event->contact_id = $obj->fk_contact;
|
$event->contact_id = $obj->fk_contact;
|
||||||
|
|
||||||
// Defined date_start_in_calendar and date_end_in_calendar property
|
// Defined date_start_in_calendar and date_end_in_calendar property
|
||||||
@ -890,13 +892,13 @@ if ($resql) {
|
|||||||
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz
|
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee, 'gmt'); // $mois, $jour, $annee has been set for user tz
|
||||||
$daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz
|
$daykeyend = dol_mktime(0, 0, 0, $moisend, $jourend, $anneeend, 'gmt'); // $moisend, $jourend, $anneeend has been set for user tz
|
||||||
/*
|
/*
|
||||||
print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'<br>';
|
print 'GMT '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'gmt').'<br>';
|
||||||
print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'<br>';
|
print 'TZSERVER '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzserver').'<br>';
|
||||||
print 'TZUSERREL '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel').'<br>';
|
print 'TZUSERREL '.$event->date_start_in_calendar.' '.dol_print_date($event->date_start_in_calendar, 'dayhour', 'tzuserrel').'<br>';
|
||||||
print 'GMT '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'gmt').'<br>';
|
print 'GMT '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'gmt').'<br>';
|
||||||
print 'TZSERVER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzserver').'<br>';
|
print 'TZSERVER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzserver').'<br>';
|
||||||
print 'TZUSER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel').'<br>';
|
print 'TZUSER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel').'<br>';
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
//if ($event->id==408)
|
//if ($event->id==408)
|
||||||
//print 'daykey='.$daykey.' daykeyend='.$daykeyend.' '.dol_print_date($daykey, 'dayhour', 'gmt').' - '.dol_print_date($event->datep, 'dayhour', 'gmt').' '.dol_print_date($event->datef, 'dayhour', 'gmt').'<br>';
|
//print 'daykey='.$daykey.' daykeyend='.$daykeyend.' '.dol_print_date($daykey, 'dayhour', 'gmt').' - '.dol_print_date($event->datep, 'dayhour', 'gmt').' '.dol_print_date($event->datef, 'dayhour', 'gmt').'<br>';
|
||||||
@ -929,7 +931,7 @@ if ($showbirthday) {
|
|||||||
$sql = 'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
|
$sql = 'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp';
|
||||||
$sql .= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.((int) $user->id).'))';
|
$sql .= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.((int) $user->id).'))';
|
||||||
$sql .= " AND sp.entity IN (".getEntity('socpeople').")";
|
$sql .= " AND sp.entity IN (".getEntity('contact').")";
|
||||||
if ($mode == 'show_day') {
|
if ($mode == 'show_day') {
|
||||||
$sql .= ' AND MONTH(birthday) = '.((int) $month);
|
$sql .= ' AND MONTH(birthday) = '.((int) $month);
|
||||||
$sql .= ' AND DAY(birthday) = '.((int) $day);
|
$sql .= ' AND DAY(birthday) = '.((int) $day);
|
||||||
@ -1031,8 +1033,8 @@ if ($resql) {
|
|||||||
$event->type = 'holiday';
|
$event->type = 'holiday';
|
||||||
$event->type_picto = 'holiday';
|
$event->type_picto = 'holiday';
|
||||||
|
|
||||||
$event->datep = $db->jdate($obj->date_start);
|
$event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1);
|
||||||
$event->datef = $db->jdate($obj->date_end);
|
$event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1;
|
||||||
$event->date_start_in_calendar = $event->datep;
|
$event->date_start_in_calendar = $event->datep;
|
||||||
$event->date_end_in_calendar = $event->datef;
|
$event->date_end_in_calendar = $event->datef;
|
||||||
|
|
||||||
|
|||||||
@ -943,8 +943,8 @@ while ($i < min($num, $limit)) {
|
|||||||
// Description
|
// Description
|
||||||
if (!empty($arrayfields['a.note']['checked'])) {
|
if (!empty($arrayfields['a.note']['checked'])) {
|
||||||
print '<td class="tdoverflowonsmartphone">';
|
print '<td class="tdoverflowonsmartphone">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 1));
|
||||||
print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private);
|
print $form->textwithtooltip(dol_trunc($text, 48), $actionstatic->note_private);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
* Copyright (C) 2015-2021 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2015-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||||
|
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -38,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
if (!empty($conf->facture->enabled)) {
|
if (!empty($conf->facture->enabled)) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
}
|
}
|
||||||
@ -112,6 +114,7 @@ $cancel = GETPOST('cancel', 'alpha');
|
|||||||
|
|
||||||
$object = new Client($db);
|
$object = new Client($db);
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
@ -159,7 +162,8 @@ if (empty($reshook)) {
|
|||||||
// set accountancy code
|
// set accountancy code
|
||||||
if ($action == 'setcustomeraccountancycode') {
|
if ($action == 'setcustomeraccountancycode') {
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
$object->code_compta = GETPOST("customeraccountancycode");
|
$object->code_compta_client = GETPOST("customeraccountancycode");
|
||||||
|
$object->code_compta = $object->code_compta_client; // For Backward compatibility
|
||||||
$result = $object->update($object->id, $user, 1, 1, 0);
|
$result = $object->update($object->id, $user, 1, 1, 0);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -357,9 +361,9 @@ if ($object->id > 0) {
|
|||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
|
print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer);
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
|
print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
@ -683,7 +687,7 @@ if ($object->id > 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</div><div class="fichehalfright">';
|
print '</div><div class="fichehalfright">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner underbanner-before-box clearboth"></div>';
|
||||||
|
|
||||||
$boxstat = '';
|
$boxstat = '';
|
||||||
|
|
||||||
@ -691,7 +695,7 @@ if ($object->id > 0) {
|
|||||||
$MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
$MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||||
|
|
||||||
// Lien recap
|
// Lien recap
|
||||||
$boxstat .= '<div class="box">';
|
$boxstat .= '<div class="box box-halfright">';
|
||||||
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
|
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
|
||||||
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
|
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
|
||||||
|
|
||||||
@ -859,6 +863,36 @@ if ($object->id > 0) {
|
|||||||
$propal_static->total_tva = $objp->total_tva;
|
$propal_static->total_tva = $objp->total_tva;
|
||||||
$propal_static->total_ttc = $objp->total_ttc;
|
$propal_static->total_ttc = $objp->total_ttc;
|
||||||
print $propal_static->getNomUrl(1);
|
print $propal_static->getNomUrl(1);
|
||||||
|
|
||||||
|
// Preview
|
||||||
|
$filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
$file_list = null;
|
||||||
|
if (!empty($filedir)) {
|
||||||
|
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||||
|
}
|
||||||
|
if (is_array($file_list)) {
|
||||||
|
// Defined relative dir to DOL_DATA_ROOT
|
||||||
|
$relativedir = '';
|
||||||
|
if ($filedir) {
|
||||||
|
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
|
||||||
|
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
|
||||||
|
}
|
||||||
|
// Get list of files stored into database for same relative directory
|
||||||
|
if ($relativedir) {
|
||||||
|
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
|
||||||
|
|
||||||
|
//var_dump($sortfield.' - '.$sortorder);
|
||||||
|
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
|
||||||
|
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
|
||||||
|
print $formfile->showPreview($file_list, $propal_static->element, $relativepath, 0, $param);
|
||||||
|
}
|
||||||
|
// $filename = dol_sanitizeFileName($objp->ref);
|
||||||
|
// $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
// $urlsource = '/comm/propal/card.php?id='.$objp->cid;
|
||||||
|
// print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir);
|
||||||
if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
|
if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
|
||||||
print " ".img_warning();
|
print " ".img_warning();
|
||||||
}
|
}
|
||||||
@ -940,7 +974,38 @@ if ($object->id > 0) {
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
print $commande_static->getNomUrl(1);
|
print $commande_static->getNomUrl(1);
|
||||||
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day')."</td>\n";
|
// Preview
|
||||||
|
$filedir = $conf->commande->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
$file_list = null;
|
||||||
|
if (!empty($filedir)) {
|
||||||
|
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||||
|
}
|
||||||
|
if (is_array($file_list)) {
|
||||||
|
// Defined relative dir to DOL_DATA_ROOT
|
||||||
|
$relativedir = '';
|
||||||
|
if ($filedir) {
|
||||||
|
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
|
||||||
|
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
|
||||||
|
}
|
||||||
|
// Get list of files stored into database for same relative directory
|
||||||
|
if ($relativedir) {
|
||||||
|
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
|
||||||
|
|
||||||
|
//var_dump($sortfield.' - '.$sortorder);
|
||||||
|
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
|
||||||
|
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
|
||||||
|
print $formfile->showPreview($file_list, $commande_static->element, $relativepath, 0, $param);
|
||||||
|
}
|
||||||
|
// $filename = dol_sanitizeFileName($objp->ref);
|
||||||
|
// $filedir = $conf->order->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
// $urlsource = '/commande/card.php?id='.$objp->cid;
|
||||||
|
// print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day')."</td>\n";
|
||||||
print '<td class="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
|
print '<td class="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
|
||||||
print '<td class="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).'</td></tr>';
|
print '<td class="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).'</td></tr>';
|
||||||
$i++;
|
$i++;
|
||||||
@ -1003,6 +1068,35 @@ if ($object->id > 0) {
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
print $sendingstatic->getNomUrl(1);
|
print $sendingstatic->getNomUrl(1);
|
||||||
|
// Preview
|
||||||
|
$filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
$file_list = null;
|
||||||
|
if (!empty($filedir)) {
|
||||||
|
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||||
|
}
|
||||||
|
if (is_array($file_list)) {
|
||||||
|
// Defined relative dir to DOL_DATA_ROOT
|
||||||
|
$relativedir = '';
|
||||||
|
if ($filedir) {
|
||||||
|
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
|
||||||
|
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
|
||||||
|
}
|
||||||
|
// Get list of files stored into database for same relative directory
|
||||||
|
if ($relativedir) {
|
||||||
|
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
|
||||||
|
|
||||||
|
//var_dump($sortfield.' - '.$sortorder);
|
||||||
|
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
|
||||||
|
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
|
||||||
|
print $formfile->showPreview($file_list, $sendingstatic->element, $relativepath, 0, $param);
|
||||||
|
}
|
||||||
|
// $filename = dol_sanitizeFileName($objp->ref);
|
||||||
|
// $filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
// $urlsource = '/expedition/card.php?id='.$objp->cid;
|
||||||
|
// print $formfile->getDocumentsLink($sendingstatic->element, $filename, $filedir);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($objp->date_creation > 0) {
|
if ($objp->date_creation > 0) {
|
||||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation), 'day').'</td>';
|
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation), 'day').'</td>';
|
||||||
@ -1076,6 +1170,35 @@ if ($object->id > 0) {
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
print $contrat->getNomUrl(1, 12);
|
print $contrat->getNomUrl(1, 12);
|
||||||
|
// Preview
|
||||||
|
$filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
$file_list = null;
|
||||||
|
if (!empty($filedir)) {
|
||||||
|
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||||
|
}
|
||||||
|
if (is_array($file_list)) {
|
||||||
|
// Defined relative dir to DOL_DATA_ROOT
|
||||||
|
$relativedir = '';
|
||||||
|
if ($filedir) {
|
||||||
|
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
|
||||||
|
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
|
||||||
|
}
|
||||||
|
// Get list of files stored into database for same relative directory
|
||||||
|
if ($relativedir) {
|
||||||
|
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
|
||||||
|
|
||||||
|
//var_dump($sortfield.' - '.$sortorder);
|
||||||
|
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
|
||||||
|
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
|
||||||
|
print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0, $param);
|
||||||
|
}
|
||||||
|
// $filename = dol_sanitizeFileName($objp->ref);
|
||||||
|
// $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
// $urlsource = '/contrat/card.php?id='.$objp->cid;
|
||||||
|
// print $formfile->getDocumentsLink($contrat->element, $filename, $filedir);
|
||||||
print $late;
|
print $late;
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print '<td class="nowrap">'.dol_trunc($objp->refsup, 12)."</td>\n";
|
print '<td class="nowrap">'.dol_trunc($objp->refsup, 12)."</td>\n";
|
||||||
@ -1137,6 +1260,35 @@ if ($object->id > 0) {
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
print $fichinter_static->getNomUrl(1);
|
print $fichinter_static->getNomUrl(1);
|
||||||
|
// Preview
|
||||||
|
$filedir = $conf->fichinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
$file_list = null;
|
||||||
|
if (!empty($filedir)) {
|
||||||
|
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||||
|
}
|
||||||
|
if (is_array($file_list)) {
|
||||||
|
// Defined relative dir to DOL_DATA_ROOT
|
||||||
|
$relativedir = '';
|
||||||
|
if ($filedir) {
|
||||||
|
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
|
||||||
|
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
|
||||||
|
}
|
||||||
|
// Get list of files stored into database for same relative directory
|
||||||
|
if ($relativedir) {
|
||||||
|
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
|
||||||
|
|
||||||
|
//var_dump($sortfield.' - '.$sortorder);
|
||||||
|
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
|
||||||
|
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
|
||||||
|
print $formfile->showPreview($file_list, $fichinter_static->element, $relativepath, 0, $param);
|
||||||
|
}
|
||||||
|
// $filename = dol_sanitizeFileName($objp->ref);
|
||||||
|
// $filedir = $conf->fichinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
// $urlsource = '/fichinter/card.php?id='.$objp->cid;
|
||||||
|
// print $formfile->getDocumentsLink($fichinter_static->element, $filename, $filedir);
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
//print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
|
//print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
|
||||||
print '<td class="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).'</td>'."\n";
|
print '<td class="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).'</td>'."\n";
|
||||||
@ -1213,6 +1365,7 @@ if ($object->id > 0) {
|
|||||||
print '<td class="nowrap">';
|
print '<td class="nowrap">';
|
||||||
print $invoicetemplate->getNomUrl(1);
|
print $invoicetemplate->getNomUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($objp->frequency && $objp->date_last_gen > 0) {
|
if ($objp->frequency && $objp->date_last_gen > 0) {
|
||||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_last_gen), 'day').'</td>';
|
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_last_gen), 'day').'</td>';
|
||||||
} else {
|
} else {
|
||||||
@ -1301,6 +1454,35 @@ if ($object->id > 0) {
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
print $facturestatic->getNomUrl(1);
|
print $facturestatic->getNomUrl(1);
|
||||||
|
// Preview
|
||||||
|
$filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
$file_list = null;
|
||||||
|
if (!empty($filedir)) {
|
||||||
|
$file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
|
||||||
|
}
|
||||||
|
if (is_array($file_list)) {
|
||||||
|
// Defined relative dir to DOL_DATA_ROOT
|
||||||
|
$relativedir = '';
|
||||||
|
if ($filedir) {
|
||||||
|
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
|
||||||
|
$relativedir = preg_replace('/^[\\/]/', '', $relativedir);
|
||||||
|
}
|
||||||
|
// Get list of files stored into database for same relative directory
|
||||||
|
if ($relativedir) {
|
||||||
|
completeFileArrayWithDatabaseInfo($file_list, $relativedir);
|
||||||
|
|
||||||
|
//var_dump($sortfield.' - '.$sortorder);
|
||||||
|
if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
|
||||||
|
$file_list = dol_sort_array($file_list, $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
|
||||||
|
print $formfile->showPreview($file_list, $facturestatic->element, $relativepath, 0, $param);
|
||||||
|
}
|
||||||
|
// $filename = dol_sanitizeFileName($objp->ref);
|
||||||
|
// $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||||
|
// $urlsource = '/compta/facture/card.php?id='.$objp->cid;
|
||||||
|
//print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if ($objp->df > 0) {
|
if ($objp->df > 0) {
|
||||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->df), 'day').'</td>';
|
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->df), 'day').'</td>';
|
||||||
|
|||||||
@ -88,7 +88,7 @@ if (empty($user->rights->societe->client->voir) && !$socid) {
|
|||||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as p";
|
$sql .= " ".MAIN_DB_PREFIX."socpeople as p";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||||
$sql .= " WHERE s.fk_stcomm = st.id";
|
$sql .= " WHERE s.fk_stcomm = st.id";
|
||||||
$sql .= " AND p.entity IN (".getEntity('socpeople').")";
|
$sql .= " AND p.entity IN (".getEntity('contact').")";
|
||||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -568,9 +568,15 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
|
|||||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||||
}
|
}
|
||||||
if ($socid) {
|
// Add where from hooks
|
||||||
$sql .= " AND s.rowid = $socid";
|
$parameters = array('socid' => $socid);
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $companystatic); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook)) {
|
||||||
|
if ($socid > 0) {
|
||||||
|
$sql .= " AND s.rowid = ".((int) $socid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
$sql .= " ORDER BY s.tms DESC";
|
$sql .= " ORDER BY s.tms DESC";
|
||||||
$sql .= $db->plimit($max, 0);
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|
||||||
@ -664,9 +670,15 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S
|
|||||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||||
}
|
}
|
||||||
if ($socid) {
|
// Add where from hooks
|
||||||
$sql .= " AND s.rowid = ".((int) $socid);
|
$parameters = array('socid' => $socid);
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $companystatic); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook)) {
|
||||||
|
if ($socid > 0) {
|
||||||
|
$sql .= " AND s.rowid = ".((int) $socid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
$sql .= " ORDER BY s.datec DESC";
|
$sql .= " ORDER BY s.datec DESC";
|
||||||
$sql .= $db->plimit($max, 0);
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|
||||||
|
|||||||
@ -686,7 +686,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
|
|
||||||
$sqlwhere = array();
|
$sqlwhere = array();
|
||||||
|
|
||||||
$sqlwhere[] = 't.entity IN ('.getEntity('socpeople').')';
|
$sqlwhere[] = 't.entity IN ('.getEntity('contact').')';
|
||||||
|
|
||||||
if (count($arrayquery) > 0) {
|
if (count($arrayquery) > 0) {
|
||||||
if (array_key_exists('contact_categ', $arrayquery)) {
|
if (array_key_exists('contact_categ', $arrayquery)) {
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -80,6 +81,7 @@ $confirm = GETPOST('confirm', 'alpha');
|
|||||||
$lineid = GETPOST('lineid', 'int');
|
$lineid = GETPOST('lineid', 'int');
|
||||||
$contactid = GETPOST('contactid', 'int');
|
$contactid = GETPOST('contactid', 'int');
|
||||||
$projectid = GETPOST('projectid', 'int');
|
$projectid = GETPOST('projectid', 'int');
|
||||||
|
$rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1;
|
||||||
|
|
||||||
// PDF
|
// PDF
|
||||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||||
@ -116,7 +118,7 @@ $usercandelete = $user->rights->propal->supprimer;
|
|||||||
|
|
||||||
$usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close)));
|
$usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close)));
|
||||||
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate)));
|
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate)));
|
||||||
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send);
|
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send)));
|
||||||
|
|
||||||
$usercancreateorder = $user->rights->commande->creer;
|
$usercancreateorder = $user->rights->commande->creer;
|
||||||
$usercancreateinvoice = $user->rights->facture->creer;
|
$usercancreateinvoice = $user->rights->facture->creer;
|
||||||
@ -220,7 +222,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null));
|
$result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), (GETPOST('update_prices', 'aZ') ? true : false));
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||||
exit();
|
exit();
|
||||||
@ -246,8 +248,11 @@ if (empty($reshook)) {
|
|||||||
// Remove line
|
// Remove line
|
||||||
$result = $object->deleteline($lineid);
|
$result = $object->deleteline($lineid);
|
||||||
// reorder lines
|
// reorder lines
|
||||||
if ($result) {
|
if ($result > 0) {
|
||||||
$object->line_order(true);
|
$object->line_order(true);
|
||||||
|
} else {
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
@ -1143,7 +1148,7 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise);
|
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, min($rank, count($object->lines) + 1), 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -1889,11 +1894,13 @@ if ($action == 'create') {
|
|||||||
$title = $langs->trans('ProductsAndServices');
|
$title = $langs->trans('ProductsAndServices');
|
||||||
print load_fiche_titre($title);
|
print load_fiche_titre($title);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
$objectsrc->printOriginLinesList();
|
$objectsrc->printOriginLinesList();
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
} elseif ($object->id > 0) {
|
} elseif ($object->id > 0) {
|
||||||
/*
|
/*
|
||||||
@ -1914,8 +1921,8 @@ if ($action == 'create') {
|
|||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
// 'text' => $langs->trans("ConfirmClone"),
|
// 'text' => $langs->trans("ConfirmClone"),
|
||||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300')),
|
||||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))
|
array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => (!empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES) ? 1 : 0)),
|
||||||
);
|
);
|
||||||
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) {
|
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) {
|
||||||
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date);
|
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date);
|
||||||
|
|||||||
@ -625,7 +625,7 @@ class Proposals extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function deleteContact($id, $contactid, $type)
|
public function deleteContact($id, $contactid, $type)
|
||||||
{
|
{
|
||||||
@ -799,7 +799,7 @@ class Proposals extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2022 ATM Consulting <contact@atm-consulting.fr>
|
* Copyright (C) 2022 ATM Consulting <contact@atm-consulting.fr>
|
||||||
* Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
|
* Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
|
||||||
|
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -744,6 +745,11 @@ class Propal extends CommonObject
|
|||||||
// Reorder if child line
|
// Reorder if child line
|
||||||
if (!empty($fk_parent_line)) {
|
if (!empty($fk_parent_line)) {
|
||||||
$this->line_order(true, 'DESC');
|
$this->line_order(true, 'DESC');
|
||||||
|
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines
|
||||||
|
$linecount = count($this->lines);
|
||||||
|
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||||
|
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la propale meme
|
// Mise a jour informations denormalisees au niveau de la propale meme
|
||||||
@ -992,6 +998,8 @@ class Propal extends CommonObject
|
|||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
$this->error = $line->error;
|
||||||
|
$this->errors = $line->errors;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1324,11 +1332,12 @@ class Propal extends CommonObject
|
|||||||
* @param User $user User making the clone
|
* @param User $user User making the clone
|
||||||
* @param int $socid Id of thirdparty
|
* @param int $socid Id of thirdparty
|
||||||
* @param int $forceentity Entity id to force
|
* @param int $forceentity Entity id to force
|
||||||
|
* @param bool $update_prices [=false] Update prices if true
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone(User $user, $socid = 0, $forceentity = null)
|
public function createFromClone(User $user, $socid = 0, $forceentity = null, $update_prices = false)
|
||||||
{
|
{
|
||||||
global $conf, $hookmanager;
|
global $conf, $hookmanager, $mysoc;
|
||||||
|
|
||||||
dol_include_once('/projet/class/project.class.php');
|
dol_include_once('/projet/class/project.class.php');
|
||||||
|
|
||||||
@ -1375,6 +1384,55 @@ class Propal extends CommonObject
|
|||||||
$objsoc->fetch($object->socid);
|
$objsoc->fetch($object->socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update prices
|
||||||
|
if ($update_prices === true) {
|
||||||
|
if ($objsoc->id > 0 && !empty($object->lines)) {
|
||||||
|
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||||
|
// If price per customer
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($object->lines as $line) {
|
||||||
|
if ($line->fk_product > 0) {
|
||||||
|
$prod = new Product($this->db);
|
||||||
|
$res = $prod->fetch($line->fk_product);
|
||||||
|
if ($res > 0) {
|
||||||
|
$pu_ht = $prod->price;
|
||||||
|
$tva_tx = get_default_tva($mysoc, $objsoc, $prod->id);
|
||||||
|
$remise_percent = $objsoc->remise_percent;
|
||||||
|
|
||||||
|
if (!empty($conf->global->PRODUIT_MULTIPRICES) && $objsoc->price_level > 0) {
|
||||||
|
$pu_ht = $prod->multiprices[$objsoc->price_level];
|
||||||
|
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility
|
||||||
|
if (isset($prod->multiprices_tva_tx[$objsoc->price_level])) {
|
||||||
|
$tva_tx = $prod->multiprices_tva_tx[$objsoc->price_level];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||||
|
$prodcustprice = new Productcustomerprice($this->db);
|
||||||
|
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $objsoc->id);
|
||||||
|
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||||
|
if ($result) {
|
||||||
|
// If there is some prices specific to the customer
|
||||||
|
if (count($prodcustprice->lines) > 0) {
|
||||||
|
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||||
|
$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx);
|
||||||
|
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
|
||||||
|
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$line->subprice = $pu_ht;
|
||||||
|
$line->tva_tx = $tva_tx;
|
||||||
|
$line->remise_percent = $remise_percent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$object->id = 0;
|
$object->id = 0;
|
||||||
$object->ref = '';
|
$object->ref = '';
|
||||||
$object->entity = (!empty($forceentity) ? $forceentity : $object->entity);
|
$object->entity = (!empty($forceentity) ? $forceentity : $object->entity);
|
||||||
@ -1730,8 +1788,9 @@ class Propal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0, $filters = '')
|
public function fetch_lines($only_product = 0, $loadalsotranslation = 0, $filters = '')
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
|
|
||||||
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
|
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
|
||||||
@ -3768,8 +3827,24 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to replace a product id with another one.
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param int $origin_id Old product id
|
||||||
|
* @param int $dest_id New product id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id)
|
||||||
|
{
|
||||||
|
$tables = array(
|
||||||
|
'propaldet'
|
||||||
|
);
|
||||||
|
|
||||||
|
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage commercial proposal lines
|
* Class to manage commercial proposal lines
|
||||||
@ -4194,36 +4269,40 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".((int) $this->rowid);
|
if (!$notrigger) {
|
||||||
dol_syslog("PropaleLigne::delete", LOG_DEBUG);
|
// Call trigger
|
||||||
if ($this->db->query($sql)) {
|
$result = $this->call_trigger('LINEPROPAL_DELETE', $user);
|
||||||
// Remove extrafields
|
if ($result < 0) {
|
||||||
if (!$error) {
|
$error++;
|
||||||
$this->id = $this->rowid;
|
|
||||||
$result = $this->deleteExtraFields();
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error) {
|
||||||
// Call trigger
|
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int) $this->rowid);
|
||||||
$result = $this->call_trigger('LINEPROPAL_DELETE', $user);
|
dol_syslog("PropaleLigne::delete", LOG_DEBUG);
|
||||||
if ($result < 0) {
|
if ($this->db->query($sql)) {
|
||||||
$this->db->rollback();
|
// Remove extrafields
|
||||||
return -1;
|
if (!$error) {
|
||||||
|
$this->id = $this->rowid;
|
||||||
|
$result = $this->deleteExtraFields();
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$this->error = $this->db->error() . " sql=" . $sql;
|
||||||
|
$error++;
|
||||||
}
|
}
|
||||||
// End call triggers
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
if ($error) {
|
||||||
|
|
||||||
return 1;
|
|
||||||
} else {
|
|
||||||
$this->error = $this->db->error()." sql=".$sql;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4369,7 +4448,7 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('LINEPROPAL_UPDATE', $user);
|
$result = $this->call_trigger('LINEPROPAL_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -123,6 +123,15 @@ $search_fk_input_reason = GETPOST("search_fk_input_reason", 'int');
|
|||||||
$search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int');
|
$search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int');
|
||||||
$search_btn = GETPOST('button_search', 'alpha');
|
$search_btn = GETPOST('button_search', 'alpha');
|
||||||
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
|
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
|
||||||
|
$search_date_signature_startday = GETPOST('search_date_signature_startday', 'int');
|
||||||
|
$search_date_signature_startmonth = GETPOST('search_date_signature_startmonth', 'int');
|
||||||
|
$search_date_signature_startyear = GETPOST('search_date_signature_startyear', 'int');
|
||||||
|
$search_date_signature_endday = GETPOST('search_date_signature_endday', 'int');
|
||||||
|
$search_date_signature_endmonth = GETPOST('search_date_signature_endmonth', 'int');
|
||||||
|
$search_date_signature_endyear = GETPOST('search_date_signature_endyear', 'int');
|
||||||
|
$search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
|
||||||
|
$search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
|
||||||
|
|
||||||
|
|
||||||
$search_status = GETPOST('search_status', 'alpha');
|
$search_status = GETPOST('search_status', 'alpha');
|
||||||
$optioncss = GETPOST('optioncss', 'alpha');
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
@ -207,6 +216,7 @@ $arrayfields = array(
|
|||||||
'p.date'=>array('label'=>"DatePropal", 'checked'=>1),
|
'p.date'=>array('label'=>"DatePropal", 'checked'=>1),
|
||||||
'p.fin_validite'=>array('label'=>"DateEnd", 'checked'=>1),
|
'p.fin_validite'=>array('label'=>"DateEnd", 'checked'=>1),
|
||||||
'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0),
|
'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0),
|
||||||
|
'p.date_signature'=>array('label'=>"DateSigning", 'checked'=>0),
|
||||||
'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0),
|
'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0),
|
||||||
'p.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'enabled'=>!empty($conf->expedition->enabled)),
|
'p.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'enabled'=>!empty($conf->expedition->enabled)),
|
||||||
'p.fk_input_reason'=>array('label'=>"Origin", 'checked'=>0, 'enabled'=>1),
|
'p.fk_input_reason'=>array('label'=>"Origin", 'checked'=>0, 'enabled'=>1),
|
||||||
@ -337,6 +347,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
$search_fk_shipping_method = '';
|
$search_fk_shipping_method = '';
|
||||||
$search_fk_input_reason = '';
|
$search_fk_input_reason = '';
|
||||||
$search_fk_mode_reglement = '';
|
$search_fk_mode_reglement = '';
|
||||||
|
$search_date_signature_startday = '';
|
||||||
|
$search_date_signature_startmonth = '';
|
||||||
|
$search_date_signature_startyear = '';
|
||||||
|
$search_date_signature_endday = '';
|
||||||
|
$search_date_signature_endmonth = '';
|
||||||
|
$search_date_signature_endyear = '';
|
||||||
|
$search_date_signature_start = '';
|
||||||
|
$search_date_signature_end = '';
|
||||||
}
|
}
|
||||||
if ($object_statut != '') {
|
if ($object_statut != '') {
|
||||||
$search_status = $object_statut;
|
$search_status = $object_statut;
|
||||||
@ -356,12 +374,12 @@ if ($action == 'validate' && $permissiontovalidate) {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
if ($tmpproposal->fetch($checked)) {
|
if ($tmpproposal->fetch($checked) > 0) {
|
||||||
if ($tmpproposal->statut == 0) {
|
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
|
||||||
if ($tmpproposal->valid($user)) {
|
if ($tmpproposal->valid($user) > 0) {
|
||||||
setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
|
setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
setEventMessage($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -370,7 +388,7 @@ if ($action == 'validate' && $permissiontovalidate) {
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -388,21 +406,21 @@ if ($action == "sign" && $permissiontoclose) {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
if ($tmpproposal->fetch($checked)) {
|
if ($tmpproposal->fetch($checked) > 0) {
|
||||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||||
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
|
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
|
||||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED)) {
|
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
|
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
|
setEventMessage($langs->trans('MustBeValidatedToBeSigned', $tmpproposal->ref), 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -413,27 +431,28 @@ if ($action == "sign" && $permissiontoclose) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == "nosign" && $permissiontoclose) {
|
if ($action == "nosign" && $permissiontoclose) {
|
||||||
if (GETPOST('confirm') == 'yes') {
|
if (GETPOST('confirm') == 'yes') {
|
||||||
$tmpproposal = new Propal($db);
|
$tmpproposal = new Propal($db);
|
||||||
$db->begin();
|
$db->begin();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
if ($tmpproposal->fetch($checked)) {
|
if ($tmpproposal->fetch($checked) > 0) {
|
||||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||||
$tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
|
$tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
|
||||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED)) {
|
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
|
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors');
|
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeNoSign'), 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -516,6 +535,7 @@ $sql .= " state.code_departement as state_code, state.nom as state_name,";
|
|||||||
$sql .= ' p.rowid, p.entity as propal_entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
|
$sql .= ' p.rowid, p.entity as propal_entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
|
||||||
$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
|
$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
|
||||||
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
|
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
|
||||||
|
$sql .= ' p.date_signature as dsignature,';
|
||||||
$sql .= ' p.note_public, p.note_private,';
|
$sql .= ' p.note_public, p.note_private,';
|
||||||
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
|
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
|
||||||
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
|
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
|
||||||
@ -700,6 +720,12 @@ if ($search_sale > 0) {
|
|||||||
if ($search_user > 0) {
|
if ($search_user > 0) {
|
||||||
$sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".((int) $search_user);
|
$sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".((int) $search_user);
|
||||||
}
|
}
|
||||||
|
if ($search_date_signature_start) {
|
||||||
|
$sql .= " AND p.date_signature >= '".$db->idate($search_date_signature_start)."'";
|
||||||
|
}
|
||||||
|
if ($search_date_signature_end) {
|
||||||
|
$sql .= " AND p.date_signature <= '".$db->idate($search_date_signature_end)."'";
|
||||||
|
}
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
|
|
||||||
@ -916,6 +942,24 @@ if ($resql) {
|
|||||||
if ($search_country) {
|
if ($search_country) {
|
||||||
$param .= '&search_country='.urlencode($search_country);
|
$param .= '&search_country='.urlencode($search_country);
|
||||||
}
|
}
|
||||||
|
if ($search_date_signature_startday) {
|
||||||
|
$param .= '&search_date_signature_startday='.urlencode($search_date_signature_startday);
|
||||||
|
}
|
||||||
|
if ($search_date_signature_startmonth) {
|
||||||
|
$param .= '&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth);
|
||||||
|
}
|
||||||
|
if ($search_date_signature_startyear) {
|
||||||
|
$param .= '&search_date_signature_startyear='.urlencode($search_date_signature_startyear);
|
||||||
|
}
|
||||||
|
if ($search_date_signature_endday) {
|
||||||
|
$param .= '&search_date_signature_endday='.urlencode($search_date_signature_endday);
|
||||||
|
}
|
||||||
|
if ($search_date_signature_endmonth) {
|
||||||
|
$param .= '&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth);
|
||||||
|
}
|
||||||
|
if ($search_date_signature_endyear) {
|
||||||
|
$param .= '&search_date_signature_endyear='.urlencode($search_date_signature_endyear);
|
||||||
|
}
|
||||||
|
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||||
@ -1147,6 +1191,17 @@ if ($resql) {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
// Date Signature
|
||||||
|
if (!empty($arrayfields['p.date_signature']['checked'])) {
|
||||||
|
print '<td class="liste_titre center">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $form->selectDate($search_date_signature_start ? $search_date_signature_start : -1, 'search_date_signature_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $form->selectDate($search_date_signature_end ? $search_date_signature_end : -1, 'search_date_signature_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Availability
|
// Availability
|
||||||
if (!empty($arrayfields['ava.rowid']['checked'])) {
|
if (!empty($arrayfields['ava.rowid']['checked'])) {
|
||||||
print '<td class="liste_titre maxwidth100onsmartphone center">';
|
print '<td class="liste_titre maxwidth100onsmartphone center">';
|
||||||
@ -1360,7 +1415,10 @@ if ($resql) {
|
|||||||
print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['p.date_livraison']['checked'])) {
|
if (!empty($arrayfields['p.date_livraison']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'p.date_livraison', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||||
|
}
|
||||||
|
if (!empty($arrayfields['p.date_signature']['checked'])) {
|
||||||
|
print_liste_field_titre($arrayfields['p.date_signature']['label'], $_SERVER["PHP_SELF"], 'p.date_signature', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['ava.rowid']['checked'])) {
|
if (!empty($arrayfields['ava.rowid']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder);
|
||||||
@ -1719,6 +1777,18 @@ if ($resql) {
|
|||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Date Signature
|
||||||
|
if (!empty($arrayfields['p.date_signature']['checked'])) {
|
||||||
|
if ($obj->dsignature) {
|
||||||
|
print '<td class="center">'.dol_print_date($db->jdate($obj->dsignature), 'day');
|
||||||
|
print '</td>';
|
||||||
|
} else {
|
||||||
|
print '<td> </td>';
|
||||||
|
}
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Availability
|
// Availability
|
||||||
if (!empty($arrayfields['ava.rowid']['checked'])) {
|
if (!empty($arrayfields['ava.rowid']['checked'])) {
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
|
|||||||
@ -30,7 +30,7 @@ if (empty($conf) || !is_object($conf)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print "<!-- BEGIN PHP TEMPLATE comm/propal/tpl/linkedopjectblock.tpl.php -->\n";
|
print "<!-- BEGIN PHP TEMPLATE comm/propal/tpl/linkedobjectblock.tpl.php -->\n";
|
||||||
|
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $user->rights->societe->creer) {
|
if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && ($user->rights->societe->creer || $user->rights->facture->creer)) {
|
||||||
//if ($user->rights->societe->creer)
|
//if ($user->rights->societe->creer)
|
||||||
//if ($user->rights->facture->creer)
|
//if ($user->rights->facture->creer)
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $user-
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setremise' && $user->rights->societe->creer) {
|
if ($action == 'setremise' && ($user->rights->societe->creer || $user->rights->facture->creer)) {
|
||||||
//if ($user->rights->societe->creer)
|
//if ($user->rights->societe->creer)
|
||||||
//if ($user->rights->facture->creer)
|
//if ($user->rights->facture->creer)
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && $user->rights->societe->creer) {
|
if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && ($user->rights->societe->creer || $user->rights->facture->creer)) {
|
||||||
//if ($user->rights->societe->creer)
|
//if ($user->rights->societe->creer)
|
||||||
//if ($user->rights->facture->creer)
|
//if ($user->rights->facture->creer)
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -81,6 +82,7 @@ $contactid = GETPOST('contactid', 'int');
|
|||||||
$projectid = GETPOST('projectid', 'int');
|
$projectid = GETPOST('projectid', 'int');
|
||||||
$origin = GETPOST('origin', 'alpha');
|
$origin = GETPOST('origin', 'alpha');
|
||||||
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
|
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
|
||||||
|
$rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1;
|
||||||
|
|
||||||
// PDF
|
// PDF
|
||||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||||
@ -939,7 +941,7 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $fk_unit, '', 0, $pu_ht_devise);
|
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, min($rank, count($object->lines) + 1), 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $fk_unit, '', 0, $pu_ht_devise);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$ret = $object->fetch($object->id); // Reload to get new records
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
@ -1369,7 +1371,7 @@ if (empty($reshook)) {
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||||
|
|
||||||
// Actions to build doc
|
// Actions to build doc
|
||||||
$upload_dir = !empty($conf->propal->multidir_output[$object->entity])?$conf->propal->multidir_output[$object->entity]:$conf->propal->dir_output;
|
$upload_dir = !empty($conf->commande->multidir_output[$object->entity])?$conf->commande->multidir_output[$object->entity]:$conf->commande->dir_output;
|
||||||
$permissiontoadd = $usercancreate;
|
$permissiontoadd = $usercancreate;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||||
|
|
||||||
@ -1862,11 +1864,13 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
$title = $langs->trans('ProductsAndServices');
|
$title = $langs->trans('ProductsAndServices');
|
||||||
print load_fiche_titre($title);
|
print load_fiche_titre($title);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
$objectsrc->printOriginLinesList('', $selectedLines);
|
$objectsrc->printOriginLinesList('', $selectedLines);
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -2039,7 +2043,7 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
if ($action == 'clone') {
|
if ($action == 'clone') {
|
||||||
// Create an array for form
|
// Create an array for form
|
||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client = 2 OR s.client=3)'))
|
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client = 2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300'))
|
||||||
);
|
);
|
||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
|
||||||
}
|
}
|
||||||
@ -2520,27 +2524,27 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
// Reopen a closed order
|
// Reopen a closed order
|
||||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans('ReOpen').'</a>';
|
print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send
|
// Send
|
||||||
if (empty($user->socid)) {
|
if (empty($user->socid)) {
|
||||||
if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
||||||
if ($usercansend) {
|
if ($usercansend) {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
|
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a>';
|
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valid
|
// Valid
|
||||||
if ($object->statut == Commande::STATUS_DRAFT && ($object->total_ttc >= 0 || !empty($conf->global->ORDER_ENABLE_NEGATIVE)) && $numlines > 0 && $usercanvalidate) {
|
if ($object->statut == Commande::STATUS_DRAFT && ($object->total_ttc >= 0 || !empty($conf->global->ORDER_ENABLE_NEGATIVE)) && $numlines > 0 && $usercanvalidate) {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate">'.$langs->trans('Validate').'</a>';
|
print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
// Edit
|
// Edit
|
||||||
if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) {
|
if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) {
|
||||||
print '<a class="butAction" href="card.php?id='.$object->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=modif&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
// Create event
|
// Create event
|
||||||
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD))
|
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD))
|
||||||
@ -2555,7 +2559,7 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER)) {
|
if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER)) {
|
||||||
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
||||||
if ($usercancreatepurchaseorder) {
|
if ($usercancreatepurchaseorder) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddPurchaseOrder").'</a>';
|
print dolGetButtonAction('', $langs->trans('AddPurchaseOrder'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2566,9 +2570,9 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
|
|
||||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
||||||
if ($user->rights->ficheinter->creer) {
|
if ($user->rights->ficheinter->creer) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans('AddIntervention').'</a>';
|
print dolGetButtonAction('', $langs->trans('AddInterventionGR'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('AddIntervention').'</a>';
|
print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2578,7 +2582,7 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
|
|
||||||
if ($user->rights->contrat->creer) {
|
if ($user->rights->contrat->creer) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans('AddContract').'</a>';
|
print dolGetButtonAction('', $langs->trans('AddContract'), 'default', DOL_URL_ROOT.'/contrat/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2590,52 +2594,52 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
||||||
if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) {
|
if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) {
|
||||||
if ($user->rights->expedition->creer) {
|
if ($user->rights->expedition->creer) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id.'">'.$langs->trans('CreateShipment').'</a>';
|
print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, '');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('CreateShipment').'</a>';
|
print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Shipment"))).'">'.$langs->trans('CreateShipment').'</a>';
|
print dolGetButtonAction($langs->trans('ErrorModuleSetupNotComplete'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set to shipped
|
// Set to shipped
|
||||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
|
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=shipped">'.$langs->trans('ClassifyShipped').'</a>';
|
print dolGetButtonAction('', $langs->trans('ClassifyShipped'), 'default', $_SERVER["PHP_SELF"].'?action=shipped&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
// Create bill and Classify billed
|
// Create bill and Classify billed
|
||||||
// Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
|
// Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
|
||||||
if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
|
if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
|
||||||
if (!empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
|
if (!empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
|
||||||
}
|
}
|
||||||
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("ClassifyBilled").'</a>';
|
print dolGetButtonAction('', $langs->trans('ClassifyBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifybilled&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
|
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
|
||||||
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifyunbilled&token='.newToken().'">'.$langs->trans("ClassifyUnBilled").'</a>';
|
print dolGetButtonAction('', $langs->trans('ClassifyUnBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifyunbilled&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Clone
|
// Clone
|
||||||
if ($usercancreate) {
|
if ($usercancreate) {
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=order">'.$langs->trans("ToClone").'</a>';
|
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id.'&socid='.$object->socid, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel order
|
// Cancel order
|
||||||
if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) {
|
if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) {
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'">'.$langs->trans("Cancel").'</a>';
|
print dolGetButtonAction('', $langs->trans('Cancel'), 'danger', $_SERVER["PHP_SELF"].'?action=cancel&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete order
|
// Delete order
|
||||||
if ($usercandelete) {
|
if ($usercandelete) {
|
||||||
if ($numshipping == 0) {
|
if ($numshipping == 0) {
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>';
|
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ShippingExist").'">'.$langs->trans("Delete").'</a>';
|
print dolGetButtonAction($langs->trans('ShippingExist'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -135,6 +135,11 @@ class Orders extends DolibarrApi
|
|||||||
// Add external contacts ids
|
// Add external contacts ids
|
||||||
$this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
|
$this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
|
||||||
$this->commande->fetchObjectLinked();
|
$this->commande->fetchObjectLinked();
|
||||||
|
|
||||||
|
// Add online_payment_url, cf #20477
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
$this->commande->online_payment_url = getOnlinePaymentUrl(0, 'order', $this->commande->ref);
|
||||||
|
|
||||||
return $this->_cleanObjectDatas($this->commande);
|
return $this->_cleanObjectDatas($this->commande);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,6 +235,10 @@ class Orders extends DolibarrApi
|
|||||||
if ($commande_static->fetch($obj->rowid)) {
|
if ($commande_static->fetch($obj->rowid)) {
|
||||||
// Add external contacts ids
|
// Add external contacts ids
|
||||||
$commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
|
$commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
|
||||||
|
// Add online_payment_url, cf #20477
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
$commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref);
|
||||||
|
|
||||||
$obj_ret[] = $this->_cleanObjectDatas($commande_static);
|
$obj_ret[] = $this->_cleanObjectDatas($commande_static);
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
@ -574,7 +583,7 @@ class Orders extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function deleteContact($id, $contactid, $type)
|
public function deleteContact($id, $contactid, $type)
|
||||||
{
|
{
|
||||||
@ -704,7 +713,7 @@ class Orders extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -735,6 +744,10 @@ class Orders extends DolibarrApi
|
|||||||
|
|
||||||
$this->commande->fetchObjectLinked();
|
$this->commande->fetchObjectLinked();
|
||||||
|
|
||||||
|
//fix #20477 : add online_payment_url
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
$this->commande->online_payment_url = getOnlinePaymentUrl(0, 'order', $this->commande->ref);
|
||||||
|
|
||||||
return $this->_cleanObjectDatas($this->commande);
|
return $this->_cleanObjectDatas($this->commande);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -974,7 +987,7 @@ class Orders extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function getOrderShipments($id)
|
public function getOrderShipments($id)
|
||||||
{
|
{
|
||||||
@ -1030,7 +1043,7 @@ class Orders extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function createOrderShipment($id, $warehouse_id)
|
public function createOrderShipment($id, $warehouse_id)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,9 +9,10 @@
|
|||||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2016-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2021-2022 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2021-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -266,6 +267,11 @@ class Commande extends CommonOrder
|
|||||||
*/
|
*/
|
||||||
public $expeditions;
|
public $expeditions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string payment url
|
||||||
|
*/
|
||||||
|
public $online_payment_url;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||||
@ -519,6 +525,7 @@ class Commande extends CommonOrder
|
|||||||
if ($this->lines[$i]->fk_product > 0) {
|
if ($this->lines[$i]->fk_product > 0) {
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
$mouvP->origin = &$this;
|
$mouvP->origin = &$this;
|
||||||
|
$mouvP->setOrigin($this->element, $this->id);
|
||||||
// We decrement stock of product (and sub-products)
|
// We decrement stock of product (and sub-products)
|
||||||
$result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr", $num));
|
$result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr", $num));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -647,6 +654,7 @@ class Commande extends CommonOrder
|
|||||||
if ($this->lines[$i]->fk_product > 0) {
|
if ($this->lines[$i]->fk_product > 0) {
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
$mouvP->origin = &$this;
|
$mouvP->origin = &$this;
|
||||||
|
$mouvP->setOrigin($this->element, $this->id);
|
||||||
// We increment stock of product (and sub-products)
|
// We increment stock of product (and sub-products)
|
||||||
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr", $this->ref));
|
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr", $this->ref));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -828,6 +836,7 @@ class Commande extends CommonOrder
|
|||||||
for ($i = 0; $i < $num; $i++) {
|
for ($i = 0; $i < $num; $i++) {
|
||||||
if ($this->lines[$i]->fk_product > 0) {
|
if ($this->lines[$i]->fk_product > 0) {
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
|
$mouvP->setOrigin($this->element, $this->id);
|
||||||
// We increment stock of product (and sub-products)
|
// We increment stock of product (and sub-products)
|
||||||
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr", $this->ref)); // price is 0, we don't want WAP to be changed
|
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr", $this->ref)); // price is 0, we don't want WAP to be changed
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -1659,6 +1668,11 @@ class Commande extends CommonOrder
|
|||||||
// Reorder if child line
|
// Reorder if child line
|
||||||
if (!empty($fk_parent_line)) {
|
if (!empty($fk_parent_line)) {
|
||||||
$this->line_order(true, 'DESC');
|
$this->line_order(true, 'DESC');
|
||||||
|
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines
|
||||||
|
$linecount = count($this->lines);
|
||||||
|
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||||
|
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la commande meme
|
// Mise a jour informations denormalisees au niveau de la commande meme
|
||||||
@ -2028,8 +2042,9 @@ class Commande extends CommonOrder
|
|||||||
*/
|
*/
|
||||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
$this->lines = array();
|
$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, l.ref_ext,';
|
$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,';
|
||||||
@ -3666,9 +3681,10 @@ class Commande extends CommonOrder
|
|||||||
* @param int $notooltip 1=Disable tooltip
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
* @param int $addlinktonotes Add link to notes
|
* @param int $addlinktonotes Add link to notes
|
||||||
|
* @param string $target attribute target for link
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
|
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0, $target = '')
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user, $hookmanager;
|
global $conf, $langs, $user, $hookmanager;
|
||||||
|
|
||||||
@ -3722,7 +3738,7 @@ class Commande extends CommonOrder
|
|||||||
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||||
}
|
}
|
||||||
if (!empty($this->date)) {
|
if (!empty($this->date)) {
|
||||||
$label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->date, 'dayhour');
|
$label .= '<br><b>'.$langs->trans('Date').':</b> '.dol_print_date($this->date, 'day');
|
||||||
}
|
}
|
||||||
if (!empty($this->delivery_date)) {
|
if (!empty($this->delivery_date)) {
|
||||||
$label .= '<br><b>'.$langs->trans('DeliveryDate').':</b> '.dol_print_date($this->delivery_date, 'dayhour');
|
$label .= '<br><b>'.$langs->trans('DeliveryDate').':</b> '.dol_print_date($this->delivery_date, 'dayhour');
|
||||||
@ -3737,6 +3753,11 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose .= ' class="classfortooltip"';
|
$linkclose .= ' class="classfortooltip"';
|
||||||
|
|
||||||
|
$target_value=array('_self', '_blank', '_parent', '_top');
|
||||||
|
if (in_array($target, $target_value)) {
|
||||||
|
$linkclose .= ' target="'.dol_escape_htmltag($target).'"';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'"';
|
$linkstart = '<a href="'.$url.'"';
|
||||||
@ -4024,6 +4045,23 @@ class Commande extends CommonOrder
|
|||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to replace a product id with another one.
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param int $origin_id Old product id
|
||||||
|
* @param int $dest_id New product id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id)
|
||||||
|
{
|
||||||
|
$tables = array(
|
||||||
|
'commandedet',
|
||||||
|
);
|
||||||
|
|
||||||
|
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the customer order delayed?
|
* Is the customer order delayed?
|
||||||
*
|
*
|
||||||
@ -4622,7 +4660,7 @@ class OrderLine extends CommonOrderLine
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('LINEORDER_UPDATE', $user);
|
$result = $this->call_trigger('LINEORDER_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -201,6 +201,7 @@ $arrayfields = array(
|
|||||||
'c.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>140),
|
'c.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>140),
|
||||||
'shippable'=>array('label'=>"Shippable", 'checked'=>1,'enabled'=>(!empty($conf->expedition->enabled)), 'position'=>990),
|
'shippable'=>array('label'=>"Shippable", 'checked'=>1,'enabled'=>(!empty($conf->expedition->enabled)), 'position'=>990),
|
||||||
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)), 'position'=>995),
|
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)), 'position'=>995),
|
||||||
|
'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999),
|
||||||
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
|
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
@ -318,7 +319,7 @@ if ($action == 'validate' && $permissiontoadd) {
|
|||||||
if ($objecttmp->valid($user, $idwarehouse)) {
|
if ($objecttmp->valid($user, $idwarehouse)) {
|
||||||
setEventMessage($langs->trans('hasBeenValidated', $objecttmp->ref), 'mesgs');
|
setEventMessage($langs->trans('hasBeenValidated', $objecttmp->ref), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
setEventMessage($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -345,7 +346,7 @@ if ($action == 'shipped' && $permissiontoadd) {
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
if ($objecttmp->fetch($checked)) {
|
if ($objecttmp->fetch($checked)) {
|
||||||
if ($objecttmp->statut == 1) {
|
if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
|
||||||
if ($objecttmp->cloture($user)) {
|
if ($objecttmp->cloture($user)) {
|
||||||
setEventMessage($langs->trans('PassedInClosedStatus', $objecttmp->ref), 'mesgs');
|
setEventMessage($langs->trans('PassedInClosedStatus', $objecttmp->ref), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
@ -441,7 +442,7 @@ $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture
|
|||||||
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
||||||
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
|
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
|
||||||
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
|
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
|
||||||
$sql .= ' c.fk_input_reason';
|
$sql .= ' c.fk_input_reason, c.import_key';
|
||||||
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
|
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
|
||||||
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||||
}
|
}
|
||||||
@ -1275,6 +1276,11 @@ if ($resql) {
|
|||||||
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1);
|
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
// Import key
|
||||||
|
if (!empty($arrayfields['c.import_key']['checked'])) {
|
||||||
|
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Status
|
// Status
|
||||||
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
||||||
print '<td class="liste_titre maxwidthonsmartphone center">';
|
print '<td class="liste_titre maxwidthonsmartphone center">';
|
||||||
@ -1436,6 +1442,9 @@ if ($resql) {
|
|||||||
if (!empty($arrayfields['c.facture']['checked'])) {
|
if (!empty($arrayfields['c.facture']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||||
}
|
}
|
||||||
|
if (!empty($arrayfields['c.import_key']['checked'])) {
|
||||||
|
print_liste_field_titre($arrayfields['c.import_key']['label'], $_SERVER["PHP_SELF"], "c.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
|
}
|
||||||
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
}
|
}
|
||||||
@ -2063,6 +2072,13 @@ if ($resql) {
|
|||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Import key
|
||||||
|
if (!empty($arrayfields['c.import_key']['checked'])) {
|
||||||
|
print '<td class="nowrap center">'.$obj->import_key.'</td>';
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Status
|
// Status
|
||||||
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
||||||
print '<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).'</td>';
|
print '<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).'</td>';
|
||||||
|
|||||||
@ -45,8 +45,14 @@ if ($mode == 'customer' && !$user->rights->commande->lire) {
|
|||||||
if ($mode == 'supplier' && empty($user->rights->fournisseur->commande->lire)) {
|
if ($mode == 'supplier' && empty($user->rights->fournisseur->commande->lire)) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
if ($mode == 'supplier') {
|
||||||
|
$object_status = GETPOST('object_status', 'array:int');
|
||||||
|
$object_status = implode(',', $object_status);
|
||||||
|
} else {
|
||||||
|
$object_status = GETPOST('object_status', 'intcomma');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$object_status = GETPOST('object_status', 'intcomma');
|
|
||||||
$typent_id = GETPOST('typent_id', 'int');
|
$typent_id = GETPOST('typent_id', 'int');
|
||||||
$categ_id = GETPOST('categ_id', 'categ_id');
|
$categ_id = GETPOST('categ_id', 'categ_id');
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedopjectblock.tpl.php -->\n";
|
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedobjectblock.tpl.php -->\n";
|
||||||
|
|
||||||
global $user;
|
global $user;
|
||||||
global $noMoreLinkedObjectBlockAfter;
|
global $noMoreLinkedObjectBlockAfter;
|
||||||
|
|||||||
@ -19,11 +19,11 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/accounting-files.php
|
* \file htdocs/compta/accounting-files.php
|
||||||
* \ingroup compta
|
* \ingroup compta
|
||||||
* \brief Page to show portoflio and files of a thirdparty and download it
|
* \brief Page to show portoflio and files of a thirdparty and download it
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((array_key_exists('action', $_GET) && $_GET['action'] == 'dl') || (array_key_exists('action', $_POST) && $_POST['action'] == 'dl')) { // To not replace token when downloading file
|
if ((array_key_exists('action', $_GET) && $_GET['action'] == 'dl') || (array_key_exists('action', $_POST) && $_POST['action'] == 'dl')) { // To not replace token when downloading file
|
||||||
if (!defined('NOTOKENRENEWAL')) {
|
if (!defined('NOTOKENRENEWAL')) {
|
||||||
@ -588,14 +588,13 @@ foreach ($listofchoices as $choice => $val) {
|
|||||||
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.$disabled.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>';
|
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.$disabled.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<input type="submit" class="button" name="search" value="'.$langs->trans("Search").'">';
|
print '<input type="submit" class="button small" name="search" value="'.$langs->trans("Search").'">';
|
||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
if (!empty($date_start) && !empty($date_stop)) {
|
if (!empty($date_start) && !empty($date_stop)) {
|
||||||
$param = 'action=searchfiles';
|
|
||||||
$param .= '&date_startday='.GETPOST('date_startday', 'int');
|
$param .= '&date_startday='.GETPOST('date_startday', 'int');
|
||||||
$param .= '&date_startmonth='.GETPOST('date_startmonth', 'int');
|
$param .= '&date_startmonth='.GETPOST('date_startmonth', 'int');
|
||||||
$param .= '&date_startyear='.GETPOST('date_startyear', 'int');
|
$param .= '&date_startyear='.GETPOST('date_startyear', 'int');
|
||||||
@ -603,13 +602,30 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
$param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int');
|
$param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int');
|
||||||
$param .= '&date_stopyear='.GETPOST('date_stopyear', 'int');
|
$param .= '&date_stopyear='.GETPOST('date_stopyear', 'int');
|
||||||
foreach ($listofchoices as $choice => $val) {
|
foreach ($listofchoices as $choice => $val) {
|
||||||
$param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0);
|
if (GETPOST($choice, 'int')) {
|
||||||
|
$param .= '&'.$choice.'=1';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print '<form name="dl" action="'.$_SERVER["PHP_SELF"].'?action=dl" method="POST">'."\n";
|
|
||||||
print '<input type="hidden" name="token" value="'.currentToken().'">';
|
$TData = dol_sort_array($filesarray, $sortfield, $sortorder);
|
||||||
|
|
||||||
|
|
||||||
|
$filename = dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip';
|
||||||
|
|
||||||
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
|
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
|
||||||
|
|
||||||
|
print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.newToken().'&output=file&file='.urlencode($filename).$param.'"';
|
||||||
|
if (empty($TData)) {
|
||||||
|
print " disabled";
|
||||||
|
}
|
||||||
|
print '>'."\n";
|
||||||
|
print $langs->trans("Download");
|
||||||
|
print '</a><br>';
|
||||||
|
|
||||||
|
$param .= '&action=searchfiles';
|
||||||
|
|
||||||
|
/*
|
||||||
|
print '<input type="hidden" name="token" value="'.currentToken().'">';
|
||||||
print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />';
|
print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />';
|
||||||
print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />';
|
print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />';
|
||||||
print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />';
|
print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />';
|
||||||
@ -620,8 +636,13 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<input class="butAction butDownload" type="submit" value="'.$langs->trans("Download").'" />';
|
print '<input class="butAction butDownload small marginleftonly" type="submit" value="'.$langs->trans("Download").'"';
|
||||||
|
if (empty($TData)) {
|
||||||
|
print " disabled";
|
||||||
|
}
|
||||||
|
print '/>';
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
|
*/
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
@ -645,172 +666,181 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
print '<td class="center">'.$langs->trans("Currency").'</td>';
|
print '<td class="center">'.$langs->trans("Currency").'</td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
if ($result) {
|
|
||||||
$TData = dol_sort_array($filesarray, $sortfield, $sortorder);
|
|
||||||
|
|
||||||
if (empty($TData)) {
|
if (empty($TData)) {
|
||||||
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td>';
|
print '<tr class="oddeven"><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td>';
|
||||||
if (!empty($conf->multicurrency->enabled)) {
|
if (!empty($conf->multicurrency->enabled)) {
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
}
|
||||||
|
print '</tr>';
|
||||||
|
} else {
|
||||||
|
// Sort array by date ASC to calculate balance
|
||||||
|
|
||||||
|
$totalET_debit = 0;
|
||||||
|
$totalIT_debit = 0;
|
||||||
|
$totalVAT_debit = 0;
|
||||||
|
$totalET_credit = 0;
|
||||||
|
$totalIT_credit = 0;
|
||||||
|
$totalVAT_credit = 0;
|
||||||
|
|
||||||
|
// Display array
|
||||||
|
foreach ($TData as $data) {
|
||||||
|
$html_class = '';
|
||||||
|
//if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
|
||||||
|
//elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
|
||||||
|
print '<tr class="oddeven '.$html_class.'">';
|
||||||
|
|
||||||
|
// Type
|
||||||
|
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans($data['item'])).'">'.$langs->trans($data['item']).'</td>';
|
||||||
|
|
||||||
|
// Date
|
||||||
|
print '<td class="center">';
|
||||||
|
print dol_print_date($data['date'], 'day');
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
|
// Date due
|
||||||
|
print '<td class="center">';
|
||||||
|
print dol_print_date($data['date_due'], 'day');
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<td class="nowraponall tdoverflowmax150">';
|
||||||
|
|
||||||
|
if ($data['item'] == 'Invoice') {
|
||||||
|
$invoice->id = $data['id'];
|
||||||
|
$invoice->ref = $data['ref'];
|
||||||
|
$invoice->total_ht = $data['amount_ht'];
|
||||||
|
$invoice->total_ttc = $data['amount_ttc'];
|
||||||
|
$invoice->total_tva = $data['amount_vat'];
|
||||||
|
$invoice->multicurrency_code = $data['currency'];
|
||||||
|
print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||||
|
} elseif ($data['item'] == 'SupplierInvoice') {
|
||||||
|
$supplier_invoice->id = $data['id'];
|
||||||
|
$supplier_invoice->ref = $data['ref'];
|
||||||
|
$supplier_invoice->total_ht = $data['amount_ht'];
|
||||||
|
$supplier_invoice->total_ttc = $data['amount_ttc'];
|
||||||
|
$supplier_invoice->total_tva = $data['amount_vat'];
|
||||||
|
$supplier_invoice->multicurrency_code = $data['currency'];
|
||||||
|
print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||||
|
} elseif ($data['item'] == 'ExpenseReport') {
|
||||||
|
$expensereport->id = $data['id'];
|
||||||
|
$expensereport->ref = $data['ref'];
|
||||||
|
print $expensereport->getNomUrl(1, 0, 0, '', 0, 0);
|
||||||
|
} elseif ($data['item'] == 'SalaryPayment') {
|
||||||
|
$salary_payment->id = $data['id'];
|
||||||
|
$salary_payment->ref = $data['ref'];
|
||||||
|
print $salary_payment->getNomUrl(1);
|
||||||
|
} elseif ($data['item'] == 'Donation') {
|
||||||
|
$don->id = $data['id'];
|
||||||
|
$don->ref = $data['ref'];
|
||||||
|
print $don->getNomUrl(1, 0, '', 0);
|
||||||
|
} elseif ($data['item'] == 'SocialContributions') {
|
||||||
|
$charge_sociales->id = $data['id'];
|
||||||
|
$charge_sociales->ref = $data['ref'];
|
||||||
|
print $charge_sociales->getNomUrl(1, 0, 0, 0, 0);
|
||||||
|
} elseif ($data['item'] == 'VariousPayment') {
|
||||||
|
$various_payment->id = $data['id'];
|
||||||
|
$various_payment->ref = $data['ref'];
|
||||||
|
print $various_payment->getNomUrl(1, '', 0, 0);
|
||||||
|
} elseif ($data['item'] == 'LoanPayment') {
|
||||||
|
$payment_loan->id = $data['id'];
|
||||||
|
$payment_loan->ref = $data['ref'];
|
||||||
|
print $payment_loan->getNomUrl(1, 0, 0, '', 0);
|
||||||
|
} else {
|
||||||
|
print $data['ref'];
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</td>';
|
||||||
} else {
|
|
||||||
// Sort array by date ASC to calculate balance
|
|
||||||
|
|
||||||
$totalET_debit = 0;
|
// File link
|
||||||
$totalIT_debit = 0;
|
print '<td class="tdoverflowmax150">';
|
||||||
$totalVAT_debit = 0;
|
if (!empty($data['files'])) {
|
||||||
$totalET_credit = 0;
|
foreach ($data['files'] as $id => $filecursor) {
|
||||||
$totalIT_credit = 0;
|
$tmppreview = $formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name'], 0);
|
||||||
$totalVAT_credit = 0;
|
if ($tmppreview) {
|
||||||
|
print $tmppreview;
|
||||||
// Display array
|
|
||||||
foreach ($TData as $data) {
|
|
||||||
$html_class = '';
|
|
||||||
//if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture'];
|
|
||||||
//elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement'];
|
|
||||||
print '<tr class="oddeven '.$html_class.'">';
|
|
||||||
|
|
||||||
// Type
|
|
||||||
print '<td>'.$langs->trans($data['item']).'</td>';
|
|
||||||
|
|
||||||
// Date
|
|
||||||
print '<td class="center">';
|
|
||||||
print dol_print_date($data['date'], 'day');
|
|
||||||
print "</td>\n";
|
|
||||||
|
|
||||||
// Date due
|
|
||||||
print '<td class="center">';
|
|
||||||
print dol_print_date($data['date_due'], 'day');
|
|
||||||
print "</td>\n";
|
|
||||||
|
|
||||||
// Ref
|
|
||||||
print '<td class="nowraponall">';
|
|
||||||
|
|
||||||
if ($data['item'] == 'Invoice') {
|
|
||||||
$invoice->id = $data['id'];
|
|
||||||
$invoice->ref = $data['ref'];
|
|
||||||
$invoice->total_ht = $data['amount_ht'];
|
|
||||||
$invoice->total_ttc = $data['amount_ttc'];
|
|
||||||
$invoice->total_tva = $data['amount_vat'];
|
|
||||||
$invoice->multicurrency_code = $data['currency'];
|
|
||||||
print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
|
||||||
} elseif ($data['item'] == 'SupplierInvoice') {
|
|
||||||
$supplier_invoice->id = $data['id'];
|
|
||||||
$supplier_invoice->ref = $data['ref'];
|
|
||||||
$supplier_invoice->total_ht = $data['amount_ht'];
|
|
||||||
$supplier_invoice->total_ttc = $data['amount_ttc'];
|
|
||||||
$supplier_invoice->total_tva = $data['amount_vat'];
|
|
||||||
$supplier_invoice->multicurrency_code = $data['currency'];
|
|
||||||
print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
|
||||||
} elseif ($data['item'] == 'ExpenseReport') {
|
|
||||||
$expensereport->id = $data['id'];
|
|
||||||
$expensereport->ref = $data['ref'];
|
|
||||||
print $expensereport->getNomUrl(1, 0, 0, '', 0, 0);
|
|
||||||
} elseif ($data['item'] == 'SalaryPayment') {
|
|
||||||
$salary_payment->id = $data['id'];
|
|
||||||
$salary_payment->ref = $data['ref'];
|
|
||||||
print $salary_payment->getNomUrl(1);
|
|
||||||
} elseif ($data['item'] == 'Donation') {
|
|
||||||
$don->id = $data['id'];
|
|
||||||
$don->ref = $data['ref'];
|
|
||||||
print $don->getNomUrl(1, 0, '', 0);
|
|
||||||
} elseif ($data['item'] == 'SocialContributions') {
|
|
||||||
$charge_sociales->id = $data['id'];
|
|
||||||
$charge_sociales->ref = $data['ref'];
|
|
||||||
print $charge_sociales->getNomUrl(1, 0, 0, 0, 0);
|
|
||||||
} elseif ($data['item'] == 'VariousPayment') {
|
|
||||||
$various_payment->id = $data['id'];
|
|
||||||
$various_payment->ref = $data['ref'];
|
|
||||||
print $various_payment->getNomUrl(1, '', 0, 0);
|
|
||||||
} elseif ($data['item'] == 'LoanPayment') {
|
|
||||||
$payment_loan->id = $data['id'];
|
|
||||||
$payment_loan->ref = $data['ref'];
|
|
||||||
print $payment_loan->getNomUrl(1, 0, 0, '', 0);
|
|
||||||
} else {
|
|
||||||
print $data['ref'];
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// File link
|
|
||||||
print '<td>';
|
|
||||||
if (!empty($data['files'])) {
|
|
||||||
foreach ($data['files'] as $id => $filecursor) {
|
|
||||||
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank" rel="noopener noreferrer">'.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).'</a> '.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).'<br>';
|
|
||||||
}
|
}
|
||||||
|
$filename = ($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']);
|
||||||
|
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank" rel="noopener noreferrer" title="'.dol_escape_htmltag($filename).'">';
|
||||||
|
if (empty($tmppreview)) {
|
||||||
|
print img_picto('', 'generic', '', false, 0, 0, '', 'pictonopreview pictofixedwidth paddingright');
|
||||||
|
}
|
||||||
|
print $filename;
|
||||||
|
print '</a><br>';
|
||||||
}
|
}
|
||||||
print "</td>\n";
|
}
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
// Paid
|
// Paid
|
||||||
print '<td aling="left">'.$data['paid'].'</td>';
|
print '<td class="center">'.($data['paid'] ? yn($data['paid']) : '').'</td>';
|
||||||
|
|
||||||
// Total ET
|
// Total ET
|
||||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</td>\n";
|
print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</span></td>\n";
|
||||||
// Total IT
|
// Total IT
|
||||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</td>\n";
|
print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</span></td>\n";
|
||||||
// Total VAT
|
// Total VAT
|
||||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</td>\n";
|
print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</span></td>\n";
|
||||||
|
|
||||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n";
|
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n";
|
||||||
|
|
||||||
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
|
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
|
||||||
|
|
||||||
print '<td class="center">'.$data['country_code']."</td>\n";
|
print '<td class="center">'.$data['country_code']."</td>\n";
|
||||||
|
|
||||||
print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n";
|
// VAT number
|
||||||
|
print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n";
|
||||||
|
|
||||||
if ($data['sens']) {
|
if ($data['sens']) {
|
||||||
$totalET_credit += $data['amount_ht'];
|
$totalET_credit += $data['amount_ht'];
|
||||||
$totalIT_credit += $data['amount_ttc'];
|
$totalIT_credit += $data['amount_ttc'];
|
||||||
$totalVAT_credit += $data['amount_vat'];
|
$totalVAT_credit += $data['amount_vat'];
|
||||||
} else {
|
} else {
|
||||||
$totalET_debit -= $data['amount_ht'];
|
$totalET_debit -= $data['amount_ht'];
|
||||||
$totalIT_debit -= $data['amount_ttc'];
|
$totalIT_debit -= $data['amount_ttc'];
|
||||||
$totalVAT_debit -= $data['amount_vat'];
|
$totalVAT_debit -= $data['amount_vat'];
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($conf->multicurrency->enabled)) {
|
|
||||||
print '<td class="center">'.$data['currency']."</td>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total credits
|
|
||||||
print '<tr class="liste_total">';
|
|
||||||
print '<td colspan="6" class="right">'.$langs->trans('Total').' '.$langs->trans('Income').'</td>';
|
|
||||||
print '<td align="right">'.price(price2num($totalET_credit, 'MT')).'</td>';
|
|
||||||
print '<td align="right">'.price(price2num($totalIT_credit, 'MT')).'</td>';
|
|
||||||
print '<td align="right">'.price(price2num($totalVAT_credit, 'MT')).'</td>';
|
|
||||||
print '<td colspan="4"></td>';
|
|
||||||
if (!empty($conf->multicurrency->enabled)) {
|
if (!empty($conf->multicurrency->enabled)) {
|
||||||
print '<td></td>';
|
print '<td class="center">'.$data['currency']."</td>\n";
|
||||||
}
|
|
||||||
print "</tr>\n";
|
|
||||||
// Total debits
|
|
||||||
print '<tr class="liste_total">';
|
|
||||||
print '<td colspan="6" class="right">'.$langs->trans('Total').' '.$langs->trans('Outcome').'</td>';
|
|
||||||
print '<td align="right">'.price(price2num($totalET_debit, 'MT')).'</td>';
|
|
||||||
print '<td align="right">'.price(price2num($totalIT_debit, 'MT')).'</td>';
|
|
||||||
print '<td align="right">'.price(price2num($totalVAT_debit, 'MT')).'</td>';
|
|
||||||
print '<td colspan="4"></td>';
|
|
||||||
if (!empty($conf->multicurrency->enabled)) {
|
|
||||||
print '<td></td>';
|
|
||||||
}
|
|
||||||
print "</tr>\n";
|
|
||||||
// Balance
|
|
||||||
print '<tr class="liste_total">';
|
|
||||||
print '<td colspan="6" class="right">'.$langs->trans('Total').'</td>';
|
|
||||||
print '<td align="right">'.price(price2num($totalET_credit + $totalET_debit, 'MT')).'</td>';
|
|
||||||
print '<td align="right">'.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).'</td>';
|
|
||||||
print '<td align="right">'.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).'</td>';
|
|
||||||
print '<td colspan="4"></td>';
|
|
||||||
if (!empty($conf->multicurrency->enabled)) {
|
|
||||||
print '<td></td>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Total credits
|
||||||
|
print '<tr class="liste_total">';
|
||||||
|
print '<td colspan="6" class="right">'.$langs->trans('Total').' '.$langs->trans('Income').'</td>';
|
||||||
|
print '<td align="right">'.price(price2num($totalET_credit, 'MT')).'</td>';
|
||||||
|
print '<td align="right">'.price(price2num($totalIT_credit, 'MT')).'</td>';
|
||||||
|
print '<td align="right">'.price(price2num($totalVAT_credit, 'MT')).'</td>';
|
||||||
|
print '<td colspan="4"></td>';
|
||||||
|
if (!empty($conf->multicurrency->enabled)) {
|
||||||
|
print '<td></td>';
|
||||||
|
}
|
||||||
|
print "</tr>\n";
|
||||||
|
// Total debits
|
||||||
|
print '<tr class="liste_total">';
|
||||||
|
print '<td colspan="6" class="right">'.$langs->trans('Total').' '.$langs->trans('Outcome').'</td>';
|
||||||
|
print '<td align="right">'.price(price2num($totalET_debit, 'MT')).'</td>';
|
||||||
|
print '<td align="right">'.price(price2num($totalIT_debit, 'MT')).'</td>';
|
||||||
|
print '<td align="right">'.price(price2num($totalVAT_debit, 'MT')).'</td>';
|
||||||
|
print '<td colspan="4"></td>';
|
||||||
|
if (!empty($conf->multicurrency->enabled)) {
|
||||||
|
print '<td></td>';
|
||||||
|
}
|
||||||
|
print "</tr>\n";
|
||||||
|
// Balance
|
||||||
|
print '<tr class="liste_total">';
|
||||||
|
print '<td colspan="6" class="right">'.$langs->trans('Total').'</td>';
|
||||||
|
print '<td align="right">'.price(price2num($totalET_credit + $totalET_debit, 'MT')).'</td>';
|
||||||
|
print '<td align="right">'.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).'</td>';
|
||||||
|
print '<td align="right">'.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).'</td>';
|
||||||
|
print '<td colspan="4"></td>';
|
||||||
|
if (!empty($conf->multicurrency->enabled)) {
|
||||||
|
print '<td></td>';
|
||||||
|
}
|
||||||
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,7 +170,7 @@ $arrayfields = array(
|
|||||||
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
|
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
|
||||||
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
|
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
|
||||||
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
|
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
|
||||||
'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020),
|
'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
@ -276,6 +276,9 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
|
|||||||
if ($offset) {
|
if ($offset) {
|
||||||
$param .= '&offset='.urlencode($offset);
|
$param .= '&offset='.urlencode($offset);
|
||||||
}
|
}
|
||||||
|
if ($limit) {
|
||||||
|
$param .= '&limit='.urlencode($limit);
|
||||||
|
}
|
||||||
if ($search_conciliated != '' && $search_conciliated != '-1') {
|
if ($search_conciliated != '' && $search_conciliated != '-1') {
|
||||||
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
||||||
}
|
}
|
||||||
@ -980,21 +983,27 @@ if ($resql) {
|
|||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
|
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
$moreforfilter .= $langs->trans('DateOperationShort').' ';
|
$moreforfilter .= $langs->trans('DateOperationShort');
|
||||||
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
|
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
|
||||||
$moreforfilter .= '<div class="nowrap inline-block">';
|
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||||
$moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'</div>';
|
$moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||||
//$moreforfilter .= ' - ';
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= '<div class="nowrap inline-block">'.$form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')).'</div>';
|
$moreforfilter .= ($conf->browser->layout == 'phone' ? '' : ' ');
|
||||||
|
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||||
|
$moreforfilter .= $form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||||
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
$moreforfilter .= $langs->trans('DateValueShort').' ';
|
$moreforfilter .= $langs->trans('DateValueShort');
|
||||||
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
|
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
|
||||||
$moreforfilter .= '<div class="nowrap inline-block">';
|
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||||
$moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'</div>';
|
$moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||||
//$moreforfilter .= ' - ';
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= '<div class="nowrap inline-block">'.$form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')).'</div>';
|
$moreforfilter .= ($conf->browser->layout == 'phone' ? '' : ' ');
|
||||||
|
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||||
|
$moreforfilter .= $form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||||
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
if (!empty($conf->categorie->enabled)) {
|
if (!empty($conf->categorie->enabled)) {
|
||||||
|
|||||||
@ -65,7 +65,8 @@ $hookmanager->initHooks(array('bankcard', 'globalcard'));
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id = GETPOST("id", 'int') ? GETPOST("id", 'int') : GETPOST('ref', 'alpha');
|
$id = GETPOST("id", 'int') ? GETPOST("id", 'int') : GETPOST('ref', 'alpha');
|
||||||
$fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid';
|
$fieldid = GETPOST("id", 'int') ? 'rowid' : 'ref';
|
||||||
|
|
||||||
$result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
|
$result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
|
||||||
|
|
||||||
|
|
||||||
@ -724,7 +725,7 @@ if ($action == 'create') {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) {
|
if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) {
|
||||||
print '<div class="underbanner clearboth"></div>';
|
//print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border tableforfield centpercent">';
|
print '<table class="border tableforfield centpercent">';
|
||||||
|
|
||||||
|
|||||||
@ -519,9 +519,10 @@ class Account extends CommonObject
|
|||||||
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
||||||
* @param int $datev Date value
|
* @param int $datev Date value
|
||||||
* @param string $num_releve Label of bank receipt for reconciliation
|
* @param string $num_releve Label of bank receipt for reconciliation
|
||||||
|
* @param float $amount_main_currency Amount
|
||||||
* @return int Rowid of added entry, <0 if KO
|
* @return int Rowid of added entry, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '')
|
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '', $amount_main_currency = null)
|
||||||
{
|
{
|
||||||
// Deprecation warning
|
// Deprecation warning
|
||||||
if (is_numeric($oper)) {
|
if (is_numeric($oper)) {
|
||||||
@ -579,6 +580,7 @@ class Account extends CommonObject
|
|||||||
$accline->datev = $datev;
|
$accline->datev = $datev;
|
||||||
$accline->label = $label;
|
$accline->label = $label;
|
||||||
$accline->amount = $amount;
|
$accline->amount = $amount;
|
||||||
|
$accline->amount_main_currency = $amount_main_currency;
|
||||||
$accline->fk_user_author = $user->id;
|
$accline->fk_user_author = $user->id;
|
||||||
$accline->fk_account = $this->id;
|
$accline->fk_account = $this->id;
|
||||||
$accline->fk_type = $oper;
|
$accline->fk_type = $oper;
|
||||||
@ -866,7 +868,7 @@ class Account extends CommonObject
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('BANKACCOUNT_UPDATE', $user);
|
$result = $this->call_trigger('BANKACCOUNT_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -1453,9 +1455,13 @@ class Account extends CommonObject
|
|||||||
|
|
||||||
// Call function to check BAN
|
// Call function to check BAN
|
||||||
|
|
||||||
if (!checkIbanForAccount($this) || !checkSwiftForAccount($this)) {
|
if (!checkIbanForAccount($this)) {
|
||||||
$this->error_number = 12;
|
$this->error_number = 12;
|
||||||
$this->error_message = 'IBANSWIFTControlError';
|
$this->error_message = 'IBANNotValid';
|
||||||
|
}
|
||||||
|
if (!checkSwiftForAccount($this)) {
|
||||||
|
$this->error_number = 12;
|
||||||
|
$this->error_message = 'SwiftNotValid';
|
||||||
}
|
}
|
||||||
/*if (! checkBanForAccount($this))
|
/*if (! checkBanForAccount($this))
|
||||||
{
|
{
|
||||||
@ -1728,7 +1734,7 @@ class Account extends CommonObject
|
|||||||
if ($dbs->query($sql)) {
|
if ($dbs->query($sql)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
|
//if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdparty and B-C on old one, we must get A-B-C after merge. Not A-B.
|
||||||
//$this->errors = $dbs->lasterror();
|
//$this->errors = $dbs->lasterror();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1797,7 +1803,8 @@ class AccountLine extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $datev;
|
public $datev;
|
||||||
|
|
||||||
public $amount;
|
public $amount; /* Amount of payment in the bank account currency */
|
||||||
|
public $amount_main_currency; /* Amount in the currency of company if bank account use another currency */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID
|
||||||
@ -1958,6 +1965,7 @@ class AccountLine extends CommonObject
|
|||||||
$sql .= ", datev";
|
$sql .= ", datev";
|
||||||
$sql .= ", label";
|
$sql .= ", label";
|
||||||
$sql .= ", amount";
|
$sql .= ", amount";
|
||||||
|
$sql .= ", amount_main_currency";
|
||||||
$sql .= ", fk_user_author";
|
$sql .= ", fk_user_author";
|
||||||
$sql .= ", num_chq";
|
$sql .= ", num_chq";
|
||||||
$sql .= ", fk_account";
|
$sql .= ", fk_account";
|
||||||
@ -1972,7 +1980,8 @@ class AccountLine extends CommonObject
|
|||||||
$sql .= ", '".$this->db->idate($this->datev)."'";
|
$sql .= ", '".$this->db->idate($this->datev)."'";
|
||||||
$sql .= ", '".$this->db->escape($this->label)."'";
|
$sql .= ", '".$this->db->escape($this->label)."'";
|
||||||
$sql .= ", ".price2num($this->amount);
|
$sql .= ", ".price2num($this->amount);
|
||||||
$sql .= ", ".($this->fk_user_author > 0 ? $this->fk_user_author : "null");
|
$sql .= ", ".(empty($this->amount_main_currency) ? "NULL" : price2num($this->amount_main_currency));
|
||||||
|
$sql .= ", ".($this->fk_user_author > 0 ? ((int) $this->fk_user_author) : "null");
|
||||||
$sql .= ", ".($this->num_chq ? "'".$this->db->escape($this->num_chq)."'" : "null");
|
$sql .= ", ".($this->num_chq ? "'".$this->db->escape($this->num_chq)."'" : "null");
|
||||||
$sql .= ", '".$this->db->escape($this->fk_account)."'";
|
$sql .= ", '".$this->db->escape($this->fk_account)."'";
|
||||||
$sql .= ", '".$this->db->escape($this->fk_type)."'";
|
$sql .= ", '".$this->db->escape($this->fk_type)."'";
|
||||||
|
|||||||
@ -60,10 +60,11 @@ $newbankreceipt = GETPOST('newbankreceipt', 'alpha');
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldid = (!empty($ref) ? $ref : $id);
|
$fieldid = (!empty($ref) ? $ref : $id);
|
||||||
$fieldname = isset($ref) ? 'ref' : 'rowid';
|
$fieldname = (!empty($ref) ? 'ref' : 'rowid');
|
||||||
if ($user->socid) {
|
if ($user->socid) {
|
||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = restrictedArea($user, 'banque', $fieldid, 'bank_account', '', '', $fieldname);
|
$result = restrictedArea($user, 'banque', $fieldid, 'bank_account', '', '', $fieldname);
|
||||||
|
|
||||||
if ($user->rights->banque->consolidate && $action == 'dvnext' && !empty($dvid)) {
|
if ($user->rights->banque->consolidate && $action == 'dvnext' && !empty($dvid)) {
|
||||||
|
|||||||
@ -179,7 +179,7 @@ if (empty($reshook)) {
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'delete') {
|
if ($action == 'confirm_delete' && $confirm == 'yes') {
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if ($object->rappro == 0) {
|
if ($object->rappro == 0) {
|
||||||
@ -543,6 +543,12 @@ if ($id) {
|
|||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Confirmation of the removal of the Various Payment
|
||||||
|
if ($action == 'delete') {
|
||||||
|
$text = $langs->trans('ConfirmDeleteVariousPayment');
|
||||||
|
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2);
|
||||||
|
}
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
|
print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
|
||||||
|
|
||||||
$morehtmlref = '<div class="refidno">';
|
$morehtmlref = '<div class="refidno">';
|
||||||
|
|||||||
@ -208,6 +208,9 @@ if (empty($reshook)) {
|
|||||||
$object->model_pdf = GETPOST('modelpdf', 'alpha');
|
$object->model_pdf = GETPOST('modelpdf', 'alpha');
|
||||||
$object->usenewprice = GETPOST('usenewprice', 'alpha');
|
$object->usenewprice = GETPOST('usenewprice', 'alpha');
|
||||||
|
|
||||||
|
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
|
||||||
|
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
|
||||||
|
|
||||||
$object->frequency = $frequency;
|
$object->frequency = $frequency;
|
||||||
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
|
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
|
||||||
$object->nb_gen_max = $nb_gen_max;
|
$object->nb_gen_max = $nb_gen_max;
|
||||||
@ -261,8 +264,6 @@ if (empty($reshook)) {
|
|||||||
} else {
|
} else {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
$error++;
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
$action = "create";
|
$action = "create";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -966,7 +967,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Title
|
// Title
|
||||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>';
|
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>';
|
||||||
print '<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'">';
|
print '<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'" autofocus>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
@ -1027,12 +1028,14 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Payment term
|
// Payment term
|
||||||
print "<tr><td>".$langs->trans("PaymentConditions")."</td><td>";
|
print "<tr><td>".$langs->trans("PaymentConditions")."</td><td>";
|
||||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
|
print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $object->cond_reglement_id, 'cond_reglement_id', -1, 0, 0, '');
|
||||||
|
//$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Payment mode
|
// Payment mode
|
||||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
|
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
|
||||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none', '', 1);
|
print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $object->mode_reglement_id, 'mode_reglement_id', '', 0, 1, 0, 0, 1, '', 1);
|
||||||
|
//$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', '', 1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
@ -1040,8 +1043,9 @@ if ($action == 'create') {
|
|||||||
$projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project;
|
$projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project;
|
||||||
$langs->load('projects');
|
$langs->load('projects');
|
||||||
print '<tr><td>'.$langs->trans('Project').'</td><td>';
|
print '<tr><td>'.$langs->trans('Project').'</td><td>';
|
||||||
|
print img_picto('', 'project');
|
||||||
$numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
|
$numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
|
||||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->thirdparty->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.$langs->trans("AddProject").'</a>';
|
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->thirdparty->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.img_object($langs->trans("AddProject"), 'add').'</a>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1074,7 +1078,8 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Frequency + unit
|
// Frequency + unit
|
||||||
print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>";
|
print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>";
|
||||||
print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' size='4' /> ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency') ?GETPOST('unit_frequency') : 'm'));
|
print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' size='4' /> ";
|
||||||
|
print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency') ?GETPOST('unit_frequency') : 'm'));
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Date next run
|
// Date next run
|
||||||
@ -1474,15 +1479,16 @@ if ($action == 'create') {
|
|||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<table class="nobordernopadding">';
|
print '<table class="nobordernopadding">';
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm'));
|
print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ";
|
||||||
|
print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm'));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
|
print '<td class="left"><input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
|
||||||
print '</tr></table></form>';
|
print '</tr></table></form>';
|
||||||
} else {
|
} else {
|
||||||
if ($object->frequency > 0) {
|
if ($object->frequency > 0) {
|
||||||
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
|
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
|
||||||
} else {
|
} else {
|
||||||
print $langs->trans("NotARecurringInvoiceTemplate");
|
print '<span class="opacitymedium">'.$langs->trans("NotARecurringInvoiceTemplate").'</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
* Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -94,6 +95,7 @@ $originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('
|
|||||||
$fac_rec = GETPOST('fac_rec', 'int');
|
$fac_rec = GETPOST('fac_rec', 'int');
|
||||||
$facid = GETPOST('facid', 'int');
|
$facid = GETPOST('facid', 'int');
|
||||||
$ref_client = GETPOST('ref_client', 'int');
|
$ref_client = GETPOST('ref_client', 'int');
|
||||||
|
$rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1;
|
||||||
|
|
||||||
// PDF
|
// PDF
|
||||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||||
@ -156,12 +158,12 @@ if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
|
|
||||||
if ($user->socid) {
|
if ($user->socid) {
|
||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
||||||
$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $fieldid, $isdraft);
|
|
||||||
|
$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -302,6 +304,14 @@ if (empty($reshook)) {
|
|||||||
// Validation
|
// Validation
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
|
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||||
|
$last_of_type = $object->willBeLastOfSameType();
|
||||||
|
if (empty($object->date_validation) && !$last_of_type[0]) {
|
||||||
|
setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors');
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// On verifie signe facture
|
// On verifie signe facture
|
||||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
|
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||||
// Si avoir, le signe doit etre negatif
|
// Si avoir, le signe doit etre negatif
|
||||||
@ -538,7 +548,8 @@ if (empty($reshook)) {
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2));
|
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2));
|
||||||
} elseif ($action == "setabsolutediscount" && $usercancreate) {
|
} elseif ($action == "setabsolutediscount" && $usercancreate) {
|
||||||
// POST[remise_id] or POST[remise_id_for_payment]
|
// We have POST[remise_id] or POST[remise_id_for_payment]
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
// We use the credit to reduce amount of invoice
|
// We use the credit to reduce amount of invoice
|
||||||
if (GETPOST("remise_id", 'int') > 0) {
|
if (GETPOST("remise_id", 'int') > 0) {
|
||||||
@ -549,7 +560,8 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db, $object->error);
|
$error++;
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We use the credit to reduce remain to pay
|
// We use the credit to reduce remain to pay
|
||||||
@ -560,7 +572,8 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
//var_dump($object->getRemainToPay(0));
|
//var_dump($object->getRemainToPay(0));
|
||||||
//var_dump($discount->amount_ttc);exit;
|
//var_dump($discount->amount_ttc);exit;
|
||||||
if (price2num($discount->amount_ttc) > price2num($object->getRemainToPay(0))) {
|
$remaintopay = $object->getRemainToPay(0);
|
||||||
|
if (price2num($discount->amount_ttc) > price2num($remaintopay)) {
|
||||||
// TODO Split the discount in 2 automatically
|
// TODO Split the discount in 2 automatically
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorDiscountLargerThanRemainToPaySplitItBefore"), null, 'errors');
|
setEventMessages($langs->trans("ErrorDiscountLargerThanRemainToPaySplitItBefore"), null, 'errors');
|
||||||
@ -569,12 +582,26 @@ if (empty($reshook)) {
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
$result = $discount->link_to_invoice(0, $id);
|
$result = $discount->link_to_invoice(0, $id);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$newremaintopay = $object->getRemainToPay(0);
|
||||||
|
if ($newremaintopay == 0) {
|
||||||
|
$object->setPaid($user);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (!$error) {
|
||||||
|
$db->commit();
|
||||||
|
} else {
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($error) && empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
||||||
@ -607,63 +634,6 @@ if (empty($reshook)) {
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
// Check parameters
|
|
||||||
|
|
||||||
// Check for mandatory fields in thirdparty (defined into setup)
|
|
||||||
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'ACCOUNTANCY_CODE_CUSTOMER');
|
|
||||||
foreach ($array_to_check as $key) {
|
|
||||||
$keymin = strtolower($key);
|
|
||||||
$i = (int) preg_replace('/[^0-9]/', '', $key);
|
|
||||||
$vallabel = $object->thirdparty->$keymin;
|
|
||||||
|
|
||||||
if ($i > 0) {
|
|
||||||
if ($object->thirdparty->isACompany()) {
|
|
||||||
// Check for mandatory prof id (but only if country is other than ours)
|
|
||||||
if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) {
|
|
||||||
$idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
|
|
||||||
if (!$vallabel && !empty($conf->global->$idprof_mandatory)) {
|
|
||||||
$langs->load("errors");
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//var_dump($conf->global->SOCIETE_EMAIL_MANDATORY);
|
|
||||||
if ($key == 'EMAIL') {
|
|
||||||
// Check for mandatory
|
|
||||||
if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($object->thirdparty->email)) {
|
|
||||||
$langs->load("errors");
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorBadEMail", $object->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') {
|
|
||||||
// Check for mandatory
|
|
||||||
if (!empty($conf->global->SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY) && empty($object->thirdparty->code_compta)) {
|
|
||||||
$langs->load("errors");
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorAccountancyCodeCustomerIsMandatory", $object->thirdparty->name).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for mandatory fields in invoice
|
|
||||||
$array_to_check = array('REF_CLIENT'=>'RefCustomer');
|
|
||||||
foreach ($array_to_check as $key => $val) {
|
|
||||||
$keymin = strtolower($key);
|
|
||||||
$vallabel = $object->$keymin;
|
|
||||||
|
|
||||||
// Check for mandatory
|
|
||||||
$keymandatory = 'INVOICE_'.$key.'_MANDATORY_FOR_VALIDATION';
|
|
||||||
if (!$vallabel && !empty($conf->global->$keymandatory)) {
|
|
||||||
$langs->load("errors");
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for warehouse
|
// Check for warehouse
|
||||||
if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||||
$qualified_for_stock_change = 0;
|
$qualified_for_stock_change = 0;
|
||||||
@ -769,7 +739,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
// On verifie si aucun paiement n'a ete effectue
|
// On verifie si aucun paiement n'a ete effectue
|
||||||
if ($ventilExportCompta == 0) {
|
if ($ventilExportCompta == 0) {
|
||||||
if (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == $object->total_ttc && empty($object->paye))) {
|
if (!empty($conf->global->INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE) || ($resteapayer == $object->total_ttc && empty($object->paye))) {
|
||||||
$result = $object->setDraft($user, $idwarehouse);
|
$result = $object->setDraft($user, $idwarehouse);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -2284,7 +2254,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, GETPOST('progress'), '', $fk_unit, $pu_ht_devise);
|
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, min($rank, count($object->lines) + 1), $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, GETPOST('progress'), '', $fk_unit, $pu_ht_devise);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
// Define output language and generate document
|
// Define output language and generate document
|
||||||
@ -2592,9 +2562,10 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($mesg, null, 'warnings');
|
setEventMessages($mesg, null, 'warnings');
|
||||||
$result = -1;
|
$result = -1;
|
||||||
} else {
|
} else {
|
||||||
$object->update_percent($line, GETPOST('all_progress'));
|
$object->update_percent($line, GETPOST('all_progress'), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$object->update_price(1);
|
||||||
}
|
}
|
||||||
} elseif ($action == 'updateline' && $usercancreate && !$cancel) {
|
} elseif ($action == 'updateline' && $usercancreate && !$cancel) {
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
|
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
|
||||||
@ -3058,7 +3029,7 @@ if ($action == 'create') {
|
|||||||
if (empty($conf->global->INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE)) {
|
if (empty($conf->global->INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE)) {
|
||||||
$text .= ' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name'));
|
$text .= ' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name'));
|
||||||
}
|
}
|
||||||
print info_admin($text, 0, 0, 0).'<br>';
|
print info_admin($text, 0, 0, 0, 'opacitymedium').'<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST" id="formtocreate" name="formtocreate">';
|
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST" id="formtocreate" name="formtocreate">';
|
||||||
@ -3554,7 +3525,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
if ($socid > 0) {
|
if ($socid > 0) {
|
||||||
// Discounts for third party
|
// Discounts for third party
|
||||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('DiscountStillRemaining').'</td><td colspan="2">';
|
||||||
|
|
||||||
$thirdparty = $soc;
|
$thirdparty = $soc;
|
||||||
$discount_type = 0;
|
$discount_type = 0;
|
||||||
@ -3847,17 +3818,18 @@ if ($action == 'create') {
|
|||||||
$title = $langs->trans('ProductsAndServices');
|
$title = $langs->trans('ProductsAndServices');
|
||||||
print load_fiche_titre($title);
|
print load_fiche_titre($title);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
$objectsrc->printOriginLinesList('', $selectedLines);
|
$objectsrc->printOriginLinesList('', $selectedLines);
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
} elseif ($id > 0 || !empty($ref)) {
|
} elseif ($id > 0 || !empty($ref)) {
|
||||||
if (empty($object->id)) {
|
if (empty($object->id)) {
|
||||||
llxHeader();
|
|
||||||
$langs->load('errors');
|
$langs->load('errors');
|
||||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||||
llxFooter();
|
llxFooter();
|
||||||
@ -4386,8 +4358,8 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Relative and absolute discounts
|
// Relative and absolute discounts
|
||||||
print '<!-- Discounts -->'."\n";
|
print '<!-- Discounts -->'."\n";
|
||||||
print '<tr><td>'.$langs->trans('Discounts');
|
print '<tr><td>'.$langs->trans('DiscountStillRemaining').'</td>';
|
||||||
print '</td><td>';
|
print '<td>';
|
||||||
$thirdparty = $soc;
|
$thirdparty = $soc;
|
||||||
$discount_type = 0;
|
$discount_type = 0;
|
||||||
$backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id);
|
$backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id);
|
||||||
@ -4818,6 +4790,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// List of previous situation invoices
|
// List of previous situation invoices
|
||||||
if (($object->situation_cycle_ref > 0) && !empty($conf->global->INVOICE_USE_SITUATION)) {
|
if (($object->situation_cycle_ref > 0) && !empty($conf->global->INVOICE_USE_SITUATION)) {
|
||||||
|
print '<!-- List of situation invoices -->';
|
||||||
print '<table class="noborder situationstable" width="100%">';
|
print '<table class="noborder situationstable" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -4956,15 +4929,16 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// List of payments already done
|
// List of payments already done
|
||||||
|
|
||||||
|
print '<!-- List of payments already done -->';
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder paymenttable centpercent">';
|
print '<table class="noborder paymenttable centpercent">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td class="liste_titre">'.($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).'</td>';
|
print '<td class="liste_titre">'.($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).'</td>';
|
||||||
print '<td class="liste_titre">'.$langs->trans('Date').'</td>';
|
print '<td class="liste_titre"><span class="hideonsmartphone">'.$langs->trans('Date').'</span></td>';
|
||||||
print '<td class="liste_titre">'.$langs->trans('Type').'</td>';
|
print '<td class="liste_titre"><span class="hideonsmartphone">'.$langs->trans('Type').'</span></td>';
|
||||||
if (!empty($conf->banque->enabled)) {
|
if (!empty($conf->banque->enabled)) {
|
||||||
print '<td class="liste_titre">'.$langs->trans('BankAccount').'</td>';
|
print '<td class="liste_titre"><span class="hideonsmartphone">'.$langs->trans('BankAccount').'</span></td>';
|
||||||
}
|
}
|
||||||
print '<td class="liste_titre right">'.$langs->trans('Amount').'</td>';
|
print '<td class="liste_titre right">'.$langs->trans('Amount').'</td>';
|
||||||
print '<td class="liste_titre" width="18"> </td>';
|
print '<td class="liste_titre" width="18"> </td>';
|
||||||
@ -4974,7 +4948,7 @@ if ($action == 'create') {
|
|||||||
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,';
|
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,';
|
||||||
$sql .= ' c.code as payment_code, c.libelle as payment_label,';
|
$sql .= ' c.code as payment_code, c.libelle as payment_label,';
|
||||||
$sql .= ' pf.amount,';
|
$sql .= ' pf.amount,';
|
||||||
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
|
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal, ba.currency_code as bacurrency_code';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||||
@ -5017,6 +4991,7 @@ if ($action == 'create') {
|
|||||||
$bankaccountstatic->ref = $objp->baref;
|
$bankaccountstatic->ref = $objp->baref;
|
||||||
$bankaccountstatic->label = $objp->baref;
|
$bankaccountstatic->label = $objp->baref;
|
||||||
$bankaccountstatic->number = $objp->banumber;
|
$bankaccountstatic->number = $objp->banumber;
|
||||||
|
$bankaccountstatic->currency_code = $objp->bacurrency_code;
|
||||||
|
|
||||||
if (!empty($conf->accounting->enabled)) {
|
if (!empty($conf->accounting->enabled)) {
|
||||||
$bankaccountstatic->account_number = $objp->account_number;
|
$bankaccountstatic->account_number = $objp->account_number;
|
||||||
@ -5251,7 +5226,7 @@ if ($action == 'create') {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="clearboth"></div><br>';
|
print '<div class="clearboth"></div><br><br>';
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
||||||
$blocname = 'contacts';
|
$blocname = 'contacts';
|
||||||
@ -5359,27 +5334,37 @@ if ($action == 'create') {
|
|||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$params = array(
|
||||||
|
'attr' => array(
|
||||||
|
'title' => '',
|
||||||
|
'class' => 'classfortooltip'
|
||||||
|
)
|
||||||
|
);
|
||||||
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
|
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
|
||||||
if ($object->statut == Facture::STATUS_VALIDATED) {
|
if ($object->statut == Facture::STATUS_VALIDATED) {
|
||||||
// We check if lines of invoice are not already transfered into accountancy
|
// We check if lines of invoice are not already transfered into accountancy
|
||||||
$ventilExportCompta = $object->getVentilExportCompta();
|
$ventilExportCompta = $object->getVentilExportCompta();
|
||||||
|
|
||||||
if ($ventilExportCompta == 0) {
|
if ($ventilExportCompta == 0) {
|
||||||
if (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) {
|
if (!empty($conf->global->INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) {
|
||||||
if (!$objectidnext && $object->is_last_in_cycle()) {
|
if (!$objectidnext && $object->is_last_in_cycle()) {
|
||||||
if ($usercanunvalidate) {
|
if ($usercanunvalidate) {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif&token='.newToken(), '', true, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('Modify').'</span>';
|
$params['attr']['title'] = $langs->trans('NotEnoughPermissions');
|
||||||
|
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif&token='.newToken(), '', false, $params);
|
||||||
}
|
}
|
||||||
} elseif (!$object->is_last_in_cycle()) {
|
} elseif (!$object->is_last_in_cycle()) {
|
||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("NotLastInCycle").'">'.$langs->trans('Modify').'</span>';
|
$params['attr']['title'] = $langs->trans('NotLastInCycle');
|
||||||
|
print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Modify').'</span>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice');
|
||||||
|
print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseDispatchedInBookkeeping").'">'.$langs->trans('Modify').'</span>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping');
|
||||||
|
print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5394,9 +5379,10 @@ if ($action == 'create') {
|
|||||||
&& ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data
|
&& ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data
|
||||||
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely)
|
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely)
|
||||||
if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted
|
if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans('ReOpen').'</a>';
|
print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken(), '', true, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>';
|
$params['attr']['title'] = $langs->trans("DisabledBecauseReplacedInvoice");
|
||||||
|
print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', '#', '', false, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5414,7 +5400,7 @@ if ($action == 'create') {
|
|||||||
// Validate
|
// Validate
|
||||||
if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
|
if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
|
||||||
if ($usercanvalidate) {
|
if ($usercanvalidate) {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken().'">'.$langs->trans('Validate').'</a>';
|
print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken(), '', true, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5425,9 +5411,9 @@ if ($action == 'create') {
|
|||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendMail').'</span>';
|
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendMail').'</span>';
|
||||||
} else {
|
} else {
|
||||||
if ($usercansend) {
|
if ($usercansend) {
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
|
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a>';
|
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5464,10 +5450,12 @@ if ($action == 'create') {
|
|||||||
} else {
|
} else {
|
||||||
if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) {
|
if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) {
|
||||||
// For down payment, we refuse to receive more than amount to pay.
|
// For down payment, we refuse to receive more than amount to pay.
|
||||||
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</span>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseRemainderToPayIsZero');
|
||||||
|
print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', '#', '', false, $params);
|
||||||
} else {
|
} else {
|
||||||
// Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
// Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>';
|
//print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>';
|
||||||
|
print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account, '', true, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5516,9 +5504,10 @@ if ($action == 'create') {
|
|||||||
) {
|
) {
|
||||||
if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpaymentall, 'MT')) {
|
if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpaymentall, 'MT')) {
|
||||||
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
|
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
|
||||||
print '<span class="butActionRefused" title="'.$langs->trans("AmountPaidMustMatchAmountOfDownPayment").'">'.$langs->trans('ClassifyPaid').'</span>';
|
$params['attr']['title'] = $langs->trans('AmountPaidMustMatchAmountOfDownPayment');
|
||||||
|
print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', '#', '', false, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid', '', true, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5563,13 +5552,13 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Clone
|
// Clone
|
||||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) {
|
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice">'.$langs->trans("ToClone").'</a>';
|
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice', '', true, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone as predefined / Create template
|
// Clone as predefined / Create template
|
||||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) {
|
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) {
|
||||||
if (!$objectidnext && count($object->lines) > 0) {
|
if (!$objectidnext && count($object->lines) > 0) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
print dolGetButtonAction($langs->trans('ChangeIntoRepeatableInvoice'), '', 'default', DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create', '', true, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5602,25 +5591,35 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
$isErasable = $object->is_erasable();
|
$isErasable = $object->is_erasable();
|
||||||
|
$params = array(
|
||||||
|
'attr' => array(
|
||||||
|
'title' => '',
|
||||||
|
'class' => 'classfortooltip'
|
||||||
|
)
|
||||||
|
);
|
||||||
if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions)
|
if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions)
|
||||||
//var_dump($isErasable);
|
$enableDelete = false;
|
||||||
|
$deleteHref = '#';
|
||||||
if ($isErasable == -4) {
|
if ($isErasable == -4) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecausePayments").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecausePayments');
|
||||||
} elseif ($isErasable == -3) {
|
} elseif ($isErasable == -3) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastSituationInvoice").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseNotLastSituationInvoice');
|
||||||
} elseif ($isErasable == -2) {
|
} elseif ($isErasable == -2) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastInvoice").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseNotLastInvoice');
|
||||||
} elseif ($isErasable == -1) {
|
} elseif ($isErasable == -1) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseDispatchedInBookkeeping").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping');
|
||||||
} elseif ($isErasable <= 0) { // Any other cases
|
} elseif ($isErasable <= 0) { // Any other cases
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotErasable").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseNotErasable');
|
||||||
} elseif ($objectidnext) {
|
} elseif ($objectidnext) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionDelete'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>';
|
$deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken();
|
||||||
|
$enableDelete = true;
|
||||||
}
|
}
|
||||||
|
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('NotAllowed');
|
||||||
|
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -519,7 +519,7 @@ class Invoices extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function deleteContact($id, $contactid, $type)
|
public function deleteContact($id, $contactid, $type)
|
||||||
{
|
{
|
||||||
@ -661,7 +661,7 @@ class Invoices extends DolibarrApi
|
|||||||
|
|
||||||
$result = $this->invoice->delete(DolibarrApiAccess::$user);
|
$result = $this->invoice->delete(DolibarrApiAccess::$user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
throw new RestException(500);
|
throw new RestException(500, 'Error when deleting invoice');
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
@ -780,7 +780,7 @@ class Invoices extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
|
public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
|
||||||
@ -829,7 +829,7 @@ class Invoices extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function settodraft($id, $idwarehouse = -1)
|
public function settodraft($id, $idwarehouse = -1)
|
||||||
@ -932,7 +932,7 @@ class Invoices extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function settopaid($id, $close_code = '', $close_note = '')
|
public function settopaid($id, $close_code = '', $close_note = '')
|
||||||
{
|
{
|
||||||
@ -982,7 +982,7 @@ class Invoices extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function settounpaid($id)
|
public function settounpaid($id)
|
||||||
{
|
{
|
||||||
@ -1069,7 +1069,7 @@ class Invoices extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function markAsCreditAvailable($id)
|
public function markAsCreditAvailable($id)
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user