Merge branch 'develop' into dev_19763
This commit is contained in:
commit
4cc40c5cbc
10
.travis.yml
10
.travis.yml
@ -50,7 +50,7 @@ jobs:
|
||||
env: DB=postgresql
|
||||
- stage: PHP 5.6-7.4
|
||||
if: type = pull_request OR type = push
|
||||
php: '7.4'
|
||||
php: '7.4.22'
|
||||
env: DB=mysql
|
||||
- stage: PHP Dev
|
||||
if: type = push AND branch = develop
|
||||
@ -106,7 +106,7 @@ install:
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
squizlabs/php_codesniffer ^3
|
||||
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 \
|
||||
php-parallel-lint/php-parallel-lint ^1.2 \
|
||||
php-parallel-lint/php-console-highlighter ^0 \
|
||||
@ -241,7 +241,7 @@ before_script:
|
||||
# enable php-fpm
|
||||
- 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
|
||||
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
|
||||
@ -276,7 +276,7 @@ script:
|
||||
set -e
|
||||
#parallel-lint --exclude htdocs/includes --blame .
|
||||
# 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 \
|
||||
--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 \
|
||||
@ -291,7 +291,7 @@ script:
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
# 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 .;
|
||||
fi
|
||||
set +e
|
||||
|
||||
@ -28,7 +28,7 @@ CKEditor 4.12.1 LGPL-2.1+ Yes
|
||||
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
|
||||
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)
|
||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||
ParseDown 1.6 MIT License Yes Markdown parser
|
||||
@ -48,8 +48,8 @@ TCPDF 6.3.2 LGPL-3+ Yes
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
|
||||
JS libraries:
|
||||
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
ChartJS 2.9.4 MIT License Yes JS library for graph
|
||||
Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
ChartJS 3.7.1 MIT License Yes JS library for graph
|
||||
jQuery 3.5.1 MIT License Yes JS library
|
||||
jQuery UI 1.12.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
|
||||
|
||||
39
ChangeLog
39
ChangeLog
@ -3,6 +3,7 @@ English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 16.0.0 compared to 15.0.0 *****
|
||||
|
||||
For users:
|
||||
@ -20,13 +21,46 @@ NEW: Experimental module Partnership Management
|
||||
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:
|
||||
* 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.
|
||||
* 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 *****
|
||||
@ -36,6 +70,7 @@ For users:
|
||||
|
||||
NEW: Online proposal signature
|
||||
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: Add option to disable globaly some notifications emails.
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
@ -35,13 +35,13 @@ You can install the web application yourself on your own platform/server so you
|
||||
|
||||
## 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 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.
|
||||
|
||||
@ -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)
|
||||
* 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 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.
|
||||
* 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" : "*",
|
||||
"ckeditor/ckeditor" : "4.12.1",
|
||||
"mike42/escpos-php" : "2.2",
|
||||
"mobiledetect/mobiledetectlib" : "2.8.34",
|
||||
"mobiledetect/mobiledetectlib" : "2.8.39",
|
||||
"phpoffice/phpexcel" : "1.8.2",
|
||||
"restler/framework" : "3.0.0-RC6",
|
||||
"tecnickcom/tcpdf" : "6.3.2",
|
||||
@ -59,4 +59,4 @@
|
||||
"ext-zip" : "ODT, Excel and file compression support",
|
||||
"ext-xml" : "Excel support"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
134
composer.lock
generated
134
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "1dbd2d05cc0836acfca5988f29005cf2",
|
||||
"content-hash": "ea80667c2a5aaabe388fbae4716d7dfb",
|
||||
"packages": [
|
||||
{
|
||||
"name": "ckeditor/ckeditor",
|
||||
@ -179,16 +179,16 @@
|
||||
},
|
||||
{
|
||||
"name": "mobiledetect/mobiledetectlib",
|
||||
"version": "2.8.34",
|
||||
"version": "2.8.39",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/serbanghita/Mobile-Detect.git",
|
||||
"reference": "6f8113f57a508494ca36acbcfa2dc2d923c7ed5b"
|
||||
"reference": "0fd6753003fc870f6e229bae869cc1337c99bc45"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/6f8113f57a508494ca36acbcfa2dc2d923c7ed5b",
|
||||
"reference": "6f8113f57a508494ca36acbcfa2dc2d923c7ed5b",
|
||||
"url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/0fd6753003fc870f6e229bae869cc1337c99bc45",
|
||||
"reference": "0fd6753003fc870f6e229bae869cc1337c99bc45",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -199,12 +199,12 @@
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"Mobile_Detect.php"
|
||||
],
|
||||
"psr-0": {
|
||||
"Detection": "namespaced/"
|
||||
}
|
||||
},
|
||||
"classmap": [
|
||||
"Mobile_Detect.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
@ -229,9 +229,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/serbanghita/Mobile-Detect/issues",
|
||||
"source": "https://github.com/serbanghita/Mobile-Detect/tree/2.8.34"
|
||||
"source": "https://github.com/serbanghita/Mobile-Detect/tree/2.8.39"
|
||||
},
|
||||
"time": "2019-09-18T18:44:20+00:00"
|
||||
"time": "2022-02-17T19:24:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nnnick/chartjs",
|
||||
@ -278,6 +278,61 @@
|
||||
},
|
||||
"time": "2020-10-19T12:22:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoffice/phpexcel",
|
||||
"version": "1.8.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPOffice/PHPExcel.git",
|
||||
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870",
|
||||
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"php": "^5.2|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"squizlabs/php_codesniffer": "2.*"
|
||||
},
|
||||
"type": "library",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-2.1"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Maarten Balliauw",
|
||||
"homepage": "http://blog.maartenballiauw.be"
|
||||
},
|
||||
{
|
||||
"name": "Erik Tilt"
|
||||
},
|
||||
{
|
||||
"name": "Franck Lefevre",
|
||||
"homepage": "http://rootslabs.net"
|
||||
},
|
||||
{
|
||||
"name": "Mark Baker",
|
||||
"homepage": "http://markbakeruk.net"
|
||||
}
|
||||
],
|
||||
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
|
||||
"homepage": "https://github.com/PHPOffice/PHPExcel",
|
||||
"keywords": [
|
||||
"OpenXML",
|
||||
"excel",
|
||||
"xlsx"
|
||||
],
|
||||
"abandoned": "phpoffice/phpspreadsheet",
|
||||
"time": "2018-11-22T23:07:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.1.3",
|
||||
@ -328,63 +383,6 @@
|
||||
},
|
||||
"time": "2020-03-23T09:12:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoffice/phpexcel",
|
||||
"version": "1.8.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPOffice/PHPExcel.git",
|
||||
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870",
|
||||
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
"ext-xml": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"php": "^5.2|^7.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"squizlabs/php_codesniffer": "2.*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-2.1"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Maarten Balliauw",
|
||||
"homepage": "http://blog.maartenballiauw.be"
|
||||
},
|
||||
{
|
||||
"name": "Erik Tilt"
|
||||
},
|
||||
{
|
||||
"name": "Franck Lefevre",
|
||||
"homepage": "http://rootslabs.net"
|
||||
},
|
||||
{
|
||||
"name": "Mark Baker",
|
||||
"homepage": "http://markbakeruk.net"
|
||||
}
|
||||
],
|
||||
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
|
||||
"homepage": "https://github.com/PHPOffice/PHPExcel",
|
||||
"keywords": [
|
||||
"OpenXML",
|
||||
"excel",
|
||||
"xlsx"
|
||||
],
|
||||
"abandoned": "phpoffice/phpspreadsheet",
|
||||
"time": "2018-11-22T23:07:24+00:00"
|
||||
},
|
||||
{
|
||||
"name": "restler/framework",
|
||||
"version": "3.0.0-RC6",
|
||||
|
||||
@ -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.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
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
# 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
|
||||
AFN,Afghanistan Afghani,2
|
||||
ALL,Albanian Lek,2
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/export.php
|
||||
* \ingroup Accountancy (Double entries)
|
||||
* \brief Setup page to configure accounting expert module
|
||||
* \brief Setup page to configure accounting export module
|
||||
*/
|
||||
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_FEC2 = 1010;
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var string[] Error codes (or messages)
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
/**
|
||||
* \file htdocs/accountancy/class/accountancyimport.class.php
|
||||
* \ingroup Accountancy (Double entries)
|
||||
* \brief Class accountancy import
|
||||
* \brief Class with methods for accountancy import
|
||||
*/
|
||||
|
||||
|
||||
@ -39,63 +39,104 @@
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @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 $listvalues Values list to add
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param int $record_key Record key
|
||||
* @return mixed Value
|
||||
*/
|
||||
public function computeAmount(&$arrayrecord, $fieldname, &$listfields, &$listvalues)
|
||||
public function computeAmount(&$arrayrecord, $listfields, $record_key)
|
||||
{
|
||||
$fieldArr = explode('.', $fieldname);
|
||||
if (count($fieldArr) > 0) {
|
||||
$fieldname = $fieldArr[1];
|
||||
// get fields indexes
|
||||
$field_index_list = array_flip($listfields);
|
||||
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']));
|
||||
$credit = floatval(trim($arrayrecord[12]['val']));
|
||||
if (!empty($debit)) {
|
||||
$amount = $debit;
|
||||
} else {
|
||||
$amount = $credit;
|
||||
}
|
||||
|
||||
$listfields[] = $fieldname;
|
||||
$listvalues[] = "'" . abs($amount) . "'";
|
||||
|
||||
return 1;
|
||||
return "''";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compute sens
|
||||
* Compute direction
|
||||
*
|
||||
* @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 $listvalues Values list to add
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param int $record_key Record key
|
||||
* @return mixed Value
|
||||
*/
|
||||
public function computeDirection(&$arrayrecord, $fieldname, &$listfields, &$listvalues)
|
||||
public function computeDirection(&$arrayrecord, $listfields, $record_key)
|
||||
{
|
||||
$fieldArr = explode('.', $fieldname);
|
||||
if (count($fieldArr) > 0) {
|
||||
$fieldname = $fieldArr[1];
|
||||
$field_index_list = array_flip($listfields);
|
||||
if (isset($field_index_list['debit'])) {
|
||||
$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']));
|
||||
if (!empty($debit)) {
|
||||
$sens = 'D';
|
||||
} else {
|
||||
$sens = 'C';
|
||||
}
|
||||
|
||||
$listfields[] = $fieldname;
|
||||
$listvalues[] = "'" . $sens . "'";
|
||||
|
||||
return 1;
|
||||
return "''";
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
$sortfield = GETPOST('sortfield', '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) {
|
||||
$page = 0;
|
||||
}
|
||||
@ -137,9 +137,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE l.rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||
|
||||
dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
@ -496,8 +496,8 @@ if ($result) {
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="tdoverflowonsmartphone">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
@ -637,7 +637,7 @@ if ($result) {
|
||||
|
||||
// Description
|
||||
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;
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc);
|
||||
print '</td>';
|
||||
|
||||
@ -405,7 +405,7 @@ if ($result) {
|
||||
|
||||
// Fees description -- Can be null
|
||||
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;
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
||||
print '</td>';
|
||||
|
||||
@ -481,7 +481,7 @@ if ($result) {
|
||||
|
||||
// Fees description -- Can be null
|
||||
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;
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
||||
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 "<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 '<hr>';
|
||||
print "<br>\n";
|
||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||
print '<hr>';
|
||||
print "<br>\n";
|
||||
|
||||
// STEPS
|
||||
$step++;
|
||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
|
||||
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
|
||||
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>';
|
||||
// STEPS
|
||||
$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);
|
||||
print $s;
|
||||
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++;
|
||||
$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);
|
||||
$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++;
|
||||
$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
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
@ -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->thirdparty_code = $companystatic->code_client;
|
||||
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
if ($k == getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT')) {
|
||||
$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->label_compte = $label_account;
|
||||
@ -886,6 +891,13 @@ if (empty($action) || $action == 'view') {
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
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>';
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -49,6 +49,7 @@ $search_societe = GETPOST('search_societe', 'alpha');
|
||||
$search_lineid = GETPOST('search_lineid', 'int');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
@ -112,6 +113,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
$search_invoice = '';
|
||||
$search_ref_supplier = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
$search_amount = '';
|
||||
@ -140,9 +142,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE l.rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||
|
||||
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
@ -236,6 +238,9 @@ if ($search_lineid) {
|
||||
if (strlen(trim($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))) {
|
||||
$sql .= natural_search("f.libelle", $search_label);
|
||||
}
|
||||
@ -328,6 +333,9 @@ if ($result) {
|
||||
if ($search_ref) {
|
||||
$param .= "&search_ref=".urlencode($search_ref);
|
||||
}
|
||||
if ($search_ref_supplier) {
|
||||
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||
}
|
||||
if ($search_label) {
|
||||
$param .= "&search_label=".urlencode($search_label);
|
||||
}
|
||||
@ -392,6 +400,7 @@ if ($result) {
|
||||
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 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 center">';
|
||||
print '<div class="nowrap">';
|
||||
@ -420,6 +429,7 @@ if ($result) {
|
||||
print '<tr class="liste_titre">';
|
||||
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("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("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
@ -446,6 +456,9 @@ if ($result) {
|
||||
|
||||
$facturefournisseur_static->ref = $objp->ref;
|
||||
$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->name = $objp->name;
|
||||
@ -465,8 +478,8 @@ if ($result) {
|
||||
$productstatic->status = $objp->tosell;
|
||||
$productstatic->status_buy = $objp->tobuy;
|
||||
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
|
||||
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy;
|
||||
$productstatic->accountancy_code_buy_export = $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_export;
|
||||
|
||||
$accountingaccountstatic->rowid = $objp->fk_compte;
|
||||
$accountingaccountstatic->label = $objp->label_account;
|
||||
@ -481,7 +494,13 @@ if ($result) {
|
||||
// Ref Invoice
|
||||
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 '</td>';
|
||||
|
||||
@ -501,8 +520,8 @@ if ($result) {
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="tdoverflowonsmartphone">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||
print '</td>';
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -55,6 +55,7 @@ $mesCasesCochees = GETPOST('toselect', 'array');
|
||||
$search_societe = GETPOST('search_societe', 'alpha');
|
||||
$search_lineid = GETPOST('search_lineid', 'int');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
|
||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
@ -137,6 +138,7 @@ if (empty($reshook)) {
|
||||
$search_societe = '';
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
$search_ref_supplier = '';
|
||||
$search_invoice = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
@ -290,6 +292,9 @@ if (strlen(trim($search_invoice))) {
|
||||
if (strlen(trim($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))) {
|
||||
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
|
||||
}
|
||||
@ -413,6 +418,9 @@ if ($result) {
|
||||
if ($search_ref) {
|
||||
$param .= '&search_ref='.urlencode($search_ref);
|
||||
}
|
||||
if ($search_ref_supplier) {
|
||||
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||
}
|
||||
if ($search_label) {
|
||||
$param .= '&search_label='.urlencode($search_label);
|
||||
}
|
||||
@ -469,7 +477,8 @@ if ($result) {
|
||||
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 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 '<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'));
|
||||
@ -499,7 +508,8 @@ if ($result) {
|
||||
print '<tr class="liste_titre">';
|
||||
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("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("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $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->id = $objp->facid;
|
||||
$facturefourn_static->type = $objp->ftype;
|
||||
$facturefourn_static->ref_supplier = $objp->ref_supplier;
|
||||
$facturefourn_static->label = $objp->invoice_label;
|
||||
$facturefourn_static->date = $db->jdate($objp->datef);
|
||||
|
||||
@ -625,15 +636,21 @@ if ($result) {
|
||||
// Ref Invoice
|
||||
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 '</td>';
|
||||
*/
|
||||
|
||||
// Date
|
||||
print '<td class="center">'.dol_print_date($facturefourn_static->date, 'day').'</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td class="tdoverflowmax150">';
|
||||
print '<td class="tdoverflowmax100">';
|
||||
if ($product_static->id > 0) {
|
||||
print $product_static->getNomUrl(1);
|
||||
}
|
||||
@ -644,7 +661,7 @@ if ($result) {
|
||||
|
||||
// Description
|
||||
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;
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
|
||||
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>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Company
|
||||
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) {
|
||||
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");
|
||||
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
|
||||
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
|
||||
@ -1778,7 +1776,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield tableforfield centpercent">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Tags / Categories
|
||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||
@ -1853,18 +1851,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
}
|
||||
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 "</div></div>\n";
|
||||
|
||||
@ -271,7 +271,7 @@ class AdherentType extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('ADHERENT_TYPE_DEL_MULTILANGS', $user);
|
||||
$result = $this->call_trigger('MEMBER_TYPE_DEL_MULTILANGS', $user);
|
||||
if ($result < 0) {
|
||||
$this->error = $this->db->lasterror();
|
||||
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) {
|
||||
return $this->get($id);
|
||||
} 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) {
|
||||
return $this->get($id);
|
||||
} 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
@ -193,7 +193,7 @@ class Subscriptions extends DolibarrApi
|
||||
if ($subscription->update(DolibarrApiAccess::$user) > 0) {
|
||||
return $this->get($id);
|
||||
} 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);
|
||||
|
||||
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) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
|
||||
@ -177,8 +177,8 @@ if ($conf->use_javascript_ajax) {
|
||||
$i = 0;
|
||||
foreach ($AdherentType as $key => $adhtype) {
|
||||
$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['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['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
|
||||
|
||||
@ -191,18 +191,18 @@ if ($conf->use_javascript_ajax) {
|
||||
}
|
||||
$total = $SumToValidate + $SumValidated + $SumUpToDate + $SumExcluded + $SumResiliated;
|
||||
$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("OutOfDate"), round($SumValidated));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), round($SumExcluded));
|
||||
$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_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, '-'.$badgeStatus8, $badgeStatus6, '-'.$badgeStatus0));
|
||||
$dolgraph->SetDataColor(array('-'.$badgeStatus0, $badgeStatus4, '-'.$badgeStatus1, '-'.$badgeStatus8, $badgeStatus6));
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
|
||||
@ -501,7 +501,7 @@ if ($rowid > 0) {
|
||||
|
||||
// Login
|
||||
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
|
||||
@ -512,25 +512,24 @@ if ($rowid > 0) {
|
||||
print '</tr>';
|
||||
|
||||
// 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
|
||||
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>';
|
||||
|
||||
// Password
|
||||
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) {
|
||||
print preg_replace('/./i', '*', $object->pass);
|
||||
} else {
|
||||
if ($user->admin) {
|
||||
print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
|
||||
} else {
|
||||
print $langs->trans("Hidden");
|
||||
print '<!-- '.$langs->trans("Crypted").': '.$object->pass_indatabase_crypted.' -->';
|
||||
}
|
||||
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");
|
||||
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
|
||||
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
|
||||
@ -546,15 +545,17 @@ if ($rowid > 0) {
|
||||
print " ".img_warning($langs->trans("Late"));
|
||||
}
|
||||
} else {
|
||||
if (!$adht->subscription) {
|
||||
if ($object->need_subscription == 0) {
|
||||
print $langs->trans("SubscriptionNotNeeded");
|
||||
} elseif (!$adht->subscription) {
|
||||
print $langs->trans("SubscriptionNotRecorded");
|
||||
if ($object->statut > 0) {
|
||||
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated
|
||||
}
|
||||
} else {
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($object->statut > 0) {
|
||||
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
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 '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
// Birthday
|
||||
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
|
||||
// Tags / Categories
|
||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||
print '<td colspan="2">';
|
||||
@ -582,6 +578,12 @@ if ($rowid > 0) {
|
||||
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
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
@ -663,8 +665,6 @@ if ($rowid > 0) {
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
/*
|
||||
* Action bar
|
||||
|
||||
@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
echo "<!-- BEGIN PHP TEMPLATE adherents/tpl/linkedopjectblock.tpl.php -->\n";
|
||||
echo "<!-- BEGIN PHP TEMPLATE adherents/tpl/linkedobjectblock.tpl.php -->\n";
|
||||
|
||||
global $user;
|
||||
|
||||
|
||||
@ -369,7 +369,7 @@ $form = new Form($db);
|
||||
$formother = new FormOther($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');
|
||||
|
||||
@ -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";
|
||||
|
||||
// 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 '<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";
|
||||
|
||||
// Country
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Oscss-Shop <support@oscss-shop.fr>.
|
||||
* 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");
|
||||
* 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/
|
||||
*/
|
||||
|
||||
if (!defined('REQUIRE_JQUERY_BLOCKUI')) {
|
||||
define('REQUIRE_JQUERY_BLOCKUI', 1);
|
||||
}
|
||||
if (!defined('NOTOKENRENEWAL')) {
|
||||
define('NOTOKENRENEWAL', 1);
|
||||
}
|
||||
|
||||
@ -67,9 +67,6 @@ div.divsearchfield {
|
||||
.tree li:last-child:after{
|
||||
display: none
|
||||
}
|
||||
.blockUI {
|
||||
cursor: auto!important;
|
||||
}
|
||||
.newAppParent{
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
@ -220,8 +220,9 @@ if ($action == 'edit') {
|
||||
foreach ($arrayofparameters as $constname => $val) {
|
||||
if ($val['enabled']==1) {
|
||||
$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 . '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 '</td><td>';
|
||||
|
||||
@ -314,6 +315,7 @@ if ($action == 'edit') {
|
||||
$setupnotempty++;
|
||||
print '<tr class="oddeven"><td>';
|
||||
$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 '</td><td>';
|
||||
|
||||
|
||||
@ -38,169 +38,178 @@ if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
//Init error
|
||||
$error = false;
|
||||
$message = false;
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('admin', 'dictionaryadmin','expensereport_rules'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
$apply_to = GETPOST('apply_to');
|
||||
$fk_user = GETPOST('fk_user', 'int');
|
||||
$fk_usergroup = GETPOST('fk_usergroup', 'int');
|
||||
|
||||
$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);
|
||||
}
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
// TODO do action
|
||||
if ($action == 'save') {
|
||||
$error = 0;
|
||||
if (empty($reshook)) {
|
||||
//Init error
|
||||
$error = false;
|
||||
$message = false;
|
||||
|
||||
// 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');
|
||||
}
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
if (empty($error)) {
|
||||
$object->setValues($_POST);
|
||||
$apply_to = GETPOST('apply_to');
|
||||
$fk_user = GETPOST('fk_user', 'int');
|
||||
$fk_usergroup = GETPOST('fk_usergroup', 'int');
|
||||
|
||||
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;
|
||||
$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 ($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;
|
||||
$object->datee = $datee;
|
||||
if (empty($error)) {
|
||||
$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);
|
||||
if ($res > 0) {
|
||||
setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
|
||||
} else {
|
||||
$object->dates = $dates;
|
||||
$object->datee = $datee;
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
header('Location: '.$_SERVER['PHP_SELF']);
|
||||
header('Location: ' . $_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
}
|
||||
} elseif ($action == 'delete') {
|
||||
// TODO add confirm
|
||||
$res = $object->delete($user);
|
||||
|
||||
if ($res < 0) {
|
||||
dol_print_error($object->db);
|
||||
}
|
||||
$rules = $object->getAllRule();
|
||||
|
||||
header('Location: '.$_SERVER['PHP_SELF']);
|
||||
exit;
|
||||
$tab_apply = array(
|
||||
'A' => $langs->trans('All'),
|
||||
'G' => $langs->trans('Group'),
|
||||
'U' => $langs->trans('User')
|
||||
);
|
||||
$tab_rules_type = array(
|
||||
'EX_DAY' => $langs->trans('Day'),
|
||||
'EX_MON' => $langs->trans('Month'),
|
||||
'EX_YEA' => $langs->trans('Year'),
|
||||
'EX_EXP' => $langs->trans('OnExpense')
|
||||
);
|
||||
}
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$rules = $object->getAllRule();
|
||||
llxHeader('', $langs->trans("ExpenseReportsSetup"));
|
||||
|
||||
$tab_apply = array(
|
||||
'A' => $langs->trans('All'),
|
||||
'G' => $langs->trans('Group'),
|
||||
'U' => $langs->trans('User')
|
||||
);
|
||||
$tab_rules_type = array(
|
||||
'EX_DAY' => $langs->trans('Day'),
|
||||
'EX_MON' => $langs->trans('Month'),
|
||||
'EX_YEA' => $langs->trans('Year'),
|
||||
'EX_EXP' => $langs->trans('OnExpense')
|
||||
);
|
||||
$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');
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$head = expensereport_admin_prepare_head();
|
||||
print dol_get_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRules"), -1, 'trip');
|
||||
|
||||
llxHeader('', $langs->trans("ExpenseReportsSetup"));
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("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>';
|
||||
echo '<span class="opacitymedium">' . $langs->trans('ExpenseReportRulesDesc') . '</span>';
|
||||
print '<br><br>';
|
||||
|
||||
if ($action != 'edit') {
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||
echo '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
|
||||
echo '<input type="hidden" name="token" value="' . newToken() . '" />';
|
||||
echo '<input type="hidden" name="action" value="save" />';
|
||||
|
||||
echo '<table class="noborder centpercent">';
|
||||
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
|
||||
echo '<th>'.$langs->trans('Type').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
|
||||
echo '<tr class="liste_titre headerexpensereportrules">';
|
||||
echo '<th class="linecolapplyto">' . $langs->trans('ExpenseReportApplyTo') . '</th>';
|
||||
echo '<th class="linecoltype">' . $langs->trans('Type') . '</th>';
|
||||
echo '<th class="linecollimiton">' . $langs->trans('ExpenseReportLimitOn') . '</th>';
|
||||
echo '<th class="linecoldatestart">' . $langs->trans('ExpenseReportDateStart') . '</th>';
|
||||
echo '<th class="linecoldateend">' . $langs->trans('ExpenseReportDateEnd') . '</th>';
|
||||
echo '<th class="linecollimitamount">' . $langs->trans('ExpenseReportLimitAmount') . '</th>';
|
||||
echo '<th class="linecolrestrictive">' . $langs->trans('ExpenseReportRestrictive') . '</th>';
|
||||
echo '<th> </th>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr class="oddeven">';
|
||||
echo '<td>';
|
||||
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, '', 0).'</div>';
|
||||
echo '<div id="user" class="float">'.$form->select_dolusers('', 'fk_user').'</div>';
|
||||
echo '<div id="group" class="float">'.$form->select_dolgroups('', 'fk_usergroup').'</div>';
|
||||
echo '<div class="float linecolapplyto">' . $form->selectarray('apply_to', $tab_apply, '', 0) . '</div>';
|
||||
echo '<div id="user" class="float linecoluser">' . $form->select_dolusers('', 'fk_user') . '</div>';
|
||||
echo '<div id="group" class="float linecolgroup">' . $form->select_dolgroups('', 'fk_usergroup') . '</div>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td>'.$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>'.$form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0).'</td>';
|
||||
echo '<td>'.$form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0).'</td>';
|
||||
echo '<td><input type="text" value="" class="maxwidth100" name="amount" class="amount" /> '.$conf->currency.'</td>';
|
||||
echo '<td>'.$form->selectyesno('restrictive', 0, 1).'</td>';
|
||||
echo '<td class="right"><input type="submit" class="button button-add" value="'.$langs->trans('Add').'" /></td>';
|
||||
echo '<td class="linecoltype">' . $form->selectExpense('', 'fk_c_type_fees', 0, 1, 1) . '</td>';
|
||||
echo '<td class="linecoltyperule">' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . '</td>';
|
||||
echo '<td class="linecoldatestart">' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . '</td>';
|
||||
echo '<td class="linecoldateend>' . $form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0) . '</td>';
|
||||
echo '<td class="linecolamount"><input type="text" value="" class="maxwidth100" name="amount" class="amount" /> ' . $conf->currency . '</td>';
|
||||
echo '<td class="linecolrestrictive">' . $form->selectyesno('restrictive', 0, 1) . '</td>';
|
||||
echo '<td class="right linecolbutton"><input type="submit" class="button button-add" value="' . $langs->trans('Add') . '" /></td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '</table>';
|
||||
@ -208,60 +217,60 @@ if ($action != 'edit') {
|
||||
}
|
||||
|
||||
|
||||
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||
echo '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">';
|
||||
echo '<input type="hidden" name="token" value="' . newToken() . '" />';
|
||||
|
||||
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 '<table class="noborder centpercent">';
|
||||
echo '<table class="noborder centpercent">';
|
||||
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
|
||||
echo '<th>'.$langs->trans('Type').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
|
||||
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
|
||||
echo '<th> </th>';
|
||||
echo '</tr>';
|
||||
echo '<tr class="liste_titre expensereportrules">';
|
||||
echo '<th class="linecolapplyto">' . $langs->trans('ExpenseReportApplyTo') . '</th>';
|
||||
echo '<th class="linecoltype">' . $langs->trans('Type') . '</th>';
|
||||
echo '<th class="linecollimiton">' . $langs->trans('ExpenseReportLimitOn') . '</th>';
|
||||
echo '<th class="linecoldatestart">' . $langs->trans('ExpenseReportDateStart') . '</th>';
|
||||
echo '<th class="linecoldateend">' . $langs->trans('ExpenseReportDateEnd') . '</th>';
|
||||
echo '<th class="linecollimitamount">' . $langs->trans('ExpenseReportLimitAmount') . '</th>';
|
||||
echo '<th class="linecolrestrictive">' . $langs->trans('ExpenseReportRestrictive') . '</th>';
|
||||
echo '<th> </th>';
|
||||
echo '</tr>';
|
||||
|
||||
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) {
|
||||
$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 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 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="group" class="float">' . $form->select_dolgroups($object->fk_usergroup, 'fk_usergroup') . '</div>';
|
||||
} else {
|
||||
if ($rule->is_for_all > 0) {
|
||||
echo $tab_apply['A'];
|
||||
} elseif ($rule->fk_usergroup > 0) {
|
||||
echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
|
||||
echo $tab_apply['G'] . ' (' . $rule->getGroupLabel() . ')';
|
||||
} elseif ($rule->fk_user > 0) {
|
||||
echo $tab_apply['U'].' ('.$rule->getUserName().')';
|
||||
echo $tab_apply['U'] . ' (' . $rule->getUserName() . ')';
|
||||
}
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
echo '<td class="linecoltype">';
|
||||
if ($action == 'edit' && $object->id == $rule->id) {
|
||||
echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
|
||||
} else {
|
||||
if ($rule->fk_c_type_fees == -1) {
|
||||
echo $langs->trans('AllExpenseReport');
|
||||
} 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)) {
|
||||
echo $langs->trans($key);
|
||||
} 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'
|
||||
}
|
||||
}
|
||||
@ -269,7 +278,7 @@ foreach ($rules as $rule) {
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
echo '<td class="linecoltyperule">';
|
||||
if ($action == 'edit' && $object->id == $rule->id) {
|
||||
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
|
||||
} else {
|
||||
@ -278,7 +287,7 @@ foreach ($rules as $rule) {
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
echo '<td class="linecoldatestart">';
|
||||
if ($action == 'edit' && $object->id == $rule->id) {
|
||||
print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0);
|
||||
} else {
|
||||
@ -287,7 +296,7 @@ foreach ($rules as $rule) {
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
echo '<td class="linecoldateend">';
|
||||
if ($action == 'edit' && $object->id == $rule->id) {
|
||||
print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0);
|
||||
} else {
|
||||
@ -296,16 +305,16 @@ foreach ($rules as $rule) {
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
echo '<td class="linecolamount">';
|
||||
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 {
|
||||
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
|
||||
}
|
||||
echo '</td>';
|
||||
|
||||
|
||||
echo '<td>';
|
||||
echo '<td class="linecolrestrictive">';
|
||||
if ($action == 'edit' && $object->id == $rule->id) {
|
||||
echo $form->selectyesno('restrictive', $object->restrictive, 1);
|
||||
} else {
|
||||
@ -316,11 +325,11 @@ foreach ($rules as $rule) {
|
||||
|
||||
echo '<td class="center">';
|
||||
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="paddingright paddingleft" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$rule->id.'">'.img_delete().'</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>';
|
||||
} else {
|
||||
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 '<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 '</td>';
|
||||
|
||||
@ -328,10 +337,10 @@ foreach ($rules as $rule) {
|
||||
}
|
||||
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
echo '<script type="text/javascript"> $(function() {
|
||||
echo '<script type="text/javascript"> $(function() {
|
||||
$("#apply_to").change(function() {
|
||||
var value = $(this).val();
|
||||
if (value == "A") {
|
||||
@ -349,6 +358,7 @@ echo '<script type="text/javascript"> $(function() {
|
||||
|
||||
}); </script>';
|
||||
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
// End of page
|
||||
|
||||
@ -225,6 +225,12 @@ if ($action == 'updateMask') {
|
||||
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 '</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 '</div>';
|
||||
|
||||
|
||||
@ -110,7 +110,8 @@ if (GETPOST('save', 'alpha')) {
|
||||
|
||||
$fckeditor_skin = GETPOST('fckeditor_skin', 'alpha');
|
||||
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++;
|
||||
}
|
||||
} else {
|
||||
@ -119,7 +120,8 @@ if (GETPOST('save', 'alpha')) {
|
||||
|
||||
$fckeditor_test = GETPOST('formtestfield', 'restricthtml');
|
||||
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++;
|
||||
}
|
||||
} else {
|
||||
@ -129,7 +131,7 @@ if (GETPOST('save', 'alpha')) {
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} 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(
|
||||
'__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',
|
||||
//'__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',
|
||||
'__FIRSTNAME__' => 'RecipientFirstname',
|
||||
'__ADDRESS__'=> 'RecipientAddress',
|
||||
@ -662,7 +663,7 @@ if ($action == 'edit') {
|
||||
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 (function_exists('openssl_open')) {
|
||||
print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED);
|
||||
print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_DKIM_ENABLED'));
|
||||
} else {
|
||||
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 '<td>';
|
||||
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
|
||||
print $conf->global->MAIN_MAIL_AUTOCOPY_TO;
|
||||
if (!isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
|
||||
print img_warning($langs->trans("ErrorBadEMail"));
|
||||
$listofemail = explode(',', $conf->global->MAIN_MAIL_AUTOCOPY_TO);
|
||||
$i = 0;
|
||||
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 {
|
||||
print ' ';
|
||||
@ -887,7 +897,6 @@ if ($action == 'edit') {
|
||||
}
|
||||
|
||||
setEventMessages($errormsg, null, 'errors');
|
||||
print $errormsg;
|
||||
}
|
||||
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'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
@ -40,17 +40,22 @@ if (!$user->admin) {
|
||||
$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.
|
||||
if ($action == 'test' || $action == 'send') {
|
||||
$usersignature = dol_string_nohtmltag($usersignature);
|
||||
$usersignature = dol_string_nohtmltag($usersignature, 2);
|
||||
}
|
||||
|
||||
$substitutionarrayfortest = array(
|
||||
'__LOGIN__' => $user->login,
|
||||
'__ID__' => 'TESTIdRecord',
|
||||
'__EMAIL__' => 'TESTEMail',
|
||||
'__LASTNAME__' => 'TESTLastname',
|
||||
'__FIRSTNAME__' => 'TESTFirstname',
|
||||
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''),
|
||||
//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet
|
||||
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
|
||||
'__ID__' => 'RecipientIdRecord',
|
||||
//'__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__' => $user->login,
|
||||
'__LASTNAME__' => 'RecipientLastname',
|
||||
'__FIRSTNAME__' => 'RecipientFirstname',
|
||||
'__ADDRESS__'=> 'RecipientAddress',
|
||||
'__ZIP__'=> 'RecipientZip',
|
||||
'__TOWN_'=> 'RecipientTown',
|
||||
'__COUNTRY__'=> 'RecipientCountry'
|
||||
);
|
||||
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
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
if ($action == 'presend' && GETPOST('trackid') == 'test') {
|
||||
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') {
|
||||
$action = 'test';
|
||||
}
|
||||
if ($action == 'presend' && GETPOST('trackid') == 'testhtml') {
|
||||
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') {
|
||||
$action = 'testhtml';
|
||||
}
|
||||
|
||||
@ -271,12 +276,15 @@ if ($action == 'edit') {
|
||||
|
||||
// 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') {
|
||||
print '<td>';
|
||||
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
|
||||
print '</td><td>';
|
||||
print $langs->trans("SeeLocalSendMailSetup");
|
||||
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
$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");
|
||||
if ($linuxlike) {
|
||||
@ -287,17 +295,19 @@ if ($action == 'edit') {
|
||||
print '</td><td>';
|
||||
// SuperAdministrator access only
|
||||
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 '<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 {
|
||||
$text = !empty($mainserver) ? $mainserver : $smtpserver;
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
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 '</td>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Port
|
||||
|
||||
@ -305,7 +315,7 @@ if ($action == 'edit') {
|
||||
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') {
|
||||
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
|
||||
print '</td><td>';
|
||||
print $langs->trans("SeeLocalSendMailSetup");
|
||||
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
|
||||
} else {
|
||||
$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");
|
||||
@ -319,7 +329,7 @@ if ($action == 'edit') {
|
||||
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 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 {
|
||||
$text = (!empty($mainport) ? $mainport : $smtpport);
|
||||
$htmltext = $langs->trans("ContactSuperAdminForChange");
|
||||
@ -360,7 +370,6 @@ if ($action == 'edit') {
|
||||
}
|
||||
|
||||
// TLS
|
||||
|
||||
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 (function_exists('openssl_open')) {
|
||||
@ -374,7 +383,6 @@ if ($action == 'edit') {
|
||||
print '</td></tr>';
|
||||
|
||||
// STARTTLS
|
||||
|
||||
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 (function_exists('openssl_open')) {
|
||||
@ -388,7 +396,6 @@ if ($action == 'edit') {
|
||||
print '</td></tr>';
|
||||
|
||||
// SMTP_ALLOW_SELF_SIGNED_EMAILING
|
||||
|
||||
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 (function_exists('openssl_open')) {
|
||||
@ -414,6 +421,7 @@ if ($action == 'edit') {
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><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 '<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").')';
|
||||
}
|
||||
} else {
|
||||
print yn(0).' ('.$langs->trans("NotSupported").')';
|
||||
print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -492,6 +500,7 @@ if ($action == 'edit') {
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -543,6 +552,7 @@ if ($action == 'edit') {
|
||||
|
||||
// Run the test to connect
|
||||
if ($action == 'testconnect') {
|
||||
print '<div id="formmailaftertstconnect" name="formmailaftertstconnect"></div>';
|
||||
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
@ -573,16 +583,18 @@ if ($action == 'edit') {
|
||||
// Cree l'objet formulaire mail
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
||||
$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->trackid = (($action == 'testhtml') ? "testhtml" : "test");
|
||||
$formmail->fromid = $user->id;
|
||||
$formmail->fromalsorobot = 1;
|
||||
$formmail->withfromreadonly = 0;
|
||||
$formmail->withsubstit = 0;
|
||||
$formmail->withfrom = 1;
|
||||
$formmail->witherrorsto = 1;
|
||||
$formmail->withto = (!GETPOST('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
|
||||
$formmail->withtocc = (!GETPOST(['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->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
|
||||
$formmail->withtocc = (GETPOSTISSET(['sendtocc']) ? GETPOST('sendtocc', '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->withtopicreadonly = 0;
|
||||
$formmail->withfile = 2;
|
||||
@ -601,7 +613,7 @@ if ($action == 'edit') {
|
||||
$formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
|
||||
|
||||
// Init list of files
|
||||
if (GETPOST("mode") == 'init') {
|
||||
if (GETPOST("mode", "aZ09") == 'init') {
|
||||
$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'));
|
||||
}
|
||||
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)) {
|
||||
$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)) {
|
||||
$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 '</td>';
|
||||
@ -1000,7 +1000,7 @@ if ($resql) {
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||
$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);
|
||||
}
|
||||
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
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
|
||||
@ -481,9 +481,9 @@ $deschelp = '';
|
||||
if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$desc = $langs->trans("ModulesDesc", '{picto}');
|
||||
$desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}');
|
||||
$desc = str_replace('{picto}', img_picto('', 'switch_off'), $desc);
|
||||
$desc = str_replace('{picto2}', img_picto('', 'setup'), $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
|
||||
$desc = str_replace('{picto}', img_picto('', 'switch_off', 'class="size15x"'), $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
|
||||
$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 '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="submit" name="updatecurrency" class="button button-edit" value="'.$langs->trans("Modify").'"> ';
|
||||
print '<input type="submit" name="deletecurrency" class="button" value="'.$langs->trans("Delete").'">';
|
||||
print '<input type="submit" name="updatecurrency" class="button button-edit smallpaddingimp" value="'.$langs->trans("Modify").'"> ';
|
||||
print '<input type="submit" name="deletecurrency" class="button smallpaddingimp" value="'.$langs->trans("Delete").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.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) 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
|
||||
* 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'];
|
||||
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
|
||||
|
||||
$model = $notifiedevent['elementtype'];
|
||||
|
||||
if ($notifiedevent['elementtype'] == 'order_supplier') {
|
||||
$elementLabel = $langs->trans('SupplierOrder');
|
||||
} elseif ($notifiedevent['elementtype'] == 'propal') {
|
||||
|
||||
@ -198,6 +198,37 @@ if ($action == 'updateMask') {
|
||||
// par appel methode canBeActivated
|
||||
|
||||
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 '</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 '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
@ -36,6 +36,14 @@ if (!$user->admin) {
|
||||
}
|
||||
|
||||
$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;
|
||||
|
||||
@ -73,8 +81,6 @@ if ($action == 'updateform') {
|
||||
} else {
|
||||
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);
|
||||
|
||||
// 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', '');
|
||||
|
||||
// End of page
|
||||
|
||||
@ -266,10 +266,20 @@ print '<br>';
|
||||
|
||||
print '<strong>$dolibarr_main_restrict_ip</strong>: ';
|
||||
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>';
|
||||
} 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>';
|
||||
|
||||
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."/ticket/class/ticket.class.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
|
||||
$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') {
|
||||
$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);
|
||||
@ -203,6 +212,12 @@ if ($action == 'setvarother') {
|
||||
if (!($res > 0)) {
|
||||
$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']);
|
||||
|
||||
$form = new Form($db);
|
||||
$formcategory = new FormCategory($db);
|
||||
|
||||
$help_url = "FR:Module_Ticket";
|
||||
$page_name = "TicketSetup";
|
||||
@ -320,7 +335,7 @@ foreach ($dirmodels as $reldir) {
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print $formcategory->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
@ -458,7 +473,7 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print $formcategory->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
|
||||
// Preview
|
||||
@ -483,8 +498,7 @@ foreach ($dirmodels as $reldir) {
|
||||
print '</table>';
|
||||
print '</div><br>';
|
||||
|
||||
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
if (empty($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="setvarworkflow">';
|
||||
@ -506,11 +520,11 @@ if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND');
|
||||
} else {
|
||||
$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 class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help');
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -522,17 +536,47 @@ if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
|
||||
} else {
|
||||
$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 class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
print '</form>';
|
||||
// Auto notify contacts when closing the ticket
|
||||
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
|
||||
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").'">
|
||||
</td>';
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -556,14 +600,18 @@ print '<td class="left">
|
||||
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
|
||||
</td>';
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
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
|
||||
print load_fiche_titre($langs->trans("Notification"), '', '');
|
||||
@ -591,7 +639,7 @@ print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationFrom").'<
|
||||
print '<td class="left">';
|
||||
print '<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_FROM" value="'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'"></td>';
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -600,7 +648,7 @@ print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationTo").' ('
|
||||
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 '<td class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -612,11 +660,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
|
||||
} else {
|
||||
$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 class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -630,7 +678,7 @@ $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120
|
||||
$doleditor->Create();
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help');
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help');
|
||||
print '</td></tr>';
|
||||
|
||||
// Texte de signature
|
||||
@ -642,12 +690,12 @@ $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '10
|
||||
$doleditor->Create();
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
print $formcategory->buttonsSaveCancel("Save", '');
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
@ -327,33 +327,6 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
|
||||
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
|
||||
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_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
|
||||
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 '</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
|
||||
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">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
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 '</td>';
|
||||
print '<td align="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketsPublicNotificationNewMessageHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// 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 '<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 align="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help');
|
||||
print '</td></tr>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -214,10 +214,6 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
|
||||
print '<br>';
|
||||
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)) {
|
||||
print '<div class="formelementrow">';
|
||||
@ -239,14 +235,35 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print '<option value="ORACLE">ORACLE</option>';
|
||||
print '<option value="POSTGRESQL">POSTGRESQL</option>';
|
||||
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 $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter'), $langs->trans('ExportUseMySQLQuickParameterHelp'));
|
||||
print '</label>';
|
||||
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 '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||
print '-->';
|
||||
|
||||
@ -137,7 +137,8 @@ $dirtocompress = basename($fulldirtocompress);
|
||||
|
||||
if ($compression == '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($outputdir."/".$file);exit;
|
||||
|
||||
@ -71,6 +71,12 @@ $workflowcodes = array(
|
||||
'enabled'=>(!empty($conf->commande->enabled) && !empty($conf->facture->enabled)),
|
||||
'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'=>''),
|
||||
|
||||
@ -161,7 +167,21 @@ $workflowcodes = array(
|
||||
'position' => 90,
|
||||
'enabled' => ! empty($conf->expedition->enabled) && ! empty($conf->facture->enabled),
|
||||
'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'])) {
|
||||
@ -237,6 +257,11 @@ foreach ($workflowcodes as $key => $params) {
|
||||
if ($reg[1] == 'shipping') {
|
||||
$header .= ' - '.$langs->trans('Shipment');
|
||||
}
|
||||
} elseif (preg_match('/link_(.*)/', $params['family'], $reg)) {
|
||||
$header = $langs->trans("AutomaticLinking");
|
||||
if ($reg[1] == 'ticket') {
|
||||
$header .= ' - '.$langs->trans('Ticket');
|
||||
}
|
||||
} else {
|
||||
$header = $langs->trans("Description");
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ https://**yourdolibarr.tld**/mydolibarr/api/index.php/otherservice?DOLAPIKEY=**a
|
||||
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
|
||||
|
||||
|
||||
@ -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).
|
||||
* @return array List of documents
|
||||
*
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
* @throws RestException 501
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
@ -249,7 +249,7 @@ class Documents extends DolibarrApi
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
* @url GET /
|
||||
*/
|
||||
@ -546,7 +546,7 @@ class Documents extends DolibarrApi
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
* @url POST /upload
|
||||
*/
|
||||
|
||||
@ -158,6 +158,25 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $
|
||||
$api = new DolibarrApi($db, '', $refreshcache);
|
||||
//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.
|
||||
// See https://github.com/Luracast/Restler-API-Explorer for more info.
|
||||
$api->r->addAPIClass('Luracast\\Restler\\Explorer');
|
||||
|
||||
@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedopjectblock.tpl.php -->\n";
|
||||
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedobjectblock.tpl.php -->\n";
|
||||
|
||||
global $user;
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
|
||||
@ -519,7 +519,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$keyforbreak = 'duration';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||
$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>';
|
||||
|
||||
// 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';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("mrp", "other"));
|
||||
$langs->loadLangs(array("mrp", "other", "stocks"));
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
@ -170,7 +170,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
$keyforbreak = 'duration';
|
||||
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>';
|
||||
|
||||
// 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 '</td>';
|
||||
print '<td class="linecolqty">'.$langs->trans('Quantity').'</td>';
|
||||
print '<td class="linecolstock">'.$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="linecolqty right">'.$langs->trans('Quantity').'</td>';
|
||||
print '<td class="linecolstock right">'.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).'</td>';
|
||||
print '<td class="linecoltheoricalstock right">'.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'</td>';
|
||||
print '</tr>';
|
||||
if (! empty($TChildBom)) {
|
||||
if ($action == 'treeview') {
|
||||
@ -227,9 +227,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print img_picto('', 'folder-open');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
print '<td class="linecolqty">'.$TProduct['qty'].'</td>';
|
||||
print '<td class="linecolstock"></td>';
|
||||
print '<td class="linecoltheoricalstock"></td>';
|
||||
print '<td class="linecolqty right">'.$TProduct['qty'].'</td>';
|
||||
print '<td class="linecolstock right"></td>';
|
||||
print '<td class="linecoltheoricalstock right"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
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.'">';
|
||||
else print '<tr class="oddeven">';
|
||||
print '<td class="linecoldescription">'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).'</td>';
|
||||
print '<td class="linecolqty">'.$TInfos['qty'].'</td>';
|
||||
print '<td class="linecolstock">'.$prod->stock_reel.'</td>';
|
||||
print '<td class="linecoltheoricalstock">'.$prod->stock_theorique.'</td>';
|
||||
print '<td class="linecolqty right">'.$TInfos['qty'].'</td>';
|
||||
print '<td class="linecolstock right">'.price2num($prod->stock_reel, 'MS').'</td>';
|
||||
print '<td class="linecoltheoricalstock right">'.$prod->stock_theorique.'</td>';
|
||||
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;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="linecoldescription">'.$prod->getNomUrl(1).'</td>';
|
||||
print '<td class="linecolqty">'.$qty.'</td>';
|
||||
print '<td class="linecolstock">'.$prod->stock_reel.'</td>';
|
||||
print '<td class="linecoltheoricalstock">'.$prod->stock_theorique.'</td>';
|
||||
print '<td class="linecolqty right">'.$qty.'</td>';
|
||||
print '<td class="linecolstock right">'.price2num($prod->stock_reel, 'MS').'</td>';
|
||||
print '<td class="linecoltheoricalstock right">'.$prod->stock_theorique.'</td>';
|
||||
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_...).
|
||||
* '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).
|
||||
* '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.
|
||||
* '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.
|
||||
@ -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",),
|
||||
'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',),
|
||||
'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'=>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'),
|
||||
@ -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
|
||||
*
|
||||
|
||||
@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
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 $noMoreLinkedObjectBlockAfter;
|
||||
|
||||
@ -126,7 +126,7 @@ print '</td>';
|
||||
$total_cost = 0;
|
||||
print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">';
|
||||
$coldisplay++;
|
||||
echo price($line->total_cost);
|
||||
echo '<span class="amount">'.price($line->total_cost).'</span>';
|
||||
print '</td>';
|
||||
|
||||
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">';
|
||||
$coldisplay++;
|
||||
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');
|
||||
print '</a>';
|
||||
}
|
||||
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');
|
||||
print '</a>';
|
||||
}
|
||||
@ -236,15 +236,16 @@ if ($resql) {
|
||||
// Efficiency
|
||||
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)) {
|
||||
$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;
|
||||
} 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;
|
||||
} 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;
|
||||
} 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';
|
||||
@ -254,7 +255,7 @@ if ($resql) {
|
||||
$obj = $object->db->fetch_object($resql_supplier_price);
|
||||
$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;
|
||||
}
|
||||
}
|
||||
@ -266,11 +267,12 @@ if ($resql) {
|
||||
}
|
||||
|
||||
// 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) {
|
||||
$line->total_cost = price($total_cost);
|
||||
?>
|
||||
<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>
|
||||
<?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)
|
||||
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) {
|
||||
//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
|
||||
@ -1174,7 +1174,6 @@ class Categorie extends CommonObject
|
||||
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.
|
||||
* It is called by get_full_arbo()
|
||||
@ -1185,19 +1184,18 @@ class Categorie extends CommonObject
|
||||
* @return void
|
||||
* @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)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
|
||||
//dol_syslog(get_class($this)."::buildPathFromId id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
|
||||
|
||||
if (!empty($this->cats[$id_categ]['fullpath'])) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
|
||||
@ -133,7 +133,9 @@ if (empty($nosearch)) {
|
||||
print '</span>';
|
||||
print "</td>\n";
|
||||
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 "\t</tr>\n";
|
||||
}
|
||||
|
||||
@ -701,7 +701,7 @@ if (empty($reshook) && $action == 'update') {
|
||||
$categories = GETPOST('categories', 'array');
|
||||
$object->setCategories($categories);
|
||||
|
||||
$object->loadReminders();
|
||||
$object->loadReminders($remindertype, 0, false);
|
||||
if (!empty($object->reminders) && $object->datep > dol_now()) {
|
||||
foreach ($object->reminders as $reminder) {
|
||||
$reminder->delete($user);
|
||||
@ -1491,6 +1491,10 @@ if ($id > 0) {
|
||||
$("#fullday").change(function() {
|
||||
setdatefields();
|
||||
});
|
||||
$("#actioncode").change(function() {
|
||||
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
|
||||
else $("#dateend").removeClass("fieldrequired");
|
||||
});
|
||||
})';
|
||||
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>';
|
||||
|
||||
// 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');
|
||||
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) {
|
||||
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 {
|
||||
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 ' - ';
|
||||
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) {
|
||||
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 {
|
||||
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>';
|
||||
|
||||
@ -1988,11 +1996,15 @@ if ($id > 0) {
|
||||
|
||||
// Date start
|
||||
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)) {
|
||||
print dol_print_date($object->datep, 'dayhour', 'tzuser');
|
||||
print dol_print_date($object->datep, 'dayhour', 'tzuserrel');
|
||||
} else {
|
||||
$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)) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
@ -2003,10 +2015,10 @@ if ($id > 0) {
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
|
||||
if (empty($object->fulldayevent)) {
|
||||
print dol_print_date($object->datef, 'dayhour', 'tzuser');
|
||||
print dol_print_date($object->datef, 'dayhour', 'tzuserrel');
|
||||
} else {
|
||||
$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)) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
|
||||
@ -868,6 +868,16 @@ class ActionComm extends CommonObject
|
||||
$this->event_paid = $obj->event_paid;
|
||||
$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();
|
||||
|
||||
if ($loadresources) {
|
||||
@ -1582,8 +1592,25 @@ class ActionComm extends CommonObject
|
||||
if (isset($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)) {
|
||||
$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 = '';
|
||||
//if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
||||
@ -1594,9 +1621,8 @@ class ActionComm extends CommonObject
|
||||
$label = $langs->trans("ShowAction");
|
||||
$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"';
|
||||
|
||||
/*
|
||||
$hookmanager->initHooks(array('actiondao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
@ -2210,6 +2236,26 @@ class ActionComm extends CommonObject
|
||||
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?
|
||||
*
|
||||
|
||||
@ -186,35 +186,55 @@ class CActionComm
|
||||
|
||||
$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)) {
|
||||
$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 ($obj->module == 'invoice' && empty($conf->facture->enabled) && empty($user->facture->lire)) {
|
||||
$qualified = 0;
|
||||
//var_dump($obj->type.' '.$obj->module.' '); var_dump($user->rights->facture->lire);
|
||||
$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)) {
|
||||
$qualified = 0;
|
||||
if ($obj->module == 'order' && !empty($conf->commande->enabled) && empty($user->rights->commande->lire)) {
|
||||
$qualified = 1;
|
||||
}
|
||||
if ($obj->module == 'propal' && empty($conf->propal->enabled) && empty($user->propale->lire)) {
|
||||
$qualified = 0;
|
||||
if ($obj->module == 'propal' && !empty($conf->propal->enabled) && !empty($user->rights->propale->lire)) {
|
||||
$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)))) {
|
||||
$qualified = 0;
|
||||
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 = 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)))) {
|
||||
$qualified = 0;
|
||||
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 = 1;
|
||||
}
|
||||
if ($obj->module == 'shipping' && empty($conf->expedition->enabled) && empty($user->expedition->lire)) {
|
||||
$qualified = 0;
|
||||
if ($obj->module == 'shipping' && !empty($conf->expedition->enabled) && !empty($user->rights->expedition->lire)) {
|
||||
$qualified = 1;
|
||||
}
|
||||
if (preg_match('/@eventorganization/', $obj->module) && empty($conf->eventorganization->enabled) && empty($user->eventorganization->read)) {
|
||||
$qualified = 0;
|
||||
// For the generic case with type = 'module...' and module = 'myobject@mymodule'
|
||||
$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)) {
|
||||
$qualified = 0;
|
||||
// For the case type is not 'system...' neither 'module', we just check module is on
|
||||
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;
|
||||
|
||||
$filter = GETPOST("search_filter", 'alpha', 3) ?GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||
$filtert = GETPOST("search_filtert", "int", 3) ?GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
||||
$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;
|
||||
$check_holiday = GETPOST('check_holiday', 'int');
|
||||
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||
$filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3);
|
||||
$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 (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) {
|
||||
$event = new ActionComm($db);
|
||||
$event->fetch($actionid);
|
||||
$event->fetch_optionals();
|
||||
$event->fetch_userassigned();
|
||||
$event->oldcopy = clone $event;
|
||||
if ($action == 'delete_action' && $user->rights->agenda->delete) {
|
||||
$event = new ActionComm($db);
|
||||
$event->fetch($actionid);
|
||||
$event->fetch_optionals();
|
||||
$event->fetch_userassigned();
|
||||
$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";
|
||||
|
||||
// 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
|
||||
$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
|
||||
if (is_array($showextcals) && count($showextcals) > 0) {
|
||||
@ -607,13 +608,13 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
|
||||
foreach ($showextcals as $val) {
|
||||
$htmlname = md5($val['name']);
|
||||
|
||||
if (!empty($val['default'])) {
|
||||
if (!empty($val['default']) || GETPOST('check_ext'.$htmlname, 'int')) {
|
||||
$default = "checked";
|
||||
} else {
|
||||
$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->socid = $obj->fk_soc;
|
||||
$event->thirdparty_id = $obj->fk_soc;
|
||||
$event->contact_id = $obj->fk_contact;
|
||||
|
||||
// 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
|
||||
$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 '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 '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 'TZUSER '.$event->date_end_in_calendar.' '.dol_print_date($event->date_end_in_calendar, 'dayhour', 'tzuserrel').'<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 '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 '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>';
|
||||
*/
|
||||
do {
|
||||
//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>';
|
||||
@ -929,7 +931,7 @@ if ($showbirthday) {
|
||||
$sql = 'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp';
|
||||
$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') {
|
||||
$sql .= ' AND MONTH(birthday) = '.((int) $month);
|
||||
$sql .= ' AND DAY(birthday) = '.((int) $day);
|
||||
|
||||
@ -943,8 +943,8 @@ while ($i < min($num, $limit)) {
|
||||
// Description
|
||||
if (!empty($arrayfields['a.note']['checked'])) {
|
||||
print '<td class="tdoverflowonsmartphone">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0));
|
||||
print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private);
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 1));
|
||||
print $form->textwithtooltip(dol_trunc($text, 48), $actionstatic->note_private);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2015-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* 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
|
||||
* 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.'/core/class/html.formcompany.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)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
}
|
||||
@ -112,6 +114,7 @@ $cancel = GETPOST('cancel', 'alpha');
|
||||
|
||||
$object = new Client($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
@ -159,7 +162,8 @@ if (empty($reshook)) {
|
||||
// set accountancy code
|
||||
if ($action == 'setcustomeraccountancycode') {
|
||||
$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);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -357,9 +361,9 @@ if ($object->id > 0) {
|
||||
|
||||
print '<tr>';
|
||||
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 $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 '</tr>';
|
||||
}
|
||||
@ -683,7 +687,7 @@ if ($object->id > 0) {
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="underbanner underbanner-before-box clearboth"></div>';
|
||||
|
||||
$boxstat = '';
|
||||
|
||||
@ -691,7 +695,7 @@ if ($object->id > 0) {
|
||||
$MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||
|
||||
// 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 .= '<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_ttc = $objp->total_ttc;
|
||||
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) {
|
||||
print " ".img_warning();
|
||||
}
|
||||
@ -940,7 +974,38 @@ if ($object->id > 0) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">';
|
||||
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" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).'</td></tr>';
|
||||
$i++;
|
||||
@ -1003,6 +1068,35 @@ if ($object->id > 0) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">';
|
||||
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>';
|
||||
if ($objp->date_creation > 0) {
|
||||
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 '<td class="nowraponall">';
|
||||
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 "</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 '<td class="nowraponall">';
|
||||
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 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";
|
||||
@ -1213,6 +1365,7 @@ if ($object->id > 0) {
|
||||
print '<td class="nowrap">';
|
||||
print $invoicetemplate->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
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>';
|
||||
} else {
|
||||
@ -1301,6 +1454,35 @@ if ($object->id > 0) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">';
|
||||
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>';
|
||||
if ($objp->df > 0) {
|
||||
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 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||
$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) {
|
||||
$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) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = $socid";
|
||||
// Add where from hooks
|
||||
$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 .= $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) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
$sql .= " AND s.rowid = ".((int) $socid);
|
||||
// Add where from hooks
|
||||
$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 .= $db->plimit($max, 0);
|
||||
|
||||
|
||||
@ -686,7 +686,7 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
|
||||
$sqlwhere = array();
|
||||
|
||||
$sqlwhere[] = 't.entity IN ('.getEntity('socpeople').')';
|
||||
$sqlwhere[] = 't.entity IN ('.getEntity('contact').')';
|
||||
|
||||
if (count($arrayquery) > 0) {
|
||||
if (array_key_exists('contact_categ', $arrayquery)) {
|
||||
|
||||
@ -116,7 +116,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)));
|
||||
$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;
|
||||
$usercancreateinvoice = $user->rights->facture->creer;
|
||||
@ -220,7 +220,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) {
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
exit();
|
||||
@ -246,8 +246,11 @@ if (empty($reshook)) {
|
||||
// Remove line
|
||||
$result = $object->deleteline($lineid);
|
||||
// reorder lines
|
||||
if ($result) {
|
||||
if ($result > 0) {
|
||||
$object->line_order(true);
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||
@ -1889,11 +1892,13 @@ if ($action == 'create') {
|
||||
$title = $langs->trans('ProductsAndServices');
|
||||
print load_fiche_titre($title);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
$objectsrc->printOriginLinesList();
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
} elseif ($object->id > 0) {
|
||||
/*
|
||||
@ -1914,8 +1919,8 @@ if ($action == 'create') {
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// 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)'))
|
||||
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)) {
|
||||
$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 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*/
|
||||
public function deleteContact($id, $contactid, $type)
|
||||
{
|
||||
@ -799,7 +799,7 @@ class Proposals extends DolibarrApi
|
||||
* @throws RestException 304
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@ -992,6 +992,8 @@ class Propal extends CommonObject
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $line->error;
|
||||
$this->errors = $line->errors;
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -1324,11 +1326,12 @@ class Propal extends CommonObject
|
||||
* @param User $user User making the clone
|
||||
* @param int $socid Id of thirdparty
|
||||
* @param int $forceentity Entity id to force
|
||||
* @param bool $update_prices [=false] Update prices if true
|
||||
* @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');
|
||||
|
||||
@ -1375,6 +1378,55 @@ class Propal extends CommonObject
|
||||
$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->ref = '';
|
||||
$object->entity = (!empty($forceentity) ? $forceentity : $object->entity);
|
||||
@ -1730,8 +1782,9 @@ class Propal extends CommonObject
|
||||
*/
|
||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0, $filters = '')
|
||||
{
|
||||
global $langs, $conf;
|
||||
// phpcs:enable
|
||||
global $langs, $conf;
|
||||
|
||||
$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,';
|
||||
@ -3768,8 +3821,24 @@ class Propal extends CommonObject
|
||||
|
||||
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
|
||||
@ -4194,36 +4263,40 @@ class PropaleLigne extends CommonObjectLine
|
||||
$error = 0;
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".((int) $this->rowid);
|
||||
dol_syslog("PropaleLigne::delete", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
// Remove extrafields
|
||||
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);
|
||||
}
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('LINEPROPAL_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('LINEPROPAL_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int) $this->rowid);
|
||||
dol_syslog("PropaleLigne::delete", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
// Remove extrafields
|
||||
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();
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->error()." sql=".$sql;
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4369,7 +4442,7 @@ class PropaleLigne extends CommonObjectLine
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('LINEPROPAL_UPDATE', $user);
|
||||
$result = $this->call_trigger('LINEPROPAL_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
|
||||
@ -356,12 +356,12 @@ if ($action == 'validate' && $permissiontovalidate) {
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($tmpproposal->fetch($checked)) {
|
||||
if ($tmpproposal->statut == 0) {
|
||||
if ($tmpproposal->valid($user)) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
|
||||
if ($tmpproposal->valid($user) > 0) {
|
||||
setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
|
||||
} else {
|
||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
||||
setEventMessage($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
@ -370,7 +370,7 @@ if ($action == 'validate' && $permissiontovalidate) {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -388,21 +388,21 @@ if ($action == "sign" && $permissiontoclose) {
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($tmpproposal->fetch($checked)) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||
$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');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
|
||||
setEventMessage($langs->trans('MustBeValidatedToBeSigned', $tmpproposal->ref), 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -413,27 +413,28 @@ if ($action == "sign" && $permissiontoclose) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == "nosign" && $permissiontoclose) {
|
||||
if (GETPOST('confirm') == 'yes') {
|
||||
$tmpproposal = new Propal($db);
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($tmpproposal->fetch($checked)) {
|
||||
if ($tmpproposal->fetch($checked) > 0) {
|
||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||
$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');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors');
|
||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeNoSign'), 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
||||
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->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->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->facture->creer)
|
||||
|
||||
|
||||
@ -1369,7 +1369,7 @@ if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// 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;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
@ -1862,11 +1862,13 @@ if ($action == 'create' && $usercancreate) {
|
||||
$title = $langs->trans('ProductsAndServices');
|
||||
print load_fiche_titre($title);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
$objectsrc->printOriginLinesList('', $selectedLines);
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
@ -2520,27 +2522,27 @@ if ($action == 'create' && $usercancreate) {
|
||||
if (empty($reshook)) {
|
||||
// Reopen a closed order
|
||||
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
|
||||
if (empty($user->socid)) {
|
||||
if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
||||
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 {
|
||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a>';
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Valid
|
||||
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
|
||||
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
|
||||
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD))
|
||||
@ -2555,7 +2557,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
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 ($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 +2568,9 @@ if ($action == 'create' && $usercancreate) {
|
||||
|
||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
||||
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 {
|
||||
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 +2580,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
$langs->load("contracts");
|
||||
|
||||
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 +2592,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 (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->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 {
|
||||
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 {
|
||||
$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
|
||||
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
|
||||
// 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 (!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)) {
|
||||
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 ($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
|
||||
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
|
||||
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
|
||||
if ($usercandelete) {
|
||||
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 {
|
||||
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
|
||||
$this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
|
||||
$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);
|
||||
}
|
||||
|
||||
@ -230,6 +235,10 @@ class Orders extends DolibarrApi
|
||||
if ($commande_static->fetch($obj->rowid)) {
|
||||
// Add external contacts ids
|
||||
$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);
|
||||
}
|
||||
$i++;
|
||||
@ -574,7 +583,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*/
|
||||
public function deleteContact($id, $contactid, $type)
|
||||
{
|
||||
@ -704,7 +713,7 @@ class Orders extends DolibarrApi
|
||||
* @throws RestException 304
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -735,6 +744,10 @@ class Orders extends DolibarrApi
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
@ -974,7 +987,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*/
|
||||
public function getOrderShipments($id)
|
||||
{
|
||||
@ -1030,7 +1043,7 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*/
|
||||
public function createOrderShipment($id, $warehouse_id)
|
||||
{
|
||||
|
||||
@ -9,9 +9,9 @@
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2016-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021-2022 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
|
||||
@ -266,6 +266,11 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
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')
|
||||
@ -519,6 +524,7 @@ class Commande extends CommonOrder
|
||||
if ($this->lines[$i]->fk_product > 0) {
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
$mouvP->origin = &$this;
|
||||
$mouvP->setOrigin($this->element, $this->id);
|
||||
// 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));
|
||||
if ($result < 0) {
|
||||
@ -647,6 +653,7 @@ class Commande extends CommonOrder
|
||||
if ($this->lines[$i]->fk_product > 0) {
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
$mouvP->origin = &$this;
|
||||
$mouvP->setOrigin($this->element, $this->id);
|
||||
// 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));
|
||||
if ($result < 0) {
|
||||
@ -828,6 +835,7 @@ class Commande extends CommonOrder
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
if ($this->lines[$i]->fk_product > 0) {
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
$mouvP->setOrigin($this->element, $this->id);
|
||||
// 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
|
||||
if ($result < 0) {
|
||||
@ -2028,8 +2036,9 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
// phpcs:enable
|
||||
global $langs, $conf;
|
||||
|
||||
$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,';
|
||||
@ -3666,9 +3675,10 @@ class Commande extends CommonOrder
|
||||
* @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 $addlinktonotes Add link to notes
|
||||
* @param string $target attribute target for link
|
||||
* @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;
|
||||
|
||||
@ -3722,7 +3732,7 @@ class Commande extends CommonOrder
|
||||
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
}
|
||||
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)) {
|
||||
$label .= '<br><b>'.$langs->trans('DeliveryDate').':</b> '.dol_print_date($this->delivery_date, 'dayhour');
|
||||
@ -3737,6 +3747,11 @@ class Commande extends CommonOrder
|
||||
}
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$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.'"';
|
||||
@ -4024,6 +4039,23 @@ class Commande extends CommonOrder
|
||||
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?
|
||||
*
|
||||
@ -4622,7 +4654,7 @@ class OrderLine extends CommonOrderLine
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('LINEORDER_UPDATE', $user);
|
||||
$result = $this->call_trigger('LINEORDER_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
$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),
|
||||
'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.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999),
|
||||
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
|
||||
);
|
||||
// Extra fields
|
||||
@ -318,7 +319,7 @@ if ($action == 'validate' && $permissiontoadd) {
|
||||
if ($objecttmp->valid($user, $idwarehouse)) {
|
||||
setEventMessage($langs->trans('hasBeenValidated', $objecttmp->ref), 'mesgs');
|
||||
} else {
|
||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
||||
setEventMessage($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
@ -345,7 +346,7 @@ if ($action == 'shipped' && $permissiontoadd) {
|
||||
$error = 0;
|
||||
foreach ($toselect as $checked) {
|
||||
if ($objecttmp->fetch($checked)) {
|
||||
if ($objecttmp->statut == 1) {
|
||||
if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
|
||||
if ($objecttmp->cloture($user)) {
|
||||
setEventMessage($langs->trans('PassedInClosedStatus', $objecttmp->ref), 'mesgs');
|
||||
} 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 .= ' 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_input_reason';
|
||||
$sql .= ' c.fk_input_reason, c.import_key';
|
||||
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
|
||||
$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 '</td>';
|
||||
}
|
||||
// Import key
|
||||
if (!empty($arrayfields['c.import_key']['checked'])) {
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
||||
print '<td class="liste_titre maxwidthonsmartphone center">';
|
||||
@ -1436,6 +1442,9 @@ if ($resql) {
|
||||
if (!empty($arrayfields['c.facture']['checked'])) {
|
||||
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'])) {
|
||||
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']++;
|
||||
}
|
||||
}
|
||||
// Import key
|
||||
if (!empty($arrayfields['c.import_key']['checked'])) {
|
||||
print '<td class="nowrap center">'.$obj->import_key.'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Status
|
||||
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
||||
print '<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).'</td>';
|
||||
|
||||
@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedopjectblock.tpl.php -->\n";
|
||||
print "<!-- BEGIN PHP TEMPLATE commande/tpl/linkedobjectblock.tpl.php -->\n";
|
||||
|
||||
global $user;
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
|
||||
@ -19,11 +19,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/accounting-files.php
|
||||
* \ingroup compta
|
||||
* \brief Page to show portoflio and files of a thirdparty and download it
|
||||
*/
|
||||
/**
|
||||
* \file htdocs/compta/accounting-files.php
|
||||
* \ingroup compta
|
||||
* \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 (!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 '<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 dol_get_fiche_end();
|
||||
|
||||
if (!empty($date_start) && !empty($date_stop)) {
|
||||
$param = 'action=searchfiles';
|
||||
$param .= '&date_startday='.GETPOST('date_startday', 'int');
|
||||
$param .= '&date_startmonth='.GETPOST('date_startmonth', '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_stopyear='.GETPOST('date_stopyear', 'int');
|
||||
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');
|
||||
|
||||
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_startmonth" value="'.GETPOST('date_startmonth', '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 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 '<br>';
|
||||
|
||||
@ -645,172 +666,181 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
print '<td class="center">'.$langs->trans("Currency").'</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
if ($result) {
|
||||
$TData = dol_sort_array($filesarray, $sortfield, $sortorder);
|
||||
|
||||
if (empty($TData)) {
|
||||
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
if (empty($TData)) {
|
||||
print '<tr class="oddeven"><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
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>';
|
||||
} else {
|
||||
// Sort array by date ASC to calculate balance
|
||||
print '</td>';
|
||||
|
||||
$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>'.$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>';
|
||||
// File link
|
||||
print '<td class="tdoverflowmax150">';
|
||||
if (!empty($data['files'])) {
|
||||
foreach ($data['files'] as $id => $filecursor) {
|
||||
$tmppreview = $formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name'], 0);
|
||||
if ($tmppreview) {
|
||||
print $tmppreview;
|
||||
}
|
||||
$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
|
||||
print '<td aling="left">'.$data['paid'].'</td>';
|
||||
// Paid
|
||||
print '<td class="center">'.($data['paid'] ? yn($data['paid']) : '').'</td>';
|
||||
|
||||
// Total ET
|
||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</td>\n";
|
||||
// Total IT
|
||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</td>\n";
|
||||
// Total VAT
|
||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</td>\n";
|
||||
// Total ET
|
||||
print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</span></td>\n";
|
||||
// Total IT
|
||||
print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</span></td>\n";
|
||||
// Total VAT
|
||||
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']) {
|
||||
$totalET_credit += $data['amount_ht'];
|
||||
$totalIT_credit += $data['amount_ttc'];
|
||||
$totalVAT_credit += $data['amount_vat'];
|
||||
} else {
|
||||
$totalET_debit -= $data['amount_ht'];
|
||||
$totalIT_debit -= $data['amount_ttc'];
|
||||
$totalVAT_debit -= $data['amount_vat'];
|
||||
}
|
||||
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="center">'.$data['currency']."</td>\n";
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
if ($data['sens']) {
|
||||
$totalET_credit += $data['amount_ht'];
|
||||
$totalIT_credit += $data['amount_ttc'];
|
||||
$totalVAT_credit += $data['amount_vat'];
|
||||
} else {
|
||||
$totalET_debit -= $data['amount_ht'];
|
||||
$totalIT_debit -= $data['amount_ttc'];
|
||||
$totalVAT_debit -= $data['amount_vat'];
|
||||
}
|
||||
|
||||
// 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 '<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)) {
|
||||
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 '</div>';
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ $arrayfields = array(
|
||||
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
|
||||
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
|
||||
'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
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
||||
@ -65,7 +65,8 @@ $hookmanager->initHooks(array('bankcard', 'globalcard'));
|
||||
|
||||
// Security check
|
||||
$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);
|
||||
|
||||
|
||||
@ -724,7 +725,7 @@ if ($action == 'create') {
|
||||
print '</table>';
|
||||
|
||||
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">';
|
||||
|
||||
|
||||
@ -866,7 +866,7 @@ class Account extends CommonObject
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('BANKACCOUNT_UPDATE', $user);
|
||||
$result = $this->call_trigger('BANKACCOUNT_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
@ -1728,7 +1728,7 @@ class Account extends CommonObject
|
||||
if ($dbs->query($sql)) {
|
||||
return true;
|
||||
} 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();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -60,10 +60,11 @@ $newbankreceipt = GETPOST('newbankreceipt', 'alpha');
|
||||
|
||||
// Security check
|
||||
$fieldid = (!empty($ref) ? $ref : $id);
|
||||
$fieldname = isset($ref) ? 'ref' : 'rowid';
|
||||
$fieldname = (!empty($ref) ? 'ref' : 'rowid');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'banque', $fieldid, 'bank_account', '', '', $fieldname);
|
||||
|
||||
if ($user->rights->banque->consolidate && $action == 'dvnext' && !empty($dvid)) {
|
||||
|
||||
@ -179,7 +179,7 @@ if (empty($reshook)) {
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if ($action == 'delete') {
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
|
||||
@ -208,6 +208,9 @@ if (empty($reshook)) {
|
||||
$object->model_pdf = GETPOST('modelpdf', '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->unit_frequency = GETPOST('unit_frequency', 'alpha');
|
||||
$object->nb_gen_max = $nb_gen_max;
|
||||
@ -261,8 +264,6 @@ if (empty($reshook)) {
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = "create";
|
||||
}
|
||||
}
|
||||
@ -966,7 +967,7 @@ if ($action == 'create') {
|
||||
|
||||
// Title
|
||||
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>';
|
||||
|
||||
// Third party
|
||||
@ -1027,12 +1028,14 @@ if ($action == 'create') {
|
||||
|
||||
// Payment term
|
||||
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>";
|
||||
|
||||
// Payment mode
|
||||
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>";
|
||||
|
||||
// Project
|
||||
@ -1040,8 +1043,9 @@ if ($action == 'create') {
|
||||
$projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project;
|
||||
$langs->load('projects');
|
||||
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, '');
|
||||
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>';
|
||||
}
|
||||
|
||||
@ -1074,7 +1078,8 @@ if ($action == 'create') {
|
||||
|
||||
// Frequency + unit
|
||||
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>";
|
||||
|
||||
// Date next run
|
||||
@ -1474,15 +1479,16 @@ if ($action == 'create') {
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<table class="nobordernopadding">';
|
||||
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 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>';
|
||||
} else {
|
||||
if ($object->frequency > 0) {
|
||||
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
|
||||
} else {
|
||||
print $langs->trans("NotARecurringInvoiceTemplate");
|
||||
print '<span class="opacitymedium">'.$langs->trans("NotARecurringInvoiceTemplate").'</span>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
@ -156,12 +156,12 @@ if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
||||
}
|
||||
|
||||
// Security check
|
||||
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$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 +302,14 @@ if (empty($reshook)) {
|
||||
// Validation
|
||||
$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
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
// Si avoir, le signe doit etre negatif
|
||||
@ -538,7 +546,8 @@ if (empty($reshook)) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2));
|
||||
} 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
|
||||
if (GETPOST("remise_id", 'int') > 0) {
|
||||
@ -549,7 +558,8 @@ if (empty($reshook)) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db, $object->error);
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
// We use the credit to reduce remain to pay
|
||||
@ -560,7 +570,8 @@ if (empty($reshook)) {
|
||||
|
||||
//var_dump($object->getRemainToPay(0));
|
||||
//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
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorDiscountLargerThanRemainToPaySplitItBefore"), null, 'errors');
|
||||
@ -569,12 +580,26 @@ if (empty($reshook)) {
|
||||
if (!$error) {
|
||||
$result = $discount->link_to_invoice(0, $id);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
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;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
||||
@ -607,63 +632,6 @@ if (empty($reshook)) {
|
||||
$object->fetch($id);
|
||||
$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
|
||||
if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||
$qualified_for_stock_change = 0;
|
||||
@ -769,7 +737,7 @@ if (empty($reshook)) {
|
||||
|
||||
// On verifie si aucun paiement n'a ete effectue
|
||||
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);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -3058,7 +3026,7 @@ if ($action == 'create') {
|
||||
if (empty($conf->global->INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE)) {
|
||||
$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">';
|
||||
@ -3554,7 +3522,7 @@ if ($action == 'create') {
|
||||
|
||||
if ($socid > 0) {
|
||||
// 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;
|
||||
$discount_type = 0;
|
||||
@ -3847,17 +3815,18 @@ if ($action == 'create') {
|
||||
$title = $langs->trans('ProductsAndServices');
|
||||
print load_fiche_titre($title);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
$objectsrc->printOriginLinesList('', $selectedLines);
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print "</form>\n";
|
||||
} elseif ($id > 0 || !empty($ref)) {
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
@ -4386,8 +4355,8 @@ if ($action == 'create') {
|
||||
|
||||
// Relative and absolute discounts
|
||||
print '<!-- Discounts -->'."\n";
|
||||
print '<tr><td>'.$langs->trans('Discounts');
|
||||
print '</td><td>';
|
||||
print '<tr><td>'.$langs->trans('DiscountStillRemaining').'</td>';
|
||||
print '<td>';
|
||||
$thirdparty = $soc;
|
||||
$discount_type = 0;
|
||||
$backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id);
|
||||
@ -4818,6 +4787,7 @@ if ($action == 'create') {
|
||||
|
||||
// List of previous situation invoices
|
||||
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 '<tr class="liste_titre">';
|
||||
@ -4956,15 +4926,16 @@ if ($action == 'create') {
|
||||
|
||||
// List of payments already done
|
||||
|
||||
print '<!-- List of payments already done -->';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder paymenttable centpercent">';
|
||||
|
||||
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">'.$langs->trans('Date').'</td>';
|
||||
print '<td class="liste_titre">'.$langs->trans('Type').'</td>';
|
||||
print '<td class="liste_titre"><span class="hideonsmartphone">'.$langs->trans('Date').'</span></td>';
|
||||
print '<td class="liste_titre"><span class="hideonsmartphone">'.$langs->trans('Type').'</span></td>';
|
||||
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" width="18"> </td>';
|
||||
@ -5251,7 +5222,7 @@ if ($action == 'create') {
|
||||
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)) {
|
||||
$blocname = 'contacts';
|
||||
@ -5359,27 +5330,37 @@ if ($action == 'create') {
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$params = array(
|
||||
'attr' => array(
|
||||
'title' => '',
|
||||
'class' => 'classfortooltip'
|
||||
)
|
||||
);
|
||||
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
|
||||
if ($object->statut == Facture::STATUS_VALIDATED) {
|
||||
// We check if lines of invoice are not already transfered into accountancy
|
||||
$ventilExportCompta = $object->getVentilExportCompta();
|
||||
|
||||
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 ($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 {
|
||||
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()) {
|
||||
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 {
|
||||
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 {
|
||||
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 +5375,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
|
||||
&& ((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
|
||||
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 {
|
||||
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 +5396,7 @@ if ($action == 'create') {
|
||||
// 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 ($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 +5407,9 @@ if ($action == 'create') {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendMail').'</span>';
|
||||
} else {
|
||||
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 {
|
||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a>';
|
||||
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5464,10 +5446,12 @@ if ($action == 'create') {
|
||||
} else {
|
||||
if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) {
|
||||
// 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 {
|
||||
// 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 +5500,10 @@ if ($action == 'create') {
|
||||
) {
|
||||
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)
|
||||
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 {
|
||||
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 +5548,13 @@ if ($action == 'create') {
|
||||
|
||||
// Clone
|
||||
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
|
||||
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) {
|
||||
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 +5587,35 @@ if ($action == 'create') {
|
||||
|
||||
// Delete
|
||||
$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)
|
||||
//var_dump($isErasable);
|
||||
$enableDelete = false;
|
||||
$deleteHref = '#';
|
||||
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) {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastSituationInvoice").'">'.$langs->trans('Delete').'</a>';
|
||||
$params['attr']['title'] = $langs->trans('DisabledBecauseNotLastSituationInvoice');
|
||||
} 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) {
|
||||
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
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotErasable").'">'.$langs->trans('Delete').'</a>';
|
||||
$params['attr']['title'] = $langs->trans('DisabledBecauseNotErasable');
|
||||
} elseif ($objectidnext) {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Delete').'</a>';
|
||||
$params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice');
|
||||
} 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 {
|
||||
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>';
|
||||
|
||||
@ -519,7 +519,7 @@ class Invoices extends DolibarrApi
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*/
|
||||
public function deleteContact($id, $contactid, $type)
|
||||
{
|
||||
@ -661,7 +661,7 @@ class Invoices extends DolibarrApi
|
||||
|
||||
$result = $this->invoice->delete(DolibarrApiAccess::$user);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500);
|
||||
throw new RestException(500, 'Error when deleting invoice');
|
||||
}
|
||||
|
||||
return array(
|
||||
@ -780,7 +780,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws RestException 304
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
*/
|
||||
public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
|
||||
@ -829,7 +829,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws RestException 304
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
*/
|
||||
public function settodraft($id, $idwarehouse = -1)
|
||||
@ -932,7 +932,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws RestException 304
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*/
|
||||
public function settopaid($id, $close_code = '', $close_note = '')
|
||||
{
|
||||
@ -982,7 +982,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws RestException 304
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*/
|
||||
public function settounpaid($id)
|
||||
{
|
||||
@ -1069,7 +1069,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws RestException 304
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
* @throws RestException 500 System error
|
||||
*/
|
||||
public function markAsCreditAvailable($id)
|
||||
{
|
||||
|
||||
@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
*/
|
||||
class FactureRec extends CommonInvoice
|
||||
{
|
||||
const TRIGGER_PREFIX = 'BILLREC';
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
@ -309,10 +310,10 @@ class FactureRec extends CommonInvoice
|
||||
$sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
|
||||
$sql .= ", ".(!empty($this->model_pdf) ? ("'".$this->db->escape($this->model_pdf)."'") : "NULL");
|
||||
$sql .= ", ".((int) $user->id);
|
||||
$sql .= ", ".(!empty($facsrc->fk_project) ? ((int) $facsrc->fk_project) : "null");
|
||||
$sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : "null");
|
||||
$sql .= ", ".(!empty($facsrc->fk_account) ? ((int) $facsrc->fk_account) : "null");
|
||||
$sql .= ", ".($facsrc->cond_reglement_id > 0 ? ((int) $facsrc->cond_reglement_id) : "null");
|
||||
$sql .= ", ".($facsrc->mode_reglement_id > 0 ? ((int) $facsrc->mode_reglement_id) : "null");
|
||||
$sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : "null");
|
||||
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "null");
|
||||
$sql .= ", ".((int) $this->usenewprice);
|
||||
$sql .= ", ".((int) $this->frequency);
|
||||
$sql .= ", '".$this->db->escape($this->unit_frequency)."'";
|
||||
@ -344,6 +345,9 @@ class FactureRec extends CommonInvoice
|
||||
$tva_tx .= ' ('.$facsrc->lines[$i]->vat_src_code.')';
|
||||
}
|
||||
|
||||
$default_start_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_START');
|
||||
$default_end_fill = getDolGlobalInt('INVOICEREC_SET_AUTOFILL_DATE_END');
|
||||
|
||||
$result_insert = $this->addline(
|
||||
$facsrc->lines[$i]->desc,
|
||||
$facsrc->lines[$i]->subprice,
|
||||
@ -363,8 +367,8 @@ class FactureRec extends CommonInvoice
|
||||
$facsrc->lines[$i]->label,
|
||||
$facsrc->lines[$i]->fk_unit,
|
||||
$facsrc->lines[$i]->multicurrency_subprice,
|
||||
0,
|
||||
0,
|
||||
$default_start_fill,
|
||||
$default_end_fill,
|
||||
null,
|
||||
$facsrc->lines[$i]->pa_ht
|
||||
);
|
||||
@ -498,7 +502,7 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('BILLREC_UPDATE', $user);
|
||||
$result = $this->call_trigger('BILLREC_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
@ -524,6 +528,8 @@ class FactureRec extends CommonInvoice
|
||||
*/
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '')
|
||||
{
|
||||
dol_syslog('FactureRec::fetch', LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc, f.total_tva, f.localtax1, f.localtax2, f.total_ht, f.total_ttc';
|
||||
$sql .= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||
$sql .= ', f.date_lim_reglement as dlr';
|
||||
@ -655,18 +661,20 @@ class FactureRec extends CommonInvoice
|
||||
*/
|
||||
public function fetch_lines()
|
||||
{
|
||||
global $extrafields;
|
||||
|
||||
// phpcs:enable
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
// Retrieve all extrafield for line
|
||||
// fetch optionals attributes and labels
|
||||
if (!is_object($extrafields)) {
|
||||
/*if (!is_object($extrafields)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
}
|
||||
$extrafields->fetch_name_optionals_label($this->table_element_line, true);
|
||||
*/
|
||||
|
||||
dol_syslog('FactureRec::fetch_lines', LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx, ';
|
||||
$sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,';
|
||||
@ -680,7 +688,6 @@ class FactureRec extends CommonInvoice
|
||||
$sql .= ' WHERE l.fk_facture = '.((int) $this->id);
|
||||
$sql .= ' ORDER BY l.rang';
|
||||
|
||||
dol_syslog('FactureRec::fetch_lines', LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
@ -810,7 +817,14 @@ class FactureRec extends CommonInvoice
|
||||
$this->error = $this->db->lasterror();
|
||||
$error = -2;
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('BILLREC_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -1745,6 +1759,23 @@ class FactureRec extends CommonInvoice
|
||||
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(
|
||||
'facturedet_rec'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update frequency and unit
|
||||
*
|
||||
@ -2116,7 +2147,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET";
|
||||
$sql .= " fk_facture = ".$this->fk_facture;
|
||||
$sql .= " fk_facture = ".((int) $this->fk_facture);
|
||||
$sql .= ", label=".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null");
|
||||
$sql .= ", description='".$this->db->escape($this->desc)."'";
|
||||
$sql .= ", price=".price2num($this->price);
|
||||
@ -2128,10 +2159,10 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
$sql .= ", localtax2_tx=".price2num($this->localtax2_tx);
|
||||
$sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
||||
$sql .= ", fk_product=".($this->fk_product > 0 ? $this->fk_product : "null");
|
||||
$sql .= ", product_type=".$this->product_type;
|
||||
$sql .= ", remise_percent='".price2num($this->remise_percent)."'";
|
||||
$sql .= ", subprice='".price2num($this->subprice)."'";
|
||||
$sql .= ", info_bits='".price2num($this->info_bits)."'";
|
||||
$sql .= ", product_type=".((int) $this->product_type);
|
||||
$sql .= ", remise_percent=".price2num($this->remise_percent);
|
||||
$sql .= ", subprice=".price2num($this->subprice);
|
||||
$sql .= ", info_bits=".price2num($this->info_bits);
|
||||
$sql .= ", date_start_fill=".(int) $this->date_start_fill;
|
||||
$sql .= ", date_end_fill=".(int) $this->date_end_fill;
|
||||
if (empty($this->skip_update_total)) {
|
||||
@ -2162,7 +2193,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('LINEBILLREC_UPDATE', $user);
|
||||
$result = $this->call_trigger('LINEBILLREC_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
|
||||
@ -1775,8 +1775,9 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
// phpcs:enable
|
||||
global $langs, $conf;
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
$sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,';
|
||||
@ -2326,6 +2327,7 @@ class Facture extends CommonInvoice
|
||||
if ($this->lines[$i]->fk_product > 0) {
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
$mouvP->origin = &$this;
|
||||
$mouvP->setOrigin($this->element, $this->id);
|
||||
// We decrease stock for product
|
||||
if ($this->type == self::TYPE_CREDIT_NOTE) {
|
||||
$result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceDeleteDolibarr", $this->ref));
|
||||
@ -2632,7 +2634,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0, $batch_rule = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $conf, $langs, $mysoc;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$productStatic = null;
|
||||
@ -2671,6 +2673,66 @@ class Facture extends CommonInvoice
|
||||
dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.$conf->global->MAIN_USE_ADVANCED_PERMS, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||
$last_of_type = $this->willBeLastOfSameType();
|
||||
if (!$last_of_type[0]) {
|
||||
$this->error = $langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $this->ref, dol_print_date($this->date, 'day'), dol_print_date($last_of_type[1], 'day'));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for mandatory fields in thirdparty (defined into setup)
|
||||
if (!empty($this->thirdparty) && is_object($this->thirdparty)) {
|
||||
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL');
|
||||
foreach ($array_to_check as $key) {
|
||||
$keymin = strtolower($key);
|
||||
if (!property_exists($this->thirdparty, $keymin)) {
|
||||
continue;
|
||||
}
|
||||
$vallabel = $this->thirdparty->$keymin;
|
||||
|
||||
$i = (int) preg_replace('/[^0-9]/', '', $key);
|
||||
if ($i > 0) {
|
||||
if ($this->thirdparty->isACompany()) {
|
||||
// Check for mandatory prof id (but only if country is other than ours)
|
||||
if ($mysoc->country_id > 0 && $this->thirdparty->country_id == $mysoc->country_id) {
|
||||
$idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
|
||||
if (!$vallabel && !empty($conf->global->$idprof_mandatory)) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $this->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
|
||||
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($key == 'EMAIL') {
|
||||
// Check for mandatory
|
||||
if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($this->thirdparty->email)) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans("ErrorBadEMail", $this->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']';
|
||||
dol_syslog(__METHOD__.' '.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for mandatory fields in $this
|
||||
$array_to_check = array('REF_CLIENT'=>'RefCustomer');
|
||||
foreach ($array_to_check as $key => $val) {
|
||||
$keymin = strtolower($key);
|
||||
$vallabel = $this->$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');
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -2763,6 +2825,7 @@ class Facture extends CommonInvoice
|
||||
if ($this->lines[$i]->fk_product > 0) {
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
$mouvP->origin = &$this;
|
||||
$mouvP->setOrigin($this->element, $this->id);
|
||||
// We decrease stock for product
|
||||
if ($this->type == self::TYPE_CREDIT_NOTE) {
|
||||
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr", $num));
|
||||
@ -3055,6 +3118,7 @@ class Facture extends CommonInvoice
|
||||
if ($this->lines[$i]->fk_product > 0) {
|
||||
$mouvP = new MouvementStock($this->db);
|
||||
$mouvP->origin = &$this;
|
||||
$mouvP->setOrigin($this->element, $this->id);
|
||||
// We decrease stock for product
|
||||
if ($this->type == self::TYPE_CREDIT_NOTE) {
|
||||
$result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr", $this->ref));
|
||||
@ -4754,6 +4818,23 @@ class Facture extends CommonInvoice
|
||||
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(
|
||||
'facturedet'
|
||||
);
|
||||
|
||||
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the customer invoice delayed?
|
||||
*
|
||||
@ -5123,6 +5204,37 @@ class Facture extends CommonInvoice
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* See if current invoice date is posterior to the last invoice date among validated invoices of same type.
|
||||
* @return boolean
|
||||
*/
|
||||
public function willBeLastOfSameType()
|
||||
{
|
||||
// get date of last validated invoices of same type
|
||||
$sql = "SELECT datef";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql .= " WHERE type = " . (int) $this->type ;
|
||||
$sql .= " AND date_valid IS NOT NULL";
|
||||
$sql .= " ORDER BY datef DESC LIMIT 1";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
// compare with current validation date
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$last_date = $this->db->jdate($obj->datef);
|
||||
$invoice_date = $this->date;
|
||||
|
||||
return [$invoice_date >= $last_date, $last_date];
|
||||
} else {
|
||||
// element is first of type to be validated
|
||||
return [true];
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5680,7 +5792,7 @@ class FactureLigne extends CommonInvoiceLine
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('LINEBILL_UPDATE', $user);
|
||||
$result = $this->call_trigger('LINEBILL_MODIFY', $user);
|
||||
if ($result < 0) {
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
|
||||
@ -721,7 +721,6 @@ if ($resql) {
|
||||
if (!empty($arrayfields['f.titre']['checked'])) {
|
||||
print '<td class="nowrap tdoverflowmax200">';
|
||||
print $invoicerectmp->getNomUrl(1);
|
||||
print "</a>";
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -765,7 +764,7 @@ if ($resql) {
|
||||
}
|
||||
// Payment term
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print '<td class="tdoverflowmax150">';
|
||||
$form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none');
|
||||
print '</td>'."\n";
|
||||
if (!$i) {
|
||||
@ -774,7 +773,7 @@ if ($resql) {
|
||||
}
|
||||
// Payment mode
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
|
||||
print '<td class="right">';
|
||||
print '<td class="tdoverflowmax150">';
|
||||
$form->form_modes_reglement('', $objp->fk_mode_reglement, 'none');
|
||||
print '</td>'."\n";
|
||||
if (!$i) {
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015-2021 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2019-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
@ -194,12 +194,12 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
$fieldstosearchall = array(
|
||||
'f.ref'=>'Ref',
|
||||
'f.ref_client'=>'RefCustomer',
|
||||
'pd.description'=>'Description',
|
||||
'f.note_public'=>'NotePublic',
|
||||
's.nom'=>"ThirdParty",
|
||||
's.name_alias'=>"AliasNameShort",
|
||||
's.zip'=>"Zip",
|
||||
's.town'=>"Town",
|
||||
'f.note_public'=>'NotePublic',
|
||||
'pd.description'=>'Description',
|
||||
);
|
||||
if (empty($user->socid)) {
|
||||
$fieldstosearchall["f.note_private"] = "NotePrivate";
|
||||
@ -568,11 +568,14 @@ $sql .= ' state.code_departement as state_code, state.nom as state_name,';
|
||||
$sql .= ' country.code as country_code,';
|
||||
$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';
|
||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0).
|
||||
// A Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||
// We disable this. It create a bug when searching with sall and sorting on status. Also it create performance troubles.
|
||||
/*
|
||||
if (!$sall) {
|
||||
$sql .= ', SUM(pf.amount) as dynamount_payed, SUM(pf.multicurrency_amount) as multicurrency_dynamount_payed';
|
||||
}
|
||||
*/
|
||||
if ($search_categ_cus && $search_categ_cus != -1) {
|
||||
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
}
|
||||
@ -595,12 +598,19 @@ if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
|
||||
}
|
||||
|
||||
$sql .= ', '.MAIN_DB_PREFIX.'facture as f';
|
||||
if ($sortfield == "f.datef") {
|
||||
$sql .= $db->hintindex('idx_facture_datef');
|
||||
}
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (f.rowid = ef.fk_object)";
|
||||
}
|
||||
|
||||
// We disable this. It create a bug when searching with sall and sorting on status. Also it create performance troubles.
|
||||
/*
|
||||
if (!$sall) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
|
||||
}
|
||||
*/
|
||||
if ($sall || $search_product_category > 0) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture';
|
||||
}
|
||||
@ -798,6 +808,8 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
// We disable this. It create a bug when searching with sall and sorting on status. Also it create performance troubles.
|
||||
/*
|
||||
if (!$sall) {
|
||||
$sql .= ' GROUP BY f.rowid, f.ref, ref_client, f.fk_soc, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total_ht, f.total_tva, f.total_ttc,';
|
||||
$sql .= ' f.localtax1, f.localtax2,';
|
||||
@ -827,6 +839,8 @@ if (!$sall) {
|
||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
} else {
|
||||
*/
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
|
||||
@ -835,6 +849,37 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
*/
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
if ($sall || $search_product_category > 0 || $search_user > 0) {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql);
|
||||
} else {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(f.rowid) as nbtotalofrecords FROM', $sql);
|
||||
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid/', '', $sqlforcount);
|
||||
}
|
||||
$sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount);
|
||||
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
// Complete request and execute it with limit
|
||||
$sql .= ' ORDER BY ';
|
||||
$listfield = explode(',', $sortfield);
|
||||
$listorder = explode(',', $sortorder);
|
||||
@ -842,19 +887,10 @@ foreach ($listfield as $key => $value) {
|
||||
$sql .= $listfield[$key].' '.($listorder[$key] ? $listorder[$key] : 'DESC').',';
|
||||
}
|
||||
$sql .= ' f.rowid DESC ';
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
@ -1624,7 +1660,7 @@ if ($resql) {
|
||||
print_liste_field_titre($arrayfields['f.note_private']['label'], $_SERVER["PHP_SELF"], "f.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
}
|
||||
if (!empty($arrayfields['f.fk_statut']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type,dynamount_payed", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "f.fk_statut,f.paye,f.type", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
@ -2077,7 +2113,7 @@ if ($resql) {
|
||||
// Sales representatives
|
||||
print '<td>';
|
||||
if ($obj->socid > 0) {
|
||||
$listsalesrepresentatives = $thirdpartystatic->getSalesRepresentatives($user);
|
||||
$listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
|
||||
if ($listsalesrepresentatives < 0) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedopjectblock.tpl.php -->\n";
|
||||
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedobjectblock.tpl.php -->\n";
|
||||
|
||||
global $user;
|
||||
global $noMoreLinkedObjectBlockAfter;
|
||||
@ -45,7 +45,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
$trclass .= ' liste_sub_total';
|
||||
}
|
||||
print '<tr class="'.$trclass.'" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" >';
|
||||
print '<td class="linkedcol-element">';
|
||||
print '<td class="linkedcol-element tdoverflowmax100">';
|
||||
switch ($objectlink->type) {
|
||||
case Facture::TYPE_REPLACEMENT:
|
||||
echo $langs->trans("InvoiceReplacement");
|
||||
|
||||
@ -24,7 +24,7 @@ if (empty($conf) || !is_object($conf)) {
|
||||
}
|
||||
|
||||
|
||||
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedopjectblockForRec.tpl.php -->\n";
|
||||
print "<!-- BEGIN PHP TEMPLATE compta/facture/tpl/linkedobjectblockForRec.tpl.php -->\n";
|
||||
|
||||
|
||||
global $user;
|
||||
@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
||||
}
|
||||
?>
|
||||
<tr class="<?php echo $trclass; ?>" >
|
||||
<td class="linkedcol-element"><?php echo $langs->trans("RepeatableInvoice"); ?></td>
|
||||
<td class="linkedcol-element tdoverflowmax100"><?php echo $langs->trans("RepeatableInvoice"); ?></td>
|
||||
<td class="linkedcol-name"><!-- nowraponall because ref is a label --><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||
<td class="linkedcol-ref" align="center"></td>
|
||||
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date_when, 'day'); ?></td>
|
||||
|
||||
@ -491,8 +491,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
if ($facture->type == 2) {
|
||||
print '<td><span class="fieldrequired">'.$langs->trans('AccountToDebit').'</span></td>';
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
print $form->select_comptes($accountid, 'accountid', 0, '', 2, '', 0, '', 1);
|
||||
print img_picto('', 'bank_account');
|
||||
print $form->select_comptes($accountid, 'accountid', 0, '', 2, '', 0, 'widthcentpercentminusx maxwidth500', 1);
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td> </td>';
|
||||
@ -501,26 +503,27 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
|
||||
// Bank check number
|
||||
print '<tr><td>'.$langs->trans('Numero');
|
||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
print ' <em class="opacitymedium">('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
print '</td>';
|
||||
print '<td><input name="num_paiement" type="text" class="maxwidth200" value="'.$paymentnum.'"></td></tr>';
|
||||
|
||||
// Check transmitter
|
||||
print '<tr><td class="'.(GETPOST('paiementcode') == 'CHQ' ? 'fieldrequired ' : '').'fieldrequireddyn">'.$langs->trans('CheckTransmitter');
|
||||
print ' <em>('.$langs->trans("ChequeMaker").')</em>';
|
||||
print ' <em class="opacitymedium">('.$langs->trans("ChequeMaker").')</em>';
|
||||
print '</td>';
|
||||
print '<td><input id="fieldchqemetteur" class="maxwidth300" name="chqemetteur" type="text" value="'.GETPOST('chqemetteur', 'alphanohtml').'"></td></tr>';
|
||||
|
||||
// Bank name
|
||||
print '<tr><td>'.$langs->trans('Bank');
|
||||
print ' <em>('.$langs->trans("ChequeBank").')</em>';
|
||||
print ' <em class="opacitymedium">('.$langs->trans("ChequeBank").')</em>';
|
||||
print '</td>';
|
||||
print '<td><input name="chqbank" class="maxwidth300" type="text" value="'.GETPOST('chqbank', 'alphanohtml').'"></td></tr>';
|
||||
|
||||
// Comments
|
||||
print '<tr><td>'.$langs->trans('Comments').'</td>';
|
||||
print '<td class="tdtop">';
|
||||
print '<textarea name="comment" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.GETPOST('comment', 'restricthtml').'</textarea></td></tr>';
|
||||
print '<textarea name="comment" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.GETPOST('comment', 'restricthtml').'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user