Merge branch 'develop' of github.com:Dolibarr/dolibarr into dev_19763
This commit is contained in:
commit
c951e681c2
10
COPYRIGHT
10
COPYRIGHT
@ -28,7 +28,7 @@ CKEditor 4.12.1 LGPL-2.1+ Yes
|
|||||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||||
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||||
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
||||||
Mobiledetect 2.8.34 MIT License Yes Detect mobile devices browsers
|
Mobiledetect 2.8.39 MIT License Yes Detect mobile devices browsers
|
||||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||||
ParseDown 1.6 MIT License Yes Markdown parser
|
ParseDown 1.6 MIT License Yes Markdown parser
|
||||||
@ -48,10 +48,10 @@ TCPDF 6.3.2 LGPL-3+ Yes
|
|||||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||||
|
|
||||||
JS libraries:
|
JS libraries:
|
||||||
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
Ace 1.4.14 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||||
ChartJS 2.9.4 MIT License Yes JS library for graph
|
ChartJS 3.7.1 MIT License Yes JS library for graph
|
||||||
jQuery 3.5.1 MIT License Yes JS library
|
jQuery 3.6.0 MIT License Yes JS library
|
||||||
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
jQuery UI 1.13.1 GPL and MIT License Yes JS library plugin UI
|
||||||
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
|
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
|
||||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||||
|
|||||||
13
ChangeLog
13
ChangeLog
@ -9,7 +9,8 @@ English Dolibarr ChangeLog
|
|||||||
For users:
|
For users:
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
NEW: ...
|
NEW: PHP 8.0 compatibility
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Modules
|
Modules
|
||||||
@ -21,14 +22,18 @@ NEW: Experimental module Partnership Management
|
|||||||
For developers:
|
For developers:
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
NEW:
|
NEW: A lot of addition of hooks.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
|
* The default value for MAIN_SECURITY_CSRF_WITH_TOKEN has been set to 2. It means any POST and any GET request that contains the "action" or "massaction"
|
||||||
|
with a value of a sensitive action must also a valid token parameter (With previous value 1, only POST was concerned). Note: With value 3, any URL
|
||||||
|
with parameter "action" or "massaction" need the token, whatever is the value of the action.
|
||||||
* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true.
|
* verifCond('stringtoevaluate') now return false when string contains a bad syntax content instead of true.
|
||||||
* The deprecated mdethod thirdparty_doc_create() has been removed. You can use the generateDocument() instead.
|
* 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 *****
|
***** ChangeLog for 15.0.1 compared to 15.0.0 *****
|
||||||
|
|||||||
@ -17,7 +17,7 @@ Alternatively send an email to security@dolibarr.org (for everybody)
|
|||||||
|
|
||||||
## Hunting vulnerabilities on Dolibarr
|
## Hunting vulnerabilities on Dolibarr
|
||||||
|
|
||||||
We believe that future of software is online SaaS. This means software are more and more critical and no technology is perfect. Working with skilled security researchers is crucial in identifying weaknesses in our technology.
|
We believe that the future of software is online SaaS. This means software are more and more critical and no technology is perfect. Working with skilled security researchers is crucial in identifying weaknesses in our technology.
|
||||||
|
|
||||||
If you believe you've found a security bug in our service, we are happy to work with you to resolve the issue promptly and ensure you are fairly rewarded for your discovery.
|
If you believe you've found a security bug in our service, we are happy to work with you to resolve the issue promptly and ensure you are fairly rewarded for your discovery.
|
||||||
|
|
||||||
@ -35,13 +35,13 @@ You can install the web application yourself on your own platform/server so you
|
|||||||
|
|
||||||
## Eligibility and Responsible Disclosure
|
## Eligibility and Responsible Disclosure
|
||||||
|
|
||||||
We are happy to thank everyone who submits valid reports which help us improve the security of Dolibarr however, only those that meet the following eligibility requirements will be "validated reports" (if not, we may close the report without any answer):
|
We are happy to thank everyone who submits valid reports which help us improve the security of Dolibarr, however only those that meet the following eligibility requirements will be "validated reports" (if not, we may close the report without any answer):
|
||||||
|
|
||||||
You must be the first reporter of the vulnerability (duplicate reports are closed).
|
You must be the first reporter of the vulnerability (duplicate reports are closed).
|
||||||
|
|
||||||
You must send a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary.
|
You must send a clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary.
|
||||||
|
|
||||||
You must avoid tests that could cause degradation or interruption of our service (refrain from using automated tools, and limit yourself about requests per second), that's why we recommand to install softwate on your own platform.
|
You must avoid tests that could cause degradation or interruption of our service (refrain from using automated tools, and limit yourself about requests per second), that's why we recommand to install software on your own platform.
|
||||||
|
|
||||||
You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability.
|
You must not leak, manipulate, or destroy any user data of third parties to find your vulnerability.
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us
|
|||||||
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
|
* The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools)
|
||||||
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
|
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities).
|
||||||
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
|
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
|
||||||
* The web server setup must be done so only the documents directory is in write mode. The root directory called htdocs must be readonly.
|
* The web server setup must be done so that only the documents directory is in write mode. The root directory called htdocs must be read-only.
|
||||||
* CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
|
* CSRF attacks are accepted but double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
|
||||||
* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user.
|
* Ability for a high level user to edit web site pages into the CMS by including HTML or Javascript is an expected feature. Vulnerabilities into the website module are validated only if HTML or Javascript injection can be done by a non allowed user.
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
"ext-curl" : "*",
|
"ext-curl" : "*",
|
||||||
"ckeditor/ckeditor" : "4.12.1",
|
"ckeditor/ckeditor" : "4.12.1",
|
||||||
"mike42/escpos-php" : "2.2",
|
"mike42/escpos-php" : "2.2",
|
||||||
"mobiledetect/mobiledetectlib" : "2.8.34",
|
"mobiledetect/mobiledetectlib" : "2.8.39",
|
||||||
"phpoffice/phpexcel" : "1.8.2",
|
"phpoffice/phpexcel" : "1.8.2",
|
||||||
"restler/framework" : "3.0.0-RC6",
|
"restler/framework" : "3.0.0-RC6",
|
||||||
"tecnickcom/tcpdf" : "6.3.2",
|
"tecnickcom/tcpdf" : "6.3.2",
|
||||||
2349
composer.lock
generated
2349
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,10 @@ https://en.wikipedia.org/wiki/EPC_QR_code#Generators
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
* For ZATCA QR Code format (Saudi Arabia)
|
* For ZATCA QR Code format (Saudi Arabia). Used when INVOICE_ADD_ZATCA_QR_CODE is set
|
||||||
-----------------------------------------
|
-------------------------------------------------------------------------------------
|
||||||
https://www.pwc.com/m1/en/services/tax/me-tax-legal-news/2021/saudi-arabia-guide-to-develop-compliant-qr-code-for-simplified-einvoices.html
|
https://www.pwc.com/m1/en/services/tax/me-tax-legal-news/2021/saudi-arabia-guide-to-develop-compliant-qr-code-for-simplified-einvoices.html
|
||||||
|
|
||||||
|
https://www.tecklenborgh.com/post/ksa-zatca-publishes-guide-on-how-to-develop-a-fatoora-compliant-qr-code
|
||||||
|
|
||||||
|
Method to encode/decode ZATCA string is available in test/phpunit/BarcodeTest.php
|
||||||
|
|||||||
@ -1,8 +1,12 @@
|
|||||||
# File of all ISO-4217 currencies codes
|
# File of all ISO-4217 currencies codes
|
||||||
# http://en.wikipedia.org/wiki/ISO_4217
|
|
||||||
# http://fx.sauder.ubc.ca/currency_table.html for symbols for 2 letter code
|
|
||||||
#
|
#
|
||||||
# Code,Name,Nb decimals
|
# https://en.wikipedia.org/wiki/ISO_4217
|
||||||
|
# https://en.wikipedia.org/wiki/Currency_symbol for symbols for 2 letter code
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
# Code, Currency Name, Nb decimals
|
||||||
|
|
||||||
AED,UAE Dirham,2
|
AED,UAE Dirham,2
|
||||||
AFN,Afghanistan Afghani,2
|
AFN,Afghanistan Afghani,2
|
||||||
ALL,Albanian Lek,2
|
ALL,Albanian Lek,2
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/admin/export.php
|
* \file htdocs/accountancy/admin/export.php
|
||||||
* \ingroup Accountancy (Double entries)
|
* \ingroup Accountancy (Double entries)
|
||||||
* \brief Setup page to configure accounting expert module
|
* \brief Setup page to configure accounting export module
|
||||||
*/
|
*/
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
|
|
||||||
|
|||||||
@ -1,325 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
|
||||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
|
||||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
|
|
||||||
* \ingroup accountancy
|
|
||||||
* \brief Tab to manage customer lettering
|
|
||||||
*/
|
|
||||||
require '../../main.inc.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|
||||||
|
|
||||||
// Load translation files required by the page
|
|
||||||
$langs->loadLangs(array("compta", "accountancy"));
|
|
||||||
|
|
||||||
$action = GETPOST('action', 'aZ09');
|
|
||||||
$massaction = GETPOST('massaction', 'alpha');
|
|
||||||
$show_files = GETPOST('show_files', 'int');
|
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
|
||||||
$toselect = GETPOST('toselect', 'array');
|
|
||||||
// $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
|
|
||||||
// Security check
|
|
||||||
$socid = GETPOSTINT("socid");
|
|
||||||
// if ($user->socid) $socid=$user->socid;
|
|
||||||
|
|
||||||
$limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
|
||||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
|
||||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
|
||||||
if (empty($page) || $page == - 1) {
|
|
||||||
$page = 0;
|
|
||||||
} // If $page is not defined, or '' or -1
|
|
||||||
$offset = $limit * $page;
|
|
||||||
$pageprev = $page - 1;
|
|
||||||
$pagenext = $page + 1;
|
|
||||||
if ($sortorder == "") {
|
|
||||||
$sortorder = "ASC";
|
|
||||||
}
|
|
||||||
if ($sortfield == "") {
|
|
||||||
$sortfield = "bk.doc_date";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
|
||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
|
||||||
//$search_doc_type = GETPOST("search_doc_type", 'alpha');
|
|
||||||
$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
|
|
||||||
*/
|
|
||||||
|
|
||||||
$lettering = GETPOST('lettering', 'alpha');
|
|
||||||
if (!empty($lettering)) {
|
|
||||||
$action = $lettering;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
|
||||||
{
|
|
||||||
$search_date_start = '';
|
|
||||||
$search_date_end = '';
|
|
||||||
//$search_doc_type = '';
|
|
||||||
$search_doc_ref = '';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$lettering = new Lettering($db);
|
|
||||||
$object = new Societe($db);
|
|
||||||
$object->id = $socid;
|
|
||||||
$result = $object->fetch($socid);
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($conf->accounting->enabled)) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
if ($user->socid > 0) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Action
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($action == 'lettering') {
|
|
||||||
$result = $lettering->updateLettering($toselect);
|
|
||||||
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages('', $lettering->errors, 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ($action == 'autolettrage') {
|
|
||||||
|
|
||||||
$result = $lettering->letteringThirdparty($socid);
|
|
||||||
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages('', $lettering->errors, 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
$form = new Form($db);
|
|
||||||
$formaccounting = new FormAccounting($db);
|
|
||||||
|
|
||||||
$title = $object->name." - ".$langs->trans('TabLetteringCustomer');
|
|
||||||
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
|
|
||||||
llxHeader('', $title, $help_url);
|
|
||||||
|
|
||||||
$head = societe_prepare_head($object);
|
|
||||||
|
|
||||||
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'lettering_customer', $langs->trans("ThirdParty"), 0, 'company');
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
|
||||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
|
||||||
$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)."' )";
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
|
||||||
$sql .= " AND ( bk.doc_date BETWEEN '" . $db->idate($search_date_start) . "' AND '" . $db->idate($search_date_end) . "' )";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sql .= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
|
||||||
|
|
||||||
$debit = 0;
|
|
||||||
$credit = 0;
|
|
||||||
$solde = 0;
|
|
||||||
// Count total nb of records and calc total sum
|
|
||||||
$nbtotalofrecords = '';
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if (!$resql) {
|
|
||||||
dol_print_error($db);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
$nbtotalofrecords = $db->num_rows($resql);
|
|
||||||
|
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
|
||||||
$debit += $obj->debit;
|
|
||||||
$credit += $obj->credit;
|
|
||||||
|
|
||||||
$solde += ($obj->credit - $obj->debit);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
|
||||||
|
|
||||||
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG);
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if (!$resql) {
|
|
||||||
dol_print_error($db);
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$param = '';
|
|
||||||
$param .= "&socid=".urlencode($socid);
|
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
|
|
||||||
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG);
|
|
||||||
if ($resql) {
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
$param = "&socid=".$socid;
|
|
||||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
|
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
|
||||||
|
|
||||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
|
||||||
print '<table class="liste centpercent">'."\n";
|
|
||||||
|
|
||||||
/*
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
|
||||||
|
|
||||||
// Date
|
|
||||||
print '<td class="liste_titre center">';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('From') . ' ';
|
|
||||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('to') . ' ';
|
|
||||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Piece
|
|
||||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
|
||||||
print '<td colspan="6"> </td>';
|
|
||||||
print '<td class="right">';
|
|
||||||
$searchpicto = $form->showFilterButtons();
|
|
||||||
print $searchpicto;
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$solde = 0;
|
|
||||||
$tmp = '';
|
|
||||||
|
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
|
||||||
if ($tmp != $obj->lettering_code || empty($tmp)) {
|
|
||||||
$tmp = $obj->lettering_code;
|
|
||||||
}
|
|
||||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->doc_date), 'day').'</td>';
|
|
||||||
print '<td>'.$obj->doc_ref.'</td>';
|
|
||||||
print '<td>'.$obj->label_compte.'</td>';
|
|
||||||
print '<td class="nowrap right">'.price($obj->debit).'</td>';
|
|
||||||
print '<td class="nowrap right">'.price($obj->credit).'</td>';
|
|
||||||
print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
|
|
||||||
|
|
||||||
// Journal
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
|
||||||
$result = $accountingjournal->fetch('', $obj->code_journal);
|
|
||||||
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
|
|
||||||
print '<td class="center">'.$journaltoshow.'</td>';
|
|
||||||
|
|
||||||
if (empty($obj->lettering_code) && empty($obj->date_validated)) {
|
|
||||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
|
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
|
|
||||||
print img_edit();
|
|
||||||
print '</a></td>'."\n";
|
|
||||||
} else {
|
|
||||||
print '<td class="center">'.$obj->lettering_code.'</td>';
|
|
||||||
print '<td></td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>'."\n";
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($debit).'</strong></td>';
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($credit).'</strong></td>';
|
|
||||||
print '<td colspan="4"></td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>'."\n";
|
|
||||||
print '<td colspan="2"> </td>';
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($credit - $debit).'</strong></td>';
|
|
||||||
print '<td colspan="6"></td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
|
||||||
print $letteringbutton;
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print "</form>";
|
|
||||||
$db->free($resql);
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
// End of page
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
@ -1,322 +0,0 @@
|
|||||||
<?php
|
|
||||||
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
||||||
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
||||||
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
|
||||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
|
||||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php
|
|
||||||
* \ingroup Accountancy (Double entries)
|
|
||||||
* \brief Tab to setup lettering
|
|
||||||
*/
|
|
||||||
require '../../main.inc.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|
||||||
|
|
||||||
// Load translation files required by the page
|
|
||||||
$langs->loadLangs(array("compta", "accountancy"));
|
|
||||||
|
|
||||||
$action = GETPOST('action', 'aZ09');
|
|
||||||
$massaction = GETPOST('massaction', 'alpha');
|
|
||||||
$show_files = GETPOST('show_files', 'int');
|
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
|
||||||
$toselect = GETPOST('toselect', 'array');
|
|
||||||
// $socid = GETPOST('socid', 'int') ? ((int) GETPOST('socid', 'int')) : ((int) GETPOST('id', 'int'));
|
|
||||||
// Security check
|
|
||||||
$socid = GETPOSTINT("socid");
|
|
||||||
// if ($user->socid) $socid=$user->socid;
|
|
||||||
|
|
||||||
|
|
||||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
|
||||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
|
||||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
|
||||||
if (empty($page) || $page == - 1) {
|
|
||||||
$page = 0;
|
|
||||||
} // If $page is not defined, or '' or -1
|
|
||||||
$offset = $limit * $page;
|
|
||||||
$pageprev = $page - 1;
|
|
||||||
$pagenext = $page + 1;
|
|
||||||
if ($sortorder == "") {
|
|
||||||
$sortorder = "ASC";
|
|
||||||
}
|
|
||||||
if ($sortfield == "") {
|
|
||||||
$sortfield = "bk.doc_date";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
|
||||||
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
|
||||||
//$search_doc_type = GETPOST("search_doc_type",'alpha');
|
|
||||||
$search_doc_ref = GETPOST("search_doc_ref",'alpha');
|
|
||||||
*/
|
|
||||||
|
|
||||||
$lettering = GETPOST('lettering', 'alpha');
|
|
||||||
if (!empty($lettering)) {
|
|
||||||
$action = $lettering;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers
|
|
||||||
{
|
|
||||||
$search_date_start = '';
|
|
||||||
$search_date_end = '';
|
|
||||||
//$search_doc_type='';
|
|
||||||
$search_doc_ref='';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$lettering = new Lettering($db);
|
|
||||||
$object = new Societe($db);
|
|
||||||
$object->id = $socid;
|
|
||||||
$result = $object->fetch($socid);
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($conf->accounting->enabled)) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
if ($user->socid > 0) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
|
||||||
accessforbidden();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Action
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ($action == 'lettering') {
|
|
||||||
$result = $lettering->updateLettering($toselect);
|
|
||||||
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages('', $lettering->errors, 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ($action == 'autolettrage') {
|
|
||||||
|
|
||||||
$result = $lettering->letteringThirdparty($socid);
|
|
||||||
|
|
||||||
if ($result < 0) {
|
|
||||||
setEventMessages('', $lettering->errors, 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* View
|
|
||||||
*/
|
|
||||||
|
|
||||||
$form = new Form($db);
|
|
||||||
$formaccounting = new FormAccounting($db);
|
|
||||||
|
|
||||||
$title = $object->name." - ".$langs->trans('TabLetteringSupplier');
|
|
||||||
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas|DE:Modul_Geschäftspartner';
|
|
||||||
llxHeader('', $title, $help_url);
|
|
||||||
|
|
||||||
$head = societe_prepare_head($object);
|
|
||||||
|
|
||||||
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
|
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'lettering_supplier', $langs->trans("ThirdParty"), 0, 'company');
|
|
||||||
|
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
|
||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
|
||||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
|
||||||
$sql .= " bk.credit, bk.montant, bk.sens, bk.code_journal, bk.piece_num, bk.lettering_code, bk.date_validated ";
|
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as bk";
|
|
||||||
$sql .= " WHERE (bk.subledger_account = '".$db->escape($object->code_compta_fournisseur)."' AND bk.numero_compte = '".$db->escape($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)."' )";
|
|
||||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
|
||||||
$sql .= " AND (bk.doc_date BETWEEN '".$db->idate($search_date_start)."' AND '".$db->idate($search_date_end)."' )";
|
|
||||||
}
|
|
||||||
$sql .= ' AND bk.entity IN ('.getEntity('accountingbookkeeping').')';
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
|
||||||
|
|
||||||
$debit = 0;
|
|
||||||
$credit = 0;
|
|
||||||
$solde = 0;
|
|
||||||
// Count total nb of records and calc total sum
|
|
||||||
$nbtotalofrecords = '';
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if (!$resql) {
|
|
||||||
dol_print_error($db);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
$nbtotalofrecords = $db->num_rows($resql);
|
|
||||||
|
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
|
||||||
$debit += $obj->debit;
|
|
||||||
$credit += $obj->credit;
|
|
||||||
|
|
||||||
$solde += ($obj->credit - $obj->debit);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
|
||||||
|
|
||||||
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG);
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if (!$resql) {
|
|
||||||
dol_print_error($db);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$param = '';
|
|
||||||
$param .= "&socid=".urlencode($socid);
|
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
|
|
||||||
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_supplier.php", LOG_DEBUG);
|
|
||||||
$resql = $db->query($sql);
|
|
||||||
if ($resql) {
|
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
$param = "&socid=".$socid;
|
|
||||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'" method="POST">';
|
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$object->id.'">';
|
|
||||||
|
|
||||||
$letteringbutton = '<a class="divButAction"><span class="valignmiddle"><input class="butAction" type="submit" value="lettering" name="lettering" id="lettering"></span></a>';
|
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, $letteringbutton, '', $limit);
|
|
||||||
|
|
||||||
print '<div class="div-table-responsive-no-min">';
|
|
||||||
print '<table class="liste centpercent">'."\n";
|
|
||||||
|
|
||||||
/*
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
//print '<td><input type="text" name="search_doc_type" value="' . $search_doc_type . '"></td>';
|
|
||||||
|
|
||||||
// Date
|
|
||||||
print '<td class="liste_titre center">';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('From') . ' ';
|
|
||||||
print $form->selectDate($search_date_start, 'date_creation_start', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('to') . ' ';
|
|
||||||
print $form->selectDate($search_date_end, 'date_creation_end', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Piece
|
|
||||||
print '<td><input type="text" name="search_doc_ref" value="' . $search_doc_ref . '"></td>';
|
|
||||||
print '<td colspan="6"> </td>';
|
|
||||||
print '<td class="right">';
|
|
||||||
$searchpicto = $form->showFilterButtons();
|
|
||||||
print $searchpicto;
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
*/
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
|
||||||
//print_liste_field_titre("Doctype", $_SERVER["PHP_SELF"], "bk.doc_type", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Docdate", $_SERVER["PHP_SELF"], "bk.doc_date", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("Piece", $_SERVER["PHP_SELF"], "bk.doc_ref", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("LabelAccount", $_SERVER["PHP_SELF"], "bk.label_compte", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "bk.debit", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "bk.credit", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Balancing", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Codejournal", $_SERVER["PHP_SELF"], "bk.code_journal", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("LetteringCode", $_SERVER["PHP_SELF"], "bk.lettering_code", "", $param, "", $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("", "", "", '', '', "", $sortfield, $sortorder, 'maxwidthsearch center ');
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
$solde = 0;
|
|
||||||
$tmp = '';
|
|
||||||
while ($obj = $db->fetch_object($resql)) {
|
|
||||||
if ($tmp != $obj->lettering_code || empty($tmp)) {
|
|
||||||
$tmp = $obj->lettering_code;
|
|
||||||
}
|
|
||||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
|
|
||||||
//print '<td>' . $obj->doc_type . '</td>' . "\n";
|
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->doc_date), 'day').'</td>';
|
|
||||||
print '<td>'.$obj->doc_ref.'</td>';
|
|
||||||
print '<td>'.$obj->label_compte.'</td>';
|
|
||||||
print '<td class="nowrap right">'.price($obj->debit).'</td>';
|
|
||||||
print '<td class="nowrap right">'.price($obj->credit).'</td>';
|
|
||||||
print '<td class="nowrap right">'.price(round($solde, 2)).'</td>';
|
|
||||||
|
|
||||||
// Journal
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
|
||||||
$result = $accountingjournal->fetch('', $obj->code_journal);
|
|
||||||
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
|
|
||||||
print '<td class="center">'.$journaltoshow.'</td>';
|
|
||||||
|
|
||||||
if (empty($obj->lettering_code) && empty($obj->date_validated)) {
|
|
||||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="'.$obj->rowid.'" /></td>';
|
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num='.$obj->piece_num.'">';
|
|
||||||
print img_edit();
|
|
||||||
print '</a></td>'."\n";
|
|
||||||
} else {
|
|
||||||
print '<td class="center">'.$obj->lettering_code.'</td>';
|
|
||||||
print '<td></td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>'."\n";
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($debit).'</strong></td>';
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($credit).'</strong></td>';
|
|
||||||
print '<td colspan="6"></td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>'."\n";
|
|
||||||
print '<td colspan="2"> </td>';
|
|
||||||
print '<td class="right nowraponall amount"><strong>'.price($credit - $debit).'</strong></td>';
|
|
||||||
print '<td colspan="4"></td>';
|
|
||||||
print "</tr>\n";
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">'."\n";
|
|
||||||
print $letteringbutton;
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
print "</form>";
|
|
||||||
$db->free($resql);
|
|
||||||
} else {
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
// End of page
|
|
||||||
llxFooter();
|
|
||||||
$db->close();
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/class/accountancyimport.class.php
|
* \file htdocs/accountancy/class/accountancyimport.class.php
|
||||||
* \ingroup Accountancy (Double entries)
|
* \ingroup Accountancy (Double entries)
|
||||||
* \brief Class accountancy import
|
* \brief Class with methods for accountancy import
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -52,68 +52,91 @@ class AccountancyImport
|
|||||||
*/
|
*/
|
||||||
public function __construct(DoliDB $db)
|
public function __construct(DoliDB $db)
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
|
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean amount
|
||||||
|
*
|
||||||
|
* @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
||||||
|
* @param array $listfields Fields list to add
|
||||||
|
* @param int $record_key Record key
|
||||||
|
* @return mixed Value
|
||||||
|
*/
|
||||||
|
public function cleanAmount(&$arrayrecord, $listfields, $record_key)
|
||||||
|
{
|
||||||
|
$value_trim = trim($arrayrecord[$record_key]['val']);
|
||||||
|
return floatval($value_trim);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean value with trim
|
||||||
|
*
|
||||||
|
* @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
||||||
|
* @param array $listfields Fields list to add
|
||||||
|
* @param int $record_key Record key
|
||||||
|
* @return mixed Value
|
||||||
|
*/
|
||||||
|
public function cleanValue(&$arrayrecord, $listfields, $record_key)
|
||||||
|
{
|
||||||
|
return trim($arrayrecord[$record_key]['val']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute amount
|
* Compute amount
|
||||||
*
|
*
|
||||||
* @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
* @param array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
||||||
* @param string $fieldname Field name with alias
|
|
||||||
* @param array $listfields Fields list to add
|
* @param array $listfields Fields list to add
|
||||||
* @param array $listvalues Values list to add
|
* @param int $record_key Record key
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return mixed Value
|
||||||
*/
|
*/
|
||||||
public function computeAmount(&$arrayrecord, $fieldname, &$listfields, &$listvalues)
|
public function computeAmount(&$arrayrecord, $listfields, $record_key)
|
||||||
{
|
{
|
||||||
$fieldArr = explode('.', $fieldname);
|
// get fields indexes
|
||||||
if (count($fieldArr) > 0) {
|
$field_index_list = array_flip($listfields);
|
||||||
$fieldname = $fieldArr[1];
|
if (isset($field_index_list['debit']) && isset($field_index_list['credit'])) {
|
||||||
}
|
$debit_index = $field_index_list['debit'];
|
||||||
|
$credit_index = $field_index_list['credit'];
|
||||||
|
|
||||||
$debit = floatval(trim($arrayrecord[11]['val']));
|
$debit = floatval($arrayrecord[$debit_index]['val']);
|
||||||
$credit = floatval(trim($arrayrecord[12]['val']));
|
$credit = floatval($arrayrecord[$credit_index]['val']);
|
||||||
if (!empty($debit)) {
|
if (!empty($debit)) {
|
||||||
$amount = $debit;
|
$amount = $debit;
|
||||||
} else {
|
} else {
|
||||||
$amount = $credit;
|
$amount = $credit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$listfields[] = $fieldname;
|
return "'" . $this->db->escape(abs($amount)) . "'";
|
||||||
$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 array $arrayrecord Array of read values: [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=string), [fieldpos+1]...
|
||||||
* @param string $fieldname Field name with alias
|
|
||||||
* @param array $listfields Fields list to add
|
* @param array $listfields Fields list to add
|
||||||
* @param array $listvalues Values list to add
|
* @param int $record_key Record key
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return mixed Value
|
||||||
*/
|
*/
|
||||||
public function computeDirection(&$arrayrecord, $fieldname, &$listfields, &$listvalues)
|
public function computeDirection(&$arrayrecord, $listfields, $record_key)
|
||||||
{
|
{
|
||||||
$fieldArr = explode('.', $fieldname);
|
$field_index_list = array_flip($listfields);
|
||||||
if (count($fieldArr) > 0) {
|
if (isset($field_index_list['debit'])) {
|
||||||
$fieldname = $fieldArr[1];
|
$debit_index = $field_index_list['debit'];
|
||||||
}
|
|
||||||
|
|
||||||
$debit = floatval(trim($arrayrecord[11]['val']));
|
$debit = floatval($arrayrecord[$debit_index]['val']);
|
||||||
if (!empty($debit)) {
|
if (!empty($debit)) {
|
||||||
$sens = 'D';
|
$sens = 'D';
|
||||||
} else {
|
} else {
|
||||||
$sens = 'C';
|
$sens = 'C';
|
||||||
}
|
}
|
||||||
|
|
||||||
$listfields[] = $fieldname;
|
return "'" . $this->db->escape($sens) . "'";
|
||||||
$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);
|
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
$page = GETPOSTISSET('pageplusonPour le détail de la facture ref…e') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||||
if (empty($page) || $page < 0) {
|
if (empty($page) || $page < 0) {
|
||||||
$page = 0;
|
$page = 0;
|
||||||
}
|
}
|
||||||
@ -137,9 +137,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as l";
|
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||||
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||||
$sql1 .= ' WHERE l.rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
$sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||||
|
|
||||||
dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1);
|
dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1);
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
@ -496,7 +496,7 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="tdoverflowonsmartphone">';
|
print '<td class="tdoverflowonsmartphone small">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||||
|
|||||||
@ -117,6 +117,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
|||||||
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
||||||
|
if (!empty($user->rights->accounting->chartofaccount)) {
|
||||||
print "<br>\n"; print "<br>\n";
|
print "<br>\n"; print "<br>\n";
|
||||||
|
|
||||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||||
@ -163,6 +164,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
|||||||
$s = str_replace('{s}', $textlink, $s);
|
$s = str_replace('{s}', $textlink, $s);
|
||||||
print $s;
|
print $s;
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
if (!empty($conf->tax->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>';
|
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
|
||||||
$step++;
|
$step++;
|
||||||
@ -171,7 +173,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
|||||||
print $s;
|
print $s;
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
}
|
}
|
||||||
if (!empty($conf->expensereport->enabled)) {
|
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++;
|
$step++;
|
||||||
$s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
|
$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 = 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);
|
||||||
@ -185,8 +187,8 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
|
|||||||
print $s;
|
print $s;
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
// Step A - E
|
// Step A - E
|
||||||
|
|
||||||
|
|||||||
@ -117,7 +117,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
|||||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.amount_main_currency, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
||||||
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
||||||
$sql .= " soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
|
$sql .= " soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
|
||||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||||
@ -142,7 +142,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
|||||||
}
|
}
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
|
||||||
$sql .= " WHERE ba.fk_accountancy_journal=".((int) $id_journal);
|
$sql .= " WHERE ba.fk_accountancy_journal=".((int) $id_journal);
|
||||||
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
$sql .= ' AND b.amount <> 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||||
if ($date_start && $date_end) {
|
if ($date_start && $date_end) {
|
||||||
$sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
|
$sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
|
||||||
}
|
}
|
||||||
@ -282,6 +282,7 @@ if ($result) {
|
|||||||
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
|
||||||
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
|
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
|
||||||
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
|
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
|
||||||
|
$reg = array();
|
||||||
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
|
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
|
||||||
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
|
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
|
||||||
} else {
|
} else {
|
||||||
@ -296,6 +297,12 @@ if ($result) {
|
|||||||
$tabtype[$obj->rowid] = 'unknown';
|
$tabtype[$obj->rowid] = 'unknown';
|
||||||
$tabmoreinfo[$obj->rowid] = array();
|
$tabmoreinfo[$obj->rowid] = array();
|
||||||
|
|
||||||
|
$amounttouse = $obj->amount;
|
||||||
|
if (!empty($obj->amount_main_currency)) {
|
||||||
|
// If $obj->amount_main_currency is set, it means that $obj->amount is not in same currency, we must use $obj->amount_main_currency
|
||||||
|
$amounttouse = $obj->amount_main_currency;
|
||||||
|
}
|
||||||
|
|
||||||
// get_url may return -1 which is not traversable
|
// get_url may return -1 which is not traversable
|
||||||
if (is_array($links) && count($links) > 0) {
|
if (is_array($links) && count($links) > 0) {
|
||||||
// Now loop on each link of record in bank (code similar to bankentries_list.php)
|
// Now loop on each link of record in bank (code similar to bankentries_list.php)
|
||||||
@ -334,7 +341,7 @@ if ($result) {
|
|||||||
$societestatic->email = $tabcompany[$obj->rowid]['email'];
|
$societestatic->email = $tabcompany[$obj->rowid]['email'];
|
||||||
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
||||||
if ($compta_soc) {
|
if ($compta_soc) {
|
||||||
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
|
||||||
}
|
}
|
||||||
} elseif ($links[$key]['type'] == 'user') {
|
} elseif ($links[$key]['type'] == 'user') {
|
||||||
$userstatic->id = $links[$key]['url_id'];
|
$userstatic->id = $links[$key]['url_id'];
|
||||||
@ -350,7 +357,7 @@ if ($result) {
|
|||||||
$tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
|
$tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
|
||||||
}
|
}
|
||||||
if ($compta_user) {
|
if ($compta_user) {
|
||||||
$tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
$tabtp[$obj->rowid][$compta_user] += $amounttouse;
|
||||||
}
|
}
|
||||||
} elseif ($links[$key]['type'] == 'sc') {
|
} elseif ($links[$key]['type'] == 'sc') {
|
||||||
$chargestatic->id = $links[$key]['url_id'];
|
$chargestatic->id = $links[$key]['url_id'];
|
||||||
@ -383,7 +390,7 @@ if ($result) {
|
|||||||
$resultmid = $db->query($sqlmid);
|
$resultmid = $db->query($sqlmid);
|
||||||
if ($resultmid) {
|
if ($resultmid) {
|
||||||
$objmid = $db->fetch_object($resultmid);
|
$objmid = $db->fetch_object($resultmid);
|
||||||
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
|
$tabtp[$obj->rowid][$objmid->accountancy_code] += $amounttouse;
|
||||||
}
|
}
|
||||||
} elseif ($links[$key]['type'] == 'payment_donation') {
|
} elseif ($links[$key]['type'] == 'payment_donation') {
|
||||||
$paymentdonstatic->id = $links[$key]['url_id'];
|
$paymentdonstatic->id = $links[$key]['url_id'];
|
||||||
@ -391,7 +398,7 @@ if ($result) {
|
|||||||
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
|
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2);
|
||||||
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
|
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
|
||||||
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
|
$tabtp[$obj->rowid][$account_pay_donation] += $amounttouse;
|
||||||
} elseif ($links[$key]['type'] == 'member') {
|
} elseif ($links[$key]['type'] == 'member') {
|
||||||
$paymentsubscriptionstatic->id = $links[$key]['url_id'];
|
$paymentsubscriptionstatic->id = $links[$key]['url_id'];
|
||||||
$paymentsubscriptionstatic->ref = $links[$key]['url_id'];
|
$paymentsubscriptionstatic->ref = $links[$key]['url_id'];
|
||||||
@ -399,14 +406,14 @@ if ($result) {
|
|||||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2);
|
||||||
$tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id;
|
$tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id;
|
||||||
$paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id);
|
$paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id);
|
||||||
$tabtp[$obj->rowid][$account_pay_subscription] += $obj->amount;
|
$tabtp[$obj->rowid][$account_pay_subscription] += $amounttouse;
|
||||||
} elseif ($links[$key]['type'] == 'payment_vat') { // Payment VAT
|
} elseif ($links[$key]['type'] == 'payment_vat') { // Payment VAT
|
||||||
$paymentvatstatic->id = $links[$key]['url_id'];
|
$paymentvatstatic->id = $links[$key]['url_id'];
|
||||||
$paymentvatstatic->ref = $links[$key]['url_id'];
|
$paymentvatstatic->ref = $links[$key]['url_id'];
|
||||||
$paymentvatstatic->label = $links[$key]['label'];
|
$paymentvatstatic->label = $links[$key]['label'];
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2);
|
||||||
$tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id;
|
$tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id;
|
||||||
$tabtp[$obj->rowid][$account_pay_vat] += $obj->amount;
|
$tabtp[$obj->rowid][$account_pay_vat] += $amounttouse;
|
||||||
} elseif ($links[$key]['type'] == 'payment_salary') {
|
} elseif ($links[$key]['type'] == 'payment_salary') {
|
||||||
$paymentsalstatic->id = $links[$key]['url_id'];
|
$paymentsalstatic->id = $links[$key]['url_id'];
|
||||||
$paymentsalstatic->ref = $links[$key]['url_id'];
|
$paymentsalstatic->ref = $links[$key]['url_id'];
|
||||||
@ -438,7 +445,7 @@ if ($result) {
|
|||||||
if (empty($obj->typeop_user)) { // Add test to avoid to add amount twice if a link already exists also on user.
|
if (empty($obj->typeop_user)) { // Add test to avoid to add amount twice if a link already exists also on user.
|
||||||
$compta_user = $userstatic->accountancy_code;
|
$compta_user = $userstatic->accountancy_code;
|
||||||
if ($compta_user) {
|
if ($compta_user) {
|
||||||
$tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
$tabtp[$obj->rowid][$compta_user] += $amounttouse;
|
||||||
$tabuser[$obj->rowid] = array(
|
$tabuser[$obj->rowid] = array(
|
||||||
'id' => $userstatic->id,
|
'id' => $userstatic->id,
|
||||||
'name' => dolGetFirstLastname($userstatic->firstname, $userstatic->lastname),
|
'name' => dolGetFirstLastname($userstatic->firstname, $userstatic->lastname),
|
||||||
@ -465,14 +472,14 @@ if ($result) {
|
|||||||
$account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
|
$account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
|
||||||
$account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
|
$account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
|
||||||
$tabpay[$obj->rowid]["account_various"] = $account_various;
|
$tabpay[$obj->rowid]["account_various"] = $account_various;
|
||||||
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
|
$tabtp[$obj->rowid][$account_subledger] += $amounttouse;
|
||||||
} elseif ($links[$key]['type'] == 'payment_loan') {
|
} elseif ($links[$key]['type'] == 'payment_loan') {
|
||||||
$paymentloanstatic->id = $links[$key]['url_id'];
|
$paymentloanstatic->id = $links[$key]['url_id'];
|
||||||
$paymentloanstatic->ref = $links[$key]['url_id'];
|
$paymentloanstatic->ref = $links[$key]['url_id'];
|
||||||
$paymentloanstatic->fk_loan = $links[$key]['url_id'];
|
$paymentloanstatic->fk_loan = $links[$key]['url_id'];
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2);
|
||||||
$tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id;
|
$tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id;
|
||||||
//$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount;
|
//$tabtp[$obj->rowid][$account_pay_loan] += $amounttouse;
|
||||||
$sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest';
|
$sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest';
|
||||||
$sqlmid .= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
|
$sqlmid .= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
|
||||||
$sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.((int) $obj->rowid);
|
$sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.((int) $obj->rowid);
|
||||||
@ -488,14 +495,14 @@ if ($result) {
|
|||||||
} elseif ($links[$key]['type'] == 'banktransfert') {
|
} elseif ($links[$key]['type'] == 'banktransfert') {
|
||||||
$accountLinestatic->fetch($links[$key]['url_id']);
|
$accountLinestatic->fetch($links[$key]['url_id']);
|
||||||
$tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1);
|
$tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1);
|
||||||
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
|
$tabtp[$obj->rowid][$account_transfer] += $amounttouse;
|
||||||
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
|
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
|
||||||
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);
|
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
|
$tabbq[$obj->rowid][$compta_bank] += $amounttouse;
|
||||||
|
|
||||||
// If no links were found to know the amount on thirdparty, we try to guess it.
|
// If no links were found to know the amount on thirdparty, we try to guess it.
|
||||||
// This may happens on bank entries without the links lines to 'company'.
|
// This may happens on bank entries without the links lines to 'company'.
|
||||||
@ -542,7 +549,7 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
@ -49,6 +49,7 @@ $search_societe = GETPOST('search_societe', 'alpha');
|
|||||||
$search_lineid = GETPOST('search_lineid', 'int');
|
$search_lineid = GETPOST('search_lineid', 'int');
|
||||||
$search_ref = GETPOST('search_ref', 'alpha');
|
$search_ref = GETPOST('search_ref', 'alpha');
|
||||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||||
|
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
|
||||||
$search_label = GETPOST('search_label', 'alpha');
|
$search_label = GETPOST('search_label', 'alpha');
|
||||||
$search_desc = GETPOST('search_desc', 'alpha');
|
$search_desc = GETPOST('search_desc', 'alpha');
|
||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
@ -112,6 +113,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
$search_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
$search_invoice = '';
|
$search_invoice = '';
|
||||||
|
$search_ref_supplier = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
$search_desc = '';
|
$search_desc = '';
|
||||||
$search_amount = '';
|
$search_amount = '';
|
||||||
@ -140,9 +142,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as l";
|
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||||
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||||
$sql1 .= ' WHERE l.rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
$sql1 .= ' WHERE rowid IN ('.$db->sanitize(implode(',', $changeaccount)).')';
|
||||||
|
|
||||||
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1);
|
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1);
|
||||||
$resql1 = $db->query($sql1);
|
$resql1 = $db->query($sql1);
|
||||||
@ -236,6 +238,9 @@ if ($search_lineid) {
|
|||||||
if (strlen(trim($search_invoice))) {
|
if (strlen(trim($search_invoice))) {
|
||||||
$sql .= natural_search("f.ref", $search_invoice);
|
$sql .= natural_search("f.ref", $search_invoice);
|
||||||
}
|
}
|
||||||
|
if (strlen(trim($search_ref_supplier))) {
|
||||||
|
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
|
||||||
|
}
|
||||||
if (strlen(trim($search_label))) {
|
if (strlen(trim($search_label))) {
|
||||||
$sql .= natural_search("f.libelle", $search_label);
|
$sql .= natural_search("f.libelle", $search_label);
|
||||||
}
|
}
|
||||||
@ -328,6 +333,9 @@ if ($result) {
|
|||||||
if ($search_ref) {
|
if ($search_ref) {
|
||||||
$param .= "&search_ref=".urlencode($search_ref);
|
$param .= "&search_ref=".urlencode($search_ref);
|
||||||
}
|
}
|
||||||
|
if ($search_ref_supplier) {
|
||||||
|
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||||
|
}
|
||||||
if ($search_label) {
|
if ($search_label) {
|
||||||
$param .= "&search_label=".urlencode($search_label);
|
$param .= "&search_label=".urlencode($search_label);
|
||||||
}
|
}
|
||||||
@ -392,6 +400,7 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||||
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
@ -420,6 +429,7 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
@ -446,6 +456,9 @@ if ($result) {
|
|||||||
|
|
||||||
$facturefournisseur_static->ref = $objp->ref;
|
$facturefournisseur_static->ref = $objp->ref;
|
||||||
$facturefournisseur_static->id = $objp->facid;
|
$facturefournisseur_static->id = $objp->facid;
|
||||||
|
$facturefournisseur_static->type = $objp->ftype;
|
||||||
|
$facturefournisseur_static->ref_supplier = $objp->ref_supplier;
|
||||||
|
$facturefournisseur_static->label = $objp->invoice_label;
|
||||||
|
|
||||||
$thirdpartystatic->id = $objp->socid;
|
$thirdpartystatic->id = $objp->socid;
|
||||||
$thirdpartystatic->name = $objp->name;
|
$thirdpartystatic->name = $objp->name;
|
||||||
@ -465,8 +478,8 @@ if ($result) {
|
|||||||
$productstatic->status = $objp->tosell;
|
$productstatic->status = $objp->tosell;
|
||||||
$productstatic->status_buy = $objp->tobuy;
|
$productstatic->status_buy = $objp->tobuy;
|
||||||
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
|
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
|
||||||
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy;
|
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy_intra;
|
||||||
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy;
|
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy_export;
|
||||||
|
|
||||||
$accountingaccountstatic->rowid = $objp->fk_compte;
|
$accountingaccountstatic->rowid = $objp->fk_compte;
|
||||||
$accountingaccountstatic->label = $objp->label_account;
|
$accountingaccountstatic->label = $objp->label_account;
|
||||||
@ -481,7 +494,13 @@ if ($result) {
|
|||||||
// Ref Invoice
|
// Ref Invoice
|
||||||
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1).'</td>';
|
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1).'</td>';
|
||||||
|
|
||||||
print '<td class="tdoverflowonsmartphone">';
|
// Ref supplier invoice
|
||||||
|
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
|
||||||
|
print $objp->ref_supplier;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Supplier invoice label
|
||||||
|
print '<td class="tdoverflowonsmartphone small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
|
||||||
print $objp->invoice_label;
|
print $objp->invoice_label;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -501,7 +520,7 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="tdoverflowonsmartphone">';
|
print '<td class="tdoverflowonsmartphone small">';
|
||||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
|
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
@ -55,6 +55,7 @@ $mesCasesCochees = GETPOST('toselect', 'array');
|
|||||||
$search_societe = GETPOST('search_societe', 'alpha');
|
$search_societe = GETPOST('search_societe', 'alpha');
|
||||||
$search_lineid = GETPOST('search_lineid', 'int');
|
$search_lineid = GETPOST('search_lineid', 'int');
|
||||||
$search_ref = GETPOST('search_ref', 'alpha');
|
$search_ref = GETPOST('search_ref', 'alpha');
|
||||||
|
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
|
||||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||||
$search_label = GETPOST('search_label', 'alpha');
|
$search_label = GETPOST('search_label', 'alpha');
|
||||||
$search_desc = GETPOST('search_desc', 'alpha');
|
$search_desc = GETPOST('search_desc', 'alpha');
|
||||||
@ -137,6 +138,7 @@ if (empty($reshook)) {
|
|||||||
$search_societe = '';
|
$search_societe = '';
|
||||||
$search_lineid = '';
|
$search_lineid = '';
|
||||||
$search_ref = '';
|
$search_ref = '';
|
||||||
|
$search_ref_supplier = '';
|
||||||
$search_invoice = '';
|
$search_invoice = '';
|
||||||
$search_label = '';
|
$search_label = '';
|
||||||
$search_desc = '';
|
$search_desc = '';
|
||||||
@ -290,6 +292,9 @@ if (strlen(trim($search_invoice))) {
|
|||||||
if (strlen(trim($search_ref))) {
|
if (strlen(trim($search_ref))) {
|
||||||
$sql .= natural_search("p.ref", $search_ref);
|
$sql .= natural_search("p.ref", $search_ref);
|
||||||
}
|
}
|
||||||
|
if (strlen(trim($search_ref_supplier))) {
|
||||||
|
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
|
||||||
|
}
|
||||||
if (strlen(trim($search_label))) {
|
if (strlen(trim($search_label))) {
|
||||||
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
|
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
|
||||||
}
|
}
|
||||||
@ -413,6 +418,9 @@ if ($result) {
|
|||||||
if ($search_ref) {
|
if ($search_ref) {
|
||||||
$param .= '&search_ref='.urlencode($search_ref);
|
$param .= '&search_ref='.urlencode($search_ref);
|
||||||
}
|
}
|
||||||
|
if ($search_ref_supplier) {
|
||||||
|
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||||
|
}
|
||||||
if ($search_label) {
|
if ($search_label) {
|
||||||
$param .= '&search_label='.urlencode($search_label);
|
$param .= '&search_label='.urlencode($search_label);
|
||||||
}
|
}
|
||||||
@ -469,7 +477,8 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||||
|
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||||
@ -499,7 +508,8 @@ if ($result) {
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
//print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||||
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||||
@ -566,6 +576,7 @@ if ($result) {
|
|||||||
$facturefourn_static->ref = $objp->ref;
|
$facturefourn_static->ref = $objp->ref;
|
||||||
$facturefourn_static->id = $objp->facid;
|
$facturefourn_static->id = $objp->facid;
|
||||||
$facturefourn_static->type = $objp->ftype;
|
$facturefourn_static->type = $objp->ftype;
|
||||||
|
$facturefourn_static->ref_supplier = $objp->ref_supplier;
|
||||||
$facturefourn_static->label = $objp->invoice_label;
|
$facturefourn_static->label = $objp->invoice_label;
|
||||||
$facturefourn_static->date = $db->jdate($objp->datef);
|
$facturefourn_static->date = $db->jdate($objp->datef);
|
||||||
|
|
||||||
@ -625,15 +636,21 @@ if ($result) {
|
|||||||
// Ref Invoice
|
// Ref Invoice
|
||||||
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
|
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
|
||||||
|
|
||||||
/*print '<td class="tdoverflowonsmartphone">';
|
// Ref supplier invoice
|
||||||
|
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
|
||||||
|
print $objp->ref_supplier;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Supplier invoice label
|
||||||
|
print '<td class="tdoverflowmax125 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
|
||||||
print $objp->invoice_label;
|
print $objp->invoice_label;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
*/
|
|
||||||
|
|
||||||
|
// Date
|
||||||
print '<td class="center">'.dol_print_date($facturefourn_static->date, 'day').'</td>';
|
print '<td class="center">'.dol_print_date($facturefourn_static->date, 'day').'</td>';
|
||||||
|
|
||||||
// Ref Product
|
// Ref Product
|
||||||
print '<td class="tdoverflowmax150">';
|
print '<td class="tdoverflowmax100">';
|
||||||
if ($product_static->id > 0) {
|
if ($product_static->id > 0) {
|
||||||
print $product_static->getNomUrl(1);
|
print $product_static->getNomUrl(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1534,9 +1534,9 @@ class Adherent extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $date Date of effect of subscription
|
* @param int $date Date of effect of subscription
|
||||||
* @param double $amount Amount of subscription (0 accepted for some members)
|
* @param double $amount Amount of subscription (0 accepted for some members)
|
||||||
* @param int $accountid Id bank account
|
* @param int $accountid Id bank account. NOT USED.
|
||||||
* @param string $operation Type of payment (if Id bank account provided). Example: 'CB', ...
|
* @param string $operation Code of payment mode (if Id bank account provided). Example: 'CB', ... NOT USED.
|
||||||
* @param string $label Label operation (if Id bank account provided)
|
* @param string $label Label operation (if Id bank account provided).
|
||||||
* @param string $num_chq Numero cheque (if Id bank account provided)
|
* @param string $num_chq Numero cheque (if Id bank account provided)
|
||||||
* @param string $emetteur_nom Name of cheque writer
|
* @param string $emetteur_nom Name of cheque writer
|
||||||
* @param string $emetteur_banque Name of bank of cheque
|
* @param string $emetteur_banque Name of bank of cheque
|
||||||
|
|||||||
@ -271,7 +271,7 @@ class AdherentType extends CommonObject
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('ADHERENT_TYPE_DEL_MULTILANGS', $user);
|
$result = $this->call_trigger('MEMBER_TYPE_DEL_MULTILANGS', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
|
dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR);
|
||||||
|
|||||||
@ -358,7 +358,7 @@ class Members extends DolibarrApi
|
|||||||
if ($member->update(DolibarrApiAccess::$user) >= 0) {
|
if ($member->update(DolibarrApiAccess::$user) >= 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
} else {
|
} else {
|
||||||
throw new RestException(500, $member->error);
|
throw new RestException(500, 'Error when updating member: '.$member->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -204,7 +204,7 @@ class MembersTypes extends DolibarrApi
|
|||||||
if ($membertype->update(DolibarrApiAccess::$user) >= 0) {
|
if ($membertype->update(DolibarrApiAccess::$user) >= 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
} else {
|
} else {
|
||||||
throw new RestException(500, $membertype->error);
|
throw new RestException(500, 'Error when updating member type: '.$membertype->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -159,7 +159,7 @@ class Subscriptions extends DolibarrApi
|
|||||||
$subscription->$field = $value;
|
$subscription->$field = $value;
|
||||||
}
|
}
|
||||||
if ($subscription->create(DolibarrApiAccess::$user) < 0) {
|
if ($subscription->create(DolibarrApiAccess::$user) < 0) {
|
||||||
throw new RestException(500, 'Error when creating subscription', array_merge(array($subscription->error), $subscription->errors));
|
throw new RestException(500, 'Error when creating contribution', array_merge(array($subscription->error), $subscription->errors));
|
||||||
}
|
}
|
||||||
return $subscription->id;
|
return $subscription->id;
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ class Subscriptions extends DolibarrApi
|
|||||||
if ($subscription->update(DolibarrApiAccess::$user) > 0) {
|
if ($subscription->update(DolibarrApiAccess::$user) > 0) {
|
||||||
return $this->get($id);
|
return $this->get($id);
|
||||||
} else {
|
} else {
|
||||||
throw new RestException(500, $subscription->error);
|
throw new RestException(500, 'Error when updating contribution: '.$subscription->error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -358,7 +358,7 @@ class Subscription extends CommonObject
|
|||||||
$result = $member->update_end_date($user);
|
$result = $member->update_end_date($user);
|
||||||
|
|
||||||
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) { // If we found bank account line (this means this->fk_bank defined)
|
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) { // If we found bank account line (this means this->fk_bank defined)
|
||||||
$result = $accountline->delete($user); // Return false if refused because line is conciliated
|
$result = $accountline->delete($user); // Return false if refused because line is reconciled
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@ -177,8 +177,8 @@ if ($conf->use_javascript_ajax) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($AdherentType as $key => $adhtype) {
|
foreach ($AdherentType as $key => $adhtype) {
|
||||||
$dataval['draft'][] = array($i, isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0);
|
$dataval['draft'][] = array($i, isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0);
|
||||||
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0);
|
|
||||||
$dataval['uptodate'][] = array($i, isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0);
|
$dataval['uptodate'][] = array($i, isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0);
|
||||||
|
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : 0);
|
||||||
$dataval['excluded'][] = array($i, isset($MembersExcluded[$key]) ? $MembersExcluded[$key] : 0);
|
$dataval['excluded'][] = array($i, isset($MembersExcluded[$key]) ? $MembersExcluded[$key] : 0);
|
||||||
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
|
$dataval['resiliated'][] = array($i, isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0);
|
||||||
|
|
||||||
@ -191,18 +191,18 @@ if ($conf->use_javascript_ajax) {
|
|||||||
}
|
}
|
||||||
$total = $SumToValidate + $SumValidated + $SumUpToDate + $SumExcluded + $SumResiliated;
|
$total = $SumToValidate + $SumValidated + $SumUpToDate + $SumExcluded + $SumResiliated;
|
||||||
$dataseries = array();
|
$dataseries = array();
|
||||||
$dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), round($SumValidated));
|
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SumToValidate)); // Draft, not yet validated
|
||||||
$dataseries[] = array($langs->transnoentitiesnoconv("UpToDate"), round($SumUpToDate));
|
$dataseries[] = array($langs->transnoentitiesnoconv("UpToDate"), round($SumUpToDate));
|
||||||
|
$dataseries[] = array($langs->transnoentitiesnoconv("OutOfDate"), round($SumValidated));
|
||||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), round($SumExcluded));
|
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusExcluded"), round($SumExcluded));
|
||||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SumResiliated));
|
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SumResiliated));
|
||||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SumToValidate));
|
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||||
$dolgraph = new DolGraph();
|
$dolgraph = new DolGraph();
|
||||||
$dolgraph->SetData($dataseries);
|
$dolgraph->SetData($dataseries);
|
||||||
$dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, '-'.$badgeStatus8, $badgeStatus6, '-'.$badgeStatus0));
|
$dolgraph->SetDataColor(array('-'.$badgeStatus0, $badgeStatus4, '-'.$badgeStatus1, '-'.$badgeStatus8, $badgeStatus6));
|
||||||
$dolgraph->setShowLegend(2);
|
$dolgraph->setShowLegend(2);
|
||||||
$dolgraph->setShowPercent(1);
|
$dolgraph->setShowPercent(1);
|
||||||
$dolgraph->SetType(array('pie'));
|
$dolgraph->SetType(array('pie'));
|
||||||
|
|||||||
@ -505,7 +505,7 @@ if (GETPOSTISSET("search_status")) {
|
|||||||
|
|
||||||
if ($search_type > 0) {
|
if ($search_type > 0) {
|
||||||
$membertype = new AdherentType($db);
|
$membertype = new AdherentType($db);
|
||||||
$result = $membertype->fetch(GETPOST("type", 'int'));
|
$result = $membertype->fetch($search_type);
|
||||||
$titre .= " (".$membertype->label.")";
|
$titre .= " (".$membertype->label.")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,7 +767,7 @@ if (!empty($arrayfields['d.email']['checked'])) {
|
|||||||
}
|
}
|
||||||
// End of subscription date
|
// End of subscription date
|
||||||
if (!empty($arrayfields['d.datefin']['checked'])) {
|
if (!empty($arrayfields['d.datefin']['checked'])) {
|
||||||
print '<td class="liste_titre left">';
|
print '<td class="liste_titre center">';
|
||||||
$selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
|
$selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
|
||||||
print $form->selectarray('search_filter', $selectarray, $search_filter);
|
print $form->selectarray('search_filter', $selectarray, $search_filter);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -858,7 +858,7 @@ if (!empty($arrayfields['state.nom']['checked'])) {
|
|||||||
print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['d.phone']['checked'])) {
|
if (!empty($arrayfields['d.phone']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['d.phone']['label'], $_SERVER["PHP_SELF"], 'd.phone', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['d.phone']['label'], $_SERVER["PHP_SELF"], 'd.phone', '', $param, '', $sortfield, $sortorder);
|
||||||
@ -873,7 +873,7 @@ if (!empty($arrayfields['d.email']['checked'])) {
|
|||||||
print_liste_field_titre($arrayfields['d.email']['label'], $_SERVER["PHP_SELF"], 'd.email', '', $param, '', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['d.email']['label'], $_SERVER["PHP_SELF"], 'd.email', '', $param, '', $sortfield, $sortorder);
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['d.datefin']['checked'])) {
|
if (!empty($arrayfields['d.datefin']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin', '', $param, 'align="center"', $sortfield, $sortorder);
|
print_liste_field_titre($arrayfields['d.datefin']['label'], $_SERVER["PHP_SELF"], 'd.datefin', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
@ -1110,16 +1110,14 @@ while ($i < min($num, $limit)) {
|
|||||||
// End of subscription date
|
// End of subscription date
|
||||||
$datefin = $db->jdate($obj->datefin);
|
$datefin = $db->jdate($obj->datefin);
|
||||||
if (!empty($arrayfields['d.datefin']['checked'])) {
|
if (!empty($arrayfields['d.datefin']['checked'])) {
|
||||||
if ($datefin) {
|
|
||||||
print '<td class="nowrap center">';
|
print '<td class="nowrap center">';
|
||||||
|
if ($datefin) {
|
||||||
print dol_print_date($datefin, 'day');
|
print dol_print_date($datefin, 'day');
|
||||||
if ($memberstatic->hasDelay()) {
|
if ($memberstatic->hasDelay()) {
|
||||||
$textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')';
|
$textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')';
|
||||||
print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
|
print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
|
||||||
}
|
}
|
||||||
print '</td>';
|
|
||||||
} else {
|
} else {
|
||||||
print '<td class="nowrap left">';
|
|
||||||
if (!empty($obj->subscription)) {
|
if (!empty($obj->subscription)) {
|
||||||
print $langs->trans("SubscriptionNotReceived");
|
print $langs->trans("SubscriptionNotReceived");
|
||||||
if ($obj->statut > 0) {
|
if ($obj->statut > 0) {
|
||||||
@ -1128,8 +1126,8 @@ while ($i < min($num, $limit)) {
|
|||||||
} else {
|
} else {
|
||||||
print ' ';
|
print ' ';
|
||||||
}
|
}
|
||||||
print '</td>';
|
|
||||||
}
|
}
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||||
|
|||||||
@ -125,6 +125,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
|
|||||||
$object->duration_value = $duration_value;
|
$object->duration_value = $duration_value;
|
||||||
$object->duration_unit = $duration_unit;
|
$object->duration_unit = $duration_unit;
|
||||||
$object->note = trim($comment);
|
$object->note = trim($comment);
|
||||||
|
$object->note_public = trim($comment);
|
||||||
$object->mail_valid = trim($mail_valid);
|
$object->mail_valid = trim($mail_valid);
|
||||||
$object->vote = (int) $vote;
|
$object->vote = (int) $vote;
|
||||||
|
|
||||||
@ -176,6 +177,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
|
|||||||
$object->duration_value = $duration_value;
|
$object->duration_value = $duration_value;
|
||||||
$object->duration_unit = $duration_unit;
|
$object->duration_unit = $duration_unit;
|
||||||
$object->note = trim($comment);
|
$object->note = trim($comment);
|
||||||
|
$object->note_public = trim($comment);
|
||||||
$object->mail_valid = trim($mail_valid);
|
$object->mail_valid = trim($mail_valid);
|
||||||
$object->vote = (boolean) trim($vote);
|
$object->vote = (boolean) trim($vote);
|
||||||
|
|
||||||
@ -358,7 +360,7 @@ if ($action == 'create') {
|
|||||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
|
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||||
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1);
|
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Morphy
|
// Morphy
|
||||||
@ -375,7 +377,7 @@ if ($action == 'create') {
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>';
|
print '<tr><td>'.$langs->trans("Amount").'</td><td>';
|
||||||
print '<input name="amount" size="5" value="'.price($amount).'">';
|
print '<input name="amount" size="5" value="'.(GETPOSTISSET('amount') ? GETPOST('amount') : price($amount)).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||||
@ -389,12 +391,12 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor = new DolEditor('comment', $object->note, '', 200, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
|
$doleditor = new DolEditor('comment', (GETPOSTISSET('comment') ? GETPOST('comment', 'restricthtml') : $object->note_public), '', 200, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
|
$doleditor = new DolEditor('mail_valid', GETPOSTISSET('mail_valid') ? GETPOST('mail_valid') : $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -783,7 +785,7 @@ if ($rowid > 0) {
|
|||||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth300" name="label" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth300" name="label" value="'.dol_escape_htmltag($object->label).'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||||
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status);
|
print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Morphy
|
// Morphy
|
||||||
|
|||||||
@ -369,7 +369,7 @@ $form = new Form($db);
|
|||||||
$formother = new FormOther($db);
|
$formother = new FormOther($db);
|
||||||
$formcompany = new FormCompany($db);
|
$formcompany = new FormCompany($db);
|
||||||
|
|
||||||
$countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')</span>';
|
$countrynotdefined = '<span class="error">'.$langs->trans("ErrorSetACountryFirst").' <a href="#trzipbeforecountry">('.$langs->trans("SeeAbove").')</a></span>';
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
|
print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
|
||||||
|
|
||||||
@ -410,10 +410,10 @@ print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->
|
|||||||
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('MAIN_INFO_SOCIETE_ADDRESS') ? GETPOST('MAIN_INFO_SOCIETE_ADDRESS', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS) ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : '')).'</textarea></td></tr>'."\n";
|
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('MAIN_INFO_SOCIETE_ADDRESS') ? GETPOST('MAIN_INFO_SOCIETE_ADDRESS', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS) ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : '')).'</textarea></td></tr>'."\n";
|
||||||
|
|
||||||
// Zip
|
// Zip
|
||||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
|
print '<tr class="oddeven" id="trzipbeforecountry"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
|
||||||
print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_ZIP') ? GETPOST('MAIN_INFO_SOCIETE_ZIP', 'alpha') : (!empty($conf->global->MAIN_INFO_SOCIETE_ZIP) ? $conf->global->MAIN_INFO_SOCIETE_ZIP : ''))).'"></td></tr>'."\n";
|
print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_ZIP') ? GETPOST('MAIN_INFO_SOCIETE_ZIP', 'alpha') : (!empty($conf->global->MAIN_INFO_SOCIETE_ZIP) ? $conf->global->MAIN_INFO_SOCIETE_ZIP : ''))).'"></td></tr>'."\n";
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
|
print '<tr class="oddeven" id="trtownbeforecountry"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
|
||||||
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_TOWN) ? $conf->global->MAIN_INFO_SOCIETE_TOWN : ''))).'"></td></tr>'."\n";
|
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'nohtml') : (!empty($conf->global->MAIN_INFO_SOCIETE_TOWN) ? $conf->global->MAIN_INFO_SOCIETE_TOWN : ''))).'"></td></tr>'."\n";
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
|
|||||||
@ -94,7 +94,7 @@ if (!GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2
|
|||||||
$search_code = GETPOST('search_code', 'alpha');
|
$search_code = GETPOST('search_code', 'alpha');
|
||||||
|
|
||||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
$hookmanager->initHooks(array('admin'));
|
$hookmanager->initHooks(array('admin', 'dictionaryadmin'));
|
||||||
|
|
||||||
// This page is a generic page to edit dictionaries
|
// This page is a generic page to edit dictionaries
|
||||||
// Put here declaration of dictionaries properties
|
// Put here declaration of dictionaries properties
|
||||||
@ -218,7 +218,7 @@ $tabsql[17] = "SELECT id as rowid, code, label, accountancy_code, active FR
|
|||||||
$tabsql[18] = "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode";
|
$tabsql[18] = "SELECT rowid as rowid, code, libelle, tracking, active FROM ".MAIN_DB_PREFIX."c_shipment_mode";
|
||||||
$tabsql[19] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif";
|
$tabsql[19] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_effectif";
|
||||||
$tabsql[20] = "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method";
|
$tabsql[20] = "SELECT rowid as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_input_method";
|
||||||
$tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.position FROM ".MAIN_DB_PREFIX."c_availability AS c";
|
$tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.qty, c.active, c.position FROM ".MAIN_DB_PREFIX."c_availability AS c";
|
||||||
$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
|
$tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
|
||||||
$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
$tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||||
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
||||||
@ -265,7 +265,7 @@ $tabsqlsort[17] = "code ASC";
|
|||||||
$tabsqlsort[18] = "code ASC, libelle ASC";
|
$tabsqlsort[18] = "code ASC, libelle ASC";
|
||||||
$tabsqlsort[19] = "id ASC";
|
$tabsqlsort[19] = "id ASC";
|
||||||
$tabsqlsort[20] = "code ASC, libelle ASC";
|
$tabsqlsort[20] = "code ASC, libelle ASC";
|
||||||
$tabsqlsort[21] = "code ASC, label ASC, position ASC";
|
$tabsqlsort[21] = "code ASC, label ASC, position ASC, type_duration ASC, qty ASC";
|
||||||
$tabsqlsort[22] = "code ASC, label ASC";
|
$tabsqlsort[22] = "code ASC, label ASC";
|
||||||
$tabsqlsort[23] = "country ASC, taux ASC";
|
$tabsqlsort[23] = "country ASC, taux ASC";
|
||||||
$tabsqlsort[24] = "code ASC, label ASC";
|
$tabsqlsort[24] = "code ASC, label ASC";
|
||||||
@ -312,7 +312,7 @@ $tabfield[17] = "code,label,accountancy_code";
|
|||||||
$tabfield[18] = "code,libelle,tracking";
|
$tabfield[18] = "code,libelle,tracking";
|
||||||
$tabfield[19] = "code,libelle";
|
$tabfield[19] = "code,libelle";
|
||||||
$tabfield[20] = "code,libelle";
|
$tabfield[20] = "code,libelle";
|
||||||
$tabfield[21] = "code,label,position";
|
$tabfield[21] = "code,label,qty,type_duration,position";
|
||||||
$tabfield[22] = "code,label";
|
$tabfield[22] = "code,label";
|
||||||
$tabfield[23] = "country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfield[23] = "country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfield[24] = "code,label";
|
$tabfield[24] = "code,label";
|
||||||
@ -359,7 +359,7 @@ $tabfieldvalue[17] = "code,label,accountancy_code";
|
|||||||
$tabfieldvalue[18] = "code,libelle,tracking";
|
$tabfieldvalue[18] = "code,libelle,tracking";
|
||||||
$tabfieldvalue[19] = "code,libelle";
|
$tabfieldvalue[19] = "code,libelle";
|
||||||
$tabfieldvalue[20] = "code,libelle";
|
$tabfieldvalue[20] = "code,libelle";
|
||||||
$tabfieldvalue[21] = "code,label,position";
|
$tabfieldvalue[21] = "code,label,qty,type_duration,position";
|
||||||
$tabfieldvalue[22] = "code,label";
|
$tabfieldvalue[22] = "code,label";
|
||||||
$tabfieldvalue[23] = "country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfieldvalue[23] = "country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfieldvalue[24] = "code,label";
|
$tabfieldvalue[24] = "code,label";
|
||||||
@ -406,7 +406,7 @@ $tabfieldinsert[17] = "code,label,accountancy_code";
|
|||||||
$tabfieldinsert[18] = "code,libelle,tracking";
|
$tabfieldinsert[18] = "code,libelle,tracking";
|
||||||
$tabfieldinsert[19] = "code,libelle";
|
$tabfieldinsert[19] = "code,libelle";
|
||||||
$tabfieldinsert[20] = "code,libelle";
|
$tabfieldinsert[20] = "code,libelle";
|
||||||
$tabfieldinsert[21] = "code,label,position";
|
$tabfieldinsert[21] = "code,label,qty,type_duration,position";
|
||||||
$tabfieldinsert[22] = "code,label";
|
$tabfieldinsert[22] = "code,label";
|
||||||
$tabfieldinsert[23] = "fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
$tabfieldinsert[23] = "fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
||||||
$tabfieldinsert[24] = "code,label";
|
$tabfieldinsert[24] = "code,label";
|
||||||
@ -566,7 +566,7 @@ $tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
|
|||||||
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
$tabhelp[35] = array();
|
$tabhelp[35] = array();
|
||||||
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
||||||
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('MeasuringUnitTypeDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'));
|
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('Measuringtype_durationDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'));
|
||||||
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
|
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
|
||||||
$tabhelp[39] = array('code'=>$langs->trans("EnterAnyCode"));
|
$tabhelp[39] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||||
$tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"));
|
$tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"));
|
||||||
@ -694,11 +694,36 @@ if ($id == 10) {
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$parameters = array(
|
||||||
|
'id' =>$id,
|
||||||
|
'rowid' =>$rowid,
|
||||||
|
'code' =>$code,
|
||||||
|
'confirm' =>$confirm,
|
||||||
|
'entity' =>$entity,
|
||||||
|
'taborder' =>$taborder,
|
||||||
|
'tabname' =>$tabname,
|
||||||
|
'tablib' =>$tablib,
|
||||||
|
'tabsql' =>$tabsql,
|
||||||
|
'tabsqlsort' =>$tabsqlsort,
|
||||||
|
'tabfield' =>$tabfield,
|
||||||
|
'tabfieldvalue' =>$tabfieldvalue,
|
||||||
|
'tabfieldinsert'=>$tabfieldinsert,
|
||||||
|
'tabrowid' =>$tabrowid,
|
||||||
|
'tabcond' =>$tabcond,
|
||||||
|
'tabhelp' =>$tabhelp,
|
||||||
|
'tabcomplete' =>$tabcomplete
|
||||||
|
);
|
||||||
|
$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');
|
||||||
|
}
|
||||||
|
|
||||||
if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) {
|
if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) {
|
||||||
$search_country_id = '';
|
$search_country_id = '';
|
||||||
$search_code = '';
|
$search_code = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($reshook)) {
|
||||||
// Actions add or modify an entry into a dictionary
|
// Actions add or modify an entry into a dictionary
|
||||||
if (GETPOST('actionadd') || GETPOST('actionmodify')) {
|
if (GETPOST('actionadd') || GETPOST('actionmodify')) {
|
||||||
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
|
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
|
||||||
@ -1132,7 +1157,7 @@ if ($action == 'disable_eec') {
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -1466,6 +1491,9 @@ if ($id) {
|
|||||||
if ($value == 'block_if_negative') {
|
if ($value == 'block_if_negative') {
|
||||||
$valuetoshow = $langs->trans('BlockHolidayIfNegative');
|
$valuetoshow = $langs->trans('BlockHolidayIfNegative');
|
||||||
}
|
}
|
||||||
|
if ($value == 'type_duration') {
|
||||||
|
$valuetoshow = $langs->trans('Unit');
|
||||||
|
}
|
||||||
|
|
||||||
if ($id == 2) { // Special case for state page
|
if ($id == 2) { // Special case for state page
|
||||||
if ($value == 'region_id') {
|
if ($value == 'region_id') {
|
||||||
@ -1818,6 +1846,9 @@ if ($id) {
|
|||||||
if ($value == 'block_if_negative') {
|
if ($value == 'block_if_negative') {
|
||||||
$valuetoshow = $langs->trans('BlockHolidayIfNegative');
|
$valuetoshow = $langs->trans('BlockHolidayIfNegative');
|
||||||
}
|
}
|
||||||
|
if ($value == 'type_duration') {
|
||||||
|
$valuetoshow = $langs->trans('Unit');
|
||||||
|
}
|
||||||
|
|
||||||
if ($value == 'region_id' || $value == 'country_id') {
|
if ($value == 'region_id' || $value == 'country_id') {
|
||||||
$showfield = 0;
|
$showfield = 0;
|
||||||
@ -2055,6 +2086,9 @@ if ($id) {
|
|||||||
$valuetoshow = $langs->trans($obj->{$value});
|
$valuetoshow = $langs->trans($obj->{$value});
|
||||||
} elseif ($value == 'block_if_negative') {
|
} elseif ($value == 'block_if_negative') {
|
||||||
$valuetoshow = yn($obj->{$value});
|
$valuetoshow = yn($obj->{$value});
|
||||||
|
} elseif ($value == 'type_duration') {
|
||||||
|
$TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes'));
|
||||||
|
$valuetoshow =$TDurationTypes[$obj->{$value}];
|
||||||
}
|
}
|
||||||
$class .= ($class ? ' ' : '').'tddict';
|
$class .= ($class ? ' ' : '').'tddict';
|
||||||
if ($value == 'note' && $id == 10) {
|
if ($value == 'note' && $id == 10) {
|
||||||
@ -2450,6 +2484,10 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->selectyesno("block_if_negative", (!empty($obj->{$value}) ? $obj->{$value}:''), 1);
|
print $form->selectyesno("block_if_negative", (!empty($obj->{$value}) ? $obj->{$value}:''), 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
} elseif ($value == 'type_duration') {
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectTypeDuration('', $obj->{$value}, array('i','h'));
|
||||||
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
$fieldValue = isset($obj->{$value}) ? $obj->{$value}: '';
|
$fieldValue = isset($obj->{$value}) ? $obj->{$value}: '';
|
||||||
|
|
||||||
|
|||||||
@ -17,9 +17,6 @@
|
|||||||
* or see https://www.gnu.org/
|
* or see https://www.gnu.org/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('REQUIRE_JQUERY_BLOCKUI')) {
|
|
||||||
define('REQUIRE_JQUERY_BLOCKUI', 1);
|
|
||||||
}
|
|
||||||
if (!defined('NOTOKENRENEWAL')) {
|
if (!defined('NOTOKENRENEWAL')) {
|
||||||
define('NOTOKENRENEWAL', 1);
|
define('NOTOKENRENEWAL', 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,9 +67,6 @@ div.divsearchfield {
|
|||||||
.tree li:last-child:after{
|
.tree li:last-child:after{
|
||||||
display: none
|
display: none
|
||||||
}
|
}
|
||||||
.blockUI {
|
|
||||||
cursor: auto!important;
|
|
||||||
}
|
|
||||||
.newAppParent{
|
.newAppParent{
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
@ -220,8 +220,9 @@ if ($action == 'edit') {
|
|||||||
foreach ($arrayofparameters as $constname => $val) {
|
foreach ($arrayofparameters as $constname => $val) {
|
||||||
if ($val['enabled']==1) {
|
if ($val['enabled']==1) {
|
||||||
$setupnotempty++;
|
$setupnotempty++;
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>aa';
|
||||||
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
||||||
|
$tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\n".$langs->trans($constname . 'Tooltip2') : '');
|
||||||
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
|
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
|
|
||||||
@ -314,6 +315,7 @@ if ($action == 'edit') {
|
|||||||
$setupnotempty++;
|
$setupnotempty++;
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
||||||
|
$tooltiphelp .= (($langs->trans($constname . 'Tooltip2') && $langs->trans($constname . 'Tooltip2') != $constname . 'Tooltip2') ? '<br><br>'."\n".$langs->trans($constname . 'Tooltip2') : '');
|
||||||
print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
|
print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
|
|
||||||
|
|||||||
@ -38,6 +38,17 @@ if (!$user->admin) {
|
|||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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'));
|
||||||
|
|
||||||
|
|
||||||
|
$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');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($reshook)) {
|
||||||
//Init error
|
//Init error
|
||||||
$error = false;
|
$error = false;
|
||||||
$message = false;
|
$message = false;
|
||||||
@ -62,7 +73,6 @@ if (!empty($id)) {
|
|||||||
dol_print_error('', $object->error, $object->errors);
|
dol_print_error('', $object->error, $object->errors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO do action
|
// TODO do action
|
||||||
if ($action == 'save') {
|
if ($action == 'save') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -150,8 +160,7 @@ $tab_rules_type = array(
|
|||||||
'EX_YEA' => $langs->trans('Year'),
|
'EX_YEA' => $langs->trans('Year'),
|
||||||
'EX_EXP' => $langs->trans('OnExpense')
|
'EX_EXP' => $langs->trans('OnExpense')
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -176,31 +185,31 @@ if ($action != 'edit') {
|
|||||||
|
|
||||||
echo '<table class="noborder centpercent">';
|
echo '<table class="noborder centpercent">';
|
||||||
|
|
||||||
echo '<tr class="liste_titre">';
|
echo '<tr class="liste_titre headerexpensereportrules">';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
|
echo '<th class="linecolapplyto">' . $langs->trans('ExpenseReportApplyTo') . '</th>';
|
||||||
echo '<th>'.$langs->trans('Type').'</th>';
|
echo '<th class="linecoltype">' . $langs->trans('Type') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
|
echo '<th class="linecollimiton">' . $langs->trans('ExpenseReportLimitOn') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
|
echo '<th class="linecoldatestart">' . $langs->trans('ExpenseReportDateStart') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
|
echo '<th class="linecoldateend">' . $langs->trans('ExpenseReportDateEnd') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
|
echo '<th class="linecollimitamount">' . $langs->trans('ExpenseReportLimitAmount') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
|
echo '<th class="linecolrestrictive">' . $langs->trans('ExpenseReportRestrictive') . '</th>';
|
||||||
echo '<th> </th>';
|
echo '<th> </th>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
echo '<tr class="oddeven">';
|
echo '<tr class="oddeven">';
|
||||||
echo '<td>';
|
echo '<td>';
|
||||||
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, '', 0).'</div>';
|
echo '<div class="float linecolapplyto">' . $form->selectarray('apply_to', $tab_apply, '', 0) . '</div>';
|
||||||
echo '<div id="user" class="float">'.$form->select_dolusers('', 'fk_user').'</div>';
|
echo '<div id="user" class="float linecoluser">' . $form->select_dolusers('', 'fk_user') . '</div>';
|
||||||
echo '<div id="group" class="float">'.$form->select_dolgroups('', 'fk_usergroup').'</div>';
|
echo '<div id="group" class="float linecolgroup">' . $form->select_dolgroups('', 'fk_usergroup') . '</div>';
|
||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
echo '<td>'.$form->selectExpense('', 'fk_c_type_fees', 0, 1, 1).'</td>';
|
echo '<td class="linecoltype">' . $form->selectExpense('', 'fk_c_type_fees', 0, 1, 1) . '</td>';
|
||||||
echo '<td>'.$form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0).'</td>';
|
echo '<td class="linecoltyperule">' . $form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0) . '</td>';
|
||||||
echo '<td>'.$form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0).'</td>';
|
echo '<td class="linecoldatestart">' . $form->selectDate(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0) . '</td>';
|
||||||
echo '<td>'.$form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0).'</td>';
|
echo '<td class="linecoldateend>' . $form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0) . '</td>';
|
||||||
echo '<td><input type="text" value="" class="maxwidth100" name="amount" class="amount" /> '.$conf->currency.'</td>';
|
echo '<td class="linecolamount"><input type="text" value="" class="maxwidth100" name="amount" class="amount" /> ' . $conf->currency . '</td>';
|
||||||
echo '<td>'.$form->selectyesno('restrictive', 0, 1).'</td>';
|
echo '<td class="linecolrestrictive">' . $form->selectyesno('restrictive', 0, 1) . '</td>';
|
||||||
echo '<td class="right"><input type="submit" class="button button-add" value="'.$langs->trans('Add').'" /></td>';
|
echo '<td class="right linecolbutton"><input type="submit" class="button button-add" value="' . $langs->trans('Add') . '" /></td>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
@ -218,21 +227,21 @@ if ($action == 'edit') {
|
|||||||
|
|
||||||
echo '<table class="noborder centpercent">';
|
echo '<table class="noborder centpercent">';
|
||||||
|
|
||||||
echo '<tr class="liste_titre">';
|
echo '<tr class="liste_titre expensereportrules">';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
|
echo '<th class="linecolapplyto">' . $langs->trans('ExpenseReportApplyTo') . '</th>';
|
||||||
echo '<th>'.$langs->trans('Type').'</th>';
|
echo '<th class="linecoltype">' . $langs->trans('Type') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
|
echo '<th class="linecollimiton">' . $langs->trans('ExpenseReportLimitOn') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
|
echo '<th class="linecoldatestart">' . $langs->trans('ExpenseReportDateStart') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
|
echo '<th class="linecoldateend">' . $langs->trans('ExpenseReportDateEnd') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
|
echo '<th class="linecollimitamount">' . $langs->trans('ExpenseReportLimitAmount') . '</th>';
|
||||||
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
|
echo '<th class="linecolrestrictive">' . $langs->trans('ExpenseReportRestrictive') . '</th>';
|
||||||
echo '<th> </th>';
|
echo '<th> </th>';
|
||||||
echo '</tr>';
|
echo '</tr>';
|
||||||
|
|
||||||
foreach ($rules as $rule) {
|
foreach ($rules as $rule) {
|
||||||
echo '<tr class="oddeven">';
|
echo '<tr class="oddeven linetrdata" id="'.$rule->id.'">';
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecolusergroup">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
$selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U');
|
$selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U');
|
||||||
echo '<div class="float">' . $form->selectarray('apply_to', $tab_apply, $selected, 0) . '</div>';
|
echo '<div class="float">' . $form->selectarray('apply_to', $tab_apply, $selected, 0) . '</div>';
|
||||||
@ -250,7 +259,7 @@ foreach ($rules as $rule) {
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecoltype">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
|
echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
|
||||||
} else {
|
} else {
|
||||||
@ -269,7 +278,7 @@ foreach ($rules as $rule) {
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecoltyperule">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
|
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -278,7 +287,7 @@ foreach ($rules as $rule) {
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecoldatestart">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0);
|
print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -287,7 +296,7 @@ foreach ($rules as $rule) {
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecoldateend">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0);
|
print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -296,7 +305,7 @@ foreach ($rules as $rule) {
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecolamount">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
echo '<input type="text" value="' . price2num($object->amount) . '" name="amount" class="amount" />' . $conf->currency;
|
echo '<input type="text" value="' . price2num($object->amount) . '" name="amount" class="amount" />' . $conf->currency;
|
||||||
} else {
|
} else {
|
||||||
@ -305,7 +314,7 @@ foreach ($rules as $rule) {
|
|||||||
echo '</td>';
|
echo '</td>';
|
||||||
|
|
||||||
|
|
||||||
echo '<td>';
|
echo '<td class="linecolrestrictive">';
|
||||||
if ($action == 'edit' && $object->id == $rule->id) {
|
if ($action == 'edit' && $object->id == $rule->id) {
|
||||||
echo $form->selectyesno('restrictive', $object->restrictive, 1);
|
echo $form->selectyesno('restrictive', $object->restrictive, 1);
|
||||||
} else {
|
} else {
|
||||||
@ -349,6 +358,7 @@ echo '<script type="text/javascript"> $(function() {
|
|||||||
|
|
||||||
}); </script>';
|
}); </script>';
|
||||||
|
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -225,6 +225,12 @@ if ($action == 'updateMask') {
|
|||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} elseif ($action == 'set_INVOICE_CHECK_POSTERIOR_DATE') {
|
||||||
|
$check_posterior_date = GETPOST('INVOICE_CHECK_POSTERIOR_DATE', 'int');
|
||||||
|
$res = dolibarr_set_const($db, 'INVOICE_CHECK_POSTERIOR_DATE', $check_posterior_date, 'chaine', 0, '', $conf->entity);
|
||||||
|
if (!($res > 0)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -761,6 +767,25 @@ print '<input type="submit" class="button button-edit" value="'.$langs->trans("M
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("InvoiceCheckPosteriorDate"). ' ' ;
|
||||||
|
print $form->textwithpicto('', $langs->trans("InvoiceCheckPosteriorDateHelp"), 1, 'help') . '</td>';
|
||||||
|
print '<td class="left">';
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print ajax_constantonoff('INVOICE_CHECK_POSTERIOR_DATE');
|
||||||
|
} else {
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||||
|
print '<input type="hidden" name="action" value="set_INVOICE_CHECK_POSTERIOR_DATE" />';
|
||||||
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
|
print $form->selectarray("INVOICE_CHECK_POSTERIOR_DATE", $arrval, $conf->global->INVOICE_CHECK_POSTERIOR_DATE);
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" />';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|||||||
@ -110,7 +110,8 @@ if (GETPOST('save', 'alpha')) {
|
|||||||
|
|
||||||
$fckeditor_skin = GETPOST('fckeditor_skin', 'alpha');
|
$fckeditor_skin = GETPOST('fckeditor_skin', 'alpha');
|
||||||
if (!empty($fckeditor_skin)) {
|
if (!empty($fckeditor_skin)) {
|
||||||
if (!dolibarr_set_const($db, 'FCKEDITOR_SKIN', $fckeditor_skin, 'chaine', 0, '', $conf->entity)) {
|
$result = dolibarr_set_const($db, 'FCKEDITOR_SKIN', $fckeditor_skin, 'chaine', 0, '', $conf->entity);
|
||||||
|
if ($result <= 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -119,7 +120,8 @@ if (GETPOST('save', 'alpha')) {
|
|||||||
|
|
||||||
$fckeditor_test = GETPOST('formtestfield', 'restricthtml');
|
$fckeditor_test = GETPOST('formtestfield', 'restricthtml');
|
||||||
if (!empty($fckeditor_test)) {
|
if (!empty($fckeditor_test)) {
|
||||||
if (!dolibarr_set_const($db, 'FCKEDITOR_TEST', $fckeditor_test, 'chaine', 0, '', $conf->entity)) {
|
$result = dolibarr_set_const($db, 'FCKEDITOR_TEST', $fckeditor_test, 'chaine', 0, '', $conf->entity);
|
||||||
|
if ($result <= 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -129,7 +131,7 @@ if (GETPOST('save', 'alpha')) {
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
setEventMessages($langs->trans("Error").' '.$db->lasterror(), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -769,7 +769,7 @@ if ($action == 'add') {
|
|||||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||||
$okforextended = false;
|
$okforextended = false;
|
||||||
}
|
}
|
||||||
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 180, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
|
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 180, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_4, '90%');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@ -1000,7 +1000,7 @@ if ($resql) {
|
|||||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
||||||
$okforextended = false;
|
$okforextended = false;
|
||||||
}
|
}
|
||||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_6, '90%');
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
}
|
}
|
||||||
if ($tmpfieldlist == 'content_lines') {
|
if ($tmpfieldlist == 'content_lines') {
|
||||||
@ -1152,6 +1152,7 @@ if ($resql) {
|
|||||||
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -481,9 +481,9 @@ $deschelp = '';
|
|||||||
if ($mode == 'common' || $mode == 'commonkanban') {
|
if ($mode == 'common' || $mode == 'commonkanban') {
|
||||||
$desc = $langs->trans("ModulesDesc", '{picto}');
|
$desc = $langs->trans("ModulesDesc", '{picto}');
|
||||||
$desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}');
|
$desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}');
|
||||||
$desc = str_replace('{picto}', img_picto('', 'switch_off'), $desc);
|
$desc = str_replace('{picto}', img_picto('', 'switch_off', 'class="size15x"'), $desc);
|
||||||
$desc = str_replace('{picto2}', img_picto('', 'setup'), $desc);
|
$desc = str_replace('{picto2}', img_picto('', 'setup', 'class="size15x"'), $desc);
|
||||||
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled
|
if (!count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) { // If only minimal initial modules enabled
|
||||||
$deschelp = '<div class="info hideonsmartphone">'.$desc."<br></div><br>\n";
|
$deschelp = '<div class="info hideonsmartphone">'.$desc."<br></div><br>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Bahfir Abbes <contact@dolibarrpar.org>
|
* Copyright (C) 2015 Bahfir Abbes <contact@dolibarrpar.org>
|
||||||
* Copyright (C) 2020 Thibault FOUCART <suport@ptibogxiv.net>
|
* Copyright (C) 2020 Thibault FOUCART <suport@ptibogxiv.net>
|
||||||
|
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -267,7 +268,8 @@ $constantes = array();
|
|||||||
foreach ($listofnotifiedevents as $notifiedevent) {
|
foreach ($listofnotifiedevents as $notifiedevent) {
|
||||||
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||||
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
|
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
|
||||||
$model = $notifiedevent['elementtype'].'_send';
|
|
||||||
|
$model = $notifiedevent['elementtype'];
|
||||||
|
|
||||||
if ($notifiedevent['elementtype'] == 'order_supplier') {
|
if ($notifiedevent['elementtype'] == 'order_supplier') {
|
||||||
$elementLabel = $langs->trans('SupplierOrder');
|
$elementLabel = $langs->trans('SupplierOrder');
|
||||||
|
|||||||
@ -198,6 +198,37 @@ if ($action == 'updateMask') {
|
|||||||
// par appel methode canBeActivated
|
// par appel methode canBeActivated
|
||||||
|
|
||||||
dolibarr_set_const($db, "PROPALE_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "PROPALE_ADDON", $value, 'chaine', 0, '', $conf->entity);
|
||||||
|
} elseif (preg_match('/set_(.*)/', $action, $reg)) {
|
||||||
|
$code = $reg[1];
|
||||||
|
$value = (GETPOST($code) ? GETPOST($code) : 1);
|
||||||
|
|
||||||
|
$res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity);
|
||||||
|
if (!($res > 0)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
setEventMessages($langs->trans('Error'), null, 'errors');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
|
||||||
|
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
} elseif (preg_match('/del_(.*)/', $action, $reg)) {
|
||||||
|
$code = $reg[1];
|
||||||
|
$res = dolibarr_del_const($db, $code, $conf->entity);
|
||||||
|
|
||||||
|
if (!($res > 0)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
setEventMessages($langs->trans('Error'), null, 'errors');
|
||||||
|
} else {
|
||||||
|
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
|
||||||
|
header("Location: " . $_SERVER["PHP_SELF"]);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -593,6 +624,28 @@ print '<td class="right"><input type="submit" class="button button-edit" value="
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
// default update prices on cloning a proposal
|
||||||
|
/*
|
||||||
|
print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '">';
|
||||||
|
print '<input type="hidden" name="token" value="' . newToken() .'">';
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td>' . $langs->trans('DefaultPuttingPricesUpToDate').'</td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td class="right">';
|
||||||
|
if (!empty($conf->use_javascript_ajax)) {
|
||||||
|
print ajax_constantonoff('PROPOSAL_CLONE_UPDATE_PRICES', array(), $conf->entity, 0, 0, 1, 0);
|
||||||
|
} else {
|
||||||
|
if (empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES)) {
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_PROPOSAL_CLONE_UPDATE_PRICES">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
|
||||||
|
} else {
|
||||||
|
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_PROPOSAL_CLONE_UPDATE_PRICES">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</form>';
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
|||||||
@ -266,10 +266,20 @@ print '<br>';
|
|||||||
|
|
||||||
print '<strong>$dolibarr_main_restrict_ip</strong>: ';
|
print '<strong>$dolibarr_main_restrict_ip</strong>: ';
|
||||||
if (empty($dolibarr_main_restrict_ip)) {
|
if (empty($dolibarr_main_restrict_ip)) {
|
||||||
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
|
print $langs->trans("None");
|
||||||
//print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
|
//print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
|
||||||
|
} else {
|
||||||
|
print $dolibarr_main_restrict_ip;
|
||||||
}
|
}
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<strong>$dolibarr_main_restrict_os_commands</strong>: ';
|
||||||
|
if (empty($dolibarr_main_restrict_os_commands)) {
|
||||||
|
print $langs->trans("None");
|
||||||
|
} else {
|
||||||
|
print $dolibarr_main_restrict_os_commands;
|
||||||
|
}
|
||||||
|
print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", 'mysqldump, mysql, pg_dump, pgrestore').')</span>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) {
|
if (empty($conf->global->SECURITY_DISABLE_TEST_ON_OBFUSCATED_CONF)) {
|
||||||
|
|||||||
@ -26,6 +26,7 @@ require '../main.inc.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||||
require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
|
require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
|
||||||
require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
|
require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
|
||||||
|
require_once DOL_DOCUMENT_ROOT."/core/class/html.formcategory.class.php";
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("admin", "ticket"));
|
$langs->loadLangs(array("admin", "ticket"));
|
||||||
@ -157,6 +158,14 @@ if ($action == 'setvarworkflow') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'setvarworkflowother' || $action == 'setvarworkflow') {
|
||||||
|
$param_ticket_product_category = GETPOST('product_category_id', 'int');
|
||||||
|
$res = dolibarr_set_const($db, 'TICKET_PRODUCT_CATEGORY', $param_ticket_product_category, 'chaine', 0, '', $conf->entity);
|
||||||
|
if (!($res > 0)) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($action == 'setvarother') {
|
if ($action == 'setvarother') {
|
||||||
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
|
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
|
||||||
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
|
||||||
@ -219,7 +228,7 @@ if ($action == 'setvarother') {
|
|||||||
|
|
||||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
$form = new Form($db);
|
$formcategory = new FormCategory($db);
|
||||||
|
|
||||||
$help_url = "FR:Module_Ticket";
|
$help_url = "FR:Module_Ticket";
|
||||||
$page_name = "TicketSetup";
|
$page_name = "TicketSetup";
|
||||||
@ -326,7 +335,7 @@ foreach ($dirmodels as $reldir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
print $formcategory->textwithpicto('', $htmltooltip, 1, 0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -464,7 +473,7 @@ foreach ($dirmodels as $reldir) {
|
|||||||
|
|
||||||
|
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
print $formcategory->textwithpicto('', $htmltooltip, 1, 0);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Preview
|
// Preview
|
||||||
@ -489,8 +498,7 @@ foreach ($dirmodels as $reldir) {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div><br>';
|
print '</div><br>';
|
||||||
|
|
||||||
|
if (empty($conf->use_javascript_ajax)) {
|
||||||
if (!$conf->use_javascript_ajax) {
|
|
||||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="setvarworkflow">';
|
print '<input type="hidden" name="action" value="setvarworkflow">';
|
||||||
@ -512,11 +520,11 @@ if ($conf->use_javascript_ajax) {
|
|||||||
print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND');
|
print ajax_constantonoff('TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND');
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND);
|
print $formcategory->selectarray("TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND", $arrval, $conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketsAutoReadTicketHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -528,11 +536,11 @@ if ($conf->use_javascript_ajax) {
|
|||||||
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
|
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
|
print $formcategory->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -543,18 +551,33 @@ if ($conf->use_javascript_ajax) {
|
|||||||
print ajax_constantonoff('TICKET_NOTIFY_AT_CLOSING');
|
print ajax_constantonoff('TICKET_NOTIFY_AT_CLOSING');
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("TICKET_NOTIFY_AT_CLOSING", $arrval, $conf->global->TICKET_NOTIFY_AT_CLOSING);
|
print $formcategory->selectarray("TICKET_NOTIFY_AT_CLOSING", $arrval, $conf->global->TICKET_NOTIFY_AT_CLOSING);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if (!$conf->use_javascript_ajax) {
|
// Choose which product category is used for tickets
|
||||||
print '</form>';
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||||
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
print '<input type="hidden" name="action" value="setvarworkflowother">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("TicketChooseProductCategory").'</td>';
|
||||||
|
print '<td class="left">';
|
||||||
|
$formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id');
|
||||||
|
if ($conf->use_javascript_ajax) {
|
||||||
|
print ajax_combobox('select_'.$htmlname);
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print $formcategory->textwithpicto('', $langs->trans("TicketChooseProductCategoryHelp"), 1, 'help');
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
// Define wanted maximum time elapsed before answers to tickets
|
// Define wanted maximum time elapsed before answers to tickets
|
||||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||||
print '<input type="hidden" name="action" value="setvarother">';
|
print '<input type="hidden" name="action" value="setvarother">';
|
||||||
@ -566,7 +589,7 @@ print '<td class="left">
|
|||||||
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
|
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
|
||||||
</td>';
|
</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBeforeFirstAnswerHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -577,14 +600,18 @@ print '<td class="left">
|
|||||||
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
|
<input type="submit" class="button small" value="'.$langs->trans("Save").'">
|
||||||
</td>';
|
</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketsDelayBetweenAnswersHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
|
|
||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
|
|
||||||
|
print '<div class="center">';
|
||||||
|
print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
// Admin var of module
|
// Admin var of module
|
||||||
print load_fiche_titre($langs->trans("Notification"), '', '');
|
print load_fiche_titre($langs->trans("Notification"), '', '');
|
||||||
@ -612,7 +639,7 @@ print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationFrom").'<
|
|||||||
print '<td class="left">';
|
print '<td class="left">';
|
||||||
print '<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_FROM" value="'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'"></td>';
|
print '<input type="text" class="minwidth200" name="TICKET_NOTIFICATION_EMAIL_FROM" value="'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'"></td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -621,7 +648,7 @@ print '<tr class="oddeven"><td>'.$langs->trans("TicketEmailNotificationTo").' ('
|
|||||||
print '<td class="left">';
|
print '<td class="left">';
|
||||||
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : '').'"></td>';
|
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="'.(!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : '').'"></td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -633,11 +660,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
|||||||
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
|
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
|
||||||
} else {
|
} else {
|
||||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||||
print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
|
print $formcategory->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
@ -651,7 +678,7 @@ $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120
|
|||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailIntroHelpAdmin"), 1, 'help');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Texte de signature
|
// Texte de signature
|
||||||
@ -663,12 +690,12 @@ $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '10
|
|||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
|
print $formcategory->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print $form->buttonsSaveCancel("Save", '');
|
print $formcategory->buttonsSaveCancel("Save", '');
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|||||||
@ -214,10 +214,6 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<fieldset><legend>'.$langs->trans("ExportOptions").'</legend>';
|
print '<fieldset><legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||||
print '<div class="formelementrow">';
|
|
||||||
print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" />';
|
|
||||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
|
||||||
print '</div>';
|
|
||||||
|
|
||||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||||
print '<div class="formelementrow">';
|
print '<div class="formelementrow">';
|
||||||
@ -239,14 +235,35 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
|||||||
print '<option value="ORACLE">ORACLE</option>';
|
print '<option value="ORACLE">ORACLE</option>';
|
||||||
print '<option value="POSTGRESQL">POSTGRESQL</option>';
|
print '<option value="POSTGRESQL">POSTGRESQL</option>';
|
||||||
print '</select>';
|
print '</select>';
|
||||||
print '<br>';
|
print '<br><br>';
|
||||||
|
|
||||||
print '<input type="checkbox" name="use_mysql_quick_param" value="yes" id="checkbox_use_quick" />';
|
print '<div class="formelementrow">';
|
||||||
|
print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" checked="checked" />';
|
||||||
|
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
print '<input type="checkbox" name="use_mysql_quick_param" value="yes" id="checkbox_use_quick" checked="checked" />';
|
||||||
print '<label for="checkbox_use_quick">';
|
print '<label for="checkbox_use_quick">';
|
||||||
print $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter'), $langs->trans('ExportUseMySQLQuickParameterHelp'));
|
print $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter'), $langs->trans('ExportUseMySQLQuickParameterHelp'));
|
||||||
print '</label>';
|
print '</label>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
$execmethod = 0;
|
||||||
|
if (!empty($conf->global->MAIN_EXEC_USE_POPEN)) {
|
||||||
|
$execmethod = $conf->global->MAIN_EXEC_USE_POPEN;
|
||||||
|
}
|
||||||
|
if (empty($execmethod)) {
|
||||||
|
$execmethod = 1;
|
||||||
|
}
|
||||||
|
if ($execmethod == 1) {
|
||||||
|
// If we use the "exec" method for shell, we ask if we need to use the alternative low memory exec mode.
|
||||||
|
print '<input type="checkbox" name="lowmemorydump" value="yes" id="lowmemorydump"'.(GETPOSTISSET('lowmemorydump') ? GETPOST('lowmemorydump', 'alpha') : getDolGlobalString('MAIN_LOW_MEMORY_DUMP') ? ' checked="checked"' : '').'" />';
|
||||||
|
print '<label for="lowmemorydump">';
|
||||||
|
print $form->textwithpicto($langs->trans('ExportUseLowMemoryMode'), $langs->trans('ExportUseLowMemoryModeHelp'));
|
||||||
|
print '</label>';
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
||||||
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||||
print '-->';
|
print '-->';
|
||||||
|
|||||||
@ -71,6 +71,12 @@ $workflowcodes = array(
|
|||||||
'enabled'=>(!empty($conf->commande->enabled) && !empty($conf->facture->enabled)),
|
'enabled'=>(!empty($conf->commande->enabled) && !empty($conf->facture->enabled)),
|
||||||
'picto'=>'bill'
|
'picto'=>'bill'
|
||||||
),
|
),
|
||||||
|
'WORKFLOW_TICKET_CREATE_INTERVENTION' => array (
|
||||||
|
'family'=>'create',
|
||||||
|
'position'=>25,
|
||||||
|
'enabled'=>(!empty($conf->ticket->enabled) && !empty($conf->ficheinter->enabled)),
|
||||||
|
'picto'=>'ticket'
|
||||||
|
),
|
||||||
|
|
||||||
'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>''),
|
'separator1'=>array('family'=>'separator', 'position'=>25, 'title'=>''),
|
||||||
|
|
||||||
@ -161,7 +167,21 @@ $workflowcodes = array(
|
|||||||
'position' => 90,
|
'position' => 90,
|
||||||
'enabled' => ! empty($conf->expedition->enabled) && ! empty($conf->facture->enabled),
|
'enabled' => ! empty($conf->expedition->enabled) && ! empty($conf->facture->enabled),
|
||||||
'picto' => 'shipment'
|
'picto' => 'shipment'
|
||||||
)
|
),
|
||||||
|
|
||||||
|
// Automatic link ticket -> contract
|
||||||
|
'WORKFLOW_TICKET_LINK_CONTRACT' => array(
|
||||||
|
'family' => 'link_ticket',
|
||||||
|
'position' => 75,
|
||||||
|
'enabled' => ! empty($conf->ticket->enabled) && ! empty($conf->contract->enabled),
|
||||||
|
'picto' => 'ticket'
|
||||||
|
),
|
||||||
|
'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array(
|
||||||
|
'family' => 'link_ticket',
|
||||||
|
'position' => 76,
|
||||||
|
'enabled' => ! empty($conf->ticket->enabled) && ! empty($conf->contract->enabled),
|
||||||
|
'picto' => 'ticket'
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) {
|
if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) {
|
||||||
@ -237,6 +257,11 @@ foreach ($workflowcodes as $key => $params) {
|
|||||||
if ($reg[1] == 'shipping') {
|
if ($reg[1] == 'shipping') {
|
||||||
$header .= ' - '.$langs->trans('Shipment');
|
$header .= ' - '.$langs->trans('Shipment');
|
||||||
}
|
}
|
||||||
|
} elseif (preg_match('/link_(.*)/', $params['family'], $reg)) {
|
||||||
|
$header = $langs->trans("AutomaticLinking");
|
||||||
|
if ($reg[1] == 'ticket') {
|
||||||
|
$header .= ' - '.$langs->trans('Ticket');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$header = $langs->trans("Description");
|
$header = $langs->trans("Description");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,7 +126,7 @@ class Documents extends DolibarrApi
|
|||||||
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
|
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
|
||||||
* @return array List of documents
|
* @return array List of documents
|
||||||
*
|
*
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
* @throws RestException 501
|
* @throws RestException 501
|
||||||
* @throws RestException 400
|
* @throws RestException 400
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
@ -249,7 +249,7 @@ class Documents extends DolibarrApi
|
|||||||
* @throws RestException 400
|
* @throws RestException 400
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
* @url GET /
|
* @url GET /
|
||||||
*/
|
*/
|
||||||
@ -546,7 +546,7 @@ class Documents extends DolibarrApi
|
|||||||
* @throws RestException 400
|
* @throws RestException 400
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
* @url POST /upload
|
* @url POST /upload
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -158,6 +158,25 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $
|
|||||||
$api = new DolibarrApi($db, '', $refreshcache);
|
$api = new DolibarrApi($db, '', $refreshcache);
|
||||||
//var_dump($api->r->apiVersionMap);
|
//var_dump($api->r->apiVersionMap);
|
||||||
|
|
||||||
|
// If MAIN_API_DEBUG is set to 1, we save logs into file "dolibarr_api.log"
|
||||||
|
if (!empty($conf->global->MAIN_API_DEBUG)) {
|
||||||
|
$r = $api->r;
|
||||||
|
$r->onCall(function () use ($r) {
|
||||||
|
// Don't log Luracast Restler Explorer recources calls
|
||||||
|
//if (!preg_match('/^explorer/', $r->url)) {
|
||||||
|
// 'method' => $api->r->requestMethod,
|
||||||
|
// 'url' => $api->r->url,
|
||||||
|
// 'route' => $api->r->apiMethodInfo->className.'::'.$api->r->apiMethodInfo->methodName,
|
||||||
|
// 'version' => $api->r->getRequestedApiVersion(),
|
||||||
|
// 'data' => $api->r->getRequestData(),
|
||||||
|
//dol_syslog("Debug API input ".var_export($r, true), LOG_DEBUG, 0, '_api');
|
||||||
|
dol_syslog("Debug API url ".var_export($r->url, true), LOG_DEBUG, 0, '_api');
|
||||||
|
dol_syslog("Debug API input ".var_export($r->getRequestData(), true), LOG_DEBUG, 0, '_api');
|
||||||
|
//}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Enable the Restler API Explorer.
|
// Enable the Restler API Explorer.
|
||||||
// See https://github.com/Luracast/Restler-API-Explorer for more info.
|
// See https://github.com/Luracast/Restler-API-Explorer for more info.
|
||||||
$api->r->addAPIClass('Luracast\\Restler\\Explorer');
|
$api->r->addAPIClass('Luracast\\Restler\\Explorer');
|
||||||
|
|||||||
@ -519,7 +519,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$keyforbreak = 'duration';
|
$keyforbreak = 'duration';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
$object->calculateCosts();
|
$object->calculateCosts();
|
||||||
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td>'.price($object->total_cost).'</td></tr>';
|
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td><span class="amount">'.price($object->total_cost).'</span></td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
|
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
|
|||||||
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("mrp", "other"));
|
$langs->loadLangs(array("mrp", "other", "stocks"));
|
||||||
|
|
||||||
// Get parameters
|
// Get parameters
|
||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
@ -170,7 +170,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
$keyforbreak = 'duration';
|
$keyforbreak = 'duration';
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||||
|
|
||||||
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td>'.price($object->total_cost).'</td></tr>';
|
print '<tr><td>'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).'</td><td><span class="amount">'.price($object->total_cost).'</span></td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
|
print '<tr><td>'.$langs->trans("UnitCost").'</td><td>'.price($object->unit_cost).'</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
@ -211,9 +211,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a> ';
|
print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a> ';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="linecolqty">'.$langs->trans('Quantity').'</td>';
|
print '<td class="linecolqty right">'.$langs->trans('Quantity').'</td>';
|
||||||
print '<td class="linecolstock">'.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).'</td>';
|
print '<td class="linecolstock right">'.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).'</td>';
|
||||||
print '<td class="linecoltheoricalstock">'.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'</td>';
|
print '<td class="linecoltheoricalstock right">'.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
if (! empty($TChildBom)) {
|
if (! empty($TChildBom)) {
|
||||||
if ($action == 'treeview') {
|
if ($action == 'treeview') {
|
||||||
@ -227,9 +227,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
print img_picto('', 'folder-open');
|
print img_picto('', 'folder-open');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="linecolqty">'.$TProduct['qty'].'</td>';
|
print '<td class="linecolqty right">'.$TProduct['qty'].'</td>';
|
||||||
print '<td class="linecolstock"></td>';
|
print '<td class="linecolstock right"></td>';
|
||||||
print '<td class="linecoltheoricalstock"></td>';
|
print '<td class="linecoltheoricalstock right"></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
if (! empty($TProduct['product'])) {
|
if (! empty($TProduct['product'])) {
|
||||||
@ -241,9 +241,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
if ($fk_bom != $object->id) print '<tr class="sub_bom_lines oddeven" parentid="'.$fk_bom.'">';
|
if ($fk_bom != $object->id) print '<tr class="sub_bom_lines oddeven" parentid="'.$fk_bom.'">';
|
||||||
else print '<tr class="oddeven">';
|
else print '<tr class="oddeven">';
|
||||||
print '<td class="linecoldescription">'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).'</td>';
|
print '<td class="linecoldescription">'.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).'</td>';
|
||||||
print '<td class="linecolqty">'.$TInfos['qty'].'</td>';
|
print '<td class="linecolqty right">'.$TInfos['qty'].'</td>';
|
||||||
print '<td class="linecolstock">'.$prod->stock_reel.'</td>';
|
print '<td class="linecolstock right">'.price2num($prod->stock_reel, 'MS').'</td>';
|
||||||
print '<td class="linecoltheoricalstock">'.$prod->stock_theorique.'</td>';
|
print '<td class="linecoltheoricalstock right">'.$prod->stock_theorique.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,9 +256,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||||||
if (empty($prod->stock_reel)) $prod->stock_reel = 0;
|
if (empty($prod->stock_reel)) $prod->stock_reel = 0;
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="linecoldescription">'.$prod->getNomUrl(1).'</td>';
|
print '<td class="linecoldescription">'.$prod->getNomUrl(1).'</td>';
|
||||||
print '<td class="linecolqty">'.$qty.'</td>';
|
print '<td class="linecolqty right">'.$qty.'</td>';
|
||||||
print '<td class="linecolstock">'.$prod->stock_reel.'</td>';
|
print '<td class="linecolstock right">'.price2num($prod->stock_reel, 'MS').'</td>';
|
||||||
print '<td class="linecoltheoricalstock">'.$prod->stock_theorique.'</td>';
|
print '<td class="linecoltheoricalstock right">'.$prod->stock_theorique.'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ class BOM extends CommonObject
|
|||||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||||
* 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200'
|
* 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200'
|
||||||
* 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
|
* 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
|
||||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||||
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||||
@ -97,7 +97,7 @@ class BOM extends CommonObject
|
|||||||
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
|
||||||
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
|
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
|
||||||
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
|
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
|
||||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'),
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'minwidth300 maxwidth400', 'csslist'=>'tdoverflowmax200'),
|
||||||
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'),
|
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'),
|
||||||
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
|
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
|
||||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),
|
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'),
|
||||||
@ -1103,6 +1103,23 @@ class BOM extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to replace a product id with another one.
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param int $origin_id Old product id
|
||||||
|
* @param int $dest_id New product id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id)
|
||||||
|
{
|
||||||
|
$tables = array(
|
||||||
|
'bom_bomline'
|
||||||
|
);
|
||||||
|
|
||||||
|
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Net needs by product
|
* Get Net needs by product
|
||||||
*
|
*
|
||||||
|
|||||||
@ -126,7 +126,7 @@ print '</td>';
|
|||||||
$total_cost = 0;
|
$total_cost = 0;
|
||||||
print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">';
|
print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">';
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
echo price($line->total_cost);
|
echo '<span class="amount">'.price($line->total_cost).'</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
|
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
|
||||||
@ -152,12 +152,12 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
|
|||||||
print '<td class="linecolmove tdlineupdown center">';
|
print '<td class="linecolmove tdlineupdown center">';
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
if ($i > 0) {
|
if ($i > 0) {
|
||||||
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id.'">';
|
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&token='.newToken().'&rowid='.$line->id.'">';
|
||||||
echo img_up('default', 0, 'imgupforline');
|
echo img_up('default', 0, 'imgupforline');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
if ($i < $num - 1) {
|
if ($i < $num - 1) {
|
||||||
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id.'">';
|
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&token='.newToken().'&rowid='.$line->id.'">';
|
||||||
echo img_down('default', 0, 'imgdownforline');
|
echo img_down('default', 0, 'imgdownforline');
|
||||||
print '</a>';
|
print '</a>';
|
||||||
}
|
}
|
||||||
@ -236,15 +236,16 @@ if ($resql) {
|
|||||||
// Efficiency
|
// Efficiency
|
||||||
print '<td class="linecolefficiency nowrap right" id="sub_bom_efficiency_'.$sub_bom_line->id.'">'.$sub_bom_line->efficiency.'</td>';
|
print '<td class="linecolefficiency nowrap right" id="sub_bom_efficiency_'.$sub_bom_line->id.'">'.$sub_bom_line->efficiency.'</td>';
|
||||||
|
|
||||||
|
// Cost
|
||||||
if (!empty($sub_bom->id)) {
|
if (!empty($sub_bom->id)) {
|
||||||
$sub_bom->calculateCosts();
|
$sub_bom->calculateCosts();
|
||||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).'</td>';
|
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($sub_bom->total_cost * $sub_bom_line->qty * $line->qty).'</span></td>';
|
||||||
$total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty;
|
$total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty;
|
||||||
} elseif ($sub_bom_product->cost_price > 0) {
|
} elseif ($sub_bom_product->cost_price > 0) {
|
||||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).'</td>';
|
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty).'</span></td>';
|
||||||
$total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty;
|
$total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty;
|
||||||
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
|
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
|
||||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).'</td>';
|
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty).'</span></td>';
|
||||||
$total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty;
|
$total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty;
|
||||||
} else { // Minimum purchase price if cost price and PMP aren't defined
|
} else { // Minimum purchase price if cost price and PMP aren't defined
|
||||||
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
||||||
@ -254,7 +255,7 @@ if ($resql) {
|
|||||||
$obj = $object->db->fetch_object($resql_supplier_price);
|
$obj = $object->db->fetch_object($resql_supplier_price);
|
||||||
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
|
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty * $line->qty;
|
||||||
|
|
||||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($line_cost).'</td>';
|
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price($line_cost).'</span></td>';
|
||||||
$total_cost+= $line_cost;
|
$total_cost+= $line_cost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,11 +267,12 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace of the total_cost value by the sum of all sub-BOM lines total_cost
|
// Replace of the total_cost value by the sum of all sub-BOM lines total_cost
|
||||||
|
// TODO Remove this bad practice. We should not replace content of ouput using javascript but value should be good during generation of output.
|
||||||
if ($total_cost > 0) {
|
if ($total_cost > 0) {
|
||||||
$line->total_cost = price($total_cost);
|
$line->total_cost = price($total_cost);
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
$('#costline_<?php echo $line->id?>').html("<?php echo "".price($total_cost)?>");
|
$('#costline_<?php echo $line->id?>').html('<?php echo "<span class=\"amount\">".price($total_cost)."</span>"; ?>');
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1141,10 +1141,10 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We add the fullpath property to each elements of first level (no parent exists)
|
// We add the fullpath property to each elements of first level (no parent exists)
|
||||||
dol_syslog(get_class($this)."::get_full_arbo call to build_path_from_id_categ", LOG_DEBUG);
|
dol_syslog(get_class($this)."::get_full_arbo call to buildPathFromId", LOG_DEBUG);
|
||||||
foreach ($this->cats as $key => $val) {
|
foreach ($this->cats as $key => $val) {
|
||||||
//print 'key='.$key.'<br>'."\n";
|
//print 'key='.$key.'<br>'."\n";
|
||||||
$this->build_path_from_id_categ($key, 0); // Process a branch from the root category key (this category has no parent)
|
$this->buildPathFromId($key, 0); // Process a branch from the root category key (this category has no parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include or exclude leaf including $markafterid from tree
|
// Include or exclude leaf including $markafterid from tree
|
||||||
@ -1174,7 +1174,6 @@ class Categorie extends CommonObject
|
|||||||
return $this->cats;
|
return $this->cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
|
||||||
/**
|
/**
|
||||||
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel.
|
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel.
|
||||||
* It is called by get_full_arbo()
|
* It is called by get_full_arbo()
|
||||||
@ -1185,19 +1184,18 @@ class Categorie extends CommonObject
|
|||||||
* @return void
|
* @return void
|
||||||
* @see get_full_arbo()
|
* @see get_full_arbo()
|
||||||
*/
|
*/
|
||||||
public function build_path_from_id_categ($id_categ, $protection = 1000)
|
private function buildPathFromId($id_categ, $protection = 1000)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
//dol_syslog(get_class($this)."::buildPathFromId id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
|
||||||
dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
|
|
||||||
|
|
||||||
if (!empty($this->cats[$id_categ]['fullpath'])) {
|
if (!empty($this->cats[$id_categ]['fullpath'])) {
|
||||||
// Already defined
|
// Already defined
|
||||||
dol_syslog(get_class($this)."::build_path_from_id_categ fullpath and fulllabel already defined", LOG_WARNING);
|
dol_syslog(get_class($this)."::buildPathFromId fullpath and fulllabel already defined", LOG_WARNING);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First build full array $motherof
|
// First build full array $motherof
|
||||||
//$this->load_motherof(); // Disabled because already done by caller of build_path_from_id_categ
|
//$this->load_motherof(); // Disabled because already done by caller of buildPathFromId
|
||||||
|
|
||||||
// $this->cats[$id_categ] is supposed to be already an array. We just want to complete it with property fullpath and fulllabel
|
// $this->cats[$id_categ] is supposed to be already an array. We just want to complete it with property fullpath and fulllabel
|
||||||
|
|
||||||
|
|||||||
@ -701,7 +701,7 @@ if (empty($reshook) && $action == 'update') {
|
|||||||
$categories = GETPOST('categories', 'array');
|
$categories = GETPOST('categories', 'array');
|
||||||
$object->setCategories($categories);
|
$object->setCategories($categories);
|
||||||
|
|
||||||
$object->loadReminders();
|
$object->loadReminders($remindertype, 0, false);
|
||||||
if (!empty($object->reminders) && $object->datep > dol_now()) {
|
if (!empty($object->reminders) && $object->datep > dol_now()) {
|
||||||
foreach ($object->reminders as $reminder) {
|
foreach ($object->reminders as $reminder) {
|
||||||
$reminder->delete($user);
|
$reminder->delete($user);
|
||||||
@ -1491,6 +1491,10 @@ if ($id > 0) {
|
|||||||
$("#fullday").change(function() {
|
$("#fullday").change(function() {
|
||||||
setdatefields();
|
setdatefields();
|
||||||
});
|
});
|
||||||
|
$("#actioncode").change(function() {
|
||||||
|
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
|
||||||
|
else $("#dateend").removeClass("fieldrequired");
|
||||||
|
});
|
||||||
})';
|
})';
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
@ -1535,22 +1539,26 @@ if ($id > 0) {
|
|||||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
|
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent ? ' checked' : '').'></td></tr>';
|
||||||
|
|
||||||
// Date start - end
|
// Date start - end
|
||||||
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").' - '.$langs->trans("DateActionEnd").'</span></td><td colspan="3">';
|
print '<tr><td class="nowrap">';
|
||||||
|
print '<span class="fieldrequired">'.$langs->trans("DateActionStart").'</span>';
|
||||||
|
print ' - ';
|
||||||
|
print '<span id="dateend"'.($object->type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'</span>';
|
||||||
|
print '</td><td td colspan="3">';
|
||||||
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
||||||
if (GETPOST("afaire") == 1) {
|
if (GETPOST("afaire") == 1) {
|
||||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
} elseif (GETPOST("afaire") == 2) {
|
} elseif (GETPOST("afaire") == 2) {
|
||||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
} else {
|
} else {
|
||||||
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 1, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
}
|
}
|
||||||
print ' - ';
|
print ' - ';
|
||||||
if (GETPOST("afaire") == 1) {
|
if (GETPOST("afaire") == 1) {
|
||||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
} elseif (GETPOST("afaire") == 2) {
|
} elseif (GETPOST("afaire") == 2) {
|
||||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
} else {
|
} else {
|
||||||
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
|
print $form->selectDate($datef ? $datef : $object->datef, 'p2', 1, 1, 1, "action", 1, 1, 0, 'fulldayend', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuserrel') : 'tzuserrel');
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@ -1988,11 +1996,15 @@ if ($id > 0) {
|
|||||||
|
|
||||||
// Date start
|
// Date start
|
||||||
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>';
|
||||||
|
// Test a date before the 27 march and one after
|
||||||
|
//print dol_print_date($object->datep, 'dayhour', 'gmt');
|
||||||
|
//print dol_print_date($object->datep, 'dayhour', 'tzuser');
|
||||||
|
//print dol_print_date($object->datep, 'dayhour', 'tzuserrel');
|
||||||
if (empty($object->fulldayevent)) {
|
if (empty($object->fulldayevent)) {
|
||||||
print dol_print_date($object->datep, 'dayhour', 'tzuser');
|
print dol_print_date($object->datep, 'dayhour', 'tzuserrel');
|
||||||
} else {
|
} else {
|
||||||
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
||||||
print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuser'));
|
print dol_print_date($object->datep, 'day', ($tzforfullday ? $tzforfullday : 'tzuserrel'));
|
||||||
}
|
}
|
||||||
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) {
|
if ($object->percentage == 0 && $object->datep && $object->datep < ($now - $delay_warning)) {
|
||||||
print img_warning($langs->trans("Late"));
|
print img_warning($langs->trans("Late"));
|
||||||
@ -2003,10 +2015,10 @@ if ($id > 0) {
|
|||||||
// Date end
|
// Date end
|
||||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
|
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
|
||||||
if (empty($object->fulldayevent)) {
|
if (empty($object->fulldayevent)) {
|
||||||
print dol_print_date($object->datef, 'dayhour', 'tzuser');
|
print dol_print_date($object->datef, 'dayhour', 'tzuserrel');
|
||||||
} else {
|
} else {
|
||||||
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
|
||||||
print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuser'));
|
print dol_print_date($object->datef, 'day', ($tzforfullday ? $tzforfullday : 'tzuserrel'));
|
||||||
}
|
}
|
||||||
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) {
|
if ($object->percentage > 0 && $object->percentage < 100 && $object->datef && $object->datef < ($now - $delay_warning)) {
|
||||||
print img_warning($langs->trans("Late"));
|
print img_warning($langs->trans("Late"));
|
||||||
|
|||||||
@ -778,7 +778,7 @@ class ActionComm extends CommonObject
|
|||||||
$sql .= " a.fk_contact, a.percent as percentage,";
|
$sql .= " a.fk_contact, a.percent as percentage,";
|
||||||
$sql .= " a.fk_element as elementid, a.elementtype,";
|
$sql .= " a.fk_element as elementid, a.elementtype,";
|
||||||
$sql .= " a.priority, a.fulldayevent, a.location, a.transparency,";
|
$sql .= " a.priority, a.fulldayevent, a.location, a.transparency,";
|
||||||
$sql .= " a.email_msgid, a.email_subject, a.email_from, a.email_to, a.email_tocc, a.email_tobcc, a.errors_to,";
|
$sql .= " a.email_msgid, a.email_subject, a.email_from, a.email_sender, a.email_to, a.email_tocc, a.email_tobcc, a.errors_to,";
|
||||||
$sql .= " c.id as type_id, c.type as type_type, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,";
|
$sql .= " c.id as type_id, c.type as type_type, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,";
|
||||||
$sql .= " s.nom as socname,";
|
$sql .= " s.nom as socname,";
|
||||||
$sql .= " u.firstname, u.lastname as lastname,";
|
$sql .= " u.firstname, u.lastname as lastname,";
|
||||||
@ -868,6 +868,16 @@ class ActionComm extends CommonObject
|
|||||||
$this->event_paid = $obj->event_paid;
|
$this->event_paid = $obj->event_paid;
|
||||||
$this->status = $obj->status;
|
$this->status = $obj->status;
|
||||||
|
|
||||||
|
//email information
|
||||||
|
$this->email_msgid=$obj->email_msgid;
|
||||||
|
$this->email_from=$obj->email_from;
|
||||||
|
$this->email_sender=$obj->email_sender;
|
||||||
|
$this->email_to=$obj->email_to;
|
||||||
|
$this->email_tocc=$obj->email_tocc;
|
||||||
|
$this->email_tobcc=$obj->email_tobcc;
|
||||||
|
$this->email_subject=$obj->email_subject;
|
||||||
|
$this->errors_to=$obj->errors_to;
|
||||||
|
|
||||||
$this->fetch_optionals();
|
$this->fetch_optionals();
|
||||||
|
|
||||||
if ($loadresources) {
|
if ($loadresources) {
|
||||||
@ -1582,8 +1592,25 @@ class ActionComm extends CommonObject
|
|||||||
if (isset($this->transparency)) {
|
if (isset($this->transparency)) {
|
||||||
$tooltip .= '<br><b>'.$langs->trans('Busy').':</b> '.yn($this->transparency);
|
$tooltip .= '<br><b>'.$langs->trans('Busy').':</b> '.yn($this->transparency);
|
||||||
}
|
}
|
||||||
|
if (!empty($this->email_msgid)) {
|
||||||
|
$langs->load("mails");
|
||||||
|
$tooltip .= '<br>';
|
||||||
|
//$tooltip .= '<br><b>'.img_picto('', 'email').' '.$langs->trans("Email").'</b>';
|
||||||
|
$tooltip .= '<br><b>'.$langs->trans('MailTopic').':</b> '.$this->email_subject;
|
||||||
|
$tooltip .= '<br><b>'.$langs->trans('MailFrom').':</b> '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_from);
|
||||||
|
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b>, '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_to);
|
||||||
|
if (!empty($this->email_tocc)) {
|
||||||
|
$tooltip .= '<br><b>'.$langs->trans('MailCC').':</b> '.str_replace(array('<', '>'), array('&lt', '&gt'), $this->email_tocc);
|
||||||
|
}
|
||||||
|
/* Disabled because bcc must remain by defintion not visible
|
||||||
|
if (!empty($this->email_tobcc)) {
|
||||||
|
$tooltip .= '<br><b>'.$langs->trans('MailCCC').':</b> '.$this->email_tobcc;
|
||||||
|
} */
|
||||||
|
}
|
||||||
if (!empty($this->note_private)) {
|
if (!empty($this->note_private)) {
|
||||||
$tooltip .= '<br><b>'.$langs->trans('Note').':</b> '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), '<br>', $this->note_private));
|
$tooltip .= '<br><br><b>'.$langs->trans('Description').':</b><br>';
|
||||||
|
$texttoshow = dolGetFirstLineOfText($this->note_private, 10);
|
||||||
|
$tooltip .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '<br>', $texttoshow));
|
||||||
}
|
}
|
||||||
$linkclose = '';
|
$linkclose = '';
|
||||||
//if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
//if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
|
||||||
@ -1594,9 +1621,8 @@ class ActionComm extends CommonObject
|
|||||||
$label = $langs->trans("ShowAction");
|
$label = $langs->trans("ShowAction");
|
||||||
$linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"';
|
$linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"';
|
||||||
}
|
}
|
||||||
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1).'"';
|
$linkclose .= ' title="'.dol_escape_htmltag($tooltip, 1, 0, 0, '', 1).'"';
|
||||||
$linkclose .= ' class="'.$classname.' classfortooltip"';
|
$linkclose .= ' class="'.$classname.' classfortooltip"';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$hookmanager->initHooks(array('actiondao'));
|
$hookmanager->initHooks(array('actiondao'));
|
||||||
$parameters=array('id'=>$this->id);
|
$parameters=array('id'=>$this->id);
|
||||||
@ -2210,6 +2236,26 @@ class ActionComm extends CommonObject
|
|||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to replace a product id with another one.
|
||||||
|
*
|
||||||
|
* @param DoliDB $dbs Database handler
|
||||||
|
* @param int $origin_id Old product id
|
||||||
|
* @param int $dest_id New product id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function replaceProduct(DoliDB $dbs, $origin_id, $dest_id)
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'actioncomm SET fk_element = ' . ((int) $dest_id) . ' WHERE elementtype="product" AND fk_element = '.((int) $origin_id);
|
||||||
|
// using $dbs, not $this->db because function is static
|
||||||
|
if (!$dbs->query($sql)) {
|
||||||
|
//$this->errors = $dbs->lasterror();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the action delayed?
|
* Is the action delayed?
|
||||||
*
|
*
|
||||||
|
|||||||
@ -931,7 +931,7 @@ if ($showbirthday) {
|
|||||||
$sql = 'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
|
$sql = 'SELECT sp.rowid, sp.lastname, sp.firstname, sp.birthday';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'socpeople as sp';
|
||||||
$sql .= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.((int) $user->id).'))';
|
$sql .= ' WHERE (priv=0 OR (priv=1 AND fk_user_creat='.((int) $user->id).'))';
|
||||||
$sql .= " AND sp.entity IN (".getEntity('socpeople').")";
|
$sql .= " AND sp.entity IN (".getEntity('contact').")";
|
||||||
if ($mode == 'show_day') {
|
if ($mode == 'show_day') {
|
||||||
$sql .= ' AND MONTH(birthday) = '.((int) $month);
|
$sql .= ' AND MONTH(birthday) = '.((int) $month);
|
||||||
$sql .= ' AND DAY(birthday) = '.((int) $day);
|
$sql .= ' AND DAY(birthday) = '.((int) $day);
|
||||||
@ -1033,8 +1033,8 @@ if ($resql) {
|
|||||||
$event->type = 'holiday';
|
$event->type = 'holiday';
|
||||||
$event->type_picto = 'holiday';
|
$event->type_picto = 'holiday';
|
||||||
|
|
||||||
$event->datep = $db->jdate($obj->date_start);
|
$event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1);
|
||||||
$event->datef = $db->jdate($obj->date_end);
|
$event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1;
|
||||||
$event->date_start_in_calendar = $event->datep;
|
$event->date_start_in_calendar = $event->datep;
|
||||||
$event->date_end_in_calendar = $event->datef;
|
$event->date_end_in_calendar = $event->datef;
|
||||||
|
|
||||||
|
|||||||
@ -162,7 +162,8 @@ if (empty($reshook)) {
|
|||||||
// set accountancy code
|
// set accountancy code
|
||||||
if ($action == 'setcustomeraccountancycode') {
|
if ($action == 'setcustomeraccountancycode') {
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
$object->code_compta = GETPOST("customeraccountancycode");
|
$object->code_compta_client = GETPOST("customeraccountancycode");
|
||||||
|
$object->code_compta = $object->code_compta_client; // For Backward compatibility
|
||||||
$result = $object->update($object->id, $user, 1, 1, 0);
|
$result = $object->update($object->id, $user, 1, 1, 0);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -360,9 +361,9 @@ if ($object->id > 0) {
|
|||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
|
print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer);
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
|
print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
@ -686,7 +687,7 @@ if ($object->id > 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</div><div class="fichehalfright">';
|
print '</div><div class="fichehalfright">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner underbanner-before-box clearboth"></div>';
|
||||||
|
|
||||||
$boxstat = '';
|
$boxstat = '';
|
||||||
|
|
||||||
@ -694,7 +695,7 @@ if ($object->id > 0) {
|
|||||||
$MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
$MAXLIST = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
|
||||||
|
|
||||||
// Lien recap
|
// Lien recap
|
||||||
$boxstat .= '<div class="box">';
|
$boxstat .= '<div class="box box-halfright">';
|
||||||
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
|
$boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="border boxtable boxtablenobottom boxtablenotop" width="100%">';
|
||||||
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
|
$boxstat .= '<tr class="impair nohover"><td colspan="2" class="tdboxstats nohover">';
|
||||||
|
|
||||||
|
|||||||
@ -88,7 +88,7 @@ if (empty($user->rights->societe->client->voir) && !$socid) {
|
|||||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as p";
|
$sql .= " ".MAIN_DB_PREFIX."socpeople as p";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||||
$sql .= " WHERE s.fk_stcomm = st.id";
|
$sql .= " WHERE s.fk_stcomm = st.id";
|
||||||
$sql .= " AND p.entity IN (".getEntity('socpeople').")";
|
$sql .= " AND p.entity IN (".getEntity('contact').")";
|
||||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -568,9 +568,15 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) {
|
|||||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||||
}
|
}
|
||||||
if ($socid) {
|
// Add where from hooks
|
||||||
$sql .= " AND s.rowid = $socid";
|
$parameters = array('socid' => $socid);
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $companystatic); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook)) {
|
||||||
|
if ($socid > 0) {
|
||||||
|
$sql .= " AND s.rowid = ".((int) $socid);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
$sql .= " ORDER BY s.tms DESC";
|
$sql .= " ORDER BY s.tms DESC";
|
||||||
$sql .= $db->plimit($max, 0);
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|
||||||
@ -664,9 +670,15 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S
|
|||||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||||
}
|
}
|
||||||
if ($socid) {
|
// Add where from hooks
|
||||||
|
$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 .= " AND s.rowid = ".((int) $socid);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
$sql .= " ORDER BY s.datec DESC";
|
$sql .= " ORDER BY s.datec DESC";
|
||||||
$sql .= $db->plimit($max, 0);
|
$sql .= $db->plimit($max, 0);
|
||||||
|
|
||||||
|
|||||||
@ -686,7 +686,7 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
|
|
||||||
$sqlwhere = array();
|
$sqlwhere = array();
|
||||||
|
|
||||||
$sqlwhere[] = 't.entity IN ('.getEntity('socpeople').')';
|
$sqlwhere[] = 't.entity IN ('.getEntity('contact').')';
|
||||||
|
|
||||||
if (count($arrayquery) > 0) {
|
if (count($arrayquery) > 0) {
|
||||||
if (array_key_exists('contact_categ', $arrayquery)) {
|
if (array_key_exists('contact_categ', $arrayquery)) {
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -80,6 +81,7 @@ $confirm = GETPOST('confirm', 'alpha');
|
|||||||
$lineid = GETPOST('lineid', 'int');
|
$lineid = GETPOST('lineid', 'int');
|
||||||
$contactid = GETPOST('contactid', 'int');
|
$contactid = GETPOST('contactid', 'int');
|
||||||
$projectid = GETPOST('projectid', 'int');
|
$projectid = GETPOST('projectid', 'int');
|
||||||
|
$rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1;
|
||||||
|
|
||||||
// PDF
|
// PDF
|
||||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||||
@ -116,7 +118,7 @@ $usercandelete = $user->rights->propal->supprimer;
|
|||||||
|
|
||||||
$usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close)));
|
$usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close)));
|
||||||
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate)));
|
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate)));
|
||||||
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send);
|
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send)));
|
||||||
|
|
||||||
$usercancreateorder = $user->rights->commande->creer;
|
$usercancreateorder = $user->rights->commande->creer;
|
||||||
$usercancreateinvoice = $user->rights->facture->creer;
|
$usercancreateinvoice = $user->rights->facture->creer;
|
||||||
@ -220,7 +222,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null));
|
$result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), (GETPOST('update_prices', 'aZ') ? true : false));
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||||
exit();
|
exit();
|
||||||
@ -246,8 +248,11 @@ if (empty($reshook)) {
|
|||||||
// Remove line
|
// Remove line
|
||||||
$result = $object->deleteline($lineid);
|
$result = $object->deleteline($lineid);
|
||||||
// reorder lines
|
// reorder lines
|
||||||
if ($result) {
|
if ($result > 0) {
|
||||||
$object->line_order(true);
|
$object->line_order(true);
|
||||||
|
} else {
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
@ -1143,7 +1148,7 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise);
|
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, min($rank, count($object->lines) + 1), 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -1889,11 +1894,13 @@ if ($action == 'create') {
|
|||||||
$title = $langs->trans('ProductsAndServices');
|
$title = $langs->trans('ProductsAndServices');
|
||||||
print load_fiche_titre($title);
|
print load_fiche_titre($title);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
$objectsrc->printOriginLinesList();
|
$objectsrc->printOriginLinesList();
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
} elseif ($object->id > 0) {
|
} elseif ($object->id > 0) {
|
||||||
/*
|
/*
|
||||||
@ -1914,8 +1921,8 @@ if ($action == 'create') {
|
|||||||
$formquestion = array(
|
$formquestion = array(
|
||||||
// 'text' => $langs->trans("ConfirmClone"),
|
// 'text' => $langs->trans("ConfirmClone"),
|
||||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')),
|
||||||
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))
|
array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => (!empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES) ? 1 : 0)),
|
||||||
);
|
);
|
||||||
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) {
|
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) {
|
||||||
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date);
|
$formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date);
|
||||||
|
|||||||
@ -625,7 +625,7 @@ class Proposals extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function deleteContact($id, $contactid, $type)
|
public function deleteContact($id, $contactid, $type)
|
||||||
{
|
{
|
||||||
@ -799,7 +799,7 @@ class Proposals extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2022 ATM Consulting <contact@atm-consulting.fr>
|
* Copyright (C) 2022 ATM Consulting <contact@atm-consulting.fr>
|
||||||
* Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
|
* Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
|
||||||
|
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -744,6 +745,11 @@ class Propal extends CommonObject
|
|||||||
// Reorder if child line
|
// Reorder if child line
|
||||||
if (!empty($fk_parent_line)) {
|
if (!empty($fk_parent_line)) {
|
||||||
$this->line_order(true, 'DESC');
|
$this->line_order(true, 'DESC');
|
||||||
|
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines
|
||||||
|
$linecount = count($this->lines);
|
||||||
|
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||||
|
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la propale meme
|
// Mise a jour informations denormalisees au niveau de la propale meme
|
||||||
@ -992,6 +998,8 @@ class Propal extends CommonObject
|
|||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
$this->error = $line->error;
|
||||||
|
$this->errors = $line->errors;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1324,11 +1332,12 @@ class Propal extends CommonObject
|
|||||||
* @param User $user User making the clone
|
* @param User $user User making the clone
|
||||||
* @param int $socid Id of thirdparty
|
* @param int $socid Id of thirdparty
|
||||||
* @param int $forceentity Entity id to force
|
* @param int $forceentity Entity id to force
|
||||||
|
* @param bool $update_prices [=false] Update prices if true
|
||||||
* @return int New id of clone
|
* @return int New id of clone
|
||||||
*/
|
*/
|
||||||
public function createFromClone(User $user, $socid = 0, $forceentity = null)
|
public function createFromClone(User $user, $socid = 0, $forceentity = null, $update_prices = false)
|
||||||
{
|
{
|
||||||
global $conf, $hookmanager;
|
global $conf, $hookmanager, $mysoc;
|
||||||
|
|
||||||
dol_include_once('/projet/class/project.class.php');
|
dol_include_once('/projet/class/project.class.php');
|
||||||
|
|
||||||
@ -1375,6 +1384,55 @@ class Propal extends CommonObject
|
|||||||
$objsoc->fetch($object->socid);
|
$objsoc->fetch($object->socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update prices
|
||||||
|
if ($update_prices === true) {
|
||||||
|
if ($objsoc->id > 0 && !empty($object->lines)) {
|
||||||
|
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||||
|
// If price per customer
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($object->lines as $line) {
|
||||||
|
if ($line->fk_product > 0) {
|
||||||
|
$prod = new Product($this->db);
|
||||||
|
$res = $prod->fetch($line->fk_product);
|
||||||
|
if ($res > 0) {
|
||||||
|
$pu_ht = $prod->price;
|
||||||
|
$tva_tx = get_default_tva($mysoc, $objsoc, $prod->id);
|
||||||
|
$remise_percent = $objsoc->remise_percent;
|
||||||
|
|
||||||
|
if (!empty($conf->global->PRODUIT_MULTIPRICES) && $objsoc->price_level > 0) {
|
||||||
|
$pu_ht = $prod->multiprices[$objsoc->price_level];
|
||||||
|
if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility
|
||||||
|
if (isset($prod->multiprices_tva_tx[$objsoc->price_level])) {
|
||||||
|
$tva_tx = $prod->multiprices_tva_tx[$objsoc->price_level];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||||
|
$prodcustprice = new Productcustomerprice($this->db);
|
||||||
|
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $objsoc->id);
|
||||||
|
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||||
|
if ($result) {
|
||||||
|
// If there is some prices specific to the customer
|
||||||
|
if (count($prodcustprice->lines) > 0) {
|
||||||
|
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||||
|
$tva_tx = ($prodcustprice->lines[0]->default_vat_code ? $prodcustprice->lines[0]->tva_tx.' ('.$prodcustprice->lines[0]->default_vat_code.' )' : $prodcustprice->lines[0]->tva_tx);
|
||||||
|
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
|
||||||
|
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$line->subprice = $pu_ht;
|
||||||
|
$line->tva_tx = $tva_tx;
|
||||||
|
$line->remise_percent = $remise_percent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$object->id = 0;
|
$object->id = 0;
|
||||||
$object->ref = '';
|
$object->ref = '';
|
||||||
$object->entity = (!empty($forceentity) ? $forceentity : $object->entity);
|
$object->entity = (!empty($forceentity) ? $forceentity : $object->entity);
|
||||||
@ -1730,8 +1788,9 @@ class Propal extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0, $filters = '')
|
public function fetch_lines($only_product = 0, $loadalsotranslation = 0, $filters = '')
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
|
|
||||||
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
|
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
|
||||||
@ -3768,8 +3827,24 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to replace a product id with another one.
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param int $origin_id Old product id
|
||||||
|
* @param int $dest_id New product id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id)
|
||||||
|
{
|
||||||
|
$tables = array(
|
||||||
|
'propaldet'
|
||||||
|
);
|
||||||
|
|
||||||
|
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage commercial proposal lines
|
* Class to manage commercial proposal lines
|
||||||
@ -4194,6 +4269,16 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
if (!$notrigger) {
|
||||||
|
// Call trigger
|
||||||
|
$result = $this->call_trigger('LINEPROPAL_DELETE', $user);
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int) $this->rowid);
|
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int) $this->rowid);
|
||||||
dol_syslog("PropaleLigne::delete", LOG_DEBUG);
|
dol_syslog("PropaleLigne::delete", LOG_DEBUG);
|
||||||
if ($this->db->query($sql)) {
|
if ($this->db->query($sql)) {
|
||||||
@ -4206,24 +4291,18 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR);
|
dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error && !$notrigger) {
|
|
||||||
// Call trigger
|
|
||||||
$result = $this->call_trigger('LINEPROPAL_DELETE', $user);
|
|
||||||
if ($result < 0) {
|
|
||||||
$this->db->rollback();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// End call triggers
|
|
||||||
|
|
||||||
$this->db->commit();
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
} else {
|
} else {
|
||||||
$this->error = $this->db->error() . " sql=" . $sql;
|
$this->error = $this->db->error() . " sql=" . $sql;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4369,7 +4448,7 @@ class PropaleLigne extends CommonObjectLine
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('LINEPROPAL_UPDATE', $user);
|
$result = $this->call_trigger('LINEPROPAL_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -356,12 +356,12 @@ if ($action == 'validate' && $permissiontovalidate) {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
if ($tmpproposal->fetch($checked)) {
|
if ($tmpproposal->fetch($checked) > 0) {
|
||||||
if ($tmpproposal->statut == 0) {
|
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
|
||||||
if ($tmpproposal->valid($user)) {
|
if ($tmpproposal->valid($user) > 0) {
|
||||||
setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
|
setEventMessage($langs->trans('hasBeenValidated', $tmpproposal->ref), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
setEventMessage($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -370,7 +370,7 @@ if ($action == 'validate' && $permissiontovalidate) {
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -388,21 +388,21 @@ if ($action == "sign" && $permissiontoclose) {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
if ($tmpproposal->fetch($checked)) {
|
if ($tmpproposal->fetch($checked) > 0) {
|
||||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||||
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
|
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
|
||||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED)) {
|
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
|
setEventMessage($tmpproposal->ref." ".$langs->trans('Signed'), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeSign'), 'errors');
|
setEventMessage($langs->trans('MustBeValidatedToBeSigned', $tmpproposal->ref), 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -413,27 +413,28 @@ if ($action == "sign" && $permissiontoclose) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == "nosign" && $permissiontoclose) {
|
if ($action == "nosign" && $permissiontoclose) {
|
||||||
if (GETPOST('confirm') == 'yes') {
|
if (GETPOST('confirm') == 'yes') {
|
||||||
$tmpproposal = new Propal($db);
|
$tmpproposal = new Propal($db);
|
||||||
$db->begin();
|
$db->begin();
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
if ($tmpproposal->fetch($checked)) {
|
if ($tmpproposal->fetch($checked) > 0) {
|
||||||
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
|
||||||
$tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
|
$tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
|
||||||
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED)) {
|
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
|
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeClosed'), 'errors');
|
setEventMessage($tmpproposal->ref." ".$langs->trans('CantBeNoSign'), 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db);
|
setEventMessages($tmpproposal->error, $tmpproposal->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,7 +62,7 @@ if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $user->rights->societe->creer) {
|
if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && ($user->rights->societe->creer || $user->rights->facture->creer)) {
|
||||||
//if ($user->rights->societe->creer)
|
//if ($user->rights->societe->creer)
|
||||||
//if ($user->rights->facture->creer)
|
//if ($user->rights->facture->creer)
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes' && $user-
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setremise' && $user->rights->societe->creer) {
|
if ($action == 'setremise' && ($user->rights->societe->creer || $user->rights->facture->creer)) {
|
||||||
//if ($user->rights->societe->creer)
|
//if ($user->rights->societe->creer)
|
||||||
//if ($user->rights->facture->creer)
|
//if ($user->rights->facture->creer)
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ if ($action == 'setremise' && $user->rights->societe->creer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && $user->rights->societe->creer) {
|
if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' && ($user->rights->societe->creer || $user->rights->facture->creer)) {
|
||||||
//if ($user->rights->societe->creer)
|
//if ($user->rights->societe->creer)
|
||||||
//if ($user->rights->facture->creer)
|
//if ($user->rights->facture->creer)
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -81,6 +82,7 @@ $contactid = GETPOST('contactid', 'int');
|
|||||||
$projectid = GETPOST('projectid', 'int');
|
$projectid = GETPOST('projectid', 'int');
|
||||||
$origin = GETPOST('origin', 'alpha');
|
$origin = GETPOST('origin', 'alpha');
|
||||||
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
|
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
|
||||||
|
$rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1;
|
||||||
|
|
||||||
// PDF
|
// PDF
|
||||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||||
@ -939,7 +941,7 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $fk_unit, '', 0, $pu_ht_devise);
|
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $info_bits, 0, $price_base_type, $pu_ttc, $date_start, $date_end, $type, min($rank, count($object->lines) + 1), 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $fk_unit, '', 0, $pu_ht_devise);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$ret = $object->fetch($object->id); // Reload to get new records
|
$ret = $object->fetch($object->id); // Reload to get new records
|
||||||
@ -1862,11 +1864,13 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
$title = $langs->trans('ProductsAndServices');
|
$title = $langs->trans('ProductsAndServices');
|
||||||
print load_fiche_titre($title);
|
print load_fiche_titre($title);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
$objectsrc->printOriginLinesList('', $selectedLines);
|
$objectsrc->printOriginLinesList('', $selectedLines);
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
@ -2520,27 +2524,27 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
// Reopen a closed order
|
// Reopen a closed order
|
||||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans('ReOpen').'</a>';
|
print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send
|
// Send
|
||||||
if (empty($user->socid)) {
|
if (empty($user->socid)) {
|
||||||
if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
if ($object->statut > Commande::STATUS_DRAFT || !empty($conf->global->COMMANDE_SENDBYEMAIL_FOR_ALL_STATUS)) {
|
||||||
if ($usercansend) {
|
if ($usercansend) {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
|
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a>';
|
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valid
|
// Valid
|
||||||
if ($object->statut == Commande::STATUS_DRAFT && ($object->total_ttc >= 0 || !empty($conf->global->ORDER_ENABLE_NEGATIVE)) && $numlines > 0 && $usercanvalidate) {
|
if ($object->statut == Commande::STATUS_DRAFT && ($object->total_ttc >= 0 || !empty($conf->global->ORDER_ENABLE_NEGATIVE)) && $numlines > 0 && $usercanvalidate) {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=validate">'.$langs->trans('Validate').'</a>';
|
print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
// Edit
|
// Edit
|
||||||
if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) {
|
if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) {
|
||||||
print '<a class="butAction" href="card.php?id='.$object->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=modif&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
// Create event
|
// Create event
|
||||||
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD))
|
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD))
|
||||||
@ -2555,7 +2559,7 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER)) {
|
if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_SALE_ORDER)) {
|
||||||
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) && $object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
||||||
if ($usercancreatepurchaseorder) {
|
if ($usercancreatepurchaseorder) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddPurchaseOrder").'</a>';
|
print dolGetButtonAction('', $langs->trans('AddPurchaseOrder'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2566,9 +2570,9 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
|
|
||||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) {
|
||||||
if ($user->rights->ficheinter->creer) {
|
if ($user->rights->ficheinter->creer) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans('AddIntervention').'</a>';
|
print dolGetButtonAction('', $langs->trans('AddInterventionGR'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('AddIntervention').'</a>';
|
print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('AddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2578,7 +2582,7 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
$langs->load("contracts");
|
$langs->load("contracts");
|
||||||
|
|
||||||
if ($user->rights->contrat->creer) {
|
if ($user->rights->contrat->creer) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans('AddContract').'</a>';
|
print dolGetButtonAction('', $langs->trans('AddContract'), 'default', DOL_URL_ROOT.'/contrat/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2590,52 +2594,52 @@ if ($action == 'create' && $usercancreate) {
|
|||||||
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
||||||
if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) {
|
if (($conf->expedition_bon->enabled && $user->rights->expedition->creer) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->creer)) {
|
||||||
if ($user->rights->expedition->creer) {
|
if ($user->rights->expedition->creer) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id.'">'.$langs->trans('CreateShipment').'</a>';
|
print dolGetButtonAction('', $langs->trans('CreateShipment'), 'default', DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id, '');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('CreateShipment').'</a>';
|
print dolGetButtonAction($langs->trans('NotAllowed'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Shipment"))).'">'.$langs->trans('CreateShipment').'</a>';
|
print dolGetButtonAction($langs->trans('ErrorModuleSetupNotComplete'), $langs->trans('CreateShipment'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set to shipped
|
// Set to shipped
|
||||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
|
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=shipped">'.$langs->trans('ClassifyShipped').'</a>';
|
print dolGetButtonAction('', $langs->trans('ClassifyShipped'), 'default', $_SERVER["PHP_SELF"].'?action=shipped&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
// Create bill and Classify billed
|
// Create bill and Classify billed
|
||||||
// Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
|
// Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
|
||||||
if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
|
if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
|
||||||
if (!empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
|
if (!empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
print dolGetButtonAction('', $langs->trans('CreateBill'), 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid, '');
|
||||||
}
|
}
|
||||||
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifybilled&token='.newToken().'">'.$langs->trans("ClassifyBilled").'</a>';
|
print dolGetButtonAction('', $langs->trans('ClassifyBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifybilled&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
|
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
|
||||||
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifyunbilled&token='.newToken().'">'.$langs->trans("ClassifyUnBilled").'</a>';
|
print dolGetButtonAction('', $langs->trans('ClassifyUnBilled'), 'default', $_SERVER["PHP_SELF"].'?action=classifyunbilled&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Clone
|
// Clone
|
||||||
if ($usercancreate) {
|
if ($usercancreate) {
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=order">'.$langs->trans("ToClone").'</a>';
|
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER["PHP_SELF"].'?action=clone&token='.newToken().'&id='.$object->id.'&socid='.$object->socid, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel order
|
// Cancel order
|
||||||
if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) {
|
if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) {
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'">'.$langs->trans("Cancel").'</a>';
|
print dolGetButtonAction('', $langs->trans('Cancel'), 'danger', $_SERVER["PHP_SELF"].'?action=cancel&token='.newToken().'&id='.$object->id, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete order
|
// Delete order
|
||||||
if ($usercandelete) {
|
if ($usercandelete) {
|
||||||
if ($numshipping == 0) {
|
if ($numshipping == 0) {
|
||||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>';
|
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id, '');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ShippingExist").'">'.$langs->trans("Delete").'</a>';
|
print dolGetButtonAction($langs->trans('ShippingExist'), $langs->trans('Delete'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -135,6 +135,11 @@ class Orders extends DolibarrApi
|
|||||||
// Add external contacts ids
|
// Add external contacts ids
|
||||||
$this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
|
$this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
|
||||||
$this->commande->fetchObjectLinked();
|
$this->commande->fetchObjectLinked();
|
||||||
|
|
||||||
|
// Add online_payment_url, cf #20477
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
$this->commande->online_payment_url = getOnlinePaymentUrl(0, 'order', $this->commande->ref);
|
||||||
|
|
||||||
return $this->_cleanObjectDatas($this->commande);
|
return $this->_cleanObjectDatas($this->commande);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,6 +235,10 @@ class Orders extends DolibarrApi
|
|||||||
if ($commande_static->fetch($obj->rowid)) {
|
if ($commande_static->fetch($obj->rowid)) {
|
||||||
// Add external contacts ids
|
// Add external contacts ids
|
||||||
$commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
|
$commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
|
||||||
|
// Add online_payment_url, cf #20477
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
$commande_static->online_payment_url = getOnlinePaymentUrl(0, 'order', $commande_static->ref);
|
||||||
|
|
||||||
$obj_ret[] = $this->_cleanObjectDatas($commande_static);
|
$obj_ret[] = $this->_cleanObjectDatas($commande_static);
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
@ -574,7 +583,7 @@ class Orders extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function deleteContact($id, $contactid, $type)
|
public function deleteContact($id, $contactid, $type)
|
||||||
{
|
{
|
||||||
@ -704,7 +713,7 @@ class Orders extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@ -735,6 +744,10 @@ class Orders extends DolibarrApi
|
|||||||
|
|
||||||
$this->commande->fetchObjectLinked();
|
$this->commande->fetchObjectLinked();
|
||||||
|
|
||||||
|
//fix #20477 : add online_payment_url
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||||
|
$this->commande->online_payment_url = getOnlinePaymentUrl(0, 'order', $this->commande->ref);
|
||||||
|
|
||||||
return $this->_cleanObjectDatas($this->commande);
|
return $this->_cleanObjectDatas($this->commande);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -974,7 +987,7 @@ class Orders extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function getOrderShipments($id)
|
public function getOrderShipments($id)
|
||||||
{
|
{
|
||||||
@ -1030,7 +1043,7 @@ class Orders extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function createOrderShipment($id, $warehouse_id)
|
public function createOrderShipment($id, $warehouse_id)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -10,8 +10,9 @@
|
|||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2016-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2021-2022 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2021-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -266,6 +267,11 @@ class Commande extends CommonOrder
|
|||||||
*/
|
*/
|
||||||
public $expeditions;
|
public $expeditions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string payment url
|
||||||
|
*/
|
||||||
|
public $online_payment_url;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||||
@ -519,6 +525,7 @@ class Commande extends CommonOrder
|
|||||||
if ($this->lines[$i]->fk_product > 0) {
|
if ($this->lines[$i]->fk_product > 0) {
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
$mouvP->origin = &$this;
|
$mouvP->origin = &$this;
|
||||||
|
$mouvP->setOrigin($this->element, $this->id);
|
||||||
// We decrement stock of product (and sub-products)
|
// We decrement stock of product (and sub-products)
|
||||||
$result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr", $num));
|
$result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr", $num));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -647,6 +654,7 @@ class Commande extends CommonOrder
|
|||||||
if ($this->lines[$i]->fk_product > 0) {
|
if ($this->lines[$i]->fk_product > 0) {
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
$mouvP->origin = &$this;
|
$mouvP->origin = &$this;
|
||||||
|
$mouvP->setOrigin($this->element, $this->id);
|
||||||
// We increment stock of product (and sub-products)
|
// We increment stock of product (and sub-products)
|
||||||
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr", $this->ref));
|
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr", $this->ref));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -828,6 +836,7 @@ class Commande extends CommonOrder
|
|||||||
for ($i = 0; $i < $num; $i++) {
|
for ($i = 0; $i < $num; $i++) {
|
||||||
if ($this->lines[$i]->fk_product > 0) {
|
if ($this->lines[$i]->fk_product > 0) {
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
|
$mouvP->setOrigin($this->element, $this->id);
|
||||||
// We increment stock of product (and sub-products)
|
// We increment stock of product (and sub-products)
|
||||||
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr", $this->ref)); // price is 0, we don't want WAP to be changed
|
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderCanceledInDolibarr", $this->ref)); // price is 0, we don't want WAP to be changed
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
@ -1659,6 +1668,11 @@ class Commande extends CommonOrder
|
|||||||
// Reorder if child line
|
// Reorder if child line
|
||||||
if (!empty($fk_parent_line)) {
|
if (!empty($fk_parent_line)) {
|
||||||
$this->line_order(true, 'DESC');
|
$this->line_order(true, 'DESC');
|
||||||
|
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines
|
||||||
|
$linecount = count($this->lines);
|
||||||
|
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||||
|
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la commande meme
|
// Mise a jour informations denormalisees au niveau de la commande meme
|
||||||
@ -2028,8 +2042,9 @@ class Commande extends CommonOrder
|
|||||||
*/
|
*/
|
||||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
|
|
||||||
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx, l.ref_ext,';
|
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx, l.ref_ext,';
|
||||||
@ -4030,6 +4045,23 @@ class Commande extends CommonOrder
|
|||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to replace a product id with another one.
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param int $origin_id Old product id
|
||||||
|
* @param int $dest_id New product id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id)
|
||||||
|
{
|
||||||
|
$tables = array(
|
||||||
|
'commandedet',
|
||||||
|
);
|
||||||
|
|
||||||
|
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the customer order delayed?
|
* Is the customer order delayed?
|
||||||
*
|
*
|
||||||
@ -4628,7 +4660,7 @@ class OrderLine extends CommonOrderLine
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('LINEORDER_UPDATE', $user);
|
$result = $this->call_trigger('LINEORDER_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -201,6 +201,7 @@ $arrayfields = array(
|
|||||||
'c.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>140),
|
'c.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>140),
|
||||||
'shippable'=>array('label'=>"Shippable", 'checked'=>1,'enabled'=>(!empty($conf->expedition->enabled)), 'position'=>990),
|
'shippable'=>array('label'=>"Shippable", 'checked'=>1,'enabled'=>(!empty($conf->expedition->enabled)), 'position'=>990),
|
||||||
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)), 'position'=>995),
|
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)), 'position'=>995),
|
||||||
|
'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999),
|
||||||
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
|
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
@ -318,7 +319,7 @@ if ($action == 'validate' && $permissiontoadd) {
|
|||||||
if ($objecttmp->valid($user, $idwarehouse)) {
|
if ($objecttmp->valid($user, $idwarehouse)) {
|
||||||
setEventMessage($langs->trans('hasBeenValidated', $objecttmp->ref), 'mesgs');
|
setEventMessage($langs->trans('hasBeenValidated', $objecttmp->ref), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('CantBeValidated'), 'errors');
|
setEventMessage($objecttmp->error, $objecttmp->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -345,7 +346,7 @@ if ($action == 'shipped' && $permissiontoadd) {
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
foreach ($toselect as $checked) {
|
foreach ($toselect as $checked) {
|
||||||
if ($objecttmp->fetch($checked)) {
|
if ($objecttmp->fetch($checked)) {
|
||||||
if ($objecttmp->statut == 1) {
|
if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
|
||||||
if ($objecttmp->cloture($user)) {
|
if ($objecttmp->cloture($user)) {
|
||||||
setEventMessage($langs->trans('PassedInClosedStatus', $objecttmp->ref), 'mesgs');
|
setEventMessage($langs->trans('PassedInClosedStatus', $objecttmp->ref), 'mesgs');
|
||||||
} else {
|
} else {
|
||||||
@ -441,7 +442,7 @@ $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture
|
|||||||
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
||||||
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
|
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
|
||||||
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
|
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method,';
|
||||||
$sql .= ' c.fk_input_reason';
|
$sql .= ' c.fk_input_reason, c.import_key';
|
||||||
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
|
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
|
||||||
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||||
}
|
}
|
||||||
@ -1275,6 +1276,11 @@ if ($resql) {
|
|||||||
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1);
|
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1, 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
// Import key
|
||||||
|
if (!empty($arrayfields['c.import_key']['checked'])) {
|
||||||
|
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
// Status
|
// Status
|
||||||
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
||||||
print '<td class="liste_titre maxwidthonsmartphone center">';
|
print '<td class="liste_titre maxwidthonsmartphone center">';
|
||||||
@ -1436,6 +1442,9 @@ if ($resql) {
|
|||||||
if (!empty($arrayfields['c.facture']['checked'])) {
|
if (!empty($arrayfields['c.facture']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||||
}
|
}
|
||||||
|
if (!empty($arrayfields['c.import_key']['checked'])) {
|
||||||
|
print_liste_field_titre($arrayfields['c.import_key']['label'], $_SERVER["PHP_SELF"], "c.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
|
}
|
||||||
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
}
|
}
|
||||||
@ -2063,6 +2072,13 @@ if ($resql) {
|
|||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Import key
|
||||||
|
if (!empty($arrayfields['c.import_key']['checked'])) {
|
||||||
|
print '<td class="nowrap center">'.$obj->import_key.'</td>';
|
||||||
|
if (!$i) {
|
||||||
|
$totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Status
|
// Status
|
||||||
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
if (!empty($arrayfields['c.fk_statut']['checked'])) {
|
||||||
print '<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).'</td>';
|
print '<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).'</td>';
|
||||||
|
|||||||
@ -45,8 +45,14 @@ if ($mode == 'customer' && !$user->rights->commande->lire) {
|
|||||||
if ($mode == 'supplier' && empty($user->rights->fournisseur->commande->lire)) {
|
if ($mode == 'supplier' && empty($user->rights->fournisseur->commande->lire)) {
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
|
if ($mode == 'supplier') {
|
||||||
|
$object_status = GETPOST('object_status', 'array:int');
|
||||||
|
$object_status = implode(',', $object_status);
|
||||||
|
} else {
|
||||||
$object_status = GETPOST('object_status', 'intcomma');
|
$object_status = GETPOST('object_status', 'intcomma');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$typent_id = GETPOST('typent_id', 'int');
|
$typent_id = GETPOST('typent_id', 'int');
|
||||||
$categ_id = GETPOST('categ_id', 'categ_id');
|
$categ_id = GETPOST('categ_id', 'categ_id');
|
||||||
|
|
||||||
|
|||||||
@ -588,14 +588,13 @@ foreach ($listofchoices as $choice => $val) {
|
|||||||
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.$disabled.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>';
|
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.$disabled.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<input type="submit" class="button" name="search" value="'.$langs->trans("Search").'">';
|
print '<input type="submit" class="button small" name="search" value="'.$langs->trans("Search").'">';
|
||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
|
|
||||||
print dol_get_fiche_end();
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
if (!empty($date_start) && !empty($date_stop)) {
|
if (!empty($date_start) && !empty($date_stop)) {
|
||||||
$param = 'action=searchfiles';
|
|
||||||
$param .= '&date_startday='.GETPOST('date_startday', 'int');
|
$param .= '&date_startday='.GETPOST('date_startday', 'int');
|
||||||
$param .= '&date_startmonth='.GETPOST('date_startmonth', 'int');
|
$param .= '&date_startmonth='.GETPOST('date_startmonth', 'int');
|
||||||
$param .= '&date_startyear='.GETPOST('date_startyear', 'int');
|
$param .= '&date_startyear='.GETPOST('date_startyear', 'int');
|
||||||
@ -603,13 +602,30 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
$param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int');
|
$param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int');
|
||||||
$param .= '&date_stopyear='.GETPOST('date_stopyear', 'int');
|
$param .= '&date_stopyear='.GETPOST('date_stopyear', 'int');
|
||||||
foreach ($listofchoices as $choice => $val) {
|
foreach ($listofchoices as $choice => $val) {
|
||||||
$param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0);
|
if (GETPOST($choice, 'int')) {
|
||||||
|
$param .= '&'.$choice.'=1';
|
||||||
}
|
}
|
||||||
print '<form name="dl" action="'.$_SERVER["PHP_SELF"].'?action=dl" method="POST">'."\n";
|
}
|
||||||
print '<input type="hidden" name="token" value="'.currentToken().'">';
|
|
||||||
|
$TData = dol_sort_array($filesarray, $sortfield, $sortorder);
|
||||||
|
|
||||||
|
|
||||||
|
$filename = dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip';
|
||||||
|
|
||||||
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
|
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
|
||||||
|
|
||||||
|
print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.newToken().'&output=file&file='.urlencode($filename).$param.'"';
|
||||||
|
if (empty($TData)) {
|
||||||
|
print " disabled";
|
||||||
|
}
|
||||||
|
print '>'."\n";
|
||||||
|
print $langs->trans("Download");
|
||||||
|
print '</a><br>';
|
||||||
|
|
||||||
|
$param .= '&action=searchfiles';
|
||||||
|
|
||||||
|
/*
|
||||||
|
print '<input type="hidden" name="token" value="'.currentToken().'">';
|
||||||
print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />';
|
print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />';
|
||||||
print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />';
|
print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />';
|
||||||
print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />';
|
print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />';
|
||||||
@ -620,8 +636,13 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<input class="butAction butDownload" type="submit" value="'.$langs->trans("Download").'" />';
|
print '<input class="butAction butDownload small marginleftonly" type="submit" value="'.$langs->trans("Download").'"';
|
||||||
|
if (empty($TData)) {
|
||||||
|
print " disabled";
|
||||||
|
}
|
||||||
|
print '/>';
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
|
*/
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
@ -645,11 +666,9 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
print '<td class="center">'.$langs->trans("Currency").'</td>';
|
print '<td class="center">'.$langs->trans("Currency").'</td>';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
if ($result) {
|
|
||||||
$TData = dol_sort_array($filesarray, $sortfield, $sortorder);
|
|
||||||
|
|
||||||
if (empty($TData)) {
|
if (empty($TData)) {
|
||||||
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td>';
|
print '<tr class="oddeven"><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td>';
|
||||||
if (!empty($conf->multicurrency->enabled)) {
|
if (!empty($conf->multicurrency->enabled)) {
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
}
|
}
|
||||||
@ -672,7 +691,7 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
print '<tr class="oddeven '.$html_class.'">';
|
print '<tr class="oddeven '.$html_class.'">';
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<td>'.$langs->trans($data['item']).'</td>';
|
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans($data['item'])).'">'.$langs->trans($data['item']).'</td>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
@ -685,7 +704,7 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall tdoverflowmax150">';
|
||||||
|
|
||||||
if ($data['item'] == 'Invoice') {
|
if ($data['item'] == 'Invoice') {
|
||||||
$invoice->id = $data['id'];
|
$invoice->id = $data['id'];
|
||||||
@ -733,23 +752,33 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// File link
|
// File link
|
||||||
print '<td>';
|
print '<td class="tdoverflowmax150">';
|
||||||
if (!empty($data['files'])) {
|
if (!empty($data['files'])) {
|
||||||
foreach ($data['files'] as $id => $filecursor) {
|
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>';
|
$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
|
// Paid
|
||||||
print '<td aling="left">'.$data['paid'].'</td>';
|
print '<td class="center">'.($data['paid'] ? yn($data['paid']) : '').'</td>';
|
||||||
|
|
||||||
// Total ET
|
// Total ET
|
||||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</td>\n";
|
print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</span></td>\n";
|
||||||
// Total IT
|
// Total IT
|
||||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</td>\n";
|
print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</span></td>\n";
|
||||||
// Total VAT
|
// Total VAT
|
||||||
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</td>\n";
|
print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</span></td>\n";
|
||||||
|
|
||||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n";
|
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n";
|
||||||
|
|
||||||
@ -757,6 +786,7 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
|
|
||||||
print '<td class="center">'.$data['country_code']."</td>\n";
|
print '<td class="center">'.$data['country_code']."</td>\n";
|
||||||
|
|
||||||
|
// VAT number
|
||||||
print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n";
|
print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n";
|
||||||
|
|
||||||
if ($data['sens']) {
|
if ($data['sens']) {
|
||||||
@ -810,7 +840,7 @@ if (!empty($date_start) && !empty($date_stop)) {
|
|||||||
}
|
}
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,7 +170,7 @@ $arrayfields = array(
|
|||||||
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
|
'balancebefore'=>array('label'=>$langs->trans("BalanceBefore"), 'checked'=>0, 'position'=>1000),
|
||||||
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
|
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1001),
|
||||||
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
|
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
|
||||||
'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020),
|
'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>1020),
|
||||||
);
|
);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||||
@ -276,6 +276,9 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
|
|||||||
if ($offset) {
|
if ($offset) {
|
||||||
$param .= '&offset='.urlencode($offset);
|
$param .= '&offset='.urlencode($offset);
|
||||||
}
|
}
|
||||||
|
if ($limit) {
|
||||||
|
$param .= '&limit='.urlencode($limit);
|
||||||
|
}
|
||||||
if ($search_conciliated != '' && $search_conciliated != '-1') {
|
if ($search_conciliated != '' && $search_conciliated != '-1') {
|
||||||
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
||||||
}
|
}
|
||||||
@ -980,21 +983,27 @@ if ($resql) {
|
|||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
|
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
$moreforfilter .= $langs->trans('DateOperationShort').' ';
|
$moreforfilter .= $langs->trans('DateOperationShort');
|
||||||
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
|
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
|
||||||
$moreforfilter .= '<div class="nowrap inline-block">';
|
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||||
$moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'</div>';
|
$moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||||
//$moreforfilter .= ' - ';
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= '<div class="nowrap inline-block">'.$form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')).'</div>';
|
$moreforfilter .= ($conf->browser->layout == 'phone' ? '' : ' ');
|
||||||
|
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||||
|
$moreforfilter .= $form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||||
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
$moreforfilter .= '<div class="divsearchfield">';
|
$moreforfilter .= '<div class="divsearchfield">';
|
||||||
$moreforfilter .= $langs->trans('DateValueShort').' ';
|
$moreforfilter .= $langs->trans('DateValueShort');
|
||||||
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
|
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
|
||||||
$moreforfilter .= '<div class="nowrap inline-block">';
|
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||||
$moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'</div>';
|
$moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||||
//$moreforfilter .= ' - ';
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= '<div class="nowrap inline-block">'.$form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')).'</div>';
|
$moreforfilter .= ($conf->browser->layout == 'phone' ? '' : ' ');
|
||||||
|
$moreforfilter .= '<div class="nowrap inline-block">';
|
||||||
|
$moreforfilter .= $form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||||
|
$moreforfilter .= '</div>';
|
||||||
$moreforfilter .= '</div>';
|
$moreforfilter .= '</div>';
|
||||||
|
|
||||||
if (!empty($conf->categorie->enabled)) {
|
if (!empty($conf->categorie->enabled)) {
|
||||||
|
|||||||
@ -65,7 +65,8 @@ $hookmanager->initHooks(array('bankcard', 'globalcard'));
|
|||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id = GETPOST("id", 'int') ? GETPOST("id", 'int') : GETPOST('ref', 'alpha');
|
$id = GETPOST("id", 'int') ? GETPOST("id", 'int') : GETPOST('ref', 'alpha');
|
||||||
$fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid';
|
$fieldid = GETPOST("id", 'int') ? 'rowid' : 'ref';
|
||||||
|
|
||||||
$result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
|
$result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
|
||||||
|
|
||||||
|
|
||||||
@ -724,7 +725,7 @@ if ($action == 'create') {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) {
|
if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT) {
|
||||||
print '<div class="underbanner clearboth"></div>';
|
//print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border tableforfield centpercent">';
|
print '<table class="border tableforfield centpercent">';
|
||||||
|
|
||||||
|
|||||||
@ -519,9 +519,10 @@ class Account extends CommonObject
|
|||||||
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
||||||
* @param int $datev Date value
|
* @param int $datev Date value
|
||||||
* @param string $num_releve Label of bank receipt for reconciliation
|
* @param string $num_releve Label of bank receipt for reconciliation
|
||||||
|
* @param float $amount_main_currency Amount
|
||||||
* @return int Rowid of added entry, <0 if KO
|
* @return int Rowid of added entry, <0 if KO
|
||||||
*/
|
*/
|
||||||
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '')
|
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '', $amount_main_currency = null)
|
||||||
{
|
{
|
||||||
// Deprecation warning
|
// Deprecation warning
|
||||||
if (is_numeric($oper)) {
|
if (is_numeric($oper)) {
|
||||||
@ -579,6 +580,7 @@ class Account extends CommonObject
|
|||||||
$accline->datev = $datev;
|
$accline->datev = $datev;
|
||||||
$accline->label = $label;
|
$accline->label = $label;
|
||||||
$accline->amount = $amount;
|
$accline->amount = $amount;
|
||||||
|
$accline->amount_main_currency = $amount_main_currency;
|
||||||
$accline->fk_user_author = $user->id;
|
$accline->fk_user_author = $user->id;
|
||||||
$accline->fk_account = $this->id;
|
$accline->fk_account = $this->id;
|
||||||
$accline->fk_type = $oper;
|
$accline->fk_type = $oper;
|
||||||
@ -866,7 +868,7 @@ class Account extends CommonObject
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('BANKACCOUNT_UPDATE', $user);
|
$result = $this->call_trigger('BANKACCOUNT_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -1453,9 +1455,13 @@ class Account extends CommonObject
|
|||||||
|
|
||||||
// Call function to check BAN
|
// Call function to check BAN
|
||||||
|
|
||||||
if (!checkIbanForAccount($this) || !checkSwiftForAccount($this)) {
|
if (!checkIbanForAccount($this)) {
|
||||||
$this->error_number = 12;
|
$this->error_number = 12;
|
||||||
$this->error_message = 'IBANSWIFTControlError';
|
$this->error_message = 'IBANNotValid';
|
||||||
|
}
|
||||||
|
if (!checkSwiftForAccount($this)) {
|
||||||
|
$this->error_number = 12;
|
||||||
|
$this->error_message = 'SwiftNotValid';
|
||||||
}
|
}
|
||||||
/*if (! checkBanForAccount($this))
|
/*if (! checkBanForAccount($this))
|
||||||
{
|
{
|
||||||
@ -1728,7 +1734,7 @@ class Account extends CommonObject
|
|||||||
if ($dbs->query($sql)) {
|
if ($dbs->query($sql)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
|
//if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdparty and B-C on old one, we must get A-B-C after merge. Not A-B.
|
||||||
//$this->errors = $dbs->lasterror();
|
//$this->errors = $dbs->lasterror();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1797,7 +1803,8 @@ class AccountLine extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $datev;
|
public $datev;
|
||||||
|
|
||||||
public $amount;
|
public $amount; /* Amount of payment in the bank account currency */
|
||||||
|
public $amount_main_currency; /* Amount in the currency of company if bank account use another currency */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID
|
||||||
@ -1958,6 +1965,7 @@ class AccountLine extends CommonObject
|
|||||||
$sql .= ", datev";
|
$sql .= ", datev";
|
||||||
$sql .= ", label";
|
$sql .= ", label";
|
||||||
$sql .= ", amount";
|
$sql .= ", amount";
|
||||||
|
$sql .= ", amount_main_currency";
|
||||||
$sql .= ", fk_user_author";
|
$sql .= ", fk_user_author";
|
||||||
$sql .= ", num_chq";
|
$sql .= ", num_chq";
|
||||||
$sql .= ", fk_account";
|
$sql .= ", fk_account";
|
||||||
@ -1972,7 +1980,8 @@ class AccountLine extends CommonObject
|
|||||||
$sql .= ", '".$this->db->idate($this->datev)."'";
|
$sql .= ", '".$this->db->idate($this->datev)."'";
|
||||||
$sql .= ", '".$this->db->escape($this->label)."'";
|
$sql .= ", '".$this->db->escape($this->label)."'";
|
||||||
$sql .= ", ".price2num($this->amount);
|
$sql .= ", ".price2num($this->amount);
|
||||||
$sql .= ", ".($this->fk_user_author > 0 ? $this->fk_user_author : "null");
|
$sql .= ", ".(empty($this->amount_main_currency) ? "NULL" : price2num($this->amount_main_currency));
|
||||||
|
$sql .= ", ".($this->fk_user_author > 0 ? ((int) $this->fk_user_author) : "null");
|
||||||
$sql .= ", ".($this->num_chq ? "'".$this->db->escape($this->num_chq)."'" : "null");
|
$sql .= ", ".($this->num_chq ? "'".$this->db->escape($this->num_chq)."'" : "null");
|
||||||
$sql .= ", '".$this->db->escape($this->fk_account)."'";
|
$sql .= ", '".$this->db->escape($this->fk_account)."'";
|
||||||
$sql .= ", '".$this->db->escape($this->fk_type)."'";
|
$sql .= ", '".$this->db->escape($this->fk_type)."'";
|
||||||
|
|||||||
@ -179,7 +179,7 @@ if (empty($reshook)) {
|
|||||||
$action = 'create';
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'delete') {
|
if ($action == 'confirm_delete' && $confirm == 'yes') {
|
||||||
$result = $object->fetch($id);
|
$result = $object->fetch($id);
|
||||||
|
|
||||||
if ($object->rappro == 0) {
|
if ($object->rappro == 0) {
|
||||||
@ -543,6 +543,12 @@ if ($id) {
|
|||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350);
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 350);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Confirmation of the removal of the Various Payment
|
||||||
|
if ($action == 'delete') {
|
||||||
|
$text = $langs->trans('ConfirmDeleteVariousPayment');
|
||||||
|
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteVariousPayment'), $text, 'confirm_delete', '', '', 2);
|
||||||
|
}
|
||||||
|
|
||||||
print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
|
print dol_get_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
|
||||||
|
|
||||||
$morehtmlref = '<div class="refidno">';
|
$morehtmlref = '<div class="refidno">';
|
||||||
|
|||||||
@ -208,6 +208,9 @@ if (empty($reshook)) {
|
|||||||
$object->model_pdf = GETPOST('modelpdf', 'alpha');
|
$object->model_pdf = GETPOST('modelpdf', 'alpha');
|
||||||
$object->usenewprice = GETPOST('usenewprice', 'alpha');
|
$object->usenewprice = GETPOST('usenewprice', 'alpha');
|
||||||
|
|
||||||
|
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
|
||||||
|
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
|
||||||
|
|
||||||
$object->frequency = $frequency;
|
$object->frequency = $frequency;
|
||||||
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
|
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
|
||||||
$object->nb_gen_max = $nb_gen_max;
|
$object->nb_gen_max = $nb_gen_max;
|
||||||
@ -261,8 +264,6 @@ if (empty($reshook)) {
|
|||||||
} else {
|
} else {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
$error++;
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
$action = "create";
|
$action = "create";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -966,7 +967,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Title
|
// Title
|
||||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>';
|
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>';
|
||||||
print '<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'">';
|
print '<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'" autofocus>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Third party
|
// Third party
|
||||||
@ -1027,12 +1028,14 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Payment term
|
// Payment term
|
||||||
print "<tr><td>".$langs->trans("PaymentConditions")."</td><td>";
|
print "<tr><td>".$langs->trans("PaymentConditions")."</td><td>";
|
||||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
|
print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $object->cond_reglement_id, 'cond_reglement_id', -1, 0, 0, '');
|
||||||
|
//$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Payment mode
|
// Payment mode
|
||||||
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
|
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
|
||||||
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none', '', 1);
|
print $form->select_types_paiements(GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $object->mode_reglement_id, 'mode_reglement_id', '', 0, 1, 0, 0, 1, '', 1);
|
||||||
|
//$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', '', 1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
@ -1040,8 +1043,9 @@ if ($action == 'create') {
|
|||||||
$projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project;
|
$projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project;
|
||||||
$langs->load('projects');
|
$langs->load('projects');
|
||||||
print '<tr><td>'.$langs->trans('Project').'</td><td>';
|
print '<tr><td>'.$langs->trans('Project').'</td><td>';
|
||||||
|
print img_picto('', 'project');
|
||||||
$numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
|
$numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
|
||||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->thirdparty->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.$langs->trans("AddProject").'</a>';
|
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->thirdparty->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.img_object($langs->trans("AddProject"), 'add').'</a>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1074,7 +1078,8 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Frequency + unit
|
// Frequency + unit
|
||||||
print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>";
|
print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>";
|
||||||
print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' size='4' /> ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency') ?GETPOST('unit_frequency') : 'm'));
|
print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' size='4' /> ";
|
||||||
|
print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency') ?GETPOST('unit_frequency') : 'm'));
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Date next run
|
// Date next run
|
||||||
@ -1474,15 +1479,16 @@ if ($action == 'create') {
|
|||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<table class="nobordernopadding">';
|
print '<table class="nobordernopadding">';
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm'));
|
print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ";
|
||||||
|
print $form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm'));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
|
print '<td class="left"><input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans("Modify").'"></td>';
|
||||||
print '</tr></table></form>';
|
print '</tr></table></form>';
|
||||||
} else {
|
} else {
|
||||||
if ($object->frequency > 0) {
|
if ($object->frequency > 0) {
|
||||||
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
|
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
|
||||||
} else {
|
} else {
|
||||||
print $langs->trans("NotARecurringInvoiceTemplate");
|
print '<span class="opacitymedium">'.$langs->trans("NotARecurringInvoiceTemplate").'</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
* Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -94,6 +95,7 @@ $originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('
|
|||||||
$fac_rec = GETPOST('fac_rec', 'int');
|
$fac_rec = GETPOST('fac_rec', 'int');
|
||||||
$facid = GETPOST('facid', 'int');
|
$facid = GETPOST('facid', 'int');
|
||||||
$ref_client = GETPOST('ref_client', 'int');
|
$ref_client = GETPOST('ref_client', 'int');
|
||||||
|
$rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1;
|
||||||
|
|
||||||
// PDF
|
// PDF
|
||||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||||
@ -156,12 +158,12 @@ if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$fieldid = (!empty($ref) ? 'ref' : 'rowid');
|
|
||||||
if ($user->socid) {
|
if ($user->socid) {
|
||||||
$socid = $user->socid;
|
$socid = $user->socid;
|
||||||
}
|
}
|
||||||
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
|
||||||
$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $fieldid, $isdraft);
|
|
||||||
|
$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -302,6 +304,14 @@ if (empty($reshook)) {
|
|||||||
// Validation
|
// Validation
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
|
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||||
|
$last_of_type = $object->willBeLastOfSameType();
|
||||||
|
if (empty($object->date_validation) && !$last_of_type[0]) {
|
||||||
|
setEventMessages($langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $object->ref, dol_print_date($object->date, 'day'), dol_print_date($last_of_type[1], 'day')), null, 'errors');
|
||||||
|
$action = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// On verifie signe facture
|
// On verifie signe facture
|
||||||
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
|
if ($object->type == Facture::TYPE_CREDIT_NOTE) {
|
||||||
// Si avoir, le signe doit etre negatif
|
// Si avoir, le signe doit etre negatif
|
||||||
@ -538,7 +548,8 @@ if (empty($reshook)) {
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2));
|
$result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2));
|
||||||
} elseif ($action == "setabsolutediscount" && $usercancreate) {
|
} elseif ($action == "setabsolutediscount" && $usercancreate) {
|
||||||
// POST[remise_id] or POST[remise_id_for_payment]
|
// We have POST[remise_id] or POST[remise_id_for_payment]
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
// We use the credit to reduce amount of invoice
|
// We use the credit to reduce amount of invoice
|
||||||
if (GETPOST("remise_id", 'int') > 0) {
|
if (GETPOST("remise_id", 'int') > 0) {
|
||||||
@ -549,7 +560,8 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dol_print_error($db, $object->error);
|
$error++;
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We use the credit to reduce remain to pay
|
// We use the credit to reduce remain to pay
|
||||||
@ -560,7 +572,8 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
//var_dump($object->getRemainToPay(0));
|
//var_dump($object->getRemainToPay(0));
|
||||||
//var_dump($discount->amount_ttc);exit;
|
//var_dump($discount->amount_ttc);exit;
|
||||||
if (price2num($discount->amount_ttc) > price2num($object->getRemainToPay(0))) {
|
$remaintopay = $object->getRemainToPay(0);
|
||||||
|
if (price2num($discount->amount_ttc) > price2num($remaintopay)) {
|
||||||
// TODO Split the discount in 2 automatically
|
// TODO Split the discount in 2 automatically
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorDiscountLargerThanRemainToPaySplitItBefore"), null, 'errors');
|
setEventMessages($langs->trans("ErrorDiscountLargerThanRemainToPaySplitItBefore"), null, 'errors');
|
||||||
@ -569,12 +582,26 @@ if (empty($reshook)) {
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
$result = $discount->link_to_invoice(0, $id);
|
$result = $discount->link_to_invoice(0, $id);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
setEventMessages($discount->error, $discount->errors, 'errors');
|
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$newremaintopay = $object->getRemainToPay(0);
|
||||||
|
if ($newremaintopay == 0) {
|
||||||
|
$object->setPaid($user);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (!$error) {
|
||||||
|
$db->commit();
|
||||||
|
} else {
|
||||||
|
$db->rollback();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($error) && empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
||||||
@ -607,63 +634,6 @@ if (empty($reshook)) {
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
// Check parameters
|
|
||||||
|
|
||||||
// Check for mandatory fields in thirdparty (defined into setup)
|
|
||||||
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'ACCOUNTANCY_CODE_CUSTOMER');
|
|
||||||
foreach ($array_to_check as $key) {
|
|
||||||
$keymin = strtolower($key);
|
|
||||||
$i = (int) preg_replace('/[^0-9]/', '', $key);
|
|
||||||
$vallabel = $object->thirdparty->$keymin;
|
|
||||||
|
|
||||||
if ($i > 0) {
|
|
||||||
if ($object->thirdparty->isACompany()) {
|
|
||||||
// Check for mandatory prof id (but only if country is other than ours)
|
|
||||||
if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) {
|
|
||||||
$idprof_mandatory = 'SOCIETE_'.$key.'_INVOICE_MANDATORY';
|
|
||||||
if (!$vallabel && !empty($conf->global->$idprof_mandatory)) {
|
|
||||||
$langs->load("errors");
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId'.$i, $object->thirdparty->country_code)).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//var_dump($conf->global->SOCIETE_EMAIL_MANDATORY);
|
|
||||||
if ($key == 'EMAIL') {
|
|
||||||
// Check for mandatory
|
|
||||||
if (!empty($conf->global->SOCIETE_EMAIL_INVOICE_MANDATORY) && !isValidEMail($object->thirdparty->email)) {
|
|
||||||
$langs->load("errors");
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorBadEMail", $object->thirdparty->email).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($key == 'ACCOUNTANCY_CODE_CUSTOMER') {
|
|
||||||
// Check for mandatory
|
|
||||||
if (!empty($conf->global->SOCIETE_ACCOUNTANCY_CODE_CUSTOMER_INVOICE_MANDATORY) && empty($object->thirdparty->code_compta)) {
|
|
||||||
$langs->load("errors");
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorAccountancyCodeCustomerIsMandatory", $object->thirdparty->name).' ('.$langs->trans("ForbiddenBySetupRules").')', null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for mandatory fields in invoice
|
|
||||||
$array_to_check = array('REF_CLIENT'=>'RefCustomer');
|
|
||||||
foreach ($array_to_check as $key => $val) {
|
|
||||||
$keymin = strtolower($key);
|
|
||||||
$vallabel = $object->$keymin;
|
|
||||||
|
|
||||||
// Check for mandatory
|
|
||||||
$keymandatory = 'INVOICE_'.$key.'_MANDATORY_FOR_VALIDATION';
|
|
||||||
if (!$vallabel && !empty($conf->global->$keymandatory)) {
|
|
||||||
$langs->load("errors");
|
|
||||||
$error++;
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for warehouse
|
// Check for warehouse
|
||||||
if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
if ($object->type != Facture::TYPE_DEPOSIT && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
||||||
$qualified_for_stock_change = 0;
|
$qualified_for_stock_change = 0;
|
||||||
@ -769,7 +739,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
// On verifie si aucun paiement n'a ete effectue
|
// On verifie si aucun paiement n'a ete effectue
|
||||||
if ($ventilExportCompta == 0) {
|
if ($ventilExportCompta == 0) {
|
||||||
if (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == $object->total_ttc && empty($object->paye))) {
|
if (!empty($conf->global->INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE) || ($resteapayer == $object->total_ttc && empty($object->paye))) {
|
||||||
$result = $object->setDraft($user, $idwarehouse);
|
$result = $object->setDraft($user, $idwarehouse);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
@ -2284,7 +2254,7 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, - 1, $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, GETPOST('progress'), '', $fk_unit, $pu_ht_devise);
|
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $date_start, $date_end, 0, $info_bits, '', $price_base_type, $pu_ttc, $type, min($rank, count($object->lines) + 1), $special_code, '', 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, GETPOST('progress'), '', $fk_unit, $pu_ht_devise);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
// Define output language and generate document
|
// Define output language and generate document
|
||||||
@ -2592,9 +2562,10 @@ if (empty($reshook)) {
|
|||||||
setEventMessages($mesg, null, 'warnings');
|
setEventMessages($mesg, null, 'warnings');
|
||||||
$result = -1;
|
$result = -1;
|
||||||
} else {
|
} else {
|
||||||
$object->update_percent($line, GETPOST('all_progress'));
|
$object->update_percent($line, GETPOST('all_progress'), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$object->update_price(1);
|
||||||
}
|
}
|
||||||
} elseif ($action == 'updateline' && $usercancreate && !$cancel) {
|
} elseif ($action == 'updateline' && $usercancreate && !$cancel) {
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
|
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page
|
||||||
@ -3058,7 +3029,7 @@ if ($action == 'create') {
|
|||||||
if (empty($conf->global->INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE)) {
|
if (empty($conf->global->INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE)) {
|
||||||
$text .= ' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name'));
|
$text .= ' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name'));
|
||||||
}
|
}
|
||||||
print info_admin($text, 0, 0, 0).'<br>';
|
print info_admin($text, 0, 0, 0, 'opacitymedium').'<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST" id="formtocreate" name="formtocreate">';
|
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST" id="formtocreate" name="formtocreate">';
|
||||||
@ -3554,7 +3525,7 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
if ($socid > 0) {
|
if ($socid > 0) {
|
||||||
// Discounts for third party
|
// Discounts for third party
|
||||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('DiscountStillRemaining').'</td><td colspan="2">';
|
||||||
|
|
||||||
$thirdparty = $soc;
|
$thirdparty = $soc;
|
||||||
$discount_type = 0;
|
$discount_type = 0;
|
||||||
@ -3847,17 +3818,18 @@ if ($action == 'create') {
|
|||||||
$title = $langs->trans('ProductsAndServices');
|
$title = $langs->trans('ProductsAndServices');
|
||||||
print load_fiche_titre($title);
|
print load_fiche_titre($title);
|
||||||
|
|
||||||
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
$objectsrc->printOriginLinesList('', $selectedLines);
|
$objectsrc->printOriginLinesList('', $selectedLines);
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
} elseif ($id > 0 || !empty($ref)) {
|
} elseif ($id > 0 || !empty($ref)) {
|
||||||
if (empty($object->id)) {
|
if (empty($object->id)) {
|
||||||
llxHeader();
|
|
||||||
$langs->load('errors');
|
$langs->load('errors');
|
||||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||||
llxFooter();
|
llxFooter();
|
||||||
@ -4386,8 +4358,8 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Relative and absolute discounts
|
// Relative and absolute discounts
|
||||||
print '<!-- Discounts -->'."\n";
|
print '<!-- Discounts -->'."\n";
|
||||||
print '<tr><td>'.$langs->trans('Discounts');
|
print '<tr><td>'.$langs->trans('DiscountStillRemaining').'</td>';
|
||||||
print '</td><td>';
|
print '<td>';
|
||||||
$thirdparty = $soc;
|
$thirdparty = $soc;
|
||||||
$discount_type = 0;
|
$discount_type = 0;
|
||||||
$backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id);
|
$backtopage = urlencode($_SERVER["PHP_SELF"].'?facid='.$object->id);
|
||||||
@ -4976,7 +4948,7 @@ if ($action == 'create') {
|
|||||||
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,';
|
$sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,';
|
||||||
$sql .= ' c.code as payment_code, c.libelle as payment_label,';
|
$sql .= ' c.code as payment_code, c.libelle as payment_label,';
|
||||||
$sql .= ' pf.amount,';
|
$sql .= ' pf.amount,';
|
||||||
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal';
|
$sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal, ba.currency_code as bacurrency_code';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||||
@ -5019,6 +4991,7 @@ if ($action == 'create') {
|
|||||||
$bankaccountstatic->ref = $objp->baref;
|
$bankaccountstatic->ref = $objp->baref;
|
||||||
$bankaccountstatic->label = $objp->baref;
|
$bankaccountstatic->label = $objp->baref;
|
||||||
$bankaccountstatic->number = $objp->banumber;
|
$bankaccountstatic->number = $objp->banumber;
|
||||||
|
$bankaccountstatic->currency_code = $objp->bacurrency_code;
|
||||||
|
|
||||||
if (!empty($conf->accounting->enabled)) {
|
if (!empty($conf->accounting->enabled)) {
|
||||||
$bankaccountstatic->account_number = $objp->account_number;
|
$bankaccountstatic->account_number = $objp->account_number;
|
||||||
@ -5253,7 +5226,7 @@ if ($action == 'create') {
|
|||||||
print '</div>';
|
print '</div>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '<div class="clearboth"></div><br>';
|
print '<div class="clearboth"></div><br><br>';
|
||||||
|
|
||||||
if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
|
||||||
$blocname = 'contacts';
|
$blocname = 'contacts';
|
||||||
@ -5361,27 +5334,37 @@ if ($action == 'create') {
|
|||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
$params = array(
|
||||||
|
'attr' => array(
|
||||||
|
'title' => '',
|
||||||
|
'class' => 'classfortooltip'
|
||||||
|
)
|
||||||
|
);
|
||||||
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
|
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
|
||||||
if ($object->statut == Facture::STATUS_VALIDATED) {
|
if ($object->statut == Facture::STATUS_VALIDATED) {
|
||||||
// We check if lines of invoice are not already transfered into accountancy
|
// We check if lines of invoice are not already transfered into accountancy
|
||||||
$ventilExportCompta = $object->getVentilExportCompta();
|
$ventilExportCompta = $object->getVentilExportCompta();
|
||||||
|
|
||||||
if ($ventilExportCompta == 0) {
|
if ($ventilExportCompta == 0) {
|
||||||
if (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_EDITED) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) {
|
if (!empty($conf->global->INVOICE_CAN_BE_EDITED_EVEN_IF_PAYMENT_DONE) || ($resteapayer == price2num($object->total_ttc, 'MT', 1) && empty($object->paye))) {
|
||||||
if (!$objectidnext && $object->is_last_in_cycle()) {
|
if (!$objectidnext && $object->is_last_in_cycle()) {
|
||||||
if ($usercanunvalidate) {
|
if ($usercanunvalidate) {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif&token='.newToken(), '', true, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('Modify').'</span>';
|
$params['attr']['title'] = $langs->trans('NotEnoughPermissions');
|
||||||
|
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif&token='.newToken(), '', false, $params);
|
||||||
}
|
}
|
||||||
} elseif (!$object->is_last_in_cycle()) {
|
} elseif (!$object->is_last_in_cycle()) {
|
||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("NotLastInCycle").'">'.$langs->trans('Modify').'</span>';
|
$params['attr']['title'] = $langs->trans('NotLastInCycle');
|
||||||
|
print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Modify').'</span>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice');
|
||||||
|
print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseDispatchedInBookkeeping").'">'.$langs->trans('Modify').'</span>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping');
|
||||||
|
print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5396,9 +5379,10 @@ if ($action == 'create') {
|
|||||||
&& ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data
|
&& ($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data
|
||||||
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely)
|
&& ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) { // A paid invoice (partially or completely)
|
||||||
if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted
|
if ($object->close_code != 'replaced' || (!$objectidnext)) { // Not replaced by another invoice or replaced but the replacement invoice has been deleted
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans('ReOpen').'</a>';
|
print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=reopen&token='.newToken(), '', true, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('ReOpen').'</span>';
|
$params['attr']['title'] = $langs->trans("DisabledBecauseReplacedInvoice");
|
||||||
|
print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', '#', '', false, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5416,7 +5400,7 @@ if ($action == 'create') {
|
|||||||
// Validate
|
// Validate
|
||||||
if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
|
if ($object->statut == Facture::STATUS_DRAFT && count($object->lines) > 0 && ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA || $object->type == Facture::TYPE_SITUATION) && (!empty($conf->global->FACTURE_ENABLE_NEGATIVE) || $object->total_ttc >= 0)) || ($object->type == Facture::TYPE_CREDIT_NOTE && $object->total_ttc <= 0))) {
|
||||||
if ($usercanvalidate) {
|
if ($usercanvalidate) {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken().'">'.$langs->trans('Validate').'</a>';
|
print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=valid&token='.newToken(), '', true, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5427,9 +5411,9 @@ if ($action == 'create') {
|
|||||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendMail').'</span>';
|
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendMail').'</span>';
|
||||||
} else {
|
} else {
|
||||||
if ($usercansend) {
|
if ($usercansend) {
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
|
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans('SendMail').'</a>';
|
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5466,10 +5450,12 @@ if ($action == 'create') {
|
|||||||
} else {
|
} else {
|
||||||
if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) {
|
if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) {
|
||||||
// For down payment, we refuse to receive more than amount to pay.
|
// For down payment, we refuse to receive more than amount to pay.
|
||||||
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</span>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseRemainderToPayIsZero');
|
||||||
|
print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', '#', '', false, $params);
|
||||||
} else {
|
} else {
|
||||||
// Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
// Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>';
|
//print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>';
|
||||||
|
print dolGetButtonAction($langs->trans('DoPayment'), '', 'default', DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account, '', true, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5518,9 +5504,10 @@ if ($action == 'create') {
|
|||||||
) {
|
) {
|
||||||
if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpaymentall, 'MT')) {
|
if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpaymentall, 'MT')) {
|
||||||
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
|
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
|
||||||
print '<span class="butActionRefused" title="'.$langs->trans("AmountPaidMustMatchAmountOfDownPayment").'">'.$langs->trans('ClassifyPaid').'</span>';
|
$params['attr']['title'] = $langs->trans('AmountPaidMustMatchAmountOfDownPayment');
|
||||||
|
print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', '#', '', false, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
print dolGetButtonAction($langs->trans('ClassifyPaid'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid', '', true, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5565,13 +5552,13 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Clone
|
// Clone
|
||||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) {
|
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) {
|
||||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice">'.$langs->trans("ToClone").'</a>';
|
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice', '', true, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clone as predefined / Create template
|
// Clone as predefined / Create template
|
||||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) {
|
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->statut == 0 && $usercancreate) {
|
||||||
if (!$objectidnext && count($object->lines) > 0) {
|
if (!$objectidnext && count($object->lines) > 0) {
|
||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
print dolGetButtonAction($langs->trans('ChangeIntoRepeatableInvoice'), '', 'default', DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$object->id.'&action=create', '', true, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5604,25 +5591,35 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
$isErasable = $object->is_erasable();
|
$isErasable = $object->is_erasable();
|
||||||
|
$params = array(
|
||||||
|
'attr' => array(
|
||||||
|
'title' => '',
|
||||||
|
'class' => 'classfortooltip'
|
||||||
|
)
|
||||||
|
);
|
||||||
if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions)
|
if ($usercandelete || ($usercancreate && $isErasable == 1)) { // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions)
|
||||||
//var_dump($isErasable);
|
$enableDelete = false;
|
||||||
|
$deleteHref = '#';
|
||||||
if ($isErasable == -4) {
|
if ($isErasable == -4) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecausePayments").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecausePayments');
|
||||||
} elseif ($isErasable == -3) {
|
} elseif ($isErasable == -3) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastSituationInvoice").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseNotLastSituationInvoice');
|
||||||
} elseif ($isErasable == -2) {
|
} elseif ($isErasable == -2) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastInvoice").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseNotLastInvoice');
|
||||||
} elseif ($isErasable == -1) {
|
} elseif ($isErasable == -1) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseDispatchedInBookkeeping").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseDispatchedInBookkeeping');
|
||||||
} elseif ($isErasable <= 0) { // Any other cases
|
} elseif ($isErasable <= 0) { // Any other cases
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotErasable").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseNotErasable');
|
||||||
} elseif ($objectidnext) {
|
} elseif ($objectidnext) {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('DisabledBecauseReplacedInvoice');
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionDelete'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>';
|
$deleteHref = $_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=delete&token='.newToken();
|
||||||
|
$enableDelete = true;
|
||||||
}
|
}
|
||||||
|
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteHref, '', $enableDelete, $params);
|
||||||
} else {
|
} else {
|
||||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('Delete').'</a>';
|
$params['attr']['title'] = $langs->trans('NotAllowed');
|
||||||
|
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', '#', '', false, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -519,7 +519,7 @@ class Invoices extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function deleteContact($id, $contactid, $type)
|
public function deleteContact($id, $contactid, $type)
|
||||||
{
|
{
|
||||||
@ -661,7 +661,7 @@ class Invoices extends DolibarrApi
|
|||||||
|
|
||||||
$result = $this->invoice->delete(DolibarrApiAccess::$user);
|
$result = $this->invoice->delete(DolibarrApiAccess::$user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
throw new RestException(500);
|
throw new RestException(500, 'Error when deleting invoice');
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
@ -780,7 +780,7 @@ class Invoices extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
|
public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
|
||||||
@ -829,7 +829,7 @@ class Invoices extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function settodraft($id, $idwarehouse = -1)
|
public function settodraft($id, $idwarehouse = -1)
|
||||||
@ -932,7 +932,7 @@ class Invoices extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function settopaid($id, $close_code = '', $close_note = '')
|
public function settopaid($id, $close_code = '', $close_note = '')
|
||||||
{
|
{
|
||||||
@ -982,7 +982,7 @@ class Invoices extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function settounpaid($id)
|
public function settounpaid($id)
|
||||||
{
|
{
|
||||||
@ -1069,7 +1069,7 @@ class Invoices extends DolibarrApi
|
|||||||
* @throws RestException 304
|
* @throws RestException 304
|
||||||
* @throws RestException 401
|
* @throws RestException 401
|
||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500 System error
|
||||||
*/
|
*/
|
||||||
public function markAsCreditAvailable($id)
|
public function markAsCreditAvailable($id)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|||||||
*/
|
*/
|
||||||
class FactureRec extends CommonInvoice
|
class FactureRec extends CommonInvoice
|
||||||
{
|
{
|
||||||
|
const TRIGGER_PREFIX = 'BILLREC';
|
||||||
/**
|
/**
|
||||||
* @var string ID to identify managed object
|
* @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->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
|
||||||
$sql .= ", ".(!empty($this->model_pdf) ? ("'".$this->db->escape($this->model_pdf)."'") : "NULL");
|
$sql .= ", ".(!empty($this->model_pdf) ? ("'".$this->db->escape($this->model_pdf)."'") : "NULL");
|
||||||
$sql .= ", ".((int) $user->id);
|
$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 .= ", ".(!empty($facsrc->fk_account) ? ((int) $facsrc->fk_account) : "null");
|
||||||
$sql .= ", ".($facsrc->cond_reglement_id > 0 ? ((int) $facsrc->cond_reglement_id) : "null");
|
$sql .= ", ".($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : "null");
|
||||||
$sql .= ", ".($facsrc->mode_reglement_id > 0 ? ((int) $facsrc->mode_reglement_id) : "null");
|
$sql .= ", ".($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : "null");
|
||||||
$sql .= ", ".((int) $this->usenewprice);
|
$sql .= ", ".((int) $this->usenewprice);
|
||||||
$sql .= ", ".((int) $this->frequency);
|
$sql .= ", ".((int) $this->frequency);
|
||||||
$sql .= ", '".$this->db->escape($this->unit_frequency)."'";
|
$sql .= ", '".$this->db->escape($this->unit_frequency)."'";
|
||||||
@ -344,6 +345,9 @@ class FactureRec extends CommonInvoice
|
|||||||
$tva_tx .= ' ('.$facsrc->lines[$i]->vat_src_code.')';
|
$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(
|
$result_insert = $this->addline(
|
||||||
$facsrc->lines[$i]->desc,
|
$facsrc->lines[$i]->desc,
|
||||||
$facsrc->lines[$i]->subprice,
|
$facsrc->lines[$i]->subprice,
|
||||||
@ -363,8 +367,8 @@ class FactureRec extends CommonInvoice
|
|||||||
$facsrc->lines[$i]->label,
|
$facsrc->lines[$i]->label,
|
||||||
$facsrc->lines[$i]->fk_unit,
|
$facsrc->lines[$i]->fk_unit,
|
||||||
$facsrc->lines[$i]->multicurrency_subprice,
|
$facsrc->lines[$i]->multicurrency_subprice,
|
||||||
0,
|
$default_start_fill,
|
||||||
0,
|
$default_end_fill,
|
||||||
null,
|
null,
|
||||||
$facsrc->lines[$i]->pa_ht
|
$facsrc->lines[$i]->pa_ht
|
||||||
);
|
);
|
||||||
@ -498,7 +502,7 @@ class FactureRec extends CommonInvoice
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('BILLREC_UPDATE', $user);
|
$result = $this->call_trigger('BILLREC_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
@ -524,6 +528,8 @@ class FactureRec extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
public function fetch($rowid, $ref = '', $ref_ext = '')
|
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 = '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.remise_percent, f.remise_absolue, f.remise';
|
||||||
$sql .= ', f.date_lim_reglement as dlr';
|
$sql .= ', f.date_lim_reglement as dlr';
|
||||||
@ -655,18 +661,20 @@ class FactureRec extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
public function fetch_lines()
|
public function fetch_lines()
|
||||||
{
|
{
|
||||||
global $extrafields;
|
|
||||||
|
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
|
|
||||||
// Retrieve all extrafield for line
|
// Retrieve all extrafield for line
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
if (!is_object($extrafields)) {
|
/*if (!is_object($extrafields)) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
$extrafields = new ExtraFields($this->db);
|
$extrafields = new ExtraFields($this->db);
|
||||||
}
|
}
|
||||||
$extrafields->fetch_name_optionals_label($this->table_element_line, true);
|
$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 = '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,';
|
$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 .= ' WHERE l.fk_facture = '.((int) $this->id);
|
||||||
$sql .= ' ORDER BY l.rang';
|
$sql .= ' ORDER BY l.rang';
|
||||||
|
|
||||||
dol_syslog('FactureRec::fetch_lines', LOG_DEBUG);
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
@ -810,7 +817,14 @@ class FactureRec extends CommonInvoice
|
|||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$error = -2;
|
$error = -2;
|
||||||
}
|
}
|
||||||
|
if (!$error && !$notrigger) {
|
||||||
|
// Call trigger
|
||||||
|
$result = $this->call_trigger('BILLREC_DELETE', $user);
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
@ -1745,6 +1759,23 @@ class FactureRec extends CommonInvoice
|
|||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to replace a product id with another one.
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param int $origin_id Old product id
|
||||||
|
* @param int $dest_id New product id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id)
|
||||||
|
{
|
||||||
|
$tables = array(
|
||||||
|
'facturedet_rec'
|
||||||
|
);
|
||||||
|
|
||||||
|
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update frequency and unit
|
* Update frequency and unit
|
||||||
*
|
*
|
||||||
@ -2116,7 +2147,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet_rec SET";
|
$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 .= ", label=".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null");
|
||||||
$sql .= ", description='".$this->db->escape($this->desc)."'";
|
$sql .= ", description='".$this->db->escape($this->desc)."'";
|
||||||
$sql .= ", price=".price2num($this->price);
|
$sql .= ", price=".price2num($this->price);
|
||||||
@ -2128,10 +2159,10 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||||||
$sql .= ", localtax2_tx=".price2num($this->localtax2_tx);
|
$sql .= ", localtax2_tx=".price2num($this->localtax2_tx);
|
||||||
$sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
$sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
||||||
$sql .= ", fk_product=".($this->fk_product > 0 ? $this->fk_product : "null");
|
$sql .= ", fk_product=".($this->fk_product > 0 ? $this->fk_product : "null");
|
||||||
$sql .= ", product_type=".$this->product_type;
|
$sql .= ", product_type=".((int) $this->product_type);
|
||||||
$sql .= ", remise_percent='".price2num($this->remise_percent)."'";
|
$sql .= ", remise_percent=".price2num($this->remise_percent);
|
||||||
$sql .= ", subprice='".price2num($this->subprice)."'";
|
$sql .= ", subprice=".price2num($this->subprice);
|
||||||
$sql .= ", info_bits='".price2num($this->info_bits)."'";
|
$sql .= ", info_bits=".price2num($this->info_bits);
|
||||||
$sql .= ", date_start_fill=".(int) $this->date_start_fill;
|
$sql .= ", date_start_fill=".(int) $this->date_start_fill;
|
||||||
$sql .= ", date_end_fill=".(int) $this->date_end_fill;
|
$sql .= ", date_end_fill=".(int) $this->date_end_fill;
|
||||||
if (empty($this->skip_update_total)) {
|
if (empty($this->skip_update_total)) {
|
||||||
@ -2162,7 +2193,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('LINEBILLREC_UPDATE', $user);
|
$result = $this->call_trigger('LINEBILLREC_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,10 +14,11 @@
|
|||||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* 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 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
|
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
|
||||||
|
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -810,6 +811,10 @@ class Facture extends CommonInvoice
|
|||||||
$fk_parent_line = 0;
|
$fk_parent_line = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Complete vat rate with code
|
||||||
|
$vatrate = $newinvoiceline->tva_tx;
|
||||||
|
if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$newinvoiceline->vat_src_code.')';
|
||||||
|
|
||||||
$newinvoiceline->fk_parent_line = $fk_parent_line;
|
$newinvoiceline->fk_parent_line = $fk_parent_line;
|
||||||
|
|
||||||
if ($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except) {
|
if ($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except) {
|
||||||
@ -820,7 +825,37 @@ class Facture extends CommonInvoice
|
|||||||
$newinvoiceline->fk_remise_except = $discountId;
|
$newinvoiceline->fk_remise_except = $discountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $newinvoiceline->insert();
|
$result = $this->addline(
|
||||||
|
$newinvoiceline->desc,
|
||||||
|
$newinvoiceline->subprice,
|
||||||
|
$newinvoiceline->qty,
|
||||||
|
$vatrate,
|
||||||
|
$newinvoiceline->localtax1_tx,
|
||||||
|
$newinvoiceline->localtax2_tx,
|
||||||
|
$newinvoiceline->fk_product,
|
||||||
|
$newinvoiceline->remise_percent,
|
||||||
|
$newinvoiceline->date_start,
|
||||||
|
$newinvoiceline->date_end,
|
||||||
|
$newinvoiceline->fk_code_ventilation,
|
||||||
|
$newinvoiceline->info_bits,
|
||||||
|
$newinvoiceline->fk_remise_except,
|
||||||
|
'HT',
|
||||||
|
0,
|
||||||
|
$newinvoiceline->product_type,
|
||||||
|
$newinvoiceline->rang,
|
||||||
|
$newinvoiceline->special_code,
|
||||||
|
$newinvoiceline->element,
|
||||||
|
$newinvoiceline->id,
|
||||||
|
$fk_parent_line,
|
||||||
|
$newinvoiceline->fk_fournprice,
|
||||||
|
$newinvoiceline->pa_ht,
|
||||||
|
$newinvoiceline->label,
|
||||||
|
$newinvoiceline->array_options,
|
||||||
|
$newinvoiceline->situation_percent,
|
||||||
|
$newinvoiceline->fk_prev_id,
|
||||||
|
$newinvoiceline->fk_unit,
|
||||||
|
$newinvoiceline->multicurrency_subprice
|
||||||
|
);
|
||||||
|
|
||||||
// Defined the new fk_parent_line
|
// Defined the new fk_parent_line
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
@ -1595,8 +1630,6 @@ class Facture extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
public function fetch($rowid, $ref = '', $ref_ext = '', $notused = '', $fetch_situation = false)
|
public function fetch($rowid, $ref = '', $ref_ext = '', $notused = '', $fetch_situation = false)
|
||||||
{
|
{
|
||||||
global $conf;
|
|
||||||
|
|
||||||
if (empty($rowid) && empty($ref) && empty($ref_ext)) {
|
if (empty($rowid) && empty($ref) && empty($ref_ext)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1775,8 +1808,9 @@ class Facture extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
|
|
||||||
$sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,';
|
$sql = '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,';
|
||||||
@ -2071,7 +2105,7 @@ class Facture extends CommonInvoice
|
|||||||
public function insert_discount($idremise)
|
public function insert_discount($idremise)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||||
@ -2101,6 +2135,14 @@ class Facture extends CommonInvoice
|
|||||||
$facligne->rang = -1;
|
$facligne->rang = -1;
|
||||||
$facligne->info_bits = 2;
|
$facligne->info_bits = 2;
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_ADD_LINE_AT_POSITION)) {
|
||||||
|
$facligne->rang = 1;
|
||||||
|
$linecount = count($this->lines);
|
||||||
|
for ($ii = 1; $ii <= $linecount; $ii++) {
|
||||||
|
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get buy/cost price of invoice that is source of discount
|
// Get buy/cost price of invoice that is source of discount
|
||||||
if ($remise->fk_facture_source > 0) {
|
if ($remise->fk_facture_source > 0) {
|
||||||
$srcinvoice = new Facture($this->db);
|
$srcinvoice = new Facture($this->db);
|
||||||
@ -2326,6 +2368,7 @@ class Facture extends CommonInvoice
|
|||||||
if ($this->lines[$i]->fk_product > 0) {
|
if ($this->lines[$i]->fk_product > 0) {
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
$mouvP->origin = &$this;
|
$mouvP->origin = &$this;
|
||||||
|
$mouvP->setOrigin($this->element, $this->id);
|
||||||
// We decrease stock for product
|
// We decrease stock for product
|
||||||
if ($this->type == self::TYPE_CREDIT_NOTE) {
|
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));
|
$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 +2675,7 @@ class Facture extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
public function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0, $batch_rule = 0)
|
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';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$productStatic = null;
|
$productStatic = null;
|
||||||
@ -2671,6 +2714,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);
|
dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.$conf->global->MAIN_USE_ADVANCED_PERMS, LOG_ERR);
|
||||||
return -1;
|
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();
|
$this->db->begin();
|
||||||
|
|
||||||
@ -2763,6 +2866,7 @@ class Facture extends CommonInvoice
|
|||||||
if ($this->lines[$i]->fk_product > 0) {
|
if ($this->lines[$i]->fk_product > 0) {
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
$mouvP->origin = &$this;
|
$mouvP->origin = &$this;
|
||||||
|
$mouvP->setOrigin($this->element, $this->id);
|
||||||
// We decrease stock for product
|
// We decrease stock for product
|
||||||
if ($this->type == self::TYPE_CREDIT_NOTE) {
|
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));
|
$result = $mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("InvoiceValidatedInDolibarr", $num));
|
||||||
@ -3055,6 +3159,7 @@ class Facture extends CommonInvoice
|
|||||||
if ($this->lines[$i]->fk_product > 0) {
|
if ($this->lines[$i]->fk_product > 0) {
|
||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
$mouvP->origin = &$this;
|
$mouvP->origin = &$this;
|
||||||
|
$mouvP->setOrigin($this->element, $this->id);
|
||||||
// We decrease stock for product
|
// We decrease stock for product
|
||||||
if ($this->type == self::TYPE_CREDIT_NOTE) {
|
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));
|
$result = $mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("InvoiceBackToDraftInDolibarr", $this->ref));
|
||||||
@ -3370,6 +3475,11 @@ class Facture extends CommonInvoice
|
|||||||
// Reorder if child line
|
// Reorder if child line
|
||||||
if (!empty($fk_parent_line)) {
|
if (!empty($fk_parent_line)) {
|
||||||
$this->line_order(true, 'DESC');
|
$this->line_order(true, 'DESC');
|
||||||
|
} elseif ($ranktouse > 0 && $ranktouse <= count($this->lines)) { // Update all rank of all other lines
|
||||||
|
$linecount = count($this->lines);
|
||||||
|
for ($ii = $ranktouse; $ii <= $linecount; $ii++) {
|
||||||
|
$this->updateRangOfLine($this->lines[$ii - 1]->id, $ii + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour informations denormalisees au niveau de la facture meme
|
// Mise a jour informations denormalisees au niveau de la facture meme
|
||||||
@ -3663,9 +3773,10 @@ class Facture extends CommonInvoice
|
|||||||
*
|
*
|
||||||
* @param FactureLigne $line Invoice line
|
* @param FactureLigne $line Invoice line
|
||||||
* @param int $percent Percentage
|
* @param int $percent Percentage
|
||||||
|
* @param boolean $update_price Update object price
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function update_percent($line, $percent)
|
public function update_percent($line, $percent, $update_price = true)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $mysoc, $user;
|
global $mysoc, $user;
|
||||||
@ -3692,8 +3803,12 @@ class Facture extends CommonInvoice
|
|||||||
$line->multicurrency_total_tva = $tabprice[17];
|
$line->multicurrency_total_tva = $tabprice[17];
|
||||||
$line->multicurrency_total_ttc = $tabprice[18];
|
$line->multicurrency_total_ttc = $tabprice[18];
|
||||||
$line->update($user);
|
$line->update($user);
|
||||||
|
|
||||||
|
// sometimes it is better to not update price for each line, ie when updating situation on all lines
|
||||||
|
if ($update_price) {
|
||||||
$this->update_price(1);
|
$this->update_price(1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete line in database
|
* Delete line in database
|
||||||
@ -3943,7 +4058,7 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($addon)) {
|
if (!empty($addon)) {
|
||||||
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->name.", type=".$soc->typent_code, LOG_DEBUG);
|
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
|
||||||
|
|
||||||
$mybool = false;
|
$mybool = false;
|
||||||
|
|
||||||
@ -4754,6 +4869,23 @@ class Facture extends CommonInvoice
|
|||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to replace a product id with another one.
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param int $origin_id Old product id
|
||||||
|
* @param int $dest_id New product id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id)
|
||||||
|
{
|
||||||
|
$tables = array(
|
||||||
|
'facturedet'
|
||||||
|
);
|
||||||
|
|
||||||
|
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the customer invoice delayed?
|
* Is the customer invoice delayed?
|
||||||
*
|
*
|
||||||
@ -5123,6 +5255,37 @@ class Facture extends CommonInvoice
|
|||||||
return $error;
|
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 +5843,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('LINEBILL_UPDATE', $user);
|
$result = $this->call_trigger('LINEBILL_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||||
* Copyright (C) 2019-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2019-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
@ -194,12 +194,12 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
|||||||
$fieldstosearchall = array(
|
$fieldstosearchall = array(
|
||||||
'f.ref'=>'Ref',
|
'f.ref'=>'Ref',
|
||||||
'f.ref_client'=>'RefCustomer',
|
'f.ref_client'=>'RefCustomer',
|
||||||
'pd.description'=>'Description',
|
'f.note_public'=>'NotePublic',
|
||||||
's.nom'=>"ThirdParty",
|
's.nom'=>"ThirdParty",
|
||||||
's.name_alias'=>"AliasNameShort",
|
's.name_alias'=>"AliasNameShort",
|
||||||
's.zip'=>"Zip",
|
's.zip'=>"Zip",
|
||||||
's.town'=>"Town",
|
's.town'=>"Town",
|
||||||
'f.note_public'=>'NotePublic',
|
'pd.description'=>'Description',
|
||||||
);
|
);
|
||||||
if (empty($user->socid)) {
|
if (empty($user->socid)) {
|
||||||
$fieldstosearchall["f.note_private"] = "NotePrivate";
|
$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 .= ' country.code as country_code,';
|
||||||
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
||||||
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
|
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender';
|
||||||
// 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)
|
// 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.
|
// 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) {
|
if (!$sall) {
|
||||||
$sql .= ', SUM(pf.amount) as dynamount_payed, SUM(pf.multicurrency_amount) as multicurrency_dynamount_payed';
|
$sql .= ', SUM(pf.amount) as dynamount_payed, SUM(pf.multicurrency_amount) as multicurrency_dynamount_payed';
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if ($search_categ_cus && $search_categ_cus != -1) {
|
if ($search_categ_cus && $search_categ_cus != -1) {
|
||||||
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
$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';
|
$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'])) {
|
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)";
|
$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) {
|
if (!$sall) {
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if ($sall || $search_product_category > 0) {
|
if ($sall || $search_product_category > 0) {
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture';
|
$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
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$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) {
|
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 .= ' 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,';
|
$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
|
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
} else {
|
} else {
|
||||||
|
*/
|
||||||
|
if ($sall) {
|
||||||
$sql .= natural_search(array_keys($fieldstosearchall), $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
|
$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;
|
$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 ';
|
$sql .= ' ORDER BY ';
|
||||||
$listfield = explode(',', $sortfield);
|
$listfield = explode(',', $sortfield);
|
||||||
$listorder = explode(',', $sortorder);
|
$listorder = explode(',', $sortorder);
|
||||||
@ -842,18 +887,9 @@ foreach ($listfield as $key => $value) {
|
|||||||
$sql .= $listfield[$key].' '.($listorder[$key] ? $listorder[$key] : 'DESC').',';
|
$sql .= $listfield[$key].' '.($listorder[$key] ? $listorder[$key] : 'DESC').',';
|
||||||
}
|
}
|
||||||
$sql .= ' f.rowid DESC ';
|
$sql .= ' f.rowid DESC ';
|
||||||
|
if ($limit) {
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
@ -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 ');
|
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'])) {
|
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_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -2077,7 +2113,7 @@ if ($resql) {
|
|||||||
// Sales representatives
|
// Sales representatives
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($obj->socid > 0) {
|
if ($obj->socid > 0) {
|
||||||
$listsalesrepresentatives = $thirdpartystatic->getSalesRepresentatives($user);
|
$listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
|
||||||
if ($listsalesrepresentatives < 0) {
|
if ($listsalesrepresentatives < 0) {
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -912,7 +912,7 @@ if ($object->id > 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$numopen && !$numclosed) {
|
if (!$numopen && !$numclosed) {
|
||||||
print '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
|
|||||||
@ -190,6 +190,7 @@ if (empty($reshook)) {
|
|||||||
|
|
||||||
// Check if payments in both currency
|
// Check if payments in both currency
|
||||||
if ($totalpayment > 0 && $multicurrency_totalpayment > 0) {
|
if ($totalpayment > 0 && $multicurrency_totalpayment > 0) {
|
||||||
|
$langs->load("errors");
|
||||||
setEventMessages($langs->transnoentities('ErrorPaymentInBothCurrency'), null, 'errors');
|
setEventMessages($langs->transnoentities('ErrorPaymentInBothCurrency'), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -211,7 +212,7 @@ if (empty($reshook)) {
|
|||||||
if ($action == 'confirm_paiement' && $confirm == 'yes' && $usercanissuepayment) {
|
if ($action == 'confirm_paiement' && $confirm == 'yes' && $usercanissuepayment) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzuser');
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
@ -220,6 +221,8 @@ if (empty($reshook)) {
|
|||||||
$thirdparty->fetch($socid);
|
$thirdparty->fetch($socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$multicurrency_code = array();
|
||||||
|
|
||||||
// Clean parameters amount if payment is for a credit note
|
// Clean parameters amount if payment is for a credit note
|
||||||
foreach ($amounts as $key => $value) { // How payment is dispatched
|
foreach ($amounts as $key => $value) { // How payment is dispatched
|
||||||
$tmpinvoice = new Facture($db);
|
$tmpinvoice = new Facture($db);
|
||||||
@ -228,6 +231,7 @@ if (empty($reshook)) {
|
|||||||
$newvalue = price2num($value, 'MT');
|
$newvalue = price2num($value, 'MT');
|
||||||
$amounts[$key] = - abs($newvalue);
|
$amounts[$key] = - abs($newvalue);
|
||||||
}
|
}
|
||||||
|
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($multicurrency_amounts as $key => $value) { // How payment is dispatched
|
foreach ($multicurrency_amounts as $key => $value) { // How payment is dispatched
|
||||||
@ -237,6 +241,7 @@ if (empty($reshook)) {
|
|||||||
$newvalue = price2num($value, 'MT');
|
$newvalue = price2num($value, 'MT');
|
||||||
$multicurrency_amounts[$key] = - abs($newvalue);
|
$multicurrency_amounts[$key] = - abs($newvalue);
|
||||||
}
|
}
|
||||||
|
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($conf->banque->enabled)) {
|
if (!empty($conf->banque->enabled)) {
|
||||||
@ -252,13 +257,16 @@ if (empty($reshook)) {
|
|||||||
$paiement->datepaye = $datepaye;
|
$paiement->datepaye = $datepaye;
|
||||||
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
||||||
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
||||||
|
$paiement->multicurrency_code = $multicurrency_code; // Array with all currency of payments dispatching
|
||||||
$paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1);
|
$paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1);
|
||||||
$paiement->num_payment = GETPOST('num_paiement', 'alpha');
|
$paiement->num_payment = GETPOST('num_paiement', 'alpha');
|
||||||
$paiement->note_private = GETPOST('comment', 'alpha');
|
$paiement->note_private = GETPOST('comment', 'alpha');
|
||||||
|
$paiement->fk_account = GETPOST('accountid', 'int');
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// Create payment and update this->multicurrency_amounts if this->amounts filled or
|
// Create payment and update this->multicurrency_amounts if this->amounts filled or
|
||||||
// this->amounts if this->multicurrency_amounts filled.
|
// this->amounts if this->multicurrency_amounts filled.
|
||||||
|
// This also set ->amount and ->multicurrency_amount
|
||||||
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty); // This include closing invoices and regenerating documents
|
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty); // This include closing invoices and regenerating documents
|
||||||
if ($paiement_id < 0) {
|
if ($paiement_id < 0) {
|
||||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||||
@ -271,7 +279,7 @@ if (empty($reshook)) {
|
|||||||
if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) {
|
if (GETPOST('type') == Facture::TYPE_CREDIT_NOTE) {
|
||||||
$label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
|
$label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
|
||||||
}
|
}
|
||||||
$result = $paiement->addPaymentToBank($user, 'payment', $label, GETPOST('accountid'), GETPOST('chqemetteur'), GETPOST('chqbank'));
|
$result = $paiement->addPaymentToBank($user, 'payment', $label, GETPOST('accountid', 'int'), GETPOST('chqemetteur'), GETPOST('chqbank'));
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
@ -491,8 +499,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
if ($facture->type == 2) {
|
if ($facture->type == 2) {
|
||||||
print '<td><span class="fieldrequired">'.$langs->trans('AccountToDebit').'</span></td>';
|
print '<td><span class="fieldrequired">'.$langs->trans('AccountToDebit').'</span></td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<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>';
|
print '</td>';
|
||||||
} else {
|
} else {
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
@ -501,26 +511,27 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
|||||||
|
|
||||||
// Bank check number
|
// Bank check number
|
||||||
print '<tr><td>'.$langs->trans('Numero');
|
print '<tr><td>'.$langs->trans('Numero');
|
||||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
print ' <em class="opacitymedium">('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input name="num_paiement" type="text" class="maxwidth200" value="'.$paymentnum.'"></td></tr>';
|
print '<td><input name="num_paiement" type="text" class="maxwidth200" value="'.$paymentnum.'"></td></tr>';
|
||||||
|
|
||||||
// Check transmitter
|
// Check transmitter
|
||||||
print '<tr><td class="'.(GETPOST('paiementcode') == 'CHQ' ? 'fieldrequired ' : '').'fieldrequireddyn">'.$langs->trans('CheckTransmitter');
|
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>';
|
||||||
print '<td><input id="fieldchqemetteur" class="maxwidth300" name="chqemetteur" type="text" value="'.GETPOST('chqemetteur', 'alphanohtml').'"></td></tr>';
|
print '<td><input id="fieldchqemetteur" class="maxwidth300" name="chqemetteur" type="text" value="'.GETPOST('chqemetteur', 'alphanohtml').'"></td></tr>';
|
||||||
|
|
||||||
// Bank name
|
// Bank name
|
||||||
print '<tr><td>'.$langs->trans('Bank');
|
print '<tr><td>'.$langs->trans('Bank');
|
||||||
print ' <em>('.$langs->trans("ChequeBank").')</em>';
|
print ' <em class="opacitymedium">('.$langs->trans("ChequeBank").')</em>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td><input name="chqbank" class="maxwidth300" type="text" value="'.GETPOST('chqbank', 'alphanohtml').'"></td></tr>';
|
print '<td><input name="chqbank" class="maxwidth300" type="text" value="'.GETPOST('chqbank', 'alphanohtml').'"></td></tr>';
|
||||||
|
|
||||||
// Comments
|
// Comments
|
||||||
print '<tr><td>'.$langs->trans('Comments').'</td>';
|
print '<tr><td>'.$langs->trans('Comments').'</td>';
|
||||||
print '<td class="tdtop">';
|
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>';
|
print '</table>';
|
||||||
|
|
||||||
|
|||||||
@ -271,7 +271,7 @@ print '<table class="border centpercent">'."\n";
|
|||||||
|
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<tr><td class="titlefield">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $user->rights->facture->paiement).'</td><td>';
|
print '<tr><td class="titlefield">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $user->rights->facture->paiement).'</td><td>';
|
||||||
print $form->editfieldval("Date", 'datep', $object->date, $object, $user->rights->facture->paiement, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
|
print $form->editfieldval("Date", 'datep', $object->date, $object, $user->rights->facture->paiement, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'), '', 0, '', 'id', 'tzuser');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Payment type (VIR, LIQ, ...)
|
// Payment type (VIR, LIQ, ...)
|
||||||
|
|||||||
@ -730,7 +730,7 @@ class RemiseCheque extends CommonObject
|
|||||||
$bankline = new AccountLine($db);
|
$bankline = new AccountLine($db);
|
||||||
$bankline->fetch($bank_id);
|
$bankline->fetch($bank_id);
|
||||||
|
|
||||||
/* Conciliation is allowed because when check is returned, a new line is created onto bank transaction log.
|
/* Reconciliation is allowed because when check is returned, a new line is created onto bank transaction log.
|
||||||
if ($bankline->rappro)
|
if ($bankline->rappro)
|
||||||
{
|
{
|
||||||
$this->error='ActionRefusedLineAlreadyConciliated';
|
$this->error='ActionRefusedLineAlreadyConciliated';
|
||||||
@ -739,7 +739,7 @@ class RemiseCheque extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Not conciliated, we can delete it
|
// Not reconciled, we can delete it
|
||||||
//$bankline->delete($user); // We delete
|
//$bankline->delete($user); // We delete
|
||||||
|
|
||||||
$bankaccount = $payment->fk_account;
|
$bankaccount = $payment->fk_account;
|
||||||
|
|||||||
@ -72,8 +72,9 @@ class Paiement extends CommonObject
|
|||||||
|
|
||||||
public $amount; // Total amount of payment (in the main currency)
|
public $amount; // Total amount of payment (in the main currency)
|
||||||
public $multicurrency_amount; // Total amount of payment (in the currency of the bank account)
|
public $multicurrency_amount; // Total amount of payment (in the currency of the bank account)
|
||||||
public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)>
|
public $amounts = array(); // array: invoice ID => amount for that invoice (in the main currency)
|
||||||
public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)>
|
public $multicurrency_amounts = array(); // array: invoice ID => amount for that invoice (in the invoice's currency)
|
||||||
|
public $multicurrency_code = array(); // array: invoice ID => currency code for that invoice
|
||||||
|
|
||||||
public $pos_change = 0; // Excess received in TakePOS cash payment
|
public $pos_change = 0; // Excess received in TakePOS cash payment
|
||||||
|
|
||||||
@ -230,7 +231,7 @@ class Paiement extends CommonObject
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$way = $this->getWay();
|
$way = $this->getWay(); // 'dolibarr' to use amount, 'customer' to use foreign multicurrency amount
|
||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
@ -239,16 +240,37 @@ class Paiement extends CommonObject
|
|||||||
$totalamount_converted = 0;
|
$totalamount_converted = 0;
|
||||||
$atleastonepaymentnotnull = 0;
|
$atleastonepaymentnotnull = 0;
|
||||||
|
|
||||||
if ($way == 'dolibarr') {
|
if ($way == 'dolibarr') { // Payments were entered into the column of main currency
|
||||||
$amounts = &$this->amounts;
|
$amounts = &$this->amounts;
|
||||||
$amounts_to_update = &$this->multicurrency_amounts;
|
$amounts_to_update = &$this->multicurrency_amounts;
|
||||||
} else {
|
} else { // Payments were entered into the column of foreign currency
|
||||||
$amounts = &$this->multicurrency_amounts;
|
$amounts = &$this->multicurrency_amounts;
|
||||||
$amounts_to_update = &$this->amounts;
|
$amounts_to_update = &$this->amounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$currencyofpayment = '';
|
||||||
|
|
||||||
foreach ($amounts as $key => $value) { // How payment is dispatch
|
foreach ($amounts as $key => $value) { // How payment is dispatch
|
||||||
|
if (empty($value)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// $key is id of invoice, $value is amount, $way is a 'dolibarr' if amount is in main currency, 'customer' if in foreign currency
|
||||||
$value_converted = Multicurrency::getAmountConversionFromInvoiceRate($key, $value, $way);
|
$value_converted = Multicurrency::getAmountConversionFromInvoiceRate($key, $value, $way);
|
||||||
|
// Add controls of input validity
|
||||||
|
if ($value_converted === false) {
|
||||||
|
// We failed to find the conversion for one invoice
|
||||||
|
$this->error = 'FailedToFoundTheConversionRateForInvoice';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (empty($currencyofpayment)) {
|
||||||
|
$currencyofpayment = $this->multicurrency_code[$key];
|
||||||
|
}
|
||||||
|
if ($currencyofpayment != $this->multicurrency_code[$key]) {
|
||||||
|
// If we have invoices with different currencies in the payment, we stop here
|
||||||
|
$this->error = 'ErrorYouTryToPayInvoicesWithDifferentCurrenciesInSamePayment';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
$totalamount_converted += $value_converted;
|
$totalamount_converted += $value_converted;
|
||||||
$amounts_to_update[$key] = price2num($value_converted, 'MT');
|
$amounts_to_update[$key] = price2num($value_converted, 'MT');
|
||||||
|
|
||||||
@ -260,6 +282,19 @@ class Paiement extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($currencyofpayment)) {
|
||||||
|
// We must check that the currency of invoices is the same than the currency of the bank
|
||||||
|
$bankaccount = new Account($this->db);
|
||||||
|
$bankaccount->fetch($this->fk_account);
|
||||||
|
$bankcurrencycode = empty($bankaccount->currency_code) ? $conf->currency : $bankaccount->currency_code;
|
||||||
|
if ($currencyofpayment != $bankcurrencycode && $currencyofpayment != $conf->currency && $bankcurrencycode != $conf->currency) {
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error = $langs->trans('ErrorYouTryToPayInvoicesInACurrencyFromBankWithAnotherCurrency', $currencyofpayment, $bankcurrencycode);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$totalamount = price2num($totalamount);
|
$totalamount = price2num($totalamount);
|
||||||
$totalamount_converted = price2num($totalamount_converted);
|
$totalamount_converted = price2num($totalamount_converted);
|
||||||
|
|
||||||
@ -305,6 +340,7 @@ class Paiement extends CommonObject
|
|||||||
if (is_numeric($amount) && $amount <> 0) {
|
if (is_numeric($amount) && $amount <> 0) {
|
||||||
$amount = price2num($amount);
|
$amount = price2num($amount);
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement_facture (fk_facture, fk_paiement, amount, multicurrency_amount)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement_facture (fk_facture, fk_paiement, amount, multicurrency_amount)";
|
||||||
|
// TODO Add multicurrency_code and multicurrency_tx
|
||||||
$sql .= " VALUES (".((int) $facid).", ".((int) $this->id).", ".((float) $amount).", ".((float) $this->multicurrency_amounts[$key]).")";
|
$sql .= " VALUES (".((int) $facid).", ".((int) $this->id).", ".((float) $amount).", ".((float) $this->multicurrency_amounts[$key]).")";
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::create Amount line '.$key.' insert paiement_facture', LOG_DEBUG);
|
dol_syslog(get_class($this).'::create Amount line '.$key.' insert paiement_facture', LOG_DEBUG);
|
||||||
@ -600,17 +636,22 @@ class Paiement extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$totalamount = $this->amount;
|
$totalamount = $this->amount;
|
||||||
|
$totalamount_main_currency = null;
|
||||||
if (empty($totalamount)) {
|
if (empty($totalamount)) {
|
||||||
$totalamount = $this->total; // For backward compatibility
|
$totalamount = $this->total; // For backward compatibility
|
||||||
}
|
}
|
||||||
|
|
||||||
// if dolibarr currency != bank currency then we received an amount in customer currency (currently I don't manage the case : my currency is USD, the customer currency is EUR and he paid me in GBP. Seems no sense for me)
|
// if dolibarr currency != bank currency then we received an amount in customer currency (currently I don't manage the case : my currency is USD, the customer currency is EUR and he paid me in GBP. Seems no sense for me)
|
||||||
if (!empty($conf->multicurrency->enabled) && $conf->currency != $acc->currency_code) {
|
if (!empty($conf->multicurrency->enabled) && $conf->currency != $acc->currency_code) {
|
||||||
$totalamount = $this->multicurrency_amount;
|
$totalamount = $this->multicurrency_amount; // We will insert into llx_bank.amount in foreign currency
|
||||||
|
$totalamount_main_currency = $this->amount; // We will also save the amount in main currency into column llx_bank.amount_main_currency
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 'payment_supplier') {
|
if ($mode == 'payment_supplier') {
|
||||||
$totalamount = -$totalamount;
|
$totalamount = -$totalamount;
|
||||||
|
if (isset($totalamount_main_currency)) {
|
||||||
|
$totalamount_main_currency = -$totalamount_main_currency;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert payment into llx_bank
|
// Insert payment into llx_bank
|
||||||
@ -624,7 +665,10 @@ class Paiement extends CommonObject
|
|||||||
$user,
|
$user,
|
||||||
$emetteur_nom,
|
$emetteur_nom,
|
||||||
$emetteur_banque,
|
$emetteur_banque,
|
||||||
$accountancycode
|
$accountancycode,
|
||||||
|
null,
|
||||||
|
'',
|
||||||
|
$totalamount_main_currency
|
||||||
);
|
);
|
||||||
|
|
||||||
// Mise a jour fk_bank dans llx_paiement
|
// Mise a jour fk_bank dans llx_paiement
|
||||||
@ -1176,6 +1220,9 @@ class Paiement extends CommonObject
|
|||||||
$label .= dol_print_date($dateofpayment, 'dayhour', 'tzuser');
|
$label .= dol_print_date($dateofpayment, 'dayhour', 'tzuser');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($this->amount) {
|
||||||
|
$label .= '<br><strong>'.$langs->trans("Amount").':</strong> '.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency);
|
||||||
|
}
|
||||||
if ($mode == 'withlistofinvoices') {
|
if ($mode == 'withlistofinvoices') {
|
||||||
$arraybill = $this->getBillsArray();
|
$arraybill = $this->getBillsArray();
|
||||||
if (is_array($arraybill) && count($arraybill) > 0) {
|
if (is_array($arraybill) && count($arraybill) > 0) {
|
||||||
|
|||||||
@ -528,7 +528,7 @@ while ($i < min($num, $limit)) {
|
|||||||
// Date
|
// Date
|
||||||
if (!empty($arrayfields['p.datep']['checked'])) {
|
if (!empty($arrayfields['p.datep']['checked'])) {
|
||||||
$dateformatforpayment = 'dayhour';
|
$dateformatforpayment = 'dayhour';
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).'</td>';
|
print '<td class="center">'.dol_print_date($db->jdate($objp->datep), $dateformatforpayment, 'tzuser').'</td>';
|
||||||
if (!$i) {
|
if (!$i) {
|
||||||
$totalarray['nbfield']++;
|
$totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,7 @@ if (prelevement_check_config('bank-transfer') < 0) {
|
|||||||
|
|
||||||
$newcardbutton = '';
|
$newcardbutton = '';
|
||||||
if ($usercancreate) {
|
if ($usercancreate) {
|
||||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type=bank-transfer');
|
$newcardbutton .= dolGetButtonTitle($langs->trans('NewPaymentByBankTransfer'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type=bank-transfer');
|
||||||
}
|
}
|
||||||
|
|
||||||
print load_fiche_titre($langs->trans("SuppliersStandingOrdersArea"), $newcardbutton);
|
print load_fiche_titre($langs->trans("SuppliersStandingOrdersArea"), $newcardbutton);
|
||||||
@ -90,7 +90,7 @@ print $bprev->nbOfInvoiceToPay('bank-transfer');
|
|||||||
print '</a>';
|
print '</a>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>'.$langs->trans("AmountToWithdraw").'</td>';
|
print '<tr class="oddeven"><td>'.$langs->trans("AmountToTransfer").'</td>';
|
||||||
print '<td class="right"><span class="amount">';
|
print '<td class="right"><span class="amount">';
|
||||||
print price($bprev->SommeAPrelever('bank-transfer'), '', '', 1, -1, -1, 'auto');
|
print price($bprev->SommeAPrelever('bank-transfer'), '', '', 1, -1, -1, 'auto');
|
||||||
print '</span></td></tr></table></div><br>';
|
print '</span></td></tr></table></div><br>';
|
||||||
@ -102,7 +102,7 @@ print '</span></td></tr></table></div><br>';
|
|||||||
*/
|
*/
|
||||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
||||||
$sql .= " pfd.date_demande, pfd.amount,";
|
$sql .= " pfd.date_demande, pfd.amount,";
|
||||||
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra";
|
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||||
@ -149,6 +149,15 @@ if ($resql) {
|
|||||||
$thirdpartystatic->name = $obj->name;
|
$thirdpartystatic->name = $obj->name;
|
||||||
$thirdpartystatic->email = $obj->email;
|
$thirdpartystatic->email = $obj->email;
|
||||||
$thirdpartystatic->tva_intra = $obj->tva_intra;
|
$thirdpartystatic->tva_intra = $obj->tva_intra;
|
||||||
|
$thirdpartystatic->siren = $obj->idprof1;
|
||||||
|
$thirdpartystatic->siret = $obj->idprof2;
|
||||||
|
$thirdpartystatic->ape = $obj->idprof3;
|
||||||
|
$thirdpartystatic->idprof1 = $obj->idprof1;
|
||||||
|
$thirdpartystatic->idprof2 = $obj->idprof2;
|
||||||
|
$thirdpartystatic->idprof3 = $obj->idprof3;
|
||||||
|
$thirdpartystatic->idprof4 = $obj->idprof4;
|
||||||
|
$thirdpartystatic->idprof5 = $obj->idprof5;
|
||||||
|
$thirdpartystatic->idprof6 = $obj->idprof6;
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $invoicestatic->getNomUrl(1, 'withdraw');
|
print $invoicestatic->getNomUrl(1, 'withdraw');
|
||||||
@ -159,7 +168,7 @@ if ($resql) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
print price($obj->amount);
|
print '<span class="amount">'.price($obj->amount).'</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
|
|||||||
@ -191,7 +191,7 @@ if ($id > 0 || $ref) {
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||||
print dol_print_date($object->date_trans, 'day');
|
print dol_print_date($object->date_trans, 'day');
|
||||||
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
|
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $object->methodes_trans[$object->method_trans];
|
print $object->methodes_trans[$object->method_trans];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -237,7 +237,9 @@ if ($id > 0 || $ref) {
|
|||||||
if ($object->type == 'bank-transfer') {
|
if ($object->type == 'bank-transfer') {
|
||||||
$modulepart = 'paymentbybanktransfer';
|
$modulepart = 'paymentbybanktransfer';
|
||||||
}
|
}
|
||||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath;
|
||||||
|
print img_picto('', 'download', 'class="paddingleft"');
|
||||||
|
print '</a>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
@ -309,7 +311,9 @@ if ($id > 0 || $ref) {
|
|||||||
// Actions
|
// Actions
|
||||||
if ($action != 'settransmitted' && $action != 'setcredited') {
|
if ($action != 'settransmitted' && $action != 'setcredited') {
|
||||||
print "\n".'<div class="tabsAction">'."\n";
|
print "\n".'<div class="tabsAction">'."\n";
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook)) {
|
||||||
if (empty($object->date_trans)) {
|
if (empty($object->date_trans)) {
|
||||||
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send);
|
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send);
|
||||||
else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send);
|
else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send);
|
||||||
@ -322,7 +326,7 @@ if ($id > 0 || $ref) {
|
|||||||
|
|
||||||
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create);
|
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create);
|
||||||
else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer);
|
else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer);
|
||||||
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -920,7 +920,7 @@ class BonPrelevement extends CommonObject
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
$ref = substr($year, -2).$month;
|
$ref = substr($year, -2).$month;
|
||||||
|
|
||||||
$sql = "SELECT substring(ref from char_length(ref) - 1)";
|
$sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX"
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
|
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
|
||||||
$sql .= " WHERE ref LIKE '%".$this->db->escape($ref)."%'";
|
$sql .= " WHERE ref LIKE '%".$this->db->escape($ref)."%'";
|
||||||
$sql .= " AND entity = ".((int) $conf->entity);
|
$sql .= " AND entity = ".((int) $conf->entity);
|
||||||
@ -931,8 +931,14 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
$row = $this->db->fetch_row($resql);
|
$row = $this->db->fetch_row($resql);
|
||||||
$ref = "T".$ref.str_pad(dol_substr("00".intval($row[0]) + 1, 0, 2), 2, "0", STR_PAD_LEFT);
|
|
||||||
|
|
||||||
|
// Build the new ref
|
||||||
|
$ref = "T".$ref.str_pad(dol_substr("00".(intval($row[0]) + 1), 0, 2), 2, "0", STR_PAD_LEFT);
|
||||||
|
|
||||||
|
// $conf->abc->dir_output may be:
|
||||||
|
// /home/ldestailleur/git/dolibarr_15.0/documents/abc/
|
||||||
|
// or
|
||||||
|
// /home/ldestailleur/git/dolibarr_15.0/documents/X/abc with X >= 2 with multicompany.
|
||||||
if ($type != 'bank-transfer') {
|
if ($type != 'bank-transfer') {
|
||||||
$dir = $conf->prelevement->dir_output.'/receipts';
|
$dir = $conf->prelevement->dir_output.'/receipts';
|
||||||
} else {
|
} else {
|
||||||
@ -949,7 +955,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$sql .= "ref, entity, datec, type";
|
$sql .= "ref, entity, datec, type";
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
$sql .= "'".$this->db->escape($ref)."'";
|
$sql .= "'".$this->db->escape($ref)."'";
|
||||||
$sql .= ", ".$conf->entity;
|
$sql .= ", ".((int) $conf->entity);
|
||||||
$sql .= ", '".$this->db->idate($now)."'";
|
$sql .= ", '".$this->db->idate($now)."'";
|
||||||
$sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'";
|
$sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'";
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
@ -1831,7 +1837,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d');
|
$DtOfSgntr = dol_print_date($row_datec, '%Y-%m-%d');
|
||||||
|
|
||||||
if ($type != 'bank-transfer') {
|
if ($type != 'bank-transfer') {
|
||||||
// SEPA Paiement Information of buyer for Direct debit
|
// SEPA Paiement Information of buyer for Direct Debit
|
||||||
$XML_DEBITOR = '';
|
$XML_DEBITOR = '';
|
||||||
$XML_DEBITOR .= ' <DrctDbtTxInf>'.$CrLf;
|
$XML_DEBITOR .= ' <DrctDbtTxInf>'.$CrLf;
|
||||||
$XML_DEBITOR .= ' <PmtId>'.$CrLf;
|
$XML_DEBITOR .= ' <PmtId>'.$CrLf;
|
||||||
@ -1884,7 +1890,7 @@ class BonPrelevement extends CommonObject
|
|||||||
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
|
// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
|
||||||
$XML_CREDITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
$XML_CREDITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||||
$XML_CREDITOR .= ' </PmtId>'.$CrLf;
|
$XML_CREDITOR .= ' </PmtId>'.$CrLf;
|
||||||
if ($this->sepa_xml_pti_in_ctti) {
|
if (!empty($this->sepa_xml_pti_in_ctti)) {
|
||||||
$XML_CREDITOR .= ' <PmtTpInf>' . $CrLf;
|
$XML_CREDITOR .= ' <PmtTpInf>' . $CrLf;
|
||||||
|
|
||||||
// Can be 'NORM' for normal or 'HIGH' for high priority level
|
// Can be 'NORM' for normal or 'HIGH' for high priority level
|
||||||
@ -2076,7 +2082,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$RefBon = $obj->ref;
|
$RefBon = $obj->ref;
|
||||||
|
|
||||||
if ($type != 'bank-transfer') {
|
if ($type != 'bank-transfer') {
|
||||||
// SEPA Paiement Information of my company for Direct debit
|
// SEPA Paiement Information of my company for Direct Debit
|
||||||
$XML_SEPA_INFO = '';
|
$XML_SEPA_INFO = '';
|
||||||
$XML_SEPA_INFO .= ' <PmtInf>'.$CrLf;
|
$XML_SEPA_INFO .= ' <PmtInf>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' <PmtInfId>'.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
|
$XML_SEPA_INFO .= ' <PmtInfId>'.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
|
||||||
@ -2147,7 +2153,7 @@ class BonPrelevement extends CommonObject
|
|||||||
//$XML_SEPA_INFO .= ' <BtchBookg>False</BtchBookg>'.$CrLf;
|
//$XML_SEPA_INFO .= ' <BtchBookg>False</BtchBookg>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' <NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
|
$XML_SEPA_INFO .= ' <NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
|
||||||
$XML_SEPA_INFO .= ' <CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
|
$XML_SEPA_INFO .= ' <CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
|
||||||
if (!$this->sepa_xml_pti_in_ctti) {
|
if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) { // @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange.
|
||||||
$XML_SEPA_INFO .= ' <PmtTpInf>' . $CrLf;
|
$XML_SEPA_INFO .= ' <PmtTpInf>' . $CrLf;
|
||||||
$XML_SEPA_INFO .= ' <SvcLvl>' . $CrLf;
|
$XML_SEPA_INFO .= ' <SvcLvl>' . $CrLf;
|
||||||
$XML_SEPA_INFO .= ' <Cd>SEPA</Cd>' . $CrLf;
|
$XML_SEPA_INFO .= ' <Cd>SEPA</Cd>' . $CrLf;
|
||||||
|
|||||||
@ -449,9 +449,17 @@ if ($resql) {
|
|||||||
|
|
||||||
// RIB
|
// RIB
|
||||||
print '<td>';
|
print '<td>';
|
||||||
|
if ($bac->id > 0) {
|
||||||
|
if (!empty($bac->iban) || !empty($bac->bic)) {
|
||||||
print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
|
print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
|
||||||
if ($bac->verif() <= 0) {
|
if ($bac->verif() <= 0) {
|
||||||
print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
|
print img_warning('Error on default bank number for IBAN : '.$langs->trans($bac->error_message));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print img_warning($langs->trans("IBANNotDefined"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print img_warning($langs->trans("NoBankAccountDefined"));
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,7 @@ if ($id > 0 || $ref) {
|
|||||||
|
|
||||||
//print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
//print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount).'</span></td></tr>';
|
||||||
|
|
||||||
if ($object->date_trans <> 0) {
|
if ($object->date_trans <> 0) {
|
||||||
$muser = new User($db);
|
$muser = new User($db);
|
||||||
@ -110,7 +110,7 @@ if ($id > 0 || $ref) {
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||||
print dol_print_date($object->date_trans, 'day');
|
print dol_print_date($object->date_trans, 'day');
|
||||||
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
|
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $object->methodes_trans[$object->method_trans];
|
print $object->methodes_trans[$object->method_trans];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -156,7 +156,9 @@ if ($id > 0 || $ref) {
|
|||||||
if ($object->type == 'bank-transfer') {
|
if ($object->type == 'bank-transfer') {
|
||||||
$modulepart = 'paymentbybanktransfer';
|
$modulepart = 'paymentbybanktransfer';
|
||||||
}
|
}
|
||||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath;
|
||||||
|
print img_picto('', 'download', 'class="paddingleft"');
|
||||||
|
print '</a>';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -97,7 +97,7 @@ if ($prev_id > 0 || $ref) {
|
|||||||
|
|
||||||
//print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
//print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount).'</span></td></tr>';
|
||||||
|
|
||||||
if ($object->date_trans <> 0) {
|
if ($object->date_trans <> 0) {
|
||||||
$muser = new User($db);
|
$muser = new User($db);
|
||||||
@ -105,7 +105,7 @@ if ($prev_id > 0 || $ref) {
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||||
print dol_print_date($object->date_trans, 'day');
|
print dol_print_date($object->date_trans, 'day');
|
||||||
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
|
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $object->methodes_trans[$object->method_trans];
|
print $object->methodes_trans[$object->method_trans];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -151,7 +151,9 @@ if ($prev_id > 0 || $ref) {
|
|||||||
if ($object->type == 'bank-transfer') {
|
if ($object->type == 'bank-transfer') {
|
||||||
$modulepart = 'paymentbybanktransfer';
|
$modulepart = 'paymentbybanktransfer';
|
||||||
}
|
}
|
||||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath;
|
||||||
|
print img_picto('', 'download', 'class="paddingleft"');
|
||||||
|
print '</a>';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -207,7 +209,7 @@ if ($resql) {
|
|||||||
|
|
||||||
print"\n<!-- debut table -->\n";
|
print"\n<!-- debut table -->\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 '<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" width="100%" cellpadding="4">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Line").'</td><td>'.$langs->trans("ThirdParty").'</td><td class="right">'.$langs->trans("Amount").'</td>';
|
print '<td>'.$langs->trans("Line").'</td><td>'.$langs->trans("ThirdParty").'</td><td class="right">'.$langs->trans("Amount").'</td>';
|
||||||
print '<td>'.$langs->trans("Reason").'</td><td align="center">'.$langs->trans("ToBill").'</td><td class="center">'.$langs->trans("Invoice").'</td></tr>';
|
print '<td>'.$langs->trans("Reason").'</td><td align="center">'.$langs->trans("ToBill").'</td><td class="center">'.$langs->trans("Invoice").'</td></tr>';
|
||||||
|
|||||||
@ -91,7 +91,7 @@ if ($prev_id > 0 || $ref) {
|
|||||||
|
|
||||||
//print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
//print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td>'.$object->getNomUrl(1).'</td></tr>';
|
||||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
print '<tr><td class="titlefieldcreate">'.$langs->trans("Date").'</td><td>'.dol_print_date($object->datec, 'day').'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>'.price($object->amount).'</td></tr>';
|
print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount).'</span></td></tr>';
|
||||||
|
|
||||||
if ($object->date_trans <> 0) {
|
if ($object->date_trans <> 0) {
|
||||||
$muser = new User($db);
|
$muser = new User($db);
|
||||||
@ -99,7 +99,7 @@ if ($prev_id > 0 || $ref) {
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransData").'</td><td>';
|
||||||
print dol_print_date($object->date_trans, 'day');
|
print dol_print_date($object->date_trans, 'day');
|
||||||
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getFullName($langs).'</td></tr>';
|
print ' <span class="opacitymedium">'.$langs->trans("By").'</span> '.$muser->getNomUrl(-1).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
print '<tr><td>'.$langs->trans("TransMetod").'</td><td>';
|
||||||
print $object->methodes_trans[$object->method_trans];
|
print $object->methodes_trans[$object->method_trans];
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -145,7 +145,9 @@ if ($prev_id > 0 || $ref) {
|
|||||||
if ($object->type == 'bank-transfer') {
|
if ($object->type == 'bank-transfer') {
|
||||||
$modulepart = 'paymentbybanktransfer';
|
$modulepart = 'paymentbybanktransfer';
|
||||||
}
|
}
|
||||||
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath.'</a>';
|
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?type=text/plain&modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$relativepath;
|
||||||
|
print img_picto('', 'download', 'class="paddingleft"');
|
||||||
|
print '</a>';
|
||||||
print '</td></tr></table>';
|
print '</td></tr></table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
@ -173,7 +175,8 @@ if ($prev_id > 0 || $ref) {
|
|||||||
print load_fiche_titre($langs->trans("StatisticsByLineStatus"), '', '');
|
print load_fiche_titre($langs->trans("StatisticsByLineStatus"), '', '');
|
||||||
|
|
||||||
print"\n<!-- debut table -->\n";
|
print"\n<!-- debut table -->\n";
|
||||||
print '<table class="noborder" width="100%" cellpadding="4">';
|
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">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans("Status").'</td><td class="right">'.$langs->trans("Amount").'</td><td class="right">%</td></tr>';
|
print '<td>'.$langs->trans("Status").'</td><td class="right">'.$langs->trans("Amount").'</td><td class="right">%</td></tr>';
|
||||||
|
|
||||||
@ -184,10 +187,13 @@ if ($prev_id > 0 || $ref) {
|
|||||||
|
|
||||||
print $line->LibStatut($row[1], 1);
|
print $line->LibStatut($row[1], 1);
|
||||||
|
|
||||||
print '</td><td class="right">';
|
print '</td>';
|
||||||
print price($row[0]);
|
|
||||||
|
|
||||||
print '</td><td class="right">';
|
print '<td class="right"><span class="amount">';
|
||||||
|
print price($row[0]);
|
||||||
|
print '</span></td>';
|
||||||
|
|
||||||
|
print '<td class="right">';
|
||||||
if ($object->amount) {
|
if ($object->amount) {
|
||||||
print round($row[0] / $object->amount * 100, 2)." %";
|
print round($row[0] / $object->amount * 100, 2)." %";
|
||||||
}
|
}
|
||||||
@ -200,6 +206,8 @@ if ($prev_id > 0 || $ref) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
} else {
|
} else {
|
||||||
print $db->error().' '.$sql;
|
print $db->error().' '.$sql;
|
||||||
|
|||||||
@ -102,7 +102,7 @@ print '</span></td></tr></table></div><br>';
|
|||||||
*/
|
*/
|
||||||
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
||||||
$sql .= " pfd.date_demande, pfd.amount,";
|
$sql .= " pfd.date_demande, pfd.amount,";
|
||||||
$sql .= " s.nom as name, s.email, s.rowid as socid";
|
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||||
@ -148,6 +148,16 @@ if ($resql) {
|
|||||||
$thirdpartystatic->id = $obj->socid;
|
$thirdpartystatic->id = $obj->socid;
|
||||||
$thirdpartystatic->name = $obj->name;
|
$thirdpartystatic->name = $obj->name;
|
||||||
$thirdpartystatic->email = $obj->email;
|
$thirdpartystatic->email = $obj->email;
|
||||||
|
$thirdpartystatic->tva_intra = $obj->tva_intra;
|
||||||
|
$thirdpartystatic->siren = $obj->idprof1;
|
||||||
|
$thirdpartystatic->siret = $obj->idprof2;
|
||||||
|
$thirdpartystatic->ape = $obj->idprof3;
|
||||||
|
$thirdpartystatic->idprof1 = $obj->idprof1;
|
||||||
|
$thirdpartystatic->idprof2 = $obj->idprof2;
|
||||||
|
$thirdpartystatic->idprof3 = $obj->idprof3;
|
||||||
|
$thirdpartystatic->idprof4 = $obj->idprof4;
|
||||||
|
$thirdpartystatic->idprof5 = $obj->idprof5;
|
||||||
|
$thirdpartystatic->idprof6 = $obj->idprof6;
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $invoicestatic->getNomUrl(1, 'withdraw');
|
print $invoicestatic->getNomUrl(1, 'withdraw');
|
||||||
@ -158,7 +168,7 @@ if ($resql) {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
print price($obj->amount);
|
print '<span class="amount">'.price($obj->amount).'</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
|
|||||||
@ -364,7 +364,7 @@ class ChargeSociales extends CommonObject
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
if (!$notrigger) {
|
if (!$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('SOCIALCHARGES_MODIFY', $user);
|
$result = $this->call_trigger('SOCIALCONTRIBUTION_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,6 +57,7 @@ $socid = GETPOST('socid', 'int');
|
|||||||
|
|
||||||
// Category
|
// Category
|
||||||
$selected_cat = (int) GETPOST('search_categ', 'int');
|
$selected_cat = (int) GETPOST('search_categ', 'int');
|
||||||
|
if ($selected_cat == -1) $selected_cat = '';
|
||||||
$subcat = false;
|
$subcat = false;
|
||||||
if (GETPOST('subcat', 'alpha') === 'yes') {
|
if (GETPOST('subcat', 'alpha') === 'yes') {
|
||||||
$subcat = true;
|
$subcat = true;
|
||||||
|
|||||||
@ -204,7 +204,7 @@ $dolibarr_main_authentication='dolibarr';
|
|||||||
// $dolibarr_main_auth_ldap_servertype='openldap'; // openldap, activedirectory or egroupware
|
// $dolibarr_main_auth_ldap_servertype='openldap'; // openldap, activedirectory or egroupware
|
||||||
// $dolibarr_main_auth_ldap_login_attribute='loginfield'; // Ex: uid or samaccountname for active directory
|
// $dolibarr_main_auth_ldap_login_attribute='loginfield'; // Ex: uid or samaccountname for active directory
|
||||||
// $dolibarr_main_auth_ldap_dn='ou=users,dc=my-domain,dc=com'; // Ex: ou=users,dc=my-domain,dc=com
|
// $dolibarr_main_auth_ldap_dn='ou=users,dc=my-domain,dc=com'; // Ex: ou=users,dc=my-domain,dc=com
|
||||||
// $dolibarr_main_auth_ldap_filter = ''; // If defined, two previous parameters are not used to find a user into LDAP. Ex: (uid=%1%) or &(uid=%1%)(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com).
|
// $dolibarr_main_auth_ldap_filter = ''; // If defined, the two previous parameters (dolibarr_main_auth_ldap_login_attribute and dolibarr_main_auth_ldap_dn) are not used to find a user into LDAP. Instead we use this search string. Ex: (uid=%1%) or &(uid=%1%)(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com).
|
||||||
// $dolibarr_main_auth_ldap_admin_login=''; // Required only if anonymous bind disabled. Ex: cn=admin,dc=example,dc=com
|
// $dolibarr_main_auth_ldap_admin_login=''; // Required only if anonymous bind disabled. Ex: cn=admin,dc=example,dc=com
|
||||||
// $dolibarr_main_auth_ldap_admin_pass=''; // Required only if anonymous bind disabled. Ex: secret
|
// $dolibarr_main_auth_ldap_admin_pass=''; // Required only if anonymous bind disabled. Ex: secret
|
||||||
// $dolibarr_main_auth_ldap_debug='false';
|
// $dolibarr_main_auth_ldap_debug='false';
|
||||||
|
|||||||
@ -520,6 +520,29 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update extrafields
|
||||||
|
if ($action == 'update_extras' && ! empty($user->rights->societe->contact->creer)) {
|
||||||
|
$object->oldcopy = dol_clone($object);
|
||||||
|
|
||||||
|
// Fill array 'array_options' with data from update form
|
||||||
|
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||||
|
if ($ret < 0) {
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$result = $object->insertExtraFields('CONTACT_MODIFY');
|
||||||
|
if ($result < 0) {
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
$action = 'edit_extras';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Actions to send emails
|
// Actions to send emails
|
||||||
$triggersendname = 'CONTACT_SENTBYMAIL';
|
$triggersendname = 'CONTACT_SENTBYMAIL';
|
||||||
$paramname = 'id';
|
$paramname = 'id';
|
||||||
@ -601,7 +624,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
*/
|
*/
|
||||||
$object->canvas = $canvas;
|
$object->canvas = $canvas;
|
||||||
|
|
||||||
$object->state_id = GETPOST("state_id");
|
$object->state_id = GETPOST("state_id", "int");
|
||||||
|
|
||||||
// We set country_id, country_code and label for the selected country
|
// We set country_id, country_code and label for the selected country
|
||||||
$object->country_id = GETPOST("country_id") ? GETPOST("country_id", "int") : (empty($objsoc->country_id) ? $mysoc->country_id : $objsoc->country_id);
|
$object->country_id = GETPOST("country_id") ? GETPOST("country_id", "int") : (empty($objsoc->country_id) ? $mysoc->country_id : $objsoc->country_id);
|
||||||
@ -674,7 +697,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
} else {
|
} else {
|
||||||
print '<tr><td><label for="socid">'.$langs->trans("ThirdParty").'</label></td><td colspan="3" class="maxwidthonsmartphone">';
|
print '<tr><td><label for="socid">'.$langs->trans("ThirdParty").'</label></td><td colspan="3" class="maxwidthonsmartphone">';
|
||||||
print img_picto('', 'company').$form->select_company($socid, 'socid', '', 'SelectThirdParty');
|
print img_picto('', 'company').$form->select_company($socid, 'socid', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -376,7 +376,7 @@ class Contact extends CommonObject
|
|||||||
public function load_state_board()
|
public function load_state_board()
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $user;
|
global $user, $hookmanager;
|
||||||
|
|
||||||
$this->nb = array();
|
$this->nb = array();
|
||||||
$clause = "WHERE";
|
$clause = "WHERE";
|
||||||
@ -394,6 +394,12 @@ class Contact extends CommonObject
|
|||||||
if ($user->socid > 0) {
|
if ($user->socid > 0) {
|
||||||
$sql .= " AND sp.fk_soc = ".((int) $user->socid);
|
$sql .= " AND sp.fk_soc = ".((int) $user->socid);
|
||||||
}
|
}
|
||||||
|
// Add where from hooks
|
||||||
|
if (is_object($hookmanager)) {
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $this); // Note that $action and $object may have been modified by hook
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
|
}
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql) {
|
if ($resql) {
|
||||||
@ -1820,7 +1826,7 @@ class Contact extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_socpeople=".((int) $this->id)." AND entity IN (".getEntity("societe_contact").")";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_contacts WHERE fk_socpeople=".((int) $this->id)." AND entity IN (".getEntity("contact").")";
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
|
|||||||
@ -384,7 +384,7 @@ if (!empty($conf->mailing->enabled)) {
|
|||||||
}
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||||
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
@ -405,7 +405,7 @@ if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') {
|
|||||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||||
}
|
}
|
||||||
$sql .= ' WHERE p.entity IN ('.getEntity('socpeople').')';
|
$sql .= ' WHERE p.entity IN ('.getEntity('contact').')';
|
||||||
if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
|
if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
|
||||||
$sql .= " AND (sc.fk_user = ".((int) $user->id)." OR p.fk_soc IS NULL)";
|
$sql .= " AND (sc.fk_user = ".((int) $user->id)." OR p.fk_soc IS NULL)";
|
||||||
}
|
}
|
||||||
@ -543,7 +543,7 @@ if (!empty($socid)) {
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
// Add order
|
// Add order
|
||||||
if ($view == "recent") {
|
if ($view == "recent") {
|
||||||
@ -767,7 +767,7 @@ $moreforfilter .= '</div>';
|
|||||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
print $moreforfilter;
|
print $moreforfilter;
|
||||||
$parameters = array('type'=>$type);
|
$parameters = array('type'=>$type);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -910,7 +910,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
|||||||
|
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters = array('arrayfields'=>$arrayfields);
|
$parameters = array('arrayfields'=>$arrayfields);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
// Date creation
|
// Date creation
|
||||||
if (!empty($arrayfields['p.datec']['checked'])) {
|
if (!empty($arrayfields['p.datec']['checked'])) {
|
||||||
@ -1018,7 +1018,7 @@ $parameters = array(
|
|||||||
'sortfield'=>$sortfield,
|
'sortfield'=>$sortfield,
|
||||||
'sortorder'=>$sortorder,
|
'sortorder'=>$sortorder,
|
||||||
);
|
);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
if (!empty($arrayfields['p.datec']['checked'])) {
|
if (!empty($arrayfields['p.datec']['checked'])) {
|
||||||
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||||
@ -1255,7 +1255,7 @@ while ($i < min($num, $limit)) {
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
// Date creation
|
// Date creation
|
||||||
if (!empty($arrayfields['p.datec']['checked'])) {
|
if (!empty($arrayfields['p.datec']['checked'])) {
|
||||||
@ -1312,7 +1312,7 @@ while ($i < min($num, $limit)) {
|
|||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|
||||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
|
|||||||
@ -233,10 +233,10 @@ class Contrat extends CommonObject
|
|||||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||||
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
|
||||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||||
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||||
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial suivi', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
|
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
|
||||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
||||||
@ -245,7 +245,7 @@ class Contrat extends CommonObject
|
|||||||
'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'Ref customer', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
|
'ref_customer' =>array('type'=>'varchar(50)', 'label'=>'Ref customer', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
|
||||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
|
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
|
||||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
||||||
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed'))
|
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'notnull'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed'))
|
||||||
);
|
);
|
||||||
// END MODULEBUILDER PROPERTIES
|
// END MODULEBUILDER PROPERTIES
|
||||||
|
|
||||||
@ -751,15 +751,14 @@ class Contrat extends CommonObject
|
|||||||
* Load lines array into this->lines.
|
* Load lines array into this->lines.
|
||||||
* This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed
|
* This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed
|
||||||
*
|
*
|
||||||
* @param int $only_product Return only physical products
|
* @param int $only_services 0=Default, 1=Force only services (depending on setup, we may also have physical products in a contract)
|
||||||
* @param int $loadalsotranslation Return translation for products
|
* @param int $loadalsotranslation 0=Default, 1=Load also translations of product descriptions
|
||||||
*
|
|
||||||
* @return ContratLigne[] Return array of contract lines
|
* @return ContratLigne[] Return array of contract lines
|
||||||
*/
|
*/
|
||||||
public function fetch_lines($only_product = 0, $loadalsotranslation = 0)
|
public function fetch_lines($only_services = 0, $loadalsotranslation = 0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs, $conf, $extrafields;
|
global $langs, $conf;
|
||||||
|
|
||||||
$this->nbofservices = 0;
|
$this->nbofservices = 0;
|
||||||
$this->nbofserviceswait = 0;
|
$this->nbofserviceswait = 0;
|
||||||
@ -773,13 +772,15 @@ class Contrat extends CommonObject
|
|||||||
|
|
||||||
$now = dol_now();
|
$now = dol_now();
|
||||||
|
|
||||||
|
/*
|
||||||
if (!is_object($extrafields)) {
|
if (!is_object($extrafields)) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
$extrafields = new ExtraFields($this->db);
|
$extrafields = new ExtraFields($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$line = new ContratLigne($this->db);
|
$line = new ContratLigne($this->db);
|
||||||
$extrafields->fetch_name_optionals_label($line->table_element, true);
|
$extrafields->fetch_name_optionals_label(ContratLigne::$table_element, true);
|
||||||
|
*/
|
||||||
|
|
||||||
$this->lines = array();
|
$this->lines = array();
|
||||||
$pos = 0;
|
$pos = 0;
|
||||||
@ -802,6 +803,9 @@ class Contrat extends CommonObject
|
|||||||
$sql .= " d.product_type as type";
|
$sql .= " d.product_type as type";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."contratdet as d LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid";
|
$sql .= " FROM ".MAIN_DB_PREFIX."contratdet as d LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid";
|
||||||
$sql .= " WHERE d.fk_contrat = ".((int) $this->id);
|
$sql .= " WHERE d.fk_contrat = ".((int) $this->id);
|
||||||
|
if ($only_services == 1) {
|
||||||
|
$sql .= " AND d.product_type = 1";
|
||||||
|
}
|
||||||
$sql .= " ORDER by d.rowid ASC";
|
$sql .= " ORDER by d.rowid ASC";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
|
||||||
@ -814,6 +818,7 @@ class Contrat extends CommonObject
|
|||||||
$objp = $this->db->fetch_object($result);
|
$objp = $this->db->fetch_object($result);
|
||||||
|
|
||||||
$line = new ContratLigne($this->db);
|
$line = new ContratLigne($this->db);
|
||||||
|
|
||||||
$line->id = $objp->rowid;
|
$line->id = $objp->rowid;
|
||||||
$line->ref = $objp->rowid;
|
$line->ref = $objp->rowid;
|
||||||
$line->fk_contrat = $objp->fk_contrat;
|
$line->fk_contrat = $objp->fk_contrat;
|
||||||
@ -840,7 +845,7 @@ class Contrat extends CommonObject
|
|||||||
$line->type = $objp->type;
|
$line->type = $objp->type;
|
||||||
|
|
||||||
$line->fk_fournprice = $objp->fk_fournprice;
|
$line->fk_fournprice = $objp->fk_fournprice;
|
||||||
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
|
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $objp->fk_fournprice, $objp->pa_ht);
|
||||||
$line->pa_ht = $marginInfos[0];
|
$line->pa_ht = $marginInfos[0];
|
||||||
|
|
||||||
$line->fk_user_author = $objp->fk_user_author;
|
$line->fk_user_author = $objp->fk_user_author;
|
||||||
@ -882,6 +887,7 @@ class Contrat extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->lines[$pos] = $line;
|
$this->lines[$pos] = $line;
|
||||||
|
|
||||||
$this->lines_id_index_mapper[$line->id] = $pos;
|
$this->lines_id_index_mapper[$line->id] = $pos;
|
||||||
|
|
||||||
//dol_syslog("1 ".$line->desc);
|
//dol_syslog("1 ".$line->desc);
|
||||||
@ -1792,7 +1798,7 @@ class Contrat extends CommonObject
|
|||||||
|
|
||||||
if (empty($error)) {
|
if (empty($error)) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('LINECONTRACT_UPDATE', $user);
|
$result = $this->call_trigger('LINECONTRACT_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -3;
|
return -3;
|
||||||
@ -2131,18 +2137,26 @@ class Contrat extends CommonObject
|
|||||||
* Return list of other contracts for same company than current contract
|
* Return list of other contracts for same company than current contract
|
||||||
*
|
*
|
||||||
* @param string $option 'all' or 'others'
|
* @param string $option 'all' or 'others'
|
||||||
|
* @param array $status sort contracts having these status
|
||||||
|
* @param array $product_categories sort contracts containing these product categories
|
||||||
|
* @param array $line_status sort contracts where lines have these status
|
||||||
* @return array|int Array of contracts id or <0 if error
|
* @return array|int Array of contracts id or <0 if error
|
||||||
*/
|
*/
|
||||||
public function getListOfContracts($option = 'all')
|
public function getListOfContracts($option = 'all', $status = [], $product_categories = [], $line_status = [])
|
||||||
{
|
{
|
||||||
$tab = array();
|
$tab = array();
|
||||||
|
|
||||||
$sql = "SELECT c.rowid, c.ref";
|
$sql = "SELECT c.rowid, c.ref";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c";
|
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c";
|
||||||
$sql .= " WHERE fk_soc =".((int) $this->socid);
|
if (!empty($product_categories)) {
|
||||||
if ($option == 'others') {
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON cd.fk_contrat = c.rowid";
|
||||||
$sql .= " AND c.rowid <> ".((int) $this->id);
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = cd.fk_product AND cp.fk_categorie IN (".$this->db->sanitize(implode(', ', $product_categories)).")";
|
||||||
}
|
}
|
||||||
|
$sql .= " WHERE c.fk_soc =".((int) $this->socid);
|
||||||
|
$sql .= ($option == 'others') ? " AND c.rowid <> ".((int) $this->id) : "";
|
||||||
|
$sql .= (!empty($status)) ? " AND c.statut IN (".$this->db->sanitize(implode(', ', $status)).")" : "";
|
||||||
|
$sql .= (!empty($line_status)) ? " AND cd.statut IN (".$this->db->sanitize(implode(', ', $line_status)).")" : "";
|
||||||
|
$sql .= " GROUP BY c.rowid";
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::getOtherContracts()", LOG_DEBUG);
|
dol_syslog(get_class($this)."::getOtherContracts()", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
@ -2460,6 +2474,23 @@ class Contrat extends CommonObject
|
|||||||
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function used to replace a product id with another one.
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param int $origin_id Old product id
|
||||||
|
* @param int $dest_id New product id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public static function replaceProduct(DoliDB $db, $origin_id, $dest_id)
|
||||||
|
{
|
||||||
|
$tables = array(
|
||||||
|
'contratdet'
|
||||||
|
);
|
||||||
|
|
||||||
|
return CommonObject::commonReplaceProduct($db, $origin_id, $dest_id, $tables);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load an object from its id and create a new one in database
|
* Load an object from its id and create a new one in database
|
||||||
*
|
*
|
||||||
@ -2750,8 +2781,8 @@ class ContratLigne extends CommonObjectLine
|
|||||||
//'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
//'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
||||||
//'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
|
//'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
|
||||||
//'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
//'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||||
'fk_user_ouverture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserOpen', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
|
'fk_user_ouverture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserStartingService', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
|
||||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserCloture', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
|
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosingService', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
|
||||||
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 4=>'Open', 5=>'Closed'))
|
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 4=>'Open', 5=>'Closed'))
|
||||||
);
|
);
|
||||||
// END MODULEBUILDER PROPERTIES
|
// END MODULEBUILDER PROPERTIES
|
||||||
@ -3190,7 +3221,7 @@ class ContratLigne extends CommonObjectLine
|
|||||||
|
|
||||||
if (!$error && !$notrigger) {
|
if (!$error && !$notrigger) {
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result = $this->call_trigger('LINECONTRACT_UPDATE', $user);
|
$result = $this->call_trigger('LINECONTRACT_MODIFY', $user);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|||||||
@ -338,9 +338,13 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters = array();
|
$parameters = array('search_dfyear' => $search_dfyear, 'search_op2df'=>$search_op2df);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
|
// Add HAVING from hooks
|
||||||
|
$parameters = array('search_dfyear' => $search_dfyear, 'search_op2df'=>$search_op2df);
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook)) {
|
||||||
if ($search_dfyear > 0 && $search_op2df) {
|
if ($search_dfyear > 0 && $search_op2df) {
|
||||||
if ($search_op2df == '<=') {
|
if ($search_op2df == '<=') {
|
||||||
$sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."'";
|
$sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."'";
|
||||||
@ -350,25 +354,45 @@ if ($search_dfyear > 0 && $search_op2df) {
|
|||||||
$sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'";
|
$sql .= " HAVING MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") <= '".$db->idate(dol_get_last_day($search_dfyear, $search_dfmonth, false))."' AND MIN(".$db->ifsql("cd.statut=4", "cd.date_fin_validite", "null").") >= '".$db->idate(dol_get_first_day($search_dfyear, $search_dfmonth, false))."'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
|
||||||
|
|
||||||
$totalnboflines = 0;
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if ($result) {
|
|
||||||
$totalnboflines = $db->num_rows($result);
|
|
||||||
}
|
}
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
$result = $db->query($sql);
|
//$result = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
//$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
|
||||||
|
if ($search_dfyear > 0 && $search_op2df) {
|
||||||
|
$resql = $db->query($sql, 0, 'auto', 1);
|
||||||
|
while ($db->fetch_object($resql)) {
|
||||||
|
if (empty($nbtotalofrecords)) {
|
||||||
|
$nbtotalofrecords = 1; // We can't make +1 because init value is ''
|
||||||
|
} else {
|
||||||
|
$nbtotalofrecords++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
|
||||||
|
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'contratdet as cd ON c.rowid = cd.fk_contrat/', '', $sqlforcount);
|
||||||
|
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=cd.fk_product/', '', $sqlforcount);
|
||||||
|
$sqlforcount = preg_replace('/AND cp.fk_categorie = '.((int) $search_product_category).'/', '', $sqlforcount);
|
||||||
|
$sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount);
|
||||||
|
|
||||||
|
$resql = $db->query($sqlforcount);
|
||||||
|
$objforcount = $db->fetch_object($resql);
|
||||||
|
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||||
|
}
|
||||||
|
|
||||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||||
$page = 0;
|
$page = 0;
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
|
if ($limit) {
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
$sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (!$resql) {
|
if (!$resql) {
|
||||||
@ -508,7 +532,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contract', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||||
|
|
||||||
$topicmail = "SendContractRef";
|
$topicmail = "SendContractRef";
|
||||||
$modelmail = "contract";
|
$modelmail = "contract";
|
||||||
|
|||||||
@ -326,25 +326,25 @@ if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $fil
|
|||||||
$sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."'";
|
$sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."'";
|
||||||
}
|
}
|
||||||
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue == ' BETWEEN ') {
|
if (!empty($filter_opouvertureprevue) && $filter_opouvertureprevue == ' BETWEEN ') {
|
||||||
$sql .= " AND '".$db->idate($filter_dateouvertureprevue_end)."'";
|
$sql .= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue_start)."' AND '".$db->idate($filter_dateouvertureprevue_end)."'";
|
||||||
}
|
}
|
||||||
if (!empty($filter_op1) && $filter_op1 != -1 && $filter_op1 != ' BETWEEN ' && $filter_date1_start != '') {
|
if (!empty($filter_op1) && $filter_op1 != -1 && $filter_op1 != ' BETWEEN ' && $filter_date1_start != '') {
|
||||||
$sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."'";
|
$sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."'";
|
||||||
}
|
}
|
||||||
if (!empty($filter_op1) && $filter_op1 == ' BETWEEN ') {
|
if (!empty($filter_op1) && $filter_op1 == ' BETWEEN ') {
|
||||||
$sql .= " AND '".$db->idate($filter_date1_end)."'";
|
$sql .= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1_start)."' AND '".$db->idate($filter_date1_end)."'";
|
||||||
}
|
}
|
||||||
if (!empty($filter_op2) && $filter_op2 != -1 && $filter_op2 != ' BETWEEN ' && $filter_date2_start != '') {
|
if (!empty($filter_op2) && $filter_op2 != -1 && $filter_op2 != ' BETWEEN ' && $filter_date2_start != '') {
|
||||||
$sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."'";
|
$sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."'";
|
||||||
}
|
}
|
||||||
if (!empty($filter_op2) && $filter_op2 == ' BETWEEN ') {
|
if (!empty($filter_op2) && $filter_op2 == ' BETWEEN ') {
|
||||||
$sql .= " AND '".$db->idate($filter_date2_end)."'";
|
$sql .= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2_start)."' AND '".$db->idate($filter_date2_end)."'";
|
||||||
}
|
}
|
||||||
if (!empty($filter_opcloture) && $filter_opcloture != ' BETWEEN ' && $filter_opcloture != -1 && $filter_datecloture_start != '') {
|
if (!empty($filter_opcloture) && $filter_opcloture != ' BETWEEN ' && $filter_opcloture != -1 && $filter_datecloture_start != '') {
|
||||||
$sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."'";
|
$sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."'";
|
||||||
}
|
}
|
||||||
if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') {
|
if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') {
|
||||||
$sql .= " AND '".$db->idate($filter_datecloture_end)."'";
|
$sql .= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture_start)."' AND '".$db->idate($filter_datecloture_end)."'";
|
||||||
}
|
}
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
|
|||||||
@ -49,7 +49,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
|||||||
<td class="nowraponall"><?php echo $objectlink->getNomUrl(1); ?></td>
|
<td class="nowraponall"><?php echo $objectlink->getNomUrl(1); ?></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td class="center"><?php echo dol_print_date($objectlink->date_contrat, 'day'); ?></td>
|
<td class="center"><?php echo dol_print_date($objectlink->date_contrat, 'day'); ?></td>
|
||||||
<td class="right"><?php
|
<td class="nowraponall right"><?php
|
||||||
// Price of contract is not shown by default because a contract is a list of service with
|
// Price of contract is not shown by default because a contract is a list of service with
|
||||||
// start and end date that change with time andd that may be different that the period of reference for price.
|
// start and end date that change with time andd that may be different that the period of reference for price.
|
||||||
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
|
// So price of a contract does often means nothing. Prices is on the different invoices done on same contract.
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user