Merge branch 'develop' of github.com:Dolibarr/dolibarr into NEW_16.0_consistency_mechanism_for_trigger_names

This commit is contained in:
atm-florian 2022-04-07 14:33:22 +02:00
commit 5953c3cd38
525 changed files with 67492 additions and 82315 deletions

View File

@ -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,8 +48,8 @@ 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.5.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css 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

View File

@ -21,14 +21,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 *****

View File

@ -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",

134
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "1dbd2d05cc0836acfca5988f29005cf2", "content-hash": "ea80667c2a5aaabe388fbae4716d7dfb",
"packages": [ "packages": [
{ {
"name": "ckeditor/ckeditor", "name": "ckeditor/ckeditor",
@ -179,16 +179,16 @@
}, },
{ {
"name": "mobiledetect/mobiledetectlib", "name": "mobiledetect/mobiledetectlib",
"version": "2.8.34", "version": "2.8.39",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/serbanghita/Mobile-Detect.git", "url": "https://github.com/serbanghita/Mobile-Detect.git",
"reference": "6f8113f57a508494ca36acbcfa2dc2d923c7ed5b" "reference": "0fd6753003fc870f6e229bae869cc1337c99bc45"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/6f8113f57a508494ca36acbcfa2dc2d923c7ed5b", "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/0fd6753003fc870f6e229bae869cc1337c99bc45",
"reference": "6f8113f57a508494ca36acbcfa2dc2d923c7ed5b", "reference": "0fd6753003fc870f6e229bae869cc1337c99bc45",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -199,12 +199,12 @@
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
"classmap": [
"Mobile_Detect.php"
],
"psr-0": { "psr-0": {
"Detection": "namespaced/" "Detection": "namespaced/"
} },
"classmap": [
"Mobile_Detect.php"
]
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@ -229,9 +229,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/serbanghita/Mobile-Detect/issues", "issues": "https://github.com/serbanghita/Mobile-Detect/issues",
"source": "https://github.com/serbanghita/Mobile-Detect/tree/2.8.34" "source": "https://github.com/serbanghita/Mobile-Detect/tree/2.8.39"
}, },
"time": "2019-09-18T18:44:20+00:00" "time": "2022-02-17T19:24:25+00:00"
}, },
{ {
"name": "nnnick/chartjs", "name": "nnnick/chartjs",
@ -278,6 +278,61 @@
}, },
"time": "2020-10-19T12:22:11+00:00" "time": "2020-10-19T12:22:11+00:00"
}, },
{
"name": "phpoffice/phpexcel",
"version": "1.8.2",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPExcel.git",
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870",
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"php": "^5.2|^7.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "2.*"
},
"type": "library",
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "http://blog.maartenballiauw.be"
},
{
"name": "Erik Tilt"
},
{
"name": "Franck Lefevre",
"homepage": "http://rootslabs.net"
},
{
"name": "Mark Baker",
"homepage": "http://markbakeruk.net"
}
],
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PHPExcel",
"keywords": [
"OpenXML",
"excel",
"xlsx"
],
"abandoned": "phpoffice/phpspreadsheet",
"time": "2018-11-22T23:07:24+00:00"
},
{ {
"name": "psr/log", "name": "psr/log",
"version": "1.1.3", "version": "1.1.3",
@ -327,63 +382,6 @@
"source": "https://github.com/php-fig/log/tree/1.1.3" "source": "https://github.com/php-fig/log/tree/1.1.3"
}, },
"time": "2020-03-23T09:12:05+00:00" "time": "2020-03-23T09:12:05+00:00"
},
{
"name": "phpoffice/phpexcel",
"version": "1.8.2",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPExcel.git",
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870",
"reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"php": "^5.2|^7.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "2.*"
},
"type": "library",
"autoload": {
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "http://blog.maartenballiauw.be"
},
{
"name": "Erik Tilt"
},
{
"name": "Franck Lefevre",
"homepage": "http://rootslabs.net"
},
{
"name": "Mark Baker",
"homepage": "http://markbakeruk.net"
}
],
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PHPExcel",
"keywords": [
"OpenXML",
"excel",
"xlsx"
],
"abandoned": "phpoffice/phpspreadsheet",
"time": "2018-11-22T23:07:24+00:00"
}, },
{ {
"name": "restler/framework", "name": "restler/framework",

View File

@ -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

View File

@ -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';

View File

@ -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;
} }
@ -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);

View File

@ -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 = '';
@ -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);

View File

@ -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);
} }

View File

@ -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);

View File

@ -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);
} }

View File

@ -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;

View File

@ -185,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>&nbsp;</th>'; echo '<th>&nbsp;</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>';
@ -227,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>&nbsp;</th>'; echo '<th>&nbsp;</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>';
@ -259,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 {
@ -278,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 {
@ -287,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 {
@ -296,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 {
@ -305,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 {
@ -314,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 {

View File

@ -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');
} }
} }

View File

@ -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)) {

View File

@ -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>';

View File

@ -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");
} }

View File

@ -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

View File

@ -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('&amp;lt', '&amp;gt'), $this->email_from);
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b>, '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_to);
if (!empty($this->email_tocc)) {
$tooltip .= '<br><b>'.$langs->trans('MailCC').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;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);

View File

@ -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>';
} }

View File

@ -1892,11 +1892,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) {
/* /*

View File

@ -4426,7 +4426,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;

View File

@ -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)

View File

@ -1862,11 +1862,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 +2522,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&amp;token='.newToken().'&amp;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&amp;token='.newToken().'&amp;id='.$object->id.'&amp;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.'&amp;action=validate">'.$langs->trans('Validate').'</a>'; print dolGetButtonAction('', $langs->trans('Validate'), 'default', $_SERVER["PHP_SELF"].'?action=validate&amp;token='.newToken().'&amp;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.'&amp;action=modif">'.$langs->trans('Modify').'</a>'; print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?action=modif&amp;token='.newToken().'&amp;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 +2557,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&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddPurchaseOrder").'</a>'; print dolGetButtonAction('', $langs->trans('AddPurchaseOrder'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid, '');
} }
} }
} }
@ -2566,9 +2568,9 @@ if ($action == 'create' && $usercancreate) {
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && $object->getNbOfServicesLines() > 0) { if ($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&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans('AddIntervention').'</a>'; print dolGetButtonAction('', $langs->trans('AddInterventionGR'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;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 +2580,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&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans('AddContract').'</a>'; print dolGetButtonAction('', $langs->trans('AddContract'), 'default', DOL_URL_ROOT.'/contrat/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid, '');
} }
} }
@ -2590,52 +2592,52 @@ if ($action == 'create' && $usercancreate) {
if ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED && ($object->getNbOfProductsLines() > 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { if ($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.'&amp;action=shipped">'.$langs->trans('ClassifyShipped').'</a>'; print dolGetButtonAction('', $langs->trans('ClassifyShipped'), 'default', $_SERVER["PHP_SELF"].'?action=shipped&amp;token='.newToken().'&amp;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&amp;token='.newToken().'&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;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&amp;token='.newToken().'&amp;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&amp;token='.newToken().'&amp;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&amp;token='.newToken().'&amp;id='.$object->id.'&amp;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&amp;token='.newToken().'&amp;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&amp;token='.newToken().'&amp;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);
} }
} }
} }

View File

@ -4637,7 +4637,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++;
} }

View File

@ -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
@ -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>';

View File

@ -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>';
} }
@ -821,7 +840,7 @@ if (!empty($date_start) && !empty($date_stop)) {
} }
print "</tr>\n"; print "</tr>\n";
} }
}
print "</table>"; print "</table>";
print '</div>'; print '</div>';
} }

View File

@ -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">';

View File

@ -866,7 +866,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++;
} }

View File

@ -967,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

View File

@ -737,7 +737,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');
@ -3522,7 +3522,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;
@ -3815,11 +3815,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('', $selectedLines); $objectsrc->printOriginLinesList('', $selectedLines);
print '</table>'; print '</table>';
print '</div>';
} }
print "</form>\n"; print "</form>\n";
@ -4353,8 +4355,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);
@ -5220,7 +5222,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';
@ -5340,13 +5342,13 @@ if ($action == 'create') {
$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 dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=modif', '', true, $params); print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=modif&token='.newToken(), '', true, $params);
} else { } else {
$params['attr']['title'] = $langs->trans('NotEnoughPermissions'); $params['attr']['title'] = $langs->trans('NotEnoughPermissions');
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&amp;action=modif', '', false, $params); 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()) {
$params['attr']['title'] = $langs->trans('NotLastInCycle'); $params['attr']['title'] = $langs->trans('NotLastInCycle');

View File

@ -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
*/ */
@ -501,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;
@ -816,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;
@ -2122,7 +2130,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);
@ -2134,10 +2142,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)) {
@ -2168,7 +2176,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++;
} }

View File

@ -5775,7 +5775,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;

View File

@ -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";

View File

@ -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++;
} }

View File

@ -1798,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;
@ -2137,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);
@ -3196,7 +3204,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();

View File

@ -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';

View File

@ -1275,9 +1275,9 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) {
$model = $objecttmp->model_pdf; $model = $objecttmp->model_pdf;
$ret = $objecttmp->fetch($objecttmp->id); // Reload to get new records $ret = $objecttmp->fetch($objecttmp->id); // Reload to get new records
// To be sure vars is defined // To be sure vars is defined
$hidedetails = !empty($hidedetails) ? $hidedetails : 0; $hidedetails = !empty($hidedetails) ? $hidedetails : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
$hidedesc = !empty($hidedesc) ? $hidedesc : 0; $hidedesc = !empty($hidedesc) ? $hidedesc : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
$hideref = !empty($hideref) ? $hideref : 0; $hideref = !empty($hideref) ? $hideref : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
$moreparams = !empty($moreparams) ? $moreparams : null; $moreparams = !empty($moreparams) ? $moreparams : null;
$result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); $result = $objecttmp->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
@ -1426,13 +1426,13 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) {
// To be sure vars is defined // To be sure vars is defined
if (empty($hidedetails)) { if (empty($hidedetails)) {
$hidedetails = 0; $hidedetails = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0);
} }
if (empty($hidedesc)) { if (empty($hidedesc)) {
$hidedesc = 0; $hidedesc = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0);
} }
if (empty($hideref)) { if (empty($hideref)) {
$hideref = 0; $hideref = (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0);
} }
if (empty($moreparams)) { if (empty($moreparams)) {
$moreparams = null; $moreparams = null;

View File

@ -109,7 +109,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
} }
$subject = ''; $subject = '';
$actionmsg = ''; //$actionmsg = '';
$actionmsg2 = ''; $actionmsg2 = '';
$langs->load('mails'); $langs->load('mails');
@ -317,7 +317,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
if ($action == 'send' || $action == 'relance') { if ($action == 'send' || $action == 'relance') {
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1); $actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1);
if ($message) { /*if ($message) {
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from); $actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto)); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
if ($sendtocc) { if ($sendtocc) {
@ -326,7 +326,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":"); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
$actionmsg = dol_concatdesc($actionmsg, $message); $actionmsg = dol_concatdesc($actionmsg, $message);
} }*/
} }
// Create form object // Create form object
@ -376,7 +376,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
$object->socid = $sendtosocid; // To link to a company $object->socid = $sendtosocid; // To link to a company
$object->sendtoid = $sendtoid; // To link to contact-addresses. This is an array. $object->sendtoid = $sendtoid; // To link to contact-addresses. This is an array.
$object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$object->actionmsg = $actionmsg; // Long text (@todo Replace this with $message, we already have details of email in dedicated properties) $object->actionmsg = $message; // Long text
$object->actionmsg2 = $actionmsg2; // Short text ($langs->transnoentities('MailSentBy')...); $object->actionmsg2 = $actionmsg2; // Short text ($langs->transnoentities('MailSentBy')...);
$object->trackid = $trackid; $object->trackid = $trackid;

View File

@ -131,7 +131,7 @@ class box_birthdays extends ModeleBoxes
} }
if ($num == 0) { if ($num == 0) {
$this->info_box_contents[$line][0] = array('td' => 'class="center opacitymedium"', 'text'=>$langs->trans("None")); $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text' => '<span class="opacitymedium">'.$langs->trans("None").'</span>');
} }
$this->db->free($result); $this->db->free($result);
@ -144,8 +144,8 @@ class box_birthdays extends ModeleBoxes
} }
} else { } else {
$this->info_box_contents[0][0] = array( $this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"', 'td' => 'class="nohover left"',
'text' => $langs->trans("ReadPermissionNotAllowed") 'text' => '<span class="opacitymedium">'.$langs->trans("ReadPermissionNotAllowed").'</span>'
); );
} }
} }

View File

@ -128,7 +128,7 @@ class box_birthdays_members extends ModeleBoxes
} }
if ($num == 0) { if ($num == 0) {
$this->info_box_contents[$line][0] = array('td' => 'class="center opacitymedium"', 'text'=>$langs->trans("None")); $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text' => '<span class="opacitymedium">'.$langs->trans("None").'</span>');
} }
$this->db->free($result); $this->db->free($result);
@ -141,8 +141,8 @@ class box_birthdays_members extends ModeleBoxes
} }
} else { } else {
$this->info_box_contents[0][0] = array( $this->info_box_contents[0][0] = array(
'td' => 'class="nohover opacitymedium left"', 'td' => 'class="nohover left"',
'text' => $langs->trans("ReadPermissionNotAllowed") 'text' => '<span class="opacitymedium">'.$langs->trans("ReadPermissionNotAllowed").'</span>'
); );
} }
} }

View File

@ -150,7 +150,7 @@ class box_graph_product_distribution extends ModeleBoxes
$userid = 0; // No filter on user creation $userid = 0; // No filter on user creation
$WIDTH = ($nbofgraph >= 2 || !empty($conf->dol_optimize_smallscreen)) ? '300' : '320'; $WIDTH = ($nbofgraph >= 2 || !empty($conf->dol_optimize_smallscreen)) ? '300' : '320';
$HEIGHT = '120'; $HEIGHT = '150'; // Height require to have 5+1 entries into legend visible.
if (!empty($conf->propal->enabled) && !empty($user->rights->propale->lire)) { if (!empty($conf->propal->enabled) && !empty($user->rights->propale->lire)) {
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)

View File

@ -15,6 +15,7 @@
* 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) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat> * Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Grégory Blémand <gregory.blemand@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
@ -124,6 +125,12 @@ abstract class CommonObject
*/ */
public $linkedObjects; public $linkedObjects;
/**
* @var boolean is linkedObjects full loaded. Loaded by ->fetchObjectLinked
* important for pdf generation time reduction
*/
public $linkedObjectsFullLoaded = false;
/** /**
* @var Object To store a cloned copy of object before to edit it and keep track of old properties * @var Object To store a cloned copy of object before to edit it and keep track of old properties
*/ */
@ -3774,6 +3781,10 @@ abstract class CommonObject
{ {
global $conf, $hookmanager, $action; global $conf, $hookmanager, $action;
// important for pdf generation time reduction
// this boolean is true if $this->linkedObjects has already been loaded with all objects linked without filter
if ($this->linkedObjectsFullLoaded) return 1;
$this->linkedObjectsIds = array(); $this->linkedObjectsIds = array();
$this->linkedObjects = array(); $this->linkedObjects = array();
@ -3835,6 +3846,9 @@ abstract class CommonObject
} else { } else {
$sql .= "(fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."')"; $sql .= "(fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."')";
$sql .= " ".$clause." (fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."')"; $sql .= " ".$clause." (fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."')";
if ($sourceid == $this->id && $sourcetype == $this->element && $targetid == $this->id && $targettype == $this->element && $clause == 'OR') {
$this->linkedObjectsFullLoaded = true;
}
} }
$sql .= " ORDER BY ".$orderby; $sql .= " ORDER BY ".$orderby;
@ -4025,7 +4039,7 @@ abstract class CommonObject
$this->context['link_source_type'] = $sourcetype; $this->context['link_source_type'] = $sourcetype;
$this->context['link_target_id'] = $targetid; $this->context['link_target_id'] = $targetid;
$this->context['link_target_type'] = $targettype; $this->context['link_target_type'] = $targettype;
$result = $this->call_trigger('OBJECT_LINK_UPDATE', $f_user); $result = $this->call_trigger('OBJECT_LINK_MODIFY', $f_user);
if ($result < 0) { if ($result < 0) {
$error++; $error++;
} }
@ -4949,6 +4963,7 @@ abstract class CommonObject
print '<td class="left">'.$langs->trans('Unit').'</td>'; print '<td class="left">'.$langs->trans('Unit').'</td>';
} }
print '<td class="right">'.$langs->trans('ReductionShort').'</td>'; print '<td class="right">'.$langs->trans('ReductionShort').'</td>';
print '<td class="linecolht right">'.$langs->trans('TotalHT').'</td>';
print '<td class="center">'.$form->showCheckAddButtons('checkforselect', 1).'</td>'; print '<td class="center">'.$form->showCheckAddButtons('checkforselect', 1).'</td>';
print '</tr>'; print '</tr>';
$i = 0; $i = 0;
@ -5079,6 +5094,7 @@ abstract class CommonObject
} }
$this->tpl['price'] = price($line->subprice); $this->tpl['price'] = price($line->subprice);
$this->tpl['total_ht'] = price($line->total_ht);
$this->tpl['multicurrency_price'] = price($line->multicurrency_subprice); $this->tpl['multicurrency_price'] = price($line->multicurrency_subprice);
$this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : '&nbsp;'; $this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : '&nbsp;';
if (!empty($conf->global->PRODUCT_USE_UNITS)) { if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@ -5997,8 +6013,15 @@ abstract class CommonObject
$attributeLabel = $extrafields->attributes[$this->table_element]['label'][$attributeKey]; $attributeLabel = $extrafields->attributes[$this->table_element]['label'][$attributeKey];
$attributeParam = $extrafields->attributes[$this->table_element]['param'][$attributeKey]; $attributeParam = $extrafields->attributes[$this->table_element]['param'][$attributeKey];
$attributeRequired = $extrafields->attributes[$this->table_element]['required'][$attributeKey]; $attributeRequired = $extrafields->attributes[$this->table_element]['required'][$attributeKey];
$attributeUnique = $extrafields->attributes[$this->table_element]['unique'][$attributeKey];
$attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$attributeKey]; $attrfieldcomputed = $extrafields->attributes[$this->table_element]['computed'][$attributeKey];
// If we clone, we have to clean unique extrafields to prevent duplicates.
// This behaviour can be prevented by external code by changing $this->context['createfromclone'] value in createFrom hook
if (! empty($this->context['createfromclone']) && $this->context['createfromclone'] == 'createfromclone' && ! empty($attributeUnique)) {
$new_array_options[$key] = null;
}
// Similar code than into insertExtraFields // Similar code than into insertExtraFields
if ($attributeRequired) { if ($attributeRequired) {
$mandatorypb = false; $mandatorypb = false;

View File

@ -245,7 +245,7 @@ class CoreObject extends CommonObject
$res = $this->updateCommon($user); $res = $this->updateCommon($user);
if ($res) { if ($res) {
$result = $this->call_trigger(strtoupper($this->element).'_UPDATE', $user); $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
if ($result < 0) { if ($result < 0) {
$error++; $error++;
} else { } else {

View File

@ -127,12 +127,12 @@ class Ctyperesource
if (!$error) { if (!$error) {
$this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element); $this->id = $this->db->last_insert_id($this->db->prefix().$this->table_element);
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change CTYPERESOURCE to your own tag if you
// want this action to call a trigger. // want this action to call a trigger.
//if (!$notrigger) { //if (!$notrigger) {
// // Call triggers // // Call triggers
// $result=$this->call_trigger('MYOBJECT_CREATE',$user); // $result=$this->call_trigger('CTYPERESOURCE_CREATE',$user);
// if ($result < 0) $error++; // if ($result < 0) $error++;
// // End call triggers // // End call triggers
//} //}
@ -325,12 +325,12 @@ class Ctyperesource
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
} }
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change CTYPERESOURCE to your own tag if you
// want this action calls a trigger. // want this action calls a trigger.
//if (!$error && !$notrigger) { //if (!$error && !$notrigger) {
// // Call triggers // // Call triggers
// $result=$this->call_trigger('MYOBJECT_MODIFY',$user); // $result=$this->call_trigger('CTYPERESOURCE_MODIFY',$user);
// if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
// // End call triggers // // End call triggers
//} //}
@ -363,12 +363,12 @@ class Ctyperesource
$this->db->begin(); $this->db->begin();
// Uncomment this and change MYOBJECT to your own tag if you // Uncomment this and change CTYPERESOURCE to your own tag if you
// want this action calls a trigger. // want this action calls a trigger.
//if (!$error && !$notrigger) { //if (!$error && !$notrigger) {
// // Call triggers // // Call triggers
// $result=$this->call_trigger('MYOBJECT_DELETE',$user); // $result=$this->call_trigger('CTYPERESOURCE_DELETE',$user);
// if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
// // End call triggers // // End call triggers
//} //}

View File

@ -1161,40 +1161,36 @@ class DolGraph
// Special case for Graph of type 'pie', 'piesemicircle', or 'polar' // Special case for Graph of type 'pie', 'piesemicircle', or 'polar'
if (isset($this->type[$firstlot]) && (in_array($this->type[$firstlot], array('pie', 'polar', 'piesemicircle')))) { if (isset($this->type[$firstlot]) && (in_array($this->type[$firstlot], array('pie', 'polar', 'piesemicircle')))) {
$type = $this->type[$firstlot]; // pie or polar $type = $this->type[$firstlot]; // pie or polar
$this->stringtoshow .= 'var options = {' . "\n"; //$this->stringtoshow .= 'var options = {' . "\n";
$this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, ';
$legendMaxLines = 0; // Does not work $legendMaxLines = 0; // Does not work
/* For Chartjs v2.9 */
if (empty($showlegend)) { if (empty($showlegend)) {
$this->stringtoshow .= 'legend: { display: false }, '; $this->stringtoshow .= 'legend: { display: false }, ';
} else { } else {
$this->stringtoshow .= 'legend: { position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\''; $this->stringtoshow .= 'legend: { labels: { boxWidth: 15 }, position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\'';
if (!empty($legendMaxLines)) { if (!empty($legendMaxLines)) {
$this->stringtoshow .= ', maxLines: ' . $legendMaxLines . ''; $this->stringtoshow .= ', maxLines: ' . $legendMaxLines . '';
} }
/* This has no effect on chartjs version with dol v14
$this->stringtoshow .= ', labels: {
color: \'rgb(255, 0, 0)\',
// This more specific font property overrides the global property
font: {
size: 24
}
}';
*/
$this->stringtoshow .= ' }, ' . "\n"; $this->stringtoshow .= ' }, ' . "\n";
} }
/* This has no effect on chartjs version with dol v14 /* For Chartjs v3.5 */
$this->stringtoshow .= 'plugins: { $this->stringtoshow .= 'plugins: { ';
legend: { if (empty($showlegend)) {
display: true, $this->stringtoshow .= 'legend: { display: false }, ';
labels: { } else {
color: \'rgb(255, 0, 0)\', $this->stringtoshow .= 'legend: { labels: { boxWidth: 15 }, position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\'';
// This more specific font property overrides the global property if (!empty($legendMaxLines)) {
font: { $this->stringtoshow .= ', maxLines: ' . $legendMaxLines . '';
size: 24
} }
$this->stringtoshow .= ' }, ' . "\n";
} }
} $this->stringtoshow .= ' }, ' . "\n";
},'."\n"; */
if ($this->type[$firstlot] == 'piesemicircle') { if ($this->type[$firstlot] == 'piesemicircle') {
$this->stringtoshow .= 'circumference: Math.PI,' . "\n"; $this->stringtoshow .= 'circumference: Math.PI,' . "\n";
@ -1291,24 +1287,37 @@ class DolGraph
$this->stringtoshow .= '});' . "\n"; $this->stringtoshow .= '});' . "\n";
} else { } else {
// Other cases, graph of type 'bars', 'lines', 'linesnopoint' // Other cases, graph of type 'bars', 'lines', 'linesnopoint'
$type = 'bar'; $type = 'bar'; $xaxis = '';
if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') { if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') {
$type = 'bar'; $type = 'bar';
} }
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'horizontalbars') { if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'horizontalbars') {
$type = 'horizontalBar'; $type = 'bar'; $xaxis = "indexAxis: 'y', ";
} }
if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) { if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) {
$type = 'line'; $type = 'line';
} }
$this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, '; $this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, ';
$this->stringtoshow .= $xaxis;
/* For Chartjs v2.9 */
if (empty($showlegend)) { if (empty($showlegend)) {
$this->stringtoshow .= 'legend: { display: false }, '; $this->stringtoshow .= 'legend: { display: false }, '."\n";
} else { } else {
$this->stringtoshow .= 'legend: { position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\' },'; $this->stringtoshow .= 'legend: { maxWidth: '.round($this->width / 2).', labels: { boxWidth: 15 }, position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\' }, '."\n";
} }
/* For Chartjs v3.5 */
$this->stringtoshow .= 'plugins: { '."\n";
if (empty($showlegend)) {
$this->stringtoshow .= 'legend: { display: false }, '."\n";
} else {
$this->stringtoshow .= 'legend: { maxWidth: '.round($this->width / 2).', labels: { boxWidth: 15 }, position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\' },'."\n";
}
$this->stringtoshow .= "}, \n";
$this->stringtoshow .= 'scales: { xAxes: [{ '; $this->stringtoshow .= 'scales: { xAxes: [{ ';
if ($this->hideXValues) { if ($this->hideXValues) {
$this->stringtoshow .= ' ticks: { display: false }, display: true,'; $this->stringtoshow .= ' ticks: { display: false }, display: true,';

View File

@ -3708,7 +3708,6 @@ class Form
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load into cache list of payment terms * Load into cache list of payment terms
@ -7188,7 +7187,7 @@ class Form
* @param int $limit Limit on number of returned lines * @param int $limit Limit on number of returned lines
* @param int $status Ticket status * @param int $status Ticket status
* @param string $selected_input_value Value of preselected input text (for use with ajax) * @param string $selected_input_value Value of preselected input text (for use with ajax)
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon before and placeholder, 3 search icon after)
* @param array $ajaxoptions Options for ajax_autocompleter * @param array $ajaxoptions Options for ajax_autocompleter
* @param int $socid Thirdparty Id (to get also price dedicated to this customer) * @param int $socid Thirdparty Id (to get also price dedicated to this customer)
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text. * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
@ -8864,7 +8863,7 @@ class Form
// Add where from hooks // Add where from hooks
if (is_object($hookmanager)) { if (is_object($hookmanager)) {
$parameters = array(); $parameters = array('showrefnav' => true);
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$object->next_prev_filter .= $hookmanager->resPrint; $object->next_prev_filter .= $hookmanager->resPrint;
} }

View File

@ -60,4 +60,44 @@ class FormCategory extends Form
return $filter; return $filter;
} }
/**
* Prints a select form for products categories
* @param string $selected Id category pre-selection
* @param string $htmlname Name of HTML field
* @param int $showempty Add an empty field
* @return integer|null
*/
public function selectProductCategory($selected = 0, $htmlname = 'product_category_id', $showempty = 0)
{
global $conf;
$sql = "SELECT cp.fk_categorie as cat_index, cat.label FROM `llx_categorie_product` as cp INNER JOIN llx_categorie as cat ON cat.rowid = cp.fk_categorie GROUP BY cp.fk_categorie;";
dol_syslog(get_class($this)."::selectProductCategory", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
print '<select class="flat" id="select_'.$htmlname.'" name="'.$htmlname.'">';
if ($showempty) {
print '<option value="0">&nbsp;</option>';
}
$i = 0;
$num_rows = $this->db->num_rows($resql);
while ($i < $num_rows) {
$category = $this->db->fetch_object($resql);
if ($selected && $selected == $category->cat_index) {
print '<option value="'.$category->cat_index.'" selected>'.$category->label.'</option>';
} else {
print '<option value="'.$category->cat_index.'">'.$category->label.'</option>';
}
$i++;
}
print ('</select>');
return $num_rows;
} else {
dol_print_error($this->db);
}
}
} }

View File

@ -651,12 +651,13 @@ class Utils
* Warning: The command line is sanitize so can't contains any redirection char '>'. Use param $redirectionfile if you need it. * Warning: The command line is sanitize so can't contains any redirection char '>'. Use param $redirectionfile if you need it.
* @param string $outputfile A path for an output file (used only when method is 2). For example: $conf->admin->dir_temp.'/out.tmp'; * @param string $outputfile A path for an output file (used only when method is 2). For example: $conf->admin->dir_temp.'/out.tmp';
* @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method * @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method
* @param string $redirectionfile If defined, a redirection of output to this files is added. * @param string $redirectionfile If defined, a redirection of output to this file is added.
* @param int $noescapecommand 1=Do not escape command. Warning: Using this parameter need you alreay sanitized the command. if not, it will lead to security vulnerability. * @param int $noescapecommand 1=Do not escape command. Warning: Using this parameter need you alreay sanitized the command. if not, it will lead to security vulnerability.
* This parameter is provided for backward compatibility with external modules. Always use 0 in core. * This parameter is provided for backward compatibility with external modules. Always use 0 in core.
* @param string $redirectionfileerr If defined, a redirection of error is added to this file instead of to channel 1.
* @return array array('result'=>...,'output'=>...,'error'=>...). result = 0 means OK. * @return array array('result'=>...,'output'=>...,'error'=>...). result = 0 means OK.
*/ */
public function executeCLI($command, $outputfile, $execmethod = 0, $redirectionfile = null, $noescapecommand = 0) public function executeCLI($command, $outputfile, $execmethod = 0, $redirectionfile = null, $noescapecommand = 0, $redirectionfileerr = null)
{ {
global $conf, $langs; global $conf, $langs;
@ -667,10 +668,17 @@ class Utils
if (empty($noescapecommand)) { if (empty($noescapecommand)) {
$command = escapeshellcmd($command); $command = escapeshellcmd($command);
} }
if ($redirectionfile) { if ($redirectionfile) {
$command .= " > ".dol_sanitizePathName($redirectionfile); $command .= " > ".dol_sanitizePathName($redirectionfile);
} }
if ($redirectionfileerr && ($redirectionfileerr != $redirectionfile)) {
// If we ask a redirect of stderr on a given file not already used for stdout
$command .= " 2> ".dol_sanitizePathName($redirectionfileerr);
} else {
$command .= " 2>&1"; $command .= " 2>&1";
}
if (!empty($conf->global->MAIN_EXEC_USE_POPEN)) { if (!empty($conf->global->MAIN_EXEC_USE_POPEN)) {
$execmethod = $conf->global->MAIN_EXEC_USE_POPEN; $execmethod = $conf->global->MAIN_EXEC_USE_POPEN;
@ -679,7 +687,7 @@ class Utils
$execmethod = 1; $execmethod = 1;
} }
//$execmethod=1; //$execmethod=1;
dol_syslog("Utils::executeCLI execmethod=".$execmethod." system:".$command, LOG_DEBUG); dol_syslog("Utils::executeCLI execmethod=".$execmethod." command=".$command, LOG_DEBUG);
$output_arr = array(); $output_arr = array();
if ($execmethod == 1) { if ($execmethod == 1) {

View File

@ -0,0 +1,63 @@
<?php
if (empty($keyforclass) || empty($keyforclassfile) || empty($keyforelement)) {
//print $keyforclass.' - '.$keyforclassfile.' - '.$keyforelement;
dol_print_error('', 'include of file commonfieldsinimport.inc.php was done but var $keyforclass or $keyforclassfile or $keyforelement was not set');
exit;
}
if (empty($keyforalias)) {
$keyforalias = 't';
}
dol_include_once($keyforclassfile);
if (class_exists($keyforclass)) {
$tmpobject = new $keyforclass($this->db);
// Add common fields
foreach ($tmpobject->fields as $keyfield => $valuefield) {
$fieldname = $keyforalias.'.'.$keyfield;
$fieldlabel = ucfirst($valuefield['label']);
$typeFilter = "Text";
$typefield = preg_replace('/\(.*$/', '', $valuefield['type']); // double(24,8) -> double
switch ($typefield) {
case 'int':
case 'integer':
case 'double':
case 'price':
$typeFilter = "Numeric";
break;
case 'date':
case 'datetime':
case 'timestamp':
$typeFilter = "Date";
break;
case 'boolean':
$typeFilter = "Boolean";
break;
/*
* case 'sellist':
* $tmp='';
* $tmpparam=jsonOrUnserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null
* if ($tmpparam['options'] && is_array($tmpparam['options'])) {
* $tmpkeys=array_keys($tmpparam['options']);
* $tmp=array_shift($tmpkeys);
* }
* if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp;
* break;
*/
}
$helpfield = '';
if (!empty($valuefield['help'])) {
$helpfield = preg_replace('/\(.*$/', '', $valuefield['help']);
}
if ($valuefield['enabled']) {
$this->import_fields_array[$r][$fieldname] = $fieldlabel;
$this->import_TypeFields_array[$r][$fieldname] = $typeFilter;
$this->import_entities_array[$r][$fieldname] = $keyforelement;
$this->import_help_array[$r][$fieldname] = $helpfield;
}
}
} else {
dol_print_error($this->db, 'Failed to find class '.$keyforclass.', even after the include of '.$keyforclassfile);
}
// End add common fields

View File

@ -96,6 +96,17 @@ abstract class DoliDB implements Database
return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)'; return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)';
} }
/**
* Return SQL string to force an index
*
* @param string $nameofindex Name of index
* @return string SQL string
*/
public function hintindex($nameofindex)
{
return '';
}
/** /**
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
* Function to use to build INSERT, UPDATE or WHERE predica * Function to use to build INSERT, UPDATE or WHERE predica
@ -106,7 +117,7 @@ abstract class DoliDB implements Database
*/ */
public function idate($param, $gm = 'tzserver') public function idate($param, $gm = 'tzserver')
{ {
// TODO $param should be gmt, so we should add $gm to 'gmt' instead of default 'tzserver' // TODO $param should be gmt, so we should have default $gm to 'gmt' instead of default 'tzserver'
return dol_print_date($param, "%Y-%m-%d %H:%M:%S", $gm); return dol_print_date($param, "%Y-%m-%d %H:%M:%S", $gm);
} }

View File

@ -168,6 +168,18 @@ class DoliDBMysqli extends DoliDB
} }
/**
* Return SQL string to force an index
*
* @param string $nameofindex Name of index
* @return string SQL string
*/
public function hintindex($nameofindex)
{
return " FORCE INDEX(".preg_replace('/[^a-z0-9_]/', '', $nameofindex).")";
}
/** /**
* Convert a SQL request in Mysql syntax to native syntax * Convert a SQL request in Mysql syntax to native syntax
* *
@ -180,6 +192,7 @@ class DoliDBMysqli extends DoliDB
return $line; return $line;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Select a database * Select a database

View File

@ -12,7 +12,7 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) {
// Add extra fields // Add extra fields
$sql = "SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields"; $sql = "SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields";
$sql .= " WHERE elementtype = '".$this->db->escape($keyforselect)."' AND type != 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC'; $sql .= " WHERE elementtype = '".$this->db->escape($keyforselect)."' AND type <> 'separate' AND entity IN (0, ".((int) $conf->entity).') ORDER BY pos ASC';
//print $sql; //print $sql;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example) if ($resql) { // This can fail when class is used on old database (during migration for example)

View File

@ -0,0 +1,75 @@
<?php
// $keyforselect = name of main table
// keyforelement = name of picto
// $keyforaliasextra = a key to avoid conflict with extrafields of other objects
if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) {
//print $keyforselet.' - '.$keyforelement.' - '.$keyforaliasextra;
dol_print_error('', 'include of file extrafieldsinimport.inc.php was done but var $keyforselect or $keyforelement or $keyforaliasextra was not set');
exit;
}
// Add extra fields
$sql = "SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields";
$sql .= " WHERE elementtype = '".$this->db->escape($keyforselect)."' AND type <> 'separate' AND entity IN (0, ".((int) $conf->entity).') ORDER BY pos ASC';
//print $sql;
$resql = $this->db->query($sql);
if ($resql) { // This can fail when class is used on old database (during migration for example)
while ($obj = $this->db->fetch_object($resql)) {
$fieldname = $keyforaliasextra.'.'.$obj->name;
$fieldlabel = ucfirst($obj->label);
$typeFilter = "Text";
$typefield = preg_replace('/\(.*$/', '', $obj->type); // double(24,8) -> double
switch ($typefield) {
case 'int':
case 'integer':
case 'double':
case 'price':
$typeFilter = "Numeric";
break;
case 'date':
case 'datetime':
case 'timestamp':
$typeFilter = "Date";
break;
case 'boolean':
$typeFilter = "Boolean";
break;
case 'checkbox':
case 'select':
if (!empty($conf->global->EXPORT_LABEL_FOR_SELECT)) {
$tmpparam = jsonOrUnserialize($obj->param); // $tmpparam may be array with 'options' = array(key1=>val1, key2=>val2 ...)
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
$typeFilter = "Select:".$obj->param;
}
}
break;
case 'sellist':
$tmp = '';
$tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) {
$tmpkeys = array_keys($tmpparam['options']);
$tmp = array_shift($tmpkeys);
}
if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) {
$typeFilter = "List:".$tmp;
}
break;
}
if ($obj->type != 'separate') {
// If not a computed field
if (empty($obj->fieldcomputed)) {
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
$this->import_TypeFields_array[$r][$fieldname] = $typeFilter;
$this->import_entities_array[$r][$fieldname] = $keyforelement;
} else {
// If this is a computed field
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
$this->import_TypeFields_array[$r][$fieldname] = $typeFilter.'Compute';
$this->import_entities_array[$r][$fieldname] = $keyforelement;
}
}
}
}
// End add axtra fields

View File

@ -42,6 +42,8 @@
function societe_prepare_head(Societe $object) function societe_prepare_head(Societe $object)
{ {
global $db, $langs, $conf, $user; global $db, $langs, $conf, $user;
global $hookmanager;
$h = 0; $h = 0;
$head = array(); $head = array();
@ -64,7 +66,15 @@ function societe_prepare_head(Societe $object)
} else { } else {
$sql = "SELECT COUNT(p.rowid) as nb"; $sql = "SELECT COUNT(p.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
// Add table from hooks
$parameters = array('contacttab' => true);
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " WHERE p.fk_soc = ".((int) $object->id); $sql .= " WHERE p.fk_soc = ".((int) $object->id);
// Add where from hooks
$parameters = array('contacttab' => true);
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -170,7 +180,7 @@ function societe_prepare_head(Societe $object)
// Related items // Related items
if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) if ((!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->ficheinter->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))
&& empty($conf->global->THIRPARTIES_DISABLE_RELATED_OBJECT_TAB)) { && empty($conf->global->THIRDPARTIES_DISABLE_RELATED_OBJECT_TAB)) {
$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Referers"); $head[$h][1] = $langs->trans("Referers");
$head[$h][2] = 'consumption'; $head[$h][2] = 'consumption';

View File

@ -2083,13 +2083,20 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
*/ */
function dol_uncompress($inputfile, $outputdir) function dol_uncompress($inputfile, $outputdir)
{ {
global $conf, $langs; global $conf, $langs, $db;
$fileinfo = pathinfo($inputfile);
$fileinfo["extension"] = strtolower($fileinfo["extension"]);
if ($fileinfo["extension"] == "zip") {
if (defined('ODTPHP_PATHTOPCLZIP') && empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_UNCOMPRESS)) { if (defined('ODTPHP_PATHTOPCLZIP') && empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_UNCOMPRESS)) {
dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir); dol_syslog("Constant ODTPHP_PATHTOPCLZIP for pclzip library is set to ".ODTPHP_PATHTOPCLZIP.", so we use Pclzip to unzip into ".$outputdir);
include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php'; include_once ODTPHP_PATHTOPCLZIP.'/pclzip.lib.php';
$archive = new PclZip($inputfile); $archive = new PclZip($inputfile);
// We create output dir manually, so it uses the correct permission (When created by the archive->extract, dir is rwx for everybody).
dol_mkdir(dol_sanitizePathName($outputdir));
// Extract into outputdir, but only files that match the regex '/^((?!\.\.).)*$/' that means "does not include .." // Extract into outputdir, but only files that match the regex '/^((?!\.\.).)*$/' that means "does not include .."
$result = $archive->extract(PCLZIP_OPT_PATH, $outputdir, PCLZIP_OPT_BY_PREG, '/^((?!\.\.).)*$/'); $result = $archive->extract(PCLZIP_OPT_PATH, $outputdir, PCLZIP_OPT_BY_PREG, '/^((?!\.\.).)*$/');
@ -2142,6 +2149,49 @@ function dol_uncompress($inputfile, $outputdir)
} }
return array('error'=>'ErrNoZipEngine'); return array('error'=>'ErrNoZipEngine');
} elseif (in_array($fileinfo["extension"], array('gz', 'bz2', 'zst'))) {
include_once DOL_DOCUMENT_ROOT."/core/class/utils.class.php";
$utils = new Utils($db);
dol_mkdir(dol_sanitizePathName($outputdir));
$outputfilename = escapeshellcmd(dol_sanitizePathName($outputdir).'/'.dol_sanitizeFileName($fileinfo["filename"]));
dol_delete_file($outputfilename.'.tmp');
dol_delete_file($outputfilename.'.err');
$extension = strtolower(pathinfo($fileinfo["filename"], PATHINFO_EXTENSION));
if ($extension == "tar") {
$cmd = 'tar -C '.escapeshellcmd(dol_sanitizePathName($outputdir)).' -xvf '.escapeshellcmd(dol_sanitizePathName($fileinfo["dirname"]).'/'.dol_sanitizeFileName($fileinfo["basename"]));
$resarray = $utils->executeCLI($cmd, $outputfilename.'.tmp', 0, $outputfilename.'.err', 0);
if ($resarray["result"] != 0) {
$resarray["error"] .= file_get_contents($outputfilename.'.err');
}
} else {
$program = "";
if ($fileinfo["extension"] == "gz") {
$program = 'gzip';
} elseif ($fileinfo["extension"] == "bz2") {
$program = 'bzip2';
} elseif ($fileinfo["extension"] == "zst") {
$program = 'zstd';
} else {
return array('error'=>'ErrorBadFileExtension');
}
$cmd = $program.' -dc '.escapeshellcmd(dol_sanitizePathName($fileinfo["dirname"]).'/'.dol_sanitizeFileName($fileinfo["basename"]));
$cmd .= ' > '.$outputfilename;
$resarray = $utils->executeCLI($cmd, $outputfilename.'.tmp', 0, null, 1, $outputfilename.'.err');
if ($resarray["result"] != 0) {
$errfilecontent = @file_get_contents($outputfilename.'.err');
if ($errfilecontent) {
$resarray["error"] .= " - ".$errfilecontent;
}
}
}
return $resarray["result"] != 0 ? array('error' => $resarray["error"]) : array();
}
return array('error'=>'ErrorBadFileExtension');
} }

View File

@ -590,6 +590,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
break; break;
} }
// Before PHP8, img was a resource, With PHP8, it is a GdImage
if (!is_resource($img) && !($img instanceof \GdImage)) { if (!is_resource($img) && !($img instanceof \GdImage)) {
dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING); dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING);
return 0; return 0;

View File

@ -546,7 +546,7 @@ function getNumberInvoicesPieChart($mode)
,array($langs->trans('InvoiceNotLate15Days'), $obj->nbnotlate15 - $obj->nbnotlate30) ,array($langs->trans('InvoiceNotLate15Days'), $obj->nbnotlate15 - $obj->nbnotlate30)
,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30)); ,array($langs->trans('InvoiceNotLate30Days'), $obj->nbnotlate30));
*/ */
$dataseries[$i]=array($langs->trans('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30); $dataseries[$i]=array($langs->transnoentitiesnoconv('NbOfOpenInvoices'), $obj->nblate30, $obj->nblate15 - $obj->nblate30, $obj->nblatenow - $obj->nblate15, $obj->nbnotlatenow - $obj->nbnotlate15, $obj->nbnotlate15 - $obj->nbnotlate30, $obj->nbnotlate30);
$i++; $i++;
} }
if (!empty($dataseries[0])) { if (!empty($dataseries[0])) {

View File

@ -507,7 +507,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
} }
// BorderTableActive // BorderTableActive
/* Disabled because not supported by md theme
if ($foruserprofile) { if ($foruserprofile) {
} else { } else {
$default = $langs->trans('No'); $default = $langs->trans('No');
@ -525,7 +524,6 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
*/
// Background color THEME_ELDY_BACKBODY // Background color THEME_ELDY_BACKBODY
if ($foruserprofile) { if ($foruserprofile) {

View File

@ -176,7 +176,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode
* @param string $type Type of barcode (EAN, ISBN, ...) * @param string $type Type of barcode (EAN, ISBN, ...)
* @return string Value if OK, '' if module not configured, <0 if KO * @return string Value if OK, '' if module not configured, <0 if KO
*/ */
public function getNextValue($objproduct = null, $type = '') public function getNextValue($objproduct, $type = '')
{ {
global $db, $conf; global $db, $conf;

View File

@ -355,7 +355,12 @@ class pdf_strato extends ModelePDFContract
$desc = dol_htmlentitiesbr($objectligne->desc, 1); // Desc (not empty for free lines) $desc = dol_htmlentitiesbr($objectligne->desc, 1); // Desc (not empty for free lines)
$txt = ''; $txt = '';
$txt .= $outputlangs->transnoentities("Quantity").' : <strong>'.$objectligne->qty.'</strong> - '.$outputlangs->transnoentities("UnitPrice").' : <strong>'.price($objectligne->subprice).'</strong>'; // Desc (not empty for free lines) if (empty($conf->global->CONTRACT_HIDE_QTY_ON_PDF)) {
$txt .= $outputlangs->transnoentities("Quantity") . ' : <strong>' . $objectligne->qty . '</strong>';
}
if (empty($conf->global->CONTRACT_HIDE_PRICE_ON_PDF)) {
$txt .= ' - ' . $outputlangs->transnoentities("UnitPrice") . ' : <strong>' . price($objectligne->subprice) . '</strong>';
}
if (empty($conf->global->CONTRACT_HIDE_PLANNED_DATE_ON_PDF)) { if (empty($conf->global->CONTRACT_HIDE_PLANNED_DATE_ON_PDF)) {
$txt .= '<br>'; $txt .= '<br>';
$txt .= $outputlangs->transnoentities("DateStartPlannedShort")." : <strong>".$datei."</strong> - ".$outputlangs->transnoentities("DateEndPlanned")." : <strong>".$datee.'</strong>'; $txt .= $outputlangs->transnoentities("DateStartPlannedShort")." : <strong>".$datei."</strong> - ".$outputlangs->transnoentities("DateEndPlanned")." : <strong>".$datee.'</strong>';

View File

@ -150,7 +150,7 @@ class mod_facture_mars extends ModeleNumRefFactures
* @param Societe $objsoc Object third party * @param Societe $objsoc Object third party
* @param Facture $invoice Object invoice * @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string Value * @return string Value if OK, 0 if KO
*/ */
public function getNextValue($objsoc, $invoice, $mode = 'next') public function getNextValue($objsoc, $invoice, $mode = 'next')
{ {

View File

@ -185,7 +185,7 @@ class mod_facture_terre extends ModeleNumRefFactures
* @param Societe $objsoc Object third party * @param Societe $objsoc Object third party
* @param Facture $invoice Object invoice * @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string Next ref value or last ref if $mode is 'last' * @return string Next ref value or last ref if $mode is 'last', <= 0 if KO
*/ */
public function getNextValue($objsoc, $invoice, $mode = 'next') public function getNextValue($objsoc, $invoice, $mode = 'next')
{ {
@ -259,6 +259,8 @@ class mod_facture_terre extends ModeleNumRefFactures
} else { } else {
dol_print_error('', 'Bad parameter for getNextValue'); dol_print_error('', 'Bad parameter for getNextValue');
} }
return 0;
} }
/** /**

View File

@ -132,10 +132,11 @@ abstract class ModeleNumRefFactures
* Renvoi prochaine valeur attribuee * Renvoi prochaine valeur attribuee
* *
* @param Societe $objsoc Objet societe * @param Societe $objsoc Objet societe
* @param Facture $facture Objet facture * @param Facture $invoice Objet facture
* @param string $mode 'next' for next value or 'last' for last value
* @return string Value * @return string Value
*/ */
public function getNextValue($objsoc, $facture) public function getNextValue($objsoc, $invoice, $mode = 'next')
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");

View File

@ -122,9 +122,11 @@ abstract class ModeleNumRefFicheinter
/** /**
* Return the next assigned value * Return the next assigned value
* *
* @return string Value * @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO
*/ */
public function getNextValue() public function getNextValue($objsoc = 0, $object = '')
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");

View File

@ -117,11 +117,11 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
/** /**
* Return next value * Return next value
* *
* @param Societe $user user object * @param Societe $objsoc third party object
* @param Object $holiday holiday object * @param Object $holiday holiday object
* @return string Value if OK, 0 if KO * @return string Value if OK, 0 if KO
*/ */
public function getNextValue($user, $holiday) public function getNextValue($objsoc, $holiday)
{ {
global $db, $conf; global $db, $conf;
@ -134,7 +134,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
return 0; return 0;
} }
$numFinal = get_next_value($db, $mask, 'holiday', 'ref', '', $user, $holiday->date_create); $numFinal = get_next_value($db, $mask, 'holiday', 'ref', '', $objsoc, $holiday->date_create);
return $numFinal; return $numFinal;
} }

View File

@ -126,10 +126,10 @@ class ModelNumRefHolidays
* Return next value * Return next value
* *
* @param Societe $objsoc third party object * @param Societe $objsoc third party object
* @param Object $contract contract object * @param Object $holiday Holiday object
* @return string Value * @return string Value if OK, 0 if KO
*/ */
public function getNextValue($objsoc, $contract) public function getNextValue($objsoc, $holiday)
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");

View File

@ -324,7 +324,8 @@ class ImportCsv extends ModeleImports
//dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid); //dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid);
//var_dump($array_match_file_to_database); //var_dump($array_match_file_to_database);
//var_dump($arrayrecord); //var_dump($arrayrecord); exit;
$array_match_database_to_file = array_flip($array_match_file_to_database); $array_match_database_to_file = array_flip($array_match_file_to_database);
$sort_array_match_file_to_database = $array_match_file_to_database; $sort_array_match_file_to_database = $array_match_file_to_database;
ksort($sort_array_match_file_to_database); ksort($sort_array_match_file_to_database);
@ -367,12 +368,15 @@ class ImportCsv extends ModeleImports
//dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); //dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]);
} }
// array of fields to column index // Define array to convert fields ('c.ref', ...) into column index (1, ...)
$arrayfield = array(); $arrayfield = array();
foreach ($sort_array_match_file_to_database as $key => $val) { foreach ($sort_array_match_file_to_database as $key => $val) {
$arrayfield[$val] = ($key - 1); $arrayfield[$val] = ($key - 1);
} }
// $arrayrecord start at key 0
// $sort_array_match_file_to_database start at key 1
// Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom) // Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom)
foreach ($sort_array_match_file_to_database as $key => $val) { foreach ($sort_array_match_file_to_database as $key => $val) {
$fieldalias = preg_replace('/\..*$/i', '', $val); $fieldalias = preg_replace('/\..*$/i', '', $val);
@ -595,9 +599,24 @@ class ImportCsv extends ModeleImports
if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) { if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) {
require_once DOL_DOCUMENT_ROOT.$pathModForNumber; require_once DOL_DOCUMENT_ROOT.$pathModForNumber;
$modForNumber = new $classModForNumber; $modForNumber = new $classModForNumber;
$defaultref = $modForNumber->getNextValue(null, null);
$tmpobject = null;
// Set the object when we can
if (!empty($objimport->array_import_convertvalue[0][$val]['classobject'])) {
$pathForObject = $objimport->array_import_convertvalue[0][$val]['pathobject'];
require_once DOL_DOCUMENT_ROOT.$pathForObject;
$tmpclassobject = $objimport->array_import_convertvalue[0][$val]['classobject'];
$tmpobject = new $tmpclassobject($this->db);
foreach ($arrayfield as $tmpkey => $tmpval) { // $arrayfield is array('c.ref'=>0, ...)
if (in_array($tmpkey, array('t.date', 'c.date_commande'))) {
$tmpobject->date = dol_stringtotime($arrayrecord[$arrayfield[$tmpkey]]['val'], 1);
} }
if (is_numeric($defaultref) && $defaultref <= 0) { }
}
$defaultref = $modForNumber->getNextValue(null, $tmpobject);
}
if (is_numeric($defaultref) && $defaultref <= 0) { // If error
$defaultref = ''; $defaultref = '';
} }
$newval = $defaultref; $newval = $defaultref;

View File

@ -367,7 +367,8 @@ class ImportXlsx extends ModeleImports
//dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid); //dol_syslog("import_csv.modules maxfields=".$maxfields." importid=".$importid);
//var_dump($array_match_file_to_database); //var_dump($array_match_file_to_database);
//var_dump($arrayrecord); //var_dump($arrayrecord); exit;
$array_match_database_to_file = array_flip($array_match_file_to_database); $array_match_database_to_file = array_flip($array_match_file_to_database);
$sort_array_match_file_to_database = $array_match_file_to_database; $sort_array_match_file_to_database = $array_match_file_to_database;
ksort($sort_array_match_file_to_database); ksort($sort_array_match_file_to_database);
@ -410,12 +411,15 @@ class ImportXlsx extends ModeleImports
//dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); //dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]);
} }
// array of fields to column index // Define array to convert fields ('c.ref', ...) into column index (1, ...)
$arrayfield = array(); $arrayfield = array();
foreach ($sort_array_match_file_to_database as $key => $val) { foreach ($sort_array_match_file_to_database as $key => $val) {
$arrayfield[$val] = ($key - 1); $arrayfield[$val] = ($key);
} }
// $arrayrecord start at key 1
// $sort_array_match_file_to_database start at key 1
// Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom) // Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom)
foreach ($sort_array_match_file_to_database as $key => $val) { foreach ($sort_array_match_file_to_database as $key => $val) {
$fieldalias = preg_replace('/\..*$/i', '', $val); $fieldalias = preg_replace('/\..*$/i', '', $val);
@ -619,7 +623,7 @@ class ImportXlsx extends ModeleImports
$this->thirpartyobject->get_codecompta('supplier'); $this->thirpartyobject->get_codecompta('supplier');
$newval = $this->thirpartyobject->code_compta_fournisseur; $newval = $this->thirpartyobject->code_compta_fournisseur;
if (empty($newval)) { if (empty($newval)) {
$arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
} }
//print 'code_compta_fournisseur='.$newval; //print 'code_compta_fournisseur='.$newval;
} }
@ -636,9 +640,24 @@ class ImportXlsx extends ModeleImports
if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) { if (!empty($classModForNumber) && !empty($pathModForNumber) && is_readable(DOL_DOCUMENT_ROOT.$pathModForNumber)) {
require_once DOL_DOCUMENT_ROOT.$pathModForNumber; require_once DOL_DOCUMENT_ROOT.$pathModForNumber;
$modForNumber = new $classModForNumber; $modForNumber = new $classModForNumber;
$defaultref = $modForNumber->getNextValue(null, null);
$tmpobject = null;
// Set the object with the date property when we can
if (!empty($objimport->array_import_convertvalue[0][$val]['classobject'])) {
$pathForObject = $objimport->array_import_convertvalue[0][$val]['pathobject'];
require_once DOL_DOCUMENT_ROOT.$pathForObject;
$tmpclassobject = $objimport->array_import_convertvalue[0][$val]['classobject'];
$tmpobject = new $tmpclassobject($this->db);
foreach ($arrayfield as $tmpkey => $tmpval) { // $arrayfield is array('c.ref'=>1, ...)
if (in_array($tmpkey, array('t.date', 'c.date_commande'))) {
$tmpobject->date = dol_stringtotime($arrayrecord[$arrayfield[$tmpkey]]['val'], 1);
} }
if (is_numeric($defaultref) && $defaultref <= 0) { }
}
$defaultref = $modForNumber->getNextValue(null, $tmpobject);
}
if (is_numeric($defaultref) && $defaultref <= 0) { // If error
$defaultref = ''; $defaultref = '';
} }
$newval = $defaultref; $newval = $defaultref;

View File

@ -196,10 +196,10 @@ class modCommande extends DolibarrModules
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'd.nom'=>'State', 'co.label'=>'Country', 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'd.nom'=>'State', 'co.label'=>'Country',
'co.code'=>"CountryCode", 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", 'co.code'=>"CountryCode", 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id",
'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation", 'c.date_commande'=>"OrderDate", 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", 'c.fk_soc'=>"IdCompany", 'c.date_creation'=>"DateCreation", 'c.date_commande'=>"OrderDate",
'c.date_livraison'=>"DateDeliveryPlanned", 'c.amount_ht'=>"Amount", 'c.remise_percent'=>"GlobalDiscount", 'c.total_ht'=>"TotalHT", 'c.date_livraison'=>"DateDeliveryPlanned", 'c.amount_ht'=>"Amount", 'c.total_ht'=>"TotalHT",
'c.total_ttc'=>"TotalTTC", 'c.facture'=>"Billed", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.date_livraison'=>'DeliveryDate', 'c.total_ttc'=>"TotalTTC", 'c.facture'=>"Billed", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.date_livraison'=>'DeliveryDate',
'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin',
'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.label'=>"Label", 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct', 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct',
'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC", 'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC",
'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel' 'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel'
); );
@ -220,7 +220,7 @@ class modCommande extends DolibarrModules
//$this->export_TypeFields_array[$r]=array( //$this->export_TypeFields_array[$r]=array(
// 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label', // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.label'=>'List:c_country:label:label',
// 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text", // 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",
// 'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric", // 'c.date_creation'=>"Date",'c.date_commande'=>"Date",'c.amount_ht'=>"Numeric",'c.total_ht'=>"Numeric",
// 'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text", // 'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','cd.description'=>"Text",
// 'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric", // 'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",
// 'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text' // 'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text'
@ -228,7 +228,7 @@ class modCommande extends DolibarrModules
$this->export_TypeFields_array[$r] = array( $this->export_TypeFields_array[$r] = array(
's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text', 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.label'=>'List:c_country:label:label', 'co.code'=>'Text', 's.phone'=>'Text',
's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.date_creation'=>"Date", 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.date_creation'=>"Date",
'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'c.amount_ht'=>"Numeric", 'c.remise_percent'=>"Numeric", 'c.total_ht'=>"Numeric", 'c.date_commande'=>"Date", 'c.date_livraison'=>"Date", 'c.amount_ht'=>"Numeric", 'c.total_ht'=>"Numeric",
'c.total_ttc'=>"Numeric", 'c.facture'=>"Boolean", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date', 'pj.ref'=>'Text', 'c.total_ttc'=>"Numeric", 'c.facture'=>"Boolean", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date', 'pj.ref'=>'Text',
'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", 'cd.total_tva'=>"Numeric", 'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", 'cd.total_tva'=>"Numeric",
'cd.total_ttc'=>"Numeric", 'p.rowid'=>'List:product:ref::product', 'p.ref'=>'Text', 'p.label'=>'Text', 'd.nom'=>'Text', 'cd.total_ttc'=>"Numeric", 'p.rowid'=>'List:product:ref::product', 'p.ref'=>'Text', 'p.label'=>'Text', 'd.nom'=>'Text',
@ -238,8 +238,8 @@ class modCommande extends DolibarrModules
's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company', 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company',
'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"order", 'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"order",
'c.ref'=>"order", 'c.ref_client'=>"order", 'c.fk_soc'=>"order", 'c.date_creation'=>"order", 'c.date_commande'=>"order", 'c.amount_ht'=>"order", 'c.ref'=>"order", 'c.ref_client'=>"order", 'c.fk_soc'=>"order", 'c.date_creation'=>"order", 'c.date_commande'=>"order", 'c.amount_ht'=>"order",
'c.remise_percent'=>"order", 'c.total_ht'=>"order", 'c.total_ttc'=>"order", 'c.facture'=>"order", 'c.fk_statut'=>"order", 'c.note'=>"order", 'c.total_ht'=>"order", 'c.total_ttc'=>"order", 'c.facture'=>"order", 'c.fk_statut'=>"order", 'c.note'=>"order",
'c.date_livraison'=>"order", 'pj.ref'=>'project', 'cd.rowid'=>'order_line', 'cd.label'=>"order_line", 'cd.description'=>"order_line", 'c.date_livraison'=>"order", 'pj.ref'=>'project', 'cd.rowid'=>'order_line', 'cd.description'=>"order_line",
'cd.product_type'=>'order_line', 'cd.tva_tx'=>"order_line", 'cd.qty'=>"order_line", 'cd.total_ht'=>"order_line", 'cd.total_tva'=>"order_line", 'cd.product_type'=>'order_line', 'cd.tva_tx'=>"order_line", 'cd.qty'=>"order_line", 'cd.total_ht'=>"order_line", 'cd.total_tva'=>"order_line",
'cd.total_ttc'=>"order_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product' 'cd.total_ttc'=>"order_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'
); );
@ -296,18 +296,17 @@ class modCommande extends DolibarrModules
$this->import_entities_array[$r] = array(); $this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = array('c' => MAIN_DB_PREFIX.'commande', 'extra' => MAIN_DB_PREFIX.'commande_extrafields'); $this->import_tables_array[$r] = array('c' => MAIN_DB_PREFIX.'commande', 'extra' => MAIN_DB_PREFIX.'commande_extrafields');
$this->import_tables_creator_array[$r] = array('c' => 'fk_user_author'); // Fields to store import user id $this->import_tables_creator_array[$r] = array('c' => 'fk_user_author'); // Fields to store import user id
$import_sample = array();
$this->import_fields_array[$r] = array( $this->import_fields_array[$r] = array(
'c.ref' => 'Ref*', 'c.ref' => 'Ref*',
'c.ref_client' => 'RefCustomer', 'c.ref_client' => 'RefCustomer',
'c.fk_soc' => 'ThirdPartyName*', 'c.fk_soc' => 'ThirdPartyName*',
'c.fk_projet' => 'ProjectId', 'c.fk_projet' => 'ProjectId',
'c.date_creation' => 'DateCreation', 'c.date_creation' => 'DateCreation',
'c.date_valid' => 'DateValid', 'c.date_valid' => 'DateValidation',
'c.date_commande' => 'DateOrder', 'c.date_commande' => 'OrderDate*',
'c.fk_user_modif' => 'ModifiedById', 'c.fk_user_modif' => 'ModifiedById',
'c.fk_user_valid' => 'ValidatedById', 'c.fk_user_valid' => 'ValidatedById',
'c.fk_statut' => 'Status*',
'c.remise_percent' => 'GlobalDiscount',
'c.total_tva' => 'TotalTVA', 'c.total_tva' => 'TotalTVA',
'c.total_ht' => 'TotalHT', 'c.total_ht' => 'TotalHT',
'c.total_ttc' => 'TotalTTC', 'c.total_ttc' => 'TotalTTC',
@ -317,7 +316,8 @@ class modCommande extends DolibarrModules
'c.date_livraison' => 'DeliveryDate', 'c.date_livraison' => 'DeliveryDate',
'c.fk_cond_reglement' => 'Payment Condition', 'c.fk_cond_reglement' => 'Payment Condition',
'c.fk_mode_reglement' => 'Payment Mode', 'c.fk_mode_reglement' => 'Payment Mode',
'c.model_pdf' => 'Model' 'c.model_pdf' => 'Model',
'c.fk_statut' => 'Status*'
); );
if (!empty($conf->multicurrency->enabled)) { if (!empty($conf->multicurrency->enabled)) {
@ -327,51 +327,48 @@ class modCommande extends DolibarrModules
$this->import_fields_array[$r]['c.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; $this->import_fields_array[$r]['c.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
$this->import_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; $this->import_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
} }
// Add extra fields
$import_extrafield_sample = array(); $import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commande' AND entity IN (0, ".$conf->entity.")"; $keyforselect = 'commande';
$resql = $this->db->query($sql); $keyforelement = 'order';
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php';
if ($resql) { $this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande');
while ($obj = $this->db->fetch_object($resql)) { $this->import_regex_array[$r] = array(
$fieldname = 'extra.'.$obj->name;
$fieldlabel = ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
$import_extrafield_sample[$fieldname] = $fieldlabel;
}
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande'];
$this->import_regex_array[$r] = [
'c.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency' 'c.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'
]; );
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = ['c.ref' => 'Ref']; $this->import_updatekeys_array[$r] = array('c.ref' => 'Ref');
$this->import_convertvalue_array[$r] = [ $this->import_convertvalue_array[$r] = array(
'c.fk_soc' => [ 'c.ref' => array(
'rule'=>'getrefifauto',
'class'=>(empty($conf->global->COMMANDE_ADDON) ? 'mod_commande_marbre' : $conf->global->COMMANDE_ADDON),
'path'=>"/core/modules/commande/".(empty($conf->global->COMMANDE_ADDON) ? 'mod_commande_marbre' : $conf->global->COMMANDE_ADDON).'.php',
'classobject'=>'Commande',
'pathobject'=>'/commande/class/commande.class.php',
),
'c.fk_soc' => array(
'rule' => 'fetchidfromref', 'rule' => 'fetchidfromref',
'file' => '/societe/class/societe.class.php', 'file' => '/societe/class/societe.class.php',
'class' => 'Societe', 'class' => 'Societe',
'method' => 'fetch', 'method' => 'fetch',
'element' => 'ThirdParty' 'element' => 'ThirdParty'
], ),
'c.fk_user_valid' => [ 'c.fk_user_valid' => array(
'rule' => 'fetchidfromref', 'rule' => 'fetchidfromref',
'file' => '/user/class/user.class.php', 'file' => '/user/class/user.class.php',
'class' => 'User', 'class' => 'User',
'method' => 'fetch', 'method' => 'fetch',
'element' => 'user' 'element' => 'user'
], ),
'c.fk_mode_reglement' => [ 'c.fk_mode_reglement' => array(
'rule' => 'fetchidfromcodeorlabel', 'rule' => 'fetchidfromcodeorlabel',
'file' => '/compta/paiement/class/cpaiement.class.php', 'file' => '/compta/paiement/class/cpaiement.class.php',
'class' => 'Cpaiement', 'class' => 'Cpaiement',
'method' => 'fetch', 'method' => 'fetch',
'element' => 'cpayment' 'element' => 'cpayment'
], ),
]; );
//Import CPV Lines //Import CPV Lines
$r++; $r++;
@ -381,15 +378,13 @@ class modCommande extends DolibarrModules
$this->import_entities_array[$r] = array(); $this->import_entities_array[$r] = array();
$this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commandedet', 'extra' => MAIN_DB_PREFIX.'commandedet_extrafields'); $this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commandedet', 'extra' => MAIN_DB_PREFIX.'commandedet_extrafields');
$this->import_fields_array[$r] = array( $this->import_fields_array[$r] = array(
'cd.fk_commande' => 'SalesOrder*', 'cd.fk_commande' => 'CustomerOrder*',
'cd.fk_parent_line' => 'PrParentLine', 'cd.fk_parent_line' => 'ParentLine',
'cd.fk_product' => 'IdProduct', 'cd.fk_product' => 'IdProduct',
'cd.label' => 'Label',
'cd.description' => 'LineDescription', 'cd.description' => 'LineDescription',
'cd.tva_tx' => 'LineVATRate', 'cd.tva_tx' => 'LineVATRate',
'cd.qty' => 'LineQty', 'cd.qty' => 'LineQty',
'cd.remise_percent' => 'Reduc. Percent', 'cd.remise_percent' => 'Reduc. Percent',
'cd.remise' => 'Reduc.',
'cd.price' => 'Price', 'cd.price' => 'Price',
'cd.subprice' => 'Sub Price', 'cd.subprice' => 'Sub Price',
'cd.total_ht' => 'LineTotalHT', 'cd.total_ht' => 'LineTotalHT',
@ -410,17 +405,11 @@ class modCommande extends DolibarrModules
$this->import_fields_array[$r]['cd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; $this->import_fields_array[$r]['cd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
} }
// Add extra fields $import_extrafield_sample = array();
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type <> 'separate' AND elementtype = 'commandedet' AND entity IN (0, ".$conf->entity.")"; $keyforselect = 'commandedet';
$resql = $this->db->query($sql); $keyforelement = 'orderline';
if ($resql) { $keyforaliasextra = 'extra';
while ($obj = $this->db->fetch_object($resql)) { include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php';
$fieldname = 'extra.'.$obj->name;
$fieldlabel = ucfirst($obj->label);
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
}
}
// End add extra fields
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commandedet']; $this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commandedet'];
$this->import_regex_array[$r] = [ $this->import_regex_array[$r] = [

View File

@ -113,7 +113,7 @@ class modFacture extends DolibarrModules
$datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']);
$this->cronjobs = array( $this->cronjobs = array(
0 => array( 0 => array(
'label'=>'RecurringInvoices', 'label'=>'RecurringInvoicesJob',
'jobtype'=>'method', 'jobtype'=>'method',
'class'=>'compta/facture/class/facture-rec.class.php', 'class'=>'compta/facture/class/facture-rec.class.php',
'objectname'=>'FactureRec', 'objectname'=>'FactureRec',
@ -122,7 +122,7 @@ class modFacture extends DolibarrModules
'comment'=>'Generate recurring invoices', 'comment'=>'Generate recurring invoices',
'frequency'=>1, 'frequency'=>1,
'unitfrequency'=>3600 * 24, 'unitfrequency'=>3600 * 24,
'priority'=>50, 'priority'=>51,
'status'=>1, 'status'=>1,
'test'=>'$conf->facture->enabled', 'test'=>'$conf->facture->enabled',
'datestart'=>$datestart 'datestart'=>$datestart
@ -276,7 +276,7 @@ class modFacture extends DolibarrModules
'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.close_code'=>'Text', 'f.close_note'=>'Text', 'f.total_ht'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.total_tva'=>"Numeric", 'f.localtax1'=>'Numeric', 'f.localtax2'=>'Numeric', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric', 'f.close_code'=>'Text', 'f.close_note'=>'Text',
'none.rest'=>"NumericCompute", 'none.rest'=>"NumericCompute",
'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text', 'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text',
'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.label'=>'Text', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric", 'pj.ref'=>'Text', 'pj.title'=>'Text', 'fd.rowid'=>'Numeric', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric",
'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_tva'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date", 'fd.qty'=>"Numeric", 'fd.total_ht'=>"Numeric", 'fd.total_tva'=>"Numeric", 'fd.total_ttc'=>"Numeric", 'fd.date_start'=>"Date", 'fd.date_end'=>"Date",
'fd.special_code'=>'Numeric', 'fd.product_type'=>"Numeric", 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text', 'fd.special_code'=>'Numeric', 'fd.product_type'=>"Numeric", 'fd.fk_product'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text',
$alias_product_perentity . '.accountancy_code_sell'=>'Text', $alias_product_perentity . '.accountancy_code_sell'=>'Text',
@ -289,7 +289,7 @@ class modFacture extends DolibarrModules
$this->export_entities_array[$r] = array( $this->export_entities_array[$r] = array(
's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company', 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.code_client'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'c.code'=>'company', 'cd.nom'=>'company', 's.phone'=>'company',
's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company',
's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>'invoice_line', 'fd.label'=>"invoice_line", 'fd.description'=>"invoice_line", 's.tva_intra'=>'company', 'pj.ref'=>'project', 'pj.title'=>'project', 'fd.rowid'=>'invoice_line', 'fd.description'=>"invoice_line",
'fd.subprice'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_tva'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva_tx'=>"invoice_line", 'fd.subprice'=>"invoice_line", 'fd.total_ht'=>"invoice_line", 'fd.total_tva'=>"invoice_line", 'fd.total_ttc'=>"invoice_line", 'fd.tva_tx'=>"invoice_line",
'fd.qty'=>"invoice_line", 'fd.date_start'=>"invoice_line", 'fd.date_end'=>"invoice_line", 'fd.special_code'=>'invoice_line', 'fd.qty'=>"invoice_line", 'fd.date_start'=>"invoice_line", 'fd.date_end'=>"invoice_line", 'fd.special_code'=>'invoice_line',
'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product', 'p.ref'=>'product', 'p.label'=>'product', $alias_product_perentity . '.accountancy_code_sell'=>'product', 'fd.product_type'=>'invoice_line', 'fd.fk_product'=>'product', 'p.ref'=>'product', 'p.label'=>'product', $alias_product_perentity . '.accountancy_code_sell'=>'product',

View File

@ -133,7 +133,7 @@ class modFournisseur extends DolibarrModules
$datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']);
$this->cronjobs = array( $this->cronjobs = array(
0 => array( 0 => array(
'label'=>'RecurringSupplierInvoices', 'label'=>'RecurringSupplierInvoicesJob',
'jobtype'=>'method', 'jobtype'=>'method',
'class'=>'fourn/class/fournisseur.facture-rec.class.php', 'class'=>'fourn/class/fournisseur.facture-rec.class.php',
'objectname'=>'FactureFournisseurRec', 'objectname'=>'FactureFournisseurRec',
@ -142,7 +142,7 @@ class modFournisseur extends DolibarrModules
'comment'=>'Generate recurring supplier invoices', 'comment'=>'Generate recurring supplier invoices',
'frequency'=>1, 'frequency'=>1,
'unitfrequency'=>3600 * 24, 'unitfrequency'=>3600 * 24,
'priority'=>50, 'priority'=>51,
'status'=>1, 'status'=>1,
'datestart'=>$datestart 'datestart'=>$datestart
)); ));
@ -612,7 +612,13 @@ class modFournisseur extends DolibarrModules
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = array('f.ref' => 'Ref'); $this->import_updatekeys_array[$r] = array('f.ref' => 'Ref');
$this->import_convertvalue_array[$r] = array( $this->import_convertvalue_array[$r] = array(
//'c.ref'=>array('rule'=>'getrefifauto'), 'f.ref' => array(
'rule'=>'getrefifauto',
'class'=>(empty($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER) ? 'mod_facture_fournisseur_cactus' : $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER),
'path'=>"/core/modules/supplier_invoice/".(empty($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER) ? 'mod_facture_fournisseur_cactus' : $conf->global->INVOICE_SUPPLIER_ADDON_NUMBER).'.php',
'classobject'=>'FactureFournisseur',
'pathobject'=>'/fourn/class/fournisseur.facture.class.php',
),
'f.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'), 'f.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'),
'f.fk_account' => array('rule' => 'fetchidfromref', 'file' => '/compta/bank/class/account.class.php', 'class' => 'Account', 'method' => 'fetch', 'element' => 'bank_account'), 'f.fk_account' => array('rule' => 'fetchidfromref', 'file' => '/compta/bank/class/account.class.php', 'class' => 'Account', 'method' => 'fetch', 'element' => 'bank_account'),
); );
@ -626,9 +632,8 @@ class modFournisseur extends DolibarrModules
$this->import_tables_array[$r] = array('fd' => MAIN_DB_PREFIX.'facture_fourn_det', 'extra' => MAIN_DB_PREFIX.'facture_fourn_det_extrafields'); $this->import_tables_array[$r] = array('fd' => MAIN_DB_PREFIX.'facture_fourn_det', 'extra' => MAIN_DB_PREFIX.'facture_fourn_det_extrafields');
$this->import_fields_array[$r] = array( $this->import_fields_array[$r] = array(
'fd.fk_facture_fourn' => 'InvoiceRef*', 'fd.fk_facture_fourn' => 'InvoiceRef*',
'fd.fk_parent_line' => 'FacParentLine', 'fd.fk_parent_line' => 'ParentLine',
'fd.fk_product' => 'IdProduct', 'fd.fk_product' => 'IdProduct',
'fd.label' => 'Label',
'fd.description' => 'LineDescription', 'fd.description' => 'LineDescription',
'fd.pu_ht' => 'PriceUHT', 'fd.pu_ht' => 'PriceUHT',
'fd.pu_ttc' => 'PriceUTTC', 'fd.pu_ttc' => 'PriceUTTC',
@ -670,7 +675,6 @@ class modFournisseur extends DolibarrModules
'fd.fk_facture_fourn' => '(PROV001)', 'fd.fk_facture_fourn' => '(PROV001)',
'fd.fk_parent_line' => '', 'fd.fk_parent_line' => '',
'fd.fk_product' => '', 'fd.fk_product' => '',
'fd.label' => '',
'fd.description' => 'Test Product', 'fd.description' => 'Test Product',
'fd.pu_ht' => '50000', 'fd.pu_ht' => '50000',
'fd.pu_ttc' => '50000', 'fd.pu_ttc' => '50000',
@ -720,7 +724,6 @@ class modFournisseur extends DolibarrModules
'c.source' => 'Source', 'c.source' => 'Source',
'c.fk_statut' => 'Status*', 'c.fk_statut' => 'Status*',
'c.billed' => 'Billed(0/1)', 'c.billed' => 'Billed(0/1)',
'c.remise_percent' => 'GlobalDiscount',
'c.total_tva' => 'TotalTVA', 'c.total_tva' => 'TotalTVA',
'c.total_ht' => 'TotalHT', 'c.total_ht' => 'TotalHT',
'c.total_ttc' => 'TotalTTC', 'c.total_ttc' => 'TotalTTC',
@ -762,6 +765,13 @@ class modFournisseur extends DolibarrModules
$this->import_updatekeys_array[$r] = array('c.ref' => 'Ref'); $this->import_updatekeys_array[$r] = array('c.ref' => 'Ref');
$this->import_convertvalue_array[$r] = array( $this->import_convertvalue_array[$r] = array(
'c.ref' => array(
'rule'=>'getrefifauto',
'class'=>(empty($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER) ? 'mod_commande_fournisseur_muguet' : $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER),
'path'=>"/core/modules/supplier_order/".(empty($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER) ? 'mod_commande_fournisseur_muguet' : $conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER).'.php',
'classobject'=>'CommandeFournisseur',
'pathobject'=>'/fourn/class/fournisseur.commande.class.php',
),
'c.fk_soc' => array( 'c.fk_soc' => array(
'rule' => 'fetchidfromref', 'rule' => 'fetchidfromref',
'file' => '/societe/class/societe.class.php', 'file' => '/societe/class/societe.class.php',
@ -788,14 +798,12 @@ class modFournisseur extends DolibarrModules
$this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commande_fournisseurdet', 'extra' => MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields'); $this->import_tables_array[$r] = array('cd' => MAIN_DB_PREFIX.'commande_fournisseurdet', 'extra' => MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields');
$this->import_fields_array[$r] = array( $this->import_fields_array[$r] = array(
'cd.fk_commande' => 'PurchaseOrder*', 'cd.fk_commande' => 'PurchaseOrder*',
'cd.fk_parent_line' => 'PrParentLine', 'cd.fk_parent_line' => 'ParentLine',
'cd.fk_product' => 'IdProduct', 'cd.fk_product' => 'IdProduct',
'cd.label' => 'Label',
'cd.description' => 'LineDescription', 'cd.description' => 'LineDescription',
'cd.tva_tx' => 'LineVATRate', 'cd.tva_tx' => 'LineVATRate',
'cd.qty' => 'LineQty', 'cd.qty' => 'LineQty',
'cd.remise_percent' => 'Reduc. Percent', 'cd.remise_percent' => 'Reduc. Percent',
'cd.remise' => 'Reduc.',
'cd.subprice' => 'Sub Price', 'cd.subprice' => 'Sub Price',
'cd.total_ht' => 'LineTotalHT', 'cd.total_ht' => 'LineTotalHT',
'cd.total_tva' => 'LineTotalVAT', 'cd.total_tva' => 'LineTotalVAT',

View File

@ -214,28 +214,28 @@ class modHRM extends DolibarrModules
$r++; $r++;
// Evaluation // Evaluation
$this->rights[$r][0] = 4020; // Permission id (must not be already used) $this->rights[$r][0] = 4021; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read evaluations'; // Permission label $this->rights[$r][1] = 'Read evaluations'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation'; $this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->read) $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->read)
$r++; $r++;
$this->rights[$r][0] = 4021; // Permission id (must not be already used) $this->rights[$r][0] = 4022; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/modify your evaluation'; // Permission label $this->rights[$r][1] = 'Create/modify your evaluation'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation'; $this->rights[$r][4] = 'evaluation';
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->write) $this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->write)
$r++; $r++;
$this->rights[$r][0] = 4022; // Permission id (must not be already used) $this->rights[$r][0] = 4023; // Permission id (must not be already used)
$this->rights[$r][1] = 'Validate evaluation'; // Permission label $this->rights[$r][1] = 'Validate evaluation'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation_advance'; $this->rights[$r][4] = 'evaluation_advance';
$this->rights[$r][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->validate) $this->rights[$r][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->hrm->evaluation->validate)
$r++; $r++;
$this->rights[$r][0] = 4023; // Permission id (must not be already used) $this->rights[$r][0] = 4025; // Permission id (must not be already used)
$this->rights[$r][1] = 'Delete evaluations'; // Permission label $this->rights[$r][1] = 'Delete evaluations'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'evaluation'; $this->rights[$r][4] = 'evaluation';
@ -243,12 +243,28 @@ class modHRM extends DolibarrModules
$r++; $r++;
// Comparison // Comparison
$this->rights[$r][0] = 4030; // Permission id (must not be already used) $this->rights[$r][0] = 4028; // Permission id (must not be already used)
$this->rights[$r][1] = 'See comparison menu'; // Permission label $this->rights[$r][1] = 'See comparison menu'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'compare_advance'; $this->rights[$r][4] = 'compare_advance';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read) $this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->compare_advance->read)
$r++; $r++;
// Read employee
$this->rights[$r][0] = 4031; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read personal information'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'read_personal_information';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->hrm->read_personal_information->read)
$r++;
// Write employee
$this->rights[$r][0] = 4032; // Permission id (must not be already used)
$this->rights[$r][1] = 'Write personal information'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'write_personal_information';
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->hrm->write_personal_information->write)
$r++;
} }
/** /**

View File

@ -182,6 +182,13 @@ class modOpenSurvey extends DolibarrModules
*/ */
public function init($options = '') public function init($options = '')
{ {
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'opensurvey');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}
// Permissions // Permissions
$this->remove($options); $this->remove($options);

View File

@ -190,10 +190,10 @@ class modPropale extends DolibarrModules
$this->export_fields_array[$r] = array( $this->export_fields_array[$r] = array(
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'co.code'=>'CountryCode', 's.phone'=>'Phone', 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 'ps.nom'=>'ParentCompany', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'co.code'=>'CountryCode', 's.phone'=>'Phone',
's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer", 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 'c.rowid'=>"Id", 'c.ref'=>"Ref", 'c.ref_client'=>"RefCustomer",
'c.fk_soc'=>"IdCompany", 'c.datec'=>"DateCreation", 'c.datep'=>"DatePropal", 'c.fin_validite'=>"DateEndPropal", 'c.remise_percent'=>"GlobalDiscount", 'c.fk_soc'=>"IdCompany", 'c.datec'=>"DateCreation", 'c.datep'=>"DatePropal", 'c.fin_validite'=>"DateEndPropal",
'c.total_ht'=>"TotalHT", 'c.total_ttc'=>"TotalTTC", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.date_livraison'=>'DeliveryDate', 'c.total_ht'=>"TotalHT", 'c.total_ttc'=>"TotalTTC", 'c.fk_statut'=>'Status', 'c.note_public'=>"Note", 'c.date_livraison'=>'DeliveryDate',
'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin', 'c.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin', 'c.fk_user_valid'=>'ValidatedById', 'uv.login'=>'ValidatedByLogin',
'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.label'=>"Label", 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct', 'pj.ref'=>'ProjectRef', 'cd.rowid'=>'LineId', 'cd.description'=>"LineDescription", 'cd.product_type'=>'TypeOfLineServiceOrProduct',
'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC", 'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC",
'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel' 'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel'
); );
@ -214,14 +214,14 @@ class modPropale extends DolibarrModules
//$this->export_TypeFields_array[$r]=array( //$this->export_TypeFields_array[$r]=array(
// 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text', // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','co.code'=>'Text','s.phone'=>'Text',
// 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date", // 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','c.ref'=>"Text",'c.ref_client'=>"Text",'c.datec'=>"Date",'c.datep'=>"Date",
// 'c.fin_validite'=>"Date",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text", // 'c.fin_validite'=>"Date",'c.total_ht'=>"Numeric",'c.total_ttc'=>"Numeric",'c.fk_statut'=>'Status','c.note_public'=>"Text",
// 'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric", // 'c.date_livraison'=>'Date','cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",
// 'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text' // 'cd.total_tva'=>"Numeric",'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text'
//); //);
$this->export_TypeFields_array[$r] = array( $this->export_TypeFields_array[$r] = array(
's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.nom'=>'Text', 'ps.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text',
's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.datec'=>"Date", 'c.datep'=>"Date", 'c.fin_validite'=>"Date", 's.ape'=>'Text', 's.idprof4'=>'Text', 'c.ref'=>"Text", 'c.ref_client'=>"Text", 'c.datec'=>"Date", 'c.datep'=>"Date", 'c.fin_validite'=>"Date",
'c.remise_percent'=>"Numeric", 'c.total_ht'=>"Numeric", 'c.total_ttc'=>"Numeric", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date', 'c.total_ht'=>"Numeric", 'c.total_ttc'=>"Numeric", 'c.fk_statut'=>'Status', 'c.note_public'=>"Text", 'c.date_livraison'=>'Date',
'pj.ref'=>'Text', 'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric", 'pj.ref'=>'Text', 'cd.description'=>"Text", 'cd.product_type'=>'Boolean', 'cd.tva_tx'=>"Numeric", 'cd.qty'=>"Numeric", 'cd.total_ht'=>"Numeric",
'cd.total_tva'=>"Numeric", 'cd.total_ttc'=>"Numeric", 'p.ref'=>'Text', 'p.label'=>'Text', 'cd.total_tva'=>"Numeric", 'cd.total_ttc'=>"Numeric", 'p.ref'=>'Text', 'p.label'=>'Text',
'c.entity'=>'List:entity:label:rowid', 'c.entity'=>'List:entity:label:rowid',
@ -229,9 +229,9 @@ class modPropale extends DolibarrModules
$this->export_entities_array[$r] = array( $this->export_entities_array[$r] = array(
's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'co.code'=>'company', 's.phone'=>'company', 's.rowid'=>"company", 's.nom'=>'company', 'ps.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'co.code'=>'company', 's.phone'=>'company',
's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"propal", 'c.ref'=>"propal", 'c.ref_client'=>"propal", 's.siren'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.siret'=>'company', 'c.rowid'=>"propal", 'c.ref'=>"propal", 'c.ref_client'=>"propal",
'c.fk_soc'=>"propal", 'c.datec'=>"propal", 'c.datep'=>"propal", 'c.fin_validite'=>"propal", 'c.remise_percent'=>"propal", 'c.total_ht'=>"propal", 'c.fk_soc'=>"propal", 'c.datec'=>"propal", 'c.datep'=>"propal", 'c.fin_validite'=>"propal", 'c.total_ht'=>"propal",
'c.total_ttc'=>"propal", 'c.fk_statut'=>"propal", 'c.note_public'=>"propal", 'c.date_livraison'=>"propal", 'pj.ref'=>'project', 'cd.rowid'=>'propal_line', 'c.total_ttc'=>"propal", 'c.fk_statut'=>"propal", 'c.note_public'=>"propal", 'c.date_livraison'=>"propal", 'pj.ref'=>'project', 'cd.rowid'=>'propal_line',
'cd.label'=>"propal_line", 'cd.description'=>"propal_line", 'cd.product_type'=>'propal_line', 'cd.tva_tx'=>"propal_line", 'cd.qty'=>"propal_line", 'cd.description'=>"propal_line", 'cd.product_type'=>'propal_line', 'cd.tva_tx'=>"propal_line", 'cd.qty'=>"propal_line",
'cd.total_ht'=>"propal_line", 'cd.total_tva'=>"propal_line", 'cd.total_ttc'=>"propal_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product' 'cd.total_ht'=>"propal_line", 'cd.total_tva'=>"propal_line", 'cd.total_ttc'=>"propal_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'
); );
$this->export_dependencies_array[$r] = array('propal_line'=>'cd.rowid', 'product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them $this->export_dependencies_array[$r] = array('propal_line'=>'cd.rowid', 'product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
@ -293,7 +293,6 @@ class modPropale extends DolibarrModules
'c.datec' => 'DateCreation', 'c.datec' => 'DateCreation',
'c.datep' => 'DatePropal', 'c.datep' => 'DatePropal',
'c.fin_validite' => 'DateEndPropal', 'c.fin_validite' => 'DateEndPropal',
'c.remise_percent' => 'GlobalDiscount',
'c.total_ht' => 'TotalHT', 'c.total_ht' => 'TotalHT',
'c.total_ttc' => 'TotalTTC', 'c.total_ttc' => 'TotalTTC',
'c.fk_statut' => 'Status*', 'c.fk_statut' => 'Status*',
@ -330,7 +329,6 @@ class modPropale extends DolibarrModules
'c.datec' => '2020-01-01', 'c.datec' => '2020-01-01',
'c.datep' => '2020-01-01', 'c.datep' => '2020-01-01',
'c.fin_validite' => '2020-01-01', 'c.fin_validite' => '2020-01-01',
'c.remise_percent' => '',
'c.total_ht' => '0', 'c.total_ht' => '0',
'c.total_ttc' => '0', 'c.total_ttc' => '0',
'c.fk_statut' => '1', 'c.fk_statut' => '1',
@ -344,16 +342,23 @@ class modPropale extends DolibarrModules
'c.multicurrency_total_ttc' => '0' 'c.multicurrency_total_ttc' => '0'
]; ];
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = ['c.ref'=>'Ref']; $this->import_updatekeys_array[$r] = array('c.ref'=>'Ref');
$this->import_convertvalue_array[$r] = [ $this->import_convertvalue_array[$r] = array(
'c.fk_soc' => [ 'c.ref' => array(
'rule'=>'getrefifauto',
'class'=>(empty($conf->global->PROPALE_ADDON) ? 'mod_propale_marbre' : $conf->global->PROPALE_ADDON),
'path'=>"/core/modules/propale/".(empty($conf->global->PROPALE_ADDON) ? 'mod_propale_marbre' : $conf->global->PROPALE_ADDON).'.php',
'classobject'=>'Propal',
'pathobject'=>'/comm/propal/class/propal.class.php',
),
'c.fk_soc' => array(
'rule' => 'fetchidfromref', 'rule' => 'fetchidfromref',
'file' => '/societe/class/societe.class.php', 'file' => '/societe/class/societe.class.php',
'class' => 'Societe', 'class' => 'Societe',
'method' => 'fetch', 'method' => 'fetch',
'element' => 'ThirdParty' 'element' => 'ThirdParty'
] )
]; );
//Import Proposal Lines //Import Proposal Lines
$r++; $r++;
@ -367,15 +372,13 @@ class modPropale extends DolibarrModules
); );
$this->import_fields_array[$r] = array( $this->import_fields_array[$r] = array(
'cd.fk_propal' => 'Proposal*', 'cd.fk_propal' => 'Proposal*',
'cd.fk_parent_line' => 'PrParentLine', 'cd.fk_parent_line' => 'ParentLine',
'cd.fk_product' => 'IdProduct', 'cd.fk_product' => 'IdProduct',
'cd.label' => 'Label',
'cd.description' => 'LineDescription', 'cd.description' => 'LineDescription',
'cd.product_type' => 'TypeOfLineServiceOrProduct', 'cd.product_type' => 'TypeOfLineServiceOrProduct',
'cd.tva_tx' => 'LineVATRate', 'cd.tva_tx' => 'LineVATRate',
'cd.qty' => 'LineQty', 'cd.qty' => 'LineQty',
'cd.remise_percent' => 'Reduc. Percent', 'cd.remise_percent' => 'Reduc. Percent',
'cd.remise' => 'Reduc.',
'cd.price' => 'Price', 'cd.price' => 'Price',
'cd.subprice' => 'Sub Price', 'cd.subprice' => 'Sub Price',
'cd.total_ht' => 'LineTotalHT', 'cd.total_ht' => 'LineTotalHT',
@ -411,13 +414,11 @@ class modPropale extends DolibarrModules
'cd.fk_propal' => 'PROV(0001)', 'cd.fk_propal' => 'PROV(0001)',
'cd.fk_parent_line' => '', 'cd.fk_parent_line' => '',
'cd.fk_product' => '', 'cd.fk_product' => '',
'cd.label' => '',
'cd.description' => 'Line description', 'cd.description' => 'Line description',
'cd.product_type' => '1', 'cd.product_type' => '1',
'cd.tva_tx' => '0', 'cd.tva_tx' => '0',
'cd.qty' => '2', 'cd.qty' => '2',
'cd.remise_percent' => '0', 'cd.remise_percent' => '0',
'cd.remise' => '0',
'cd.price' => '', 'cd.price' => '',
'cd.subprice' => '5000', 'cd.subprice' => '5000',
'cd.total_ht' => '10000', 'cd.total_ht' => '10000',

View File

@ -111,6 +111,7 @@ class modTicket extends DolibarrModules
5 => array('TICKET_DELAY_BEFORE_FIRST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time before a first answer to a ticket (in hours). Display a warning in tickets list if not respected.', 0), 5 => array('TICKET_DELAY_BEFORE_FIRST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time before a first answer to a ticket (in hours). Display a warning in tickets list if not respected.', 0),
6 => array('TICKET_DELAY_SINCE_LAST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time between two answers on the same ticket (in hours). Display a warning in tickets list if not respected.', 0), 6 => array('TICKET_DELAY_SINCE_LAST_RESPONSE', 'chaine', '0', 'Maximum wanted elapsed time between two answers on the same ticket (in hours). Display a warning in tickets list if not respected.', 0),
7 => array('TICKET_NOTIFY_AT_CLOSING', 'chaine', '0', 'Default notify contacts when closing a module', 0), 7 => array('TICKET_NOTIFY_AT_CLOSING', 'chaine', '0', 'Default notify contacts when closing a module', 0),
8 => array('TICKET_PRODUCT_CATEGORY', 'chaine', 0, 'The category of product that is being used for ticket accounting', 0)
); );

View File

@ -93,7 +93,10 @@ class modWorkflow extends DolibarrModules
6=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 0, 'current', 0), 6=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 0, 'current', 0),
7=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 0, 'current', 0), 7=>array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 0, 'current', 0),
8=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0), 8=>array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0),
9=>array('WORKFLOW_BILL_ON_RECEPTION', 'chaine', '1', 'WORKFLOW_BILL_ON_RECEPTION', 0, 'current', 0) 9=>array('WORKFLOW_BILL_ON_RECEPTION', 'chaine', '1', 'WORKFLOW_BILL_ON_RECEPTION', 0, 'current', 0),
10=>array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0),
11=>array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0),
11=>array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '1', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0)
); );
// Boxes // Boxes

View File

@ -128,7 +128,7 @@ class mod_lot_advanced extends ModeleNumRefBatch
/** /**
* Return next free value * Return next free value
* *
* @param Societe $objsoc Object Societe * @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for * @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO * @return string Value if KO, <0 if KO
*/ */

View File

@ -93,11 +93,11 @@ class mod_lot_free extends ModeleNumRefBatch
/** /**
* Return an example of result returned by getNextValue * Return an example of result returned by getNextValue
* *
* @param product $objproduct Object product * @param Societe $objsoc Object thirdparty
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @param Object $object Object we need next value for
* @return string Return next value * @return string Return next value
*/ */
public function getNextValue($objproduct = 0, $type = -1) public function getNextValue($objsoc, $object)
{ {
global $langs; global $langs;
return ''; return '';

View File

@ -111,11 +111,11 @@ class mod_lot_standard extends ModeleNumRefBatch
/** /**
* Return next free value * Return next free value
* *
* @param Product $objprod Object product * @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for * @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO * @return string Value if KO, <0 if KO
*/ */
public function getNextValue($objprod, $object) public function getNextValue($objsoc, $object)
{ {
global $db, $conf; global $db, $conf;

View File

@ -128,11 +128,11 @@ class mod_sn_advanced extends ModeleNumRefBatch
/** /**
* Return next free value * Return next free value
* *
* @param Product $objprod Object product * @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for * @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO * @return string Value if KO, <0 if KO
*/ */
public function getNextValue($objprod, $object) public function getNextValue($objsoc, $object)
{ {
global $db, $conf; global $db, $conf;

View File

@ -92,11 +92,11 @@ class mod_sn_free extends ModeleNumRefBatch
/** /**
* Return an example of result returned by getNextValue * Return an example of result returned by getNextValue
* *
* @param product $objproduct Object product * @param Societe $objsoc Object thirdparty
* @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) * @param Object $object Object we need next value for
* @return string Return next value * @return string Return next value
*/ */
public function getNextValue($objproduct = 0, $type = -1) public function getNextValue($objsoc, $object)
{ {
global $langs; global $langs;
return ''; return '';

View File

@ -111,7 +111,7 @@ class mod_sn_standard extends ModeleNumRefBatch
/** /**
* Return next free value * Return next free value
* *
* @param Societe $objsoc Object product * @param Societe $objsoc Object thirdparty
* @param Object $object Object we need next value for * @param Object $object Object we need next value for
* @return string Value if KO, <0 if KO * @return string Value if KO, <0 if KO
*/ */

View File

@ -96,10 +96,10 @@ class mod_reception_beryl extends ModelNumRefReception
* Return next value * Return next value
* *
* @param Societe $objsoc Third party object * @param Societe $objsoc Third party object
* @param Object $shipment Shipment object * @param Object $reception Reception object
* @return string Value if OK, 0 if KO * @return string Value if OK, 0 if KO
*/ */
public function getNextValue($objsoc, $shipment) public function getNextValue($objsoc, $reception)
{ {
global $db, $conf; global $db, $conf;

View File

@ -110,10 +110,10 @@ abstract class ModelNumRefReception
* Returns next value assigned * Returns next value assigned
* *
* @param Societe $objsoc Third party object * @param Societe $objsoc Third party object
* @param Object $shipment Shipment object * @param Object $reception Reception object
* @return string Value * @return string Value
*/ */
public function getNextValue($objsoc, $shipment) public function getNextValue($objsoc, $reception)
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");

View File

@ -120,7 +120,7 @@ abstract class ModeleNumRefSuppliersInvoices
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string Value if OK, 0 if KO * @return string Value if OK, 0 if KO
*/ */
public function getNextValue($objsoc, $object, $mode) public function getNextValue($objsoc, $object, $mode = 'next')
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");

View File

@ -120,9 +120,11 @@ abstract class ModeleNumRefSuppliersOrders
/** Returns next value assigned /** Returns next value assigned
* *
* @param Societe $objsoc Object third party
* @param Object $object Object
* @return string Valeur * @return string Valeur
*/ */
public function getNextValue() public function getNextValue($objsoc = 0, $object = '')
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");

View File

@ -121,7 +121,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
* Return next value * Return next value
* *
* @param Societe $objsoc Object third party * @param Societe $objsoc Object third party
* @param Propal $supplier_proposal Object commercial proposal * @param SupplierProposal $supplier_proposal Object commercial proposal
* @return string Next value * @return string Next value
*/ */
public function getNextValue($objsoc, $supplier_proposal) public function getNextValue($objsoc, $supplier_proposal)

View File

@ -121,7 +121,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal
* Return next value * Return next value
* *
* @param Societe $objsoc Object third party * @param Societe $objsoc Object third party
* @param Propal $supplier_proposal Object supplier_proposal * @param SupplierProposal $supplier_proposal Object commercial proposal
* @return string Value if OK, 0 if KO * @return string Value if OK, 0 if KO
*/ */
public function getNextValue($objsoc, $supplier_proposal) public function getNextValue($objsoc, $supplier_proposal)

View File

@ -125,10 +125,10 @@ abstract class ModeleNumRefSupplierProposal
* Renvoi prochaine valeur attribuee * Renvoi prochaine valeur attribuee
* *
* @param Societe $objsoc Object third party * @param Societe $objsoc Object third party
* @param Propal $propal Object commercial proposal * @param SupplierProposal $supplier_proposal Object commercial proposal
* @return string Valeur * @return string Valeur
*/ */
public function getNextValue($objsoc, $propal) public function getNextValue($objsoc, $supplier_proposal)
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");

View File

@ -119,7 +119,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string Value if KO, <0 if KO * @return string Value if KO, <0 if KO
*/ */
public function getNextValue($objsoc = 0, $invoice = null, $mode = 'next') public function getNextValue($objsoc = null, $invoice = null, $mode = 'next')
{ {
global $db, $conf; global $db, $conf;

View File

@ -89,9 +89,12 @@ abstract class ModeleNumRefTakepos
/** /**
* Renvoi prochaine valeur attribuee * Renvoi prochaine valeur attribuee
* *
* @return string Valeur * @param Societe $objsoc Object thirdparty
* @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value
* @return string Value if KO, <0 if KO
*/ */
public function getNextValue() public function getNextValue($objsoc = null, $invoice = null, $mode = 'next')
{ {
global $langs; global $langs;
return $langs->trans('NotAvailable'); return $langs->trans('NotAvailable');

View File

@ -116,10 +116,10 @@ abstract class ModeleNumRefTicket
* Renvoi prochaine valeur attribuee * Renvoi prochaine valeur attribuee
* *
* @param Societe $objsoc Object third party * @param Societe $objsoc Object third party
* @param Project $project Object project * @param Ticket $ticket Object ticket
* @return string Valeur * @return string Valeur
*/ */
public function getNextValue($objsoc, $project) public function getNextValue($objsoc, $ticket)
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");

View File

@ -259,7 +259,7 @@ $arrayfields = array(
'rowid' => array('label'=>$langs->trans("Id"), 'checked'=>1), 'rowid' => array('label'=>$langs->trans("Id"), 'checked'=>1),
'nature' => array('label'=>$langs->trans("NatureOfContact"), 'checked'=>1), 'nature' => array('label'=>$langs->trans("NatureOfContact"), 'checked'=>1),
'thirdparty' => array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 'thirdparty' => array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
'contact' => array('label'=>$langs->trans("Users").'/'.$langs->trans("Contacts"), 'checked'=>1), 'contact' => array('label'=>$langs->trans("Users").' | '.$langs->trans("Contacts"), 'checked'=>1),
'type' => array('label'=>$langs->trans("ContactType"), 'checked'=>1), 'type' => array('label'=>$langs->trans("ContactType"), 'checked'=>1),
'status' => array('label'=>$langs->trans("Status"), 'checked'=>1), 'status' => array('label'=>$langs->trans("Status"), 'checked'=>1),
'link' => array('label'=>$langs->trans("Link"), 'checked'=>1), 'link' => array('label'=>$langs->trans("Link"), 'checked'=>1),

View File

@ -25,7 +25,7 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
'type' => $extrafields->attributes[$extrafieldsobjectkey]['type'][$key], 'type' => $extrafields->attributes[$extrafieldsobjectkey]['type'][$key],
'checked' => ((dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1') <= 0) ? 0 : 1), 'checked' => ((dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1') <= 0) ? 0 : 1),
'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key], 'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key],
'enabled' => (abs((int) $extrafields->attributes[$extrafieldsobjectkey]['list'][$key]) != 3 && dol_eval($extrafields->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1')), 'enabled' => (abs((int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1)) != 3 && dol_eval($extrafields->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1')),
'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key], 'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key],
'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key], 'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key],
); );

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com> /* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2017 Charlie Benke <charlie@patas-monkey.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
@ -26,7 +27,7 @@ if (empty($conf) || !is_object($conf)) {
<!-- BEGIN PHP TEMPLATE originproductline.tpl.php --> <!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->
<?php <?php
print '<tr class="oddeven'.(empty($this->tpl['strike']) ? '' : ' strikefordisabled').'">'; print '<tr data-id="'.$this->tpl['id'].'" class="oddeven'.(empty($this->tpl['strike']) ? '' : ' strikefordisabled').'">';
print '<td>'.$this->tpl['label'].'</td>'; print '<td>'.$this->tpl['label'].'</td>';
print '<td>'.$this->tpl['description'].'</td>'; print '<td>'.$this->tpl['description'].'</td>';
print '<td class="right">'.$this->tpl['vat_rate'].'</td>'; print '<td class="right">'.$this->tpl['vat_rate'].'</td>';
@ -41,6 +42,7 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
} }
print '<td class="right">'.$this->tpl['remise_percent'].'</td>'; print '<td class="right">'.$this->tpl['remise_percent'].'</td>';
print '<td class="linecolht right">'.$this->tpl['total_ht'].'</td>';
$selected = 1; $selected = 1;
if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) { if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) {

View File

@ -13,9 +13,11 @@ require_once DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php';
$form = new Form($db); $form = new Form($db);
$formresources = new FormResource($db); $formresources = new FormResource($db);
$out = '<div class="tagtable centpercent noborder borderbottom allwidth nohover">'; $out = '';
$out .= '<form class="tagtr nohover '.($var == true ? 'pair' : 'impair').'" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $out .= '<div class="centpercent allwidth nohover">';
$out .= '<form class="nohover '.($var == true ? 'pair' : 'impair').'" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">'; $out .= '<input type="hidden" name="token" value="'.newToken().'">';
$out .= '<input type="hidden" name="action" value="add_element_resource">'; $out .= '<input type="hidden" name="action" value="add_element_resource">';
$out .= '<input type="hidden" name="element" value="'.$element.'">'; $out .= '<input type="hidden" name="element" value="'.$element.'">';
@ -23,21 +25,30 @@ $out .= '<input type="hidden" name="element_id" value="'.$element_id.'">';
$out .= '<input type="hidden" name="ref" value="'.$element_ref.'">'; $out .= '<input type="hidden" name="ref" value="'.$element_ref.'">';
$out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_type) ? 'dolresource' : $resource_type).'">'; $out .= '<input type="hidden" name="resource_type" value="'.(empty($resource_type) ? 'dolresource' : $resource_type).'">';
$out .= '<div class="noborder borderbottom">';
// Place // Place
$out .= '<div class="tagtd">'.$langs->trans("SelectResource").'</div>'; $out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">'.$langs->trans("SelectResource").'</div>';
$out .= '<div class="tagtd">'; $out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$events = array(); $events = array();
$out .= $formresources->select_resource_list('', 'fk_resource', '', 1, 1, 0, $events, '', 2, null); $out .= $formresources->select_resource_list('', 'fk_resource', '', 1, 1, 0, $events, '', 2, null);
$out .= '</div>'; $out .= '</div>';
$out .= '<div class="tagtd"><label>'.$langs->trans('Busy').'</label> '.$form->selectyesno('busy', (GETPOSTISSET('busy') ? GETPOST('busy') : 1), 1).'</div>'; $out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block marginleftonly"><label for="resbusy">'.$langs->trans('Busy').'</label> ';
$out .= '<div class="tagtd"><label>'.$langs->trans('Mandatory').'</label> '.$form->selectyesno('mandatory', (GETPOSTISSET('mandatory') ? GETPOST('mandatory') : 0), 1).'</div>'; //$out .= $form->selectyesno('busy', (GETPOSTISSET('busy') ? GETPOST('busy') : 1), 1);
$out .= '<input type="checkbox" id="resbusy" name="busy" value="1"'.(GETPOSTISSET('fk_resource') ? (GETPOST('busy') ? ' checked' : '') : ' checked').'>';
$out .= '</div>';
$out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block marginleftonly"><label for="resmandatory">'.$langs->trans('Mandatory').'</label> ';
//$out .= $form->selectyesno('mandatory', (GETPOSTISSET('mandatory') ? GETPOST('mandatory') : 0), 1);
$out .= '<input type="checkbox" id="resmandatory" name="mandatory" value="1"'.(GETPOSTISSET('fk_resource') ? (GETPOST('mandatory') ? ' checked' : '') : ' checked').'>';
$out .= '</div>';
$out .= '<div class="tagtd right">'; $out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block right">';
$out .= '<input type="submit" id="add-resource-place" class="button button-add" value="'.$langs->trans("Add").'"/>'; $out .= '<input type="submit" id="add-resource-place" class="button button-add" value="'.$langs->trans("Add").'"/>';
$out .= '</div>'; $out .= '</div>';
$out .= '</div>';
$out .= '</form>'; $out .= '</form>';
$out .= '</div>'; $out .= '</div>';

View File

@ -424,6 +424,61 @@ class InterfaceWorkflowManager extends DolibarrTriggers
} }
} }
if ($action == 'TICKET_CREATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Auto link contract
if (!empty($conf->contract->enabled) && !empty($conf->ticket->enabled) && !empty($conf->ficheinter->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_LINK_CONTRACT) && !empty($conf->global->TICKET_PRODUCT_CATEGORY) && !empty($object->fk_soc)) {
$societe = new Societe($this->db);
$company_ids = (empty($conf->global->WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS)) ? [$object->fk_soc] : $societe->getParentsForCompany($object->fk_soc, [$object->fk_soc]);
$contrat = new Contrat($this->db);
$number_contracts_found = 0;
foreach ($company_ids as $company_id) {
$contrat->socid = $company_id;
$list = $contrat->getListOfContracts($option = 'all', $status = [Contrat::STATUS_DRAFT, Contrat::STATUS_VALIDATED], $product_categories = [$conf->global->TICKET_PRODUCT_CATEGORY], $line_status = [ContratLigne::STATUS_INITIAL, ContratLigne::STATUS_OPEN]);
if (is_array($list) && !empty($list)) {
$number_contracts_found = count($list);
if ($number_contracts_found == 1) {
$contractid = $list[0]->id;
$object->setContract($contractid);
break;
} elseif ($number_contracts_found > 1) {
foreach ($list as $linked_contract) {
$object->setContract($linked_contract->id);
// don't set '$contractid' so it is not used when creating an intervention.
}
if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketManyContractsLinked'), 'warnings');
break;
}
}
}
if ($number_contracts_found == 0) {
if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs');
}
}
// Automatically create intervention
if (!empty($conf->ficheinter->enabled) && !empty($conf->ticket->enabled) && !empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_TICKET_CREATE_INTERVENTION)) {
$fichinter = new Fichinter($this->db);
$fichinter->socid = (int) $object->fk_soc;
$fichinter->fk_project = $projectid;
$fichinter->fk_contrat = (int) $object->fk_contract;
$fichinter->author = $user->id;
$fichinter->model_pdf = (!empty($conf->global->FICHEINTER_ADDON_PDF)) ? $conf->global->FICHEINTER_ADDON_PDF : 'soleil';
$fichinter->origin = $object->element;
$fichinter->origin_id = $object->id;
// Extrafields
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label($fichinter->table_element);
$array_options = $extrafields->getOptionalsFromPost($fichinter->table_element);
$fichinter->array_options = $array_options;
$id = $fichinter->create($user);
if ($id <= 0) {
setEventMessages($fichinter->error, null, 'errors');
}
}
}
return 0; return 0;
} }

View File

@ -958,11 +958,13 @@ class InterfaceActionsAuto extends DolibarrTriggers
} }
} }
/* Seems no more required: We have the data in dedicated field now.
if (!empty($user->login)) { if (!empty($user->login)) {
$object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$user->login, $object->actionmsg); $object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$user->login, $object->actionmsg);
} elseif (isset($object->origin_email)) { } elseif (isset($object->origin_email)) {
$object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$object->origin_email, $object->actionmsg); $object->actionmsg = dol_concatdesc($langs->transnoentities("Author").': '.$object->origin_email, $object->actionmsg);
} }
*/
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@ -1019,7 +1021,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
$actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_'.$action; $actioncomm->code = 'AC_'.$action;
$actioncomm->label = $object->actionmsg2; $actioncomm->label = $object->actionmsg2;
$actioncomm->note_private = $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg) $actioncomm->note_private = $object->actionmsg;
$actioncomm->fk_project = $projectid; $actioncomm->fk_project = $projectid;
$actioncomm->datep = $now; $actioncomm->datep = $now;
$actioncomm->datef = $now; $actioncomm->datef = $now;

View File

@ -183,7 +183,7 @@ class InterfaceStripe extends DolibarrTriggers
if ($action == 'COMPANY_DELETE') { if ($action == 'COMPANY_DELETE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (!empty($conf->global->STRIPE_DELETE_STRIPE_ACCOUNT_WHEN_DELETING_THIRPARTY)) { if (!empty($conf->global->STRIPE_DELETE_STRIPE_ACCOUNT_WHEN_DELETING_THIRDPARTY)) {
// By default, we do not delete the stripe account. We may need to reuse it with its payment_intent, for example if delete is for a merge of thirdparties. // By default, we do not delete the stripe account. We may need to reuse it with its payment_intent, for example if delete is for a merge of thirdparties.
$stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined. $stripeacc = $stripe->getStripeAccount($service); // No need of network access for this. May return '' if no Oauth defined.

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