From 163faf24014854857ade3e97b11a504920161873 Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Mon, 4 Mar 2019 11:19:54 +0100 Subject: [PATCH 01/92] Fix remove "canceled" invoices in margin by user --- htdocs/margin/agentMargins.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 687a381d790..d2d125f38c0 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -132,6 +132,8 @@ dol_fiche_end(); print ''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); + $sql = "SELECT"; $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; $sql.= " u.rowid as agent, u.login, u.lastname, u.firstname,"; @@ -153,7 +155,7 @@ if (! empty($conf->global->AGENT_CONTACT_TYPE)) $sql.= " AND ((e.fk_socpeople IS NULL AND sc.fk_user = u.rowid) OR (e.fk_socpeople IS NOT NULL AND e.fk_socpeople = u.rowid))"; else $sql .= " AND sc.fk_user = u.rowid"; -$sql.= " AND f.fk_statut > 0"; +$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= ' AND s.entity IN ('.getEntity('societe').')'; $sql.= " AND d.fk_facture = f.rowid"; if ($agentid > 0) { From dada8c8ff57ce95538bda83a0074b585dbe5ad1c Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 4 Mar 2019 17:23:29 +0100 Subject: [PATCH 02/92] FIX : wrong redirect link on holiday refuse --- htdocs/holiday/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index be61223d704..b69f6fb185b 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -568,7 +568,7 @@ if ($action == 'confirm_refuse') } } else { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&error=NoMotifRefuse'); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'&error=NoMotifRefuse'); exit; } } From 784012a47e9384eb8ec1c0d61b1e21d5df3154b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Mar 2019 23:47:40 +0100 Subject: [PATCH 03/92] Update main.inc.php --- htdocs/main.inc.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 70571964162..4a85cd8ddab 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -395,6 +395,7 @@ if ((! defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && ! empty($conf-> { dol_syslog("Invalid token, so we disable POST and some GET parameters - referer=".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _GET|POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING); //print 'Unset POST by CSRF protection in main.inc.php.'; // Do not output anything because this create problems when using the BACK button on browsers. + if ($conf->global->MAIN_FEATURES_LEVEL>1) setEventMessages('Unset POST by CSRF protection in main.inc.php.', null, 'warnings'); unset($_POST); unset($_GET['confirm']); } From 5cf8421d87d76853a977e20566fb14ddd193a7a5 Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Tue, 5 Mar 2019 09:56:49 +0100 Subject: [PATCH 04/92] Fix remove "canceled" invoices in all reports --- htdocs/margin/checkMargins.php | 3 ++- htdocs/margin/customerMargins.php | 4 +++- htdocs/margin/productMargins.php | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index d418aba780e..a05762b4bb5 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -183,6 +183,7 @@ dol_fiche_end(); $arrayfields=array(); $massactionbutton=''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); $sql = "SELECT"; $sql .= " f.ref, f.rowid as invoiceid, d.rowid as invoicedetid, d.buy_price_ht, d.total_ht, d.subprice, d.label, d.description , d.qty"; @@ -190,7 +191,7 @@ $sql .= " ,d.fk_product"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture as f "; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as d ON d.fk_facture = f.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON d.fk_product = p.rowid"; -$sql .= " WHERE f.fk_statut > 0"; +$sql .= " WHERE f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql .= " AND f.entity IN (" . getEntity('invoice') . ") "; if (! empty($startdate)) $sql .= " AND f.datef >= '" . $db->idate($startdate) . "'"; if (! empty($enddate)) $sql .= " AND f.datef <= '" . $db->idate($enddate) . "'"; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index fa264a81920..cc5abb0ee38 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -200,6 +200,8 @@ dol_fiche_end(); print ''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); + $sql = "SELECT"; $sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; if ($client) $sql.= " f.rowid as facid, f.ref, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; @@ -218,7 +220,7 @@ if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PRE $sql.= " WHERE f.fk_soc = s.rowid"; if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; -$sql.= " AND f.fk_statut > 0"; +$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= ' AND s.entity IN ('.getEntity('societe').')'; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 95686967fd9..547bd3d205b 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -174,6 +174,8 @@ dol_fiche_end(); print ''; +$invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABANDONED); + $sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,"; if ($id > 0) $sql.= " d.fk_product,"; if ($id > 0) $sql.= " f.rowid as facid, f.ref, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; @@ -190,7 +192,7 @@ if (! empty($TSelectedCats)) { } $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= ' AND f.entity IN ('.getEntity('invoice').')'; -$sql.= " AND f.fk_statut > 0"; +$sql.= " AND f.fk_statut NOT IN (" . implode(', ', $invoice_status_except_list) . ")"; $sql.= " AND d.fk_facture = f.rowid"; if ($id > 0) $sql.= " AND d.fk_product =".$id; From 1bbf6737ecbf48948cb2c70f52a0ab513d2e3455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 5 Mar 2019 15:27:31 +0100 Subject: [PATCH 05/92] add session newtoken --- htdocs/exports/export.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index ec11f9c1771..6888f638a27 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -761,6 +761,7 @@ if ($step == 3 && $datatoexport) // un formulaire en plus pour recuperer les filtres print '
'; + print ''; print ''; print ''; print ''; From 598d1fc9143c28b75ee2e311a9e1651d987cc177 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 5 Mar 2019 16:53:36 +0100 Subject: [PATCH 06/92] FIX : extrafields always visible on view mode --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5bb557cac2c..c16ee425cad 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6299,6 +6299,7 @@ abstract class CommonObject } if (($mode == 'create' || $mode == 'edit') && abs($visibility) != 1 && abs($visibility) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list + elseif($mode == 'view' && empty($visibility)) continue; if (empty($perms)) continue; // Load language if required From c06d2f6c3b019a976458e3bc89d8dd1ffb398435 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Mar 2019 18:22:03 +0100 Subject: [PATCH 07/92] Remove warning --- htdocs/install/upgrade2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index b1f0fc68254..4e5e116a599 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -186,7 +186,7 @@ if (! GETPOST('action','aZ09') || preg_match('/upgrade/i',GETPOST('action','aZ09 { // Current version is $conf->global->MAIN_VERSION_LAST_UPGRADE // Version to install is DOL_VERSION - $dolibarrlastupgradeversionarray=preg_split('/[\.-]/',isset($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_UPGRADE:$conf->global->MAIN_VERSION_LAST_INSTALL); + $dolibarrlastupgradeversionarray=preg_split('/[\.-]/',isset($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_UPGRADE:(isset($conf->global->MAIN_VERSION_LAST_INSTALL)?$conf->global->MAIN_VERSION_LAST_INSTALL:'')); // Chaque action de migration doit renvoyer une ligne sur 4 colonnes avec // dans la 1ere colonne, la description de l'action a faire From b4851e3d40e9ba0d74384fc39eba06172d1186fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 5 Mar 2019 21:54:51 +0100 Subject: [PATCH 08/92] Update mailinglist_mymodule_myobject.modules.php Warning: Declaration of mailing_***********::add_to_target($mailing_id) should be compatible with MailingTargets::add_to_target($mailing_id, $cibles) --- .../modules/mailings/mailinglist_mymodule_myobject.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 83644cd1f0e..07419af532d 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -97,9 +97,10 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets * This is the main function that returns the array of emails * * @param int $mailing_id Id of emailing + * @param array $cibles Array with targets * @return int <0 if error, number of emails added if ok */ - public function add_to_target($mailing_id) + public function add_to_target($mailing_id, $cibles) { // phpcs:enable $target = array(); From 2745f986441023472858126a55698d2d15e18f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 5 Mar 2019 22:10:46 +0100 Subject: [PATCH 09/92] PSR2.Classes.PropertyDeclaration.VarUsed --- dev/setup/codesniffer/ruleset.xml | 1 + htdocs/comm/propal/class/propal.class.php | 88 +++++++++---------- htdocs/core/class/commonorder.class.php | 2 +- htdocs/core/class/stats.class.php | 6 +- .../modules/syslog/mod_syslog_chromephp.php | 6 +- .../core/modules/syslog/mod_syslog_file.php | 4 +- .../core/modules/syslog/mod_syslog_syslog.php | 2 +- .../class/expensereportstats.class.php | 10 +-- 8 files changed, 60 insertions(+), 59 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index b6f62aede64..d8fff2265e9 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -428,4 +428,5 @@ + diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 304eccf9bb7..ad5197512d4 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3526,13 +3526,13 @@ class Propal extends CommonObject if ($option == '') { $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params; } - if ($option == 'compta') { // deprecated + elseif ($option == 'compta') { // deprecated $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params; } - if ($option == 'expedition') { + elseif ($option == 'expedition') { $url = DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params; } - if ($option == 'document') { + elseif ($option == 'document') { $url = DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id. $get_params; } @@ -3646,68 +3646,68 @@ class PropaleLigne extends CommonObjectLine */ public $table_element='propaldet'; - var $oldline; + public $oldline; // From llx_propaldet - var $fk_propal; - var $fk_parent_line; - var $desc; // Description ligne - var $fk_product; // Id produit predefini + public $fk_propal; + public $fk_parent_line; + public $desc; // Description ligne + public $fk_product; // Id produit predefini /** * @deprecated * @see product_type */ - var $fk_product_type; + public $fk_product_type; /** * Product type. * @var int * @see Product::TYPE_PRODUCT, Product::TYPE_SERVICE */ - var $product_type = Product::TYPE_PRODUCT; + public $product_type = Product::TYPE_PRODUCT; - var $qty; - var $tva_tx; - var $subprice; - var $remise_percent; - var $fk_remise_except; + public $qty; + public $tva_tx; + public $subprice; + public $remise_percent; + public $fk_remise_except; - var $rang = 0; + public $rang = 0; - var $fk_fournprice; - var $pa_ht; - var $marge_tx; - var $marque_tx; + public $fk_fournprice; + public $pa_ht; + public $marge_tx; + public $marque_tx; - var $special_code; // Tag for special lines (exlusive tags) + public $special_code; // Tag for special lines (exlusive tags) // 1: frais de port // 2: ecotaxe // 3: option line (when qty = 0) - var $info_bits = 0; // Liste d'options cumulables: + public $info_bits = 0; // Liste d'options cumulables: // Bit 0: 0 si TVA normal - 1 si TVA NPR // Bit 1: 0 ligne normale - 1 si ligne de remise fixe - var $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne - var $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne - var $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne + public $total_ht; // Total HT de la ligne toute quantite et incluant la remise ligne + public $total_tva; // Total TVA de la ligne toute quantite et incluant la remise ligne + public $total_ttc; // Total TTC de la ligne toute quantite et incluant la remise ligne /** * @deprecated * @see $remise_percent, $fk_remise_except */ - var $remise; + public $remise; /** * @deprecated * @see subprice */ - var $price; + public $price; // From llx_product /** * @deprecated * @see product_ref */ - var $ref; + public $ref; /** * Product reference * @var string @@ -3717,7 +3717,7 @@ class PropaleLigne extends CommonObjectLine * @deprecated * @see product_label */ - var $libelle; + public $libelle; /** * Product label * @var string @@ -3729,25 +3729,25 @@ class PropaleLigne extends CommonObjectLine */ public $product_desc; - var $localtax1_tx; // Local tax 1 - var $localtax2_tx; // Local tax 2 - var $localtax1_type; // Local tax 1 type - var $localtax2_type; // Local tax 2 type - var $total_localtax1; // Line total local tax 1 - var $total_localtax2; // Line total local tax 2 + public $localtax1_tx; // Local tax 1 + public $localtax2_tx; // Local tax 2 + public $localtax1_type; // Local tax 1 type + public $localtax2_type; // Local tax 2 type + public $total_localtax1; // Line total local tax 1 + public $total_localtax2; // Line total local tax 2 - var $date_start; - var $date_end; + public $date_start; + public $date_end; - var $skip_update_total; // Skip update price total for special lines + public $skip_update_total; // Skip update price total for special lines // Multicurrency - var $fk_multicurrency; - var $multicurrency_code; - var $multicurrency_subprice; - var $multicurrency_total_ht; - var $multicurrency_total_tva; - var $multicurrency_total_ttc; + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_subprice; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; /** * Class line Contructor diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php index 9d9445df91c..ddaef527630 100644 --- a/htdocs/core/class/commonorder.class.php +++ b/htdocs/core/class/commonorder.class.php @@ -82,7 +82,7 @@ abstract class CommonOrderLine extends CommonObjectLine * @deprecated * @see subprice */ - var $price; + public $price; /** * Unit price before taxes diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index b35e9947644..b06f1deb4c3 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -29,9 +29,9 @@ */ abstract class Stats { - protected $db; - var $_lastfetchdate=array(); // Dates of cache file read by methods - var $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts) + protected $db; + private $_lastfetchdate=array(); // Dates of cache file read by methods + public $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts) /** * Return nb of elements by month for several years diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php index 8ace164fce6..f3d34c4a9cd 100644 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php @@ -7,7 +7,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; */ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface { - var $code = 'chromephp'; + public $code = 'chromephp'; /** * Return name of logger @@ -50,7 +50,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface return ($this->isActive() == 1)?'':$langs->trans('ClassNotFoundIntoPathWarning', 'ChromePhp.class.php'); } - + /** * Is the module active ? * @@ -159,7 +159,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface $res = @include_once 'ChromePhp.php'; if (! $res) $res=@include_once 'ChromePhp.class.php'; set_include_path($oldinclude); - + ob_start(); // To be sure headers are not flushed until all page is completely processed if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index ced2cf9133b..4c59eb5ef98 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -7,8 +7,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; */ class mod_syslog_file extends LogHandler implements LogHandlerInterface { - var $code = 'file'; - var $lastTime = 0; + public $code = 'file'; + public $lastTime = 0; /** * Return name of logger diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index 26232e91ed5..97a37ff2c8a 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -7,7 +7,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; */ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface { - var $code = 'syslog'; + public $code = 'syslog'; /** * Return name of logger diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php index 082e3ce016e..5edf301ac25 100644 --- a/htdocs/expensereport/class/expensereportstats.class.php +++ b/htdocs/expensereport/class/expensereportstats.class.php @@ -35,12 +35,12 @@ class ExpenseReportStats extends Stats */ public $table_element; - var $socid; - var $userid; + public $socid; + public $userid; - var $from; - var $field; - var $where; + public $from; + public $field; + public $where; /** * Constructor From b56cd11f021e76fba68d134e3a0e26985e2d7882 Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Wed, 6 Mar 2019 12:00:55 +0100 Subject: [PATCH 10/92] Fix default contact id for update and clone actions in event card --- htdocs/comm/action/card.php | 8 ++++++++ htdocs/comm/action/class/actioncomm.class.php | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8458207a5d8..6ad881d141c 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -160,6 +160,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes') { if ($id > 0) { $object->fetch($id); + if (!empty($object->socpeopleassigned)) { + reset($object->socpeopleassigned); + $object->contactid = key($object->socpeopleassigned); + } $result = $object->createFromClone(GETPOST('fk_userowner'), GETPOST('socid')); if ($result > 0) { header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); @@ -431,6 +435,10 @@ if ($action == 'update') $object->socpeopleassigned = array(); foreach ($socpeopleassigned as $cid) $object->socpeopleassigned[$cid] = array('id' => $cid); $object->contactid = GETPOST("contactid", 'int'); + if (empty($object->contactid) && !empty($object->socpeopleassigned)) { + reset($object->socpeopleassigned); + $object->contactid = key($object->socpeopleassigned); + } $object->fk_project = GETPOST("projectid", 'int'); $object->note = GETPOST("note", "none"); // deprecated $object->note_private= GETPOST("note", "none"); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index fba891a848a..56e5e68b2f7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -270,7 +270,7 @@ class ActionComm extends CommonObject $this->userassigned[$tmpid]=array('id'=>$tmpid, 'transparency'=>$this->transparency); } - if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated + //if (is_object($this->contact) && isset($this->contact->id) && $this->contact->id > 0 && ! ($this->contactid > 0)) $this->contactid = $this->contact->id; // For backward compatibility. Using this->contact->xx is deprecated $userownerid=$this->userownerid; @@ -656,7 +656,7 @@ class ActionComm extends CommonObject $this->fk_project = $obj->fk_project; // To have fetch_project method working $this->societe->id = $obj->fk_soc; // deprecated - $this->contact->id = $obj->fk_contact; // deprecated + //$this->contact->id = $obj->fk_contact; // deprecated $this->fk_element = $obj->elementid; $this->elementid = $obj->elementid; @@ -867,7 +867,7 @@ class ActionComm extends CommonObject } $socid=($this->socid?$this->socid:((isset($this->societe->id) && $this->societe->id > 0) ? $this->societe->id : 0)); - $contactid=($this->contactid?$this->contactid:((isset($this->contact->id) && $this->contact->id > 0) ? $this->contact->id : 0)); + $contactid=($this->contactid?$this->contactid:0); $userownerid=($this->userownerid?$this->userownerid:0); $userdoneid=($this->userdoneid?$this->userdoneid:0); From 0ff29051802d477a47071e75d5ebba9744b48f99 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 6 Mar 2019 12:10:24 +0100 Subject: [PATCH 11/92] FIX : we need to keep originline special_code --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- htdocs/fourn/facture/card.php | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 309230a4dcc..b0351252c0b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1386,7 +1386,7 @@ class FactureFournisseur extends CommonInvoice * * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order. */ - public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='') + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='', $special_code='') { dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1481,7 +1481,7 @@ class FactureFournisseur extends CommonInvoice $this->line->total_localtax1=$total_localtax1; $this->line->total_localtax2=$total_localtax2; $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); - $this->line->special_code=$this->special_code; + $this->line->special_code=!empty($special_code) ? $special_code : $this->special_code; $this->line->fk_parent_line=$this->fk_parent_line; $this->line->origin=$this->origin; $this->line->origin_id=$origin_id; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index cc9164b753f..3e7df0b27f3 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -716,7 +716,10 @@ if (empty($reshook)) 0, $lines[$i]->array_options, $lines[$i]->fk_unit, - $lines[$i]->id + $lines[$i]->id, + 0, + '', + $lines[$i]->special_code ); if ($result < 0) From d3bb9d2cc2a4b56f856d27e1261463be23b6597e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 16:37:02 +0100 Subject: [PATCH 12/92] add contant DISPLAY_DISCOUNTED_SUPPLIER_PRICE --- htdocs/core/class/html.form.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a83ff1083e6..023adfae7a5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2747,23 +2747,23 @@ class Form } if ($objp->quantity == 1) { - $opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; - $outval.= price($objp->fprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; + $opt.= price($objp->fprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/"; + $outval.= price($objp->fprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/"; $opt.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding $outval.=$langs->transnoentities("Unit"); } else { - $opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; - $outval.= price($objp->fprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; + $opt.= price($objp->fprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; + $outval.= price($objp->fprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $opt.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding $outval.= ' '.$langs->transnoentities("Units"); } if ($objp->quantity >= 1) { - $opt.=" (".price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding - $outval.=" (".price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding + $opt.=" (".price($objp->unitprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding + $outval.=" (".price($objp->unitprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding } if ($objp->remise_percent >= 1) { @@ -2854,7 +2854,7 @@ class Form $langs->load('stocks'); $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.duration, pfp.fk_soc,"; - $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.quantity, pfp.unitprice,"; + $sql.= " pfp.ref_fourn, pfp.rowid as idprodfournprice, pfp.price as fprice, pfp.remise_percent, pfp.quantity, pfp.unitprice,"; $sql.= " pfp.fk_supplier_price_expression, pfp.fk_product, pfp.tva_tx, s.nom as name"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; @@ -2914,7 +2914,7 @@ class Form } if ($objp->quantity == 1) { - $opt.= price($objp->fprice, 1, $langs, 0, 0, -1, $conf->currency)."/"; + $opt.= price($objp->fprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/"; } $opt.= $objp->quantity.' '; @@ -2930,7 +2930,7 @@ class Form if ($objp->quantity > 1) { $opt.=" - "; - $opt.= price($objp->unitprice, 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit"); + $opt.= price($objp->unitprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit"); } if ($objp->duration) $opt .= " - ".$objp->duration; $opt .= "\n"; From 4e533b2a91bd5950f70b4a34236628660624bcda Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 16:41:28 +0100 Subject: [PATCH 13/92] better constant test --- htdocs/core/class/html.form.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 023adfae7a5..0618e15afe8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2747,23 +2747,23 @@ class Form } if ($objp->quantity == 1) { - $opt.= price($objp->fprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/"; - $outval.= price($objp->fprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/"; + $opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/"; + $outval.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/"; $opt.= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding $outval.=$langs->transnoentities("Unit"); } else { - $opt.= price($objp->fprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; - $outval.= price($objp->fprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; + $opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; + $outval.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $opt.= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding $outval.= ' '.$langs->transnoentities("Units"); } if ($objp->quantity >= 1) { - $opt.=" (".price($objp->unitprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding - $outval.=" (".price($objp->unitprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding + $opt.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit").")"; // Do not use strtolower because it breaks utf8 encoding + $outval.=" (".price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 0, $langs, 0, 0, -1, $conf->currency)."/".$langs->transnoentities("Unit").")"; // Do not use strtolower because it breaks utf8 encoding } if ($objp->remise_percent >= 1) { @@ -2914,7 +2914,7 @@ class Form } if ($objp->quantity == 1) { - $opt.= price($objp->fprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/"; + $opt.= price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/"; } $opt.= $objp->quantity.' '; @@ -2930,7 +2930,7 @@ class Form if ($objp->quantity > 1) { $opt.=" - "; - $opt.= price($objp->unitprice * ($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit"); + $opt.= price($objp->unitprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE)?(1 - $objp->remise_percent / 100):1), 1, $langs, 0, 0, -1, $conf->currency)."/".$langs->trans("Unit"); } if ($objp->duration) $opt .= " - ".$objp->duration; $opt .= "\n"; From 7a512d587c07f5d5b256197ab702f486562fc815 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 16:44:06 +0100 Subject: [PATCH 14/92] remove specific entry in gitignore --- htdocs/.gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/.gitignore b/htdocs/.gitignore index aa007a70ae5..ac35d8fab2f 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -28,4 +28,3 @@ /nomenclature* /of/ /workstation/ -/theme/dolipro* \ No newline at end of file From cb39c6f3ce5cbe91e94dd5186d2ec317c059a8e9 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 16:48:48 +0100 Subject: [PATCH 15/92] remove specific entry in gitignore --- htdocs/.gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/.gitignore b/htdocs/.gitignore index aa007a70ae5..ac35d8fab2f 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -28,4 +28,3 @@ /nomenclature* /of/ /workstation/ -/theme/dolipro* \ No newline at end of file From ceab55f26b47b86e4b4b3f1b59b89568491e2e32 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 17:07:51 +0100 Subject: [PATCH 16/92] NEW : add constant MAIN_DEFAULT_LANGUAGE_FILTER --- htdocs/core/class/html.formadmin.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 1758480af8f..166e0ce2044 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -62,7 +62,9 @@ class FormAdmin public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0) { // phpcs:enable - global $langs; + global $conf, $langs; + + if (!empty($conf->global->MAIN_DEFAULT_LANGUAGE_FILTER)) $filter[$conf->global->MAIN_DEFAULT_LANGUAGE_FILTER] = 1; $langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT, 12); From 0f8f4fbc15e2d8d7796f6c5ccfa4fafb72978662 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 17:12:39 +0100 Subject: [PATCH 17/92] bad branching --- htdocs/theme/eldy/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 35f6f56c57c..cecfc3e5efa 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -61,7 +61,7 @@ if (defined('THEME_ONLY_CONSTANT')) return; session_cache_limiter('public'); -require_once __DIR__.'/../../main.inc.php'; // __DIR__ allow this script to be included in custom themes +require_once '/../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) From b4397806fcd66667ba85269f44facb8897540cae Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 17:14:05 +0100 Subject: [PATCH 18/92] bad branching 2 --- htdocs/theme/eldy/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index cecfc3e5efa..1f58937d879 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -61,7 +61,7 @@ if (defined('THEME_ONLY_CONSTANT')) return; session_cache_limiter('public'); -require_once '/../../main.inc.php'; +require_once '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) From 4382a26c879194d55b84b2cf29af6e56b66997ed Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 17:21:44 +0100 Subject: [PATCH 19/92] sort list of models alphabetically --- htdocs/core/class/html.formfile.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 5e875be176d..a3134f641a1 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -677,11 +677,12 @@ class FormFile $out.= ''; $addcolumforpicto=($delallowed || $printer || $morepicto); - $out.= ''; $addcolumforpicto=($delallowed || $printer || $morepicto); - $out.= '' . "\n"; $out.='' . "\n"; $out.='' . "\n"; From d39b600ff4cd6eb4b702fef71899e38dffe67837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 20:29:58 +0100 Subject: [PATCH 35/92] Update CMailFile.class.php --- htdocs/core/class/CMailFile.class.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index e23b32c5fb7..3c0e979cbed 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1,11 +1,12 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) Dan Potter + * Copyright (C) Eric Seigne + * Copyright (C) 2000-2005 Rodolphe Quiedeville + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2019 Frédéric France * * 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 @@ -1429,7 +1430,7 @@ class CMailFile * Return a formatted address string for SMTP protocol * * @param string $address Example: 'John Doe , Alan Smith ' or 'john@doe.com, alan@smith.com' - * @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between " + * @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between ", 4 label or email, 5 mailto link * @param int $encode 0=No encode name, 1=Encode name to RFC2822 * @param int $maxnumberofemail 0=No limit. Otherwise, maximum number of emails returned ($address may contains several email separated with ','). Add '...' if there is more. * @return string If format 0: '' or 'John Doe ' or '=?UTF-8?B?Sm9obiBEb2U=?= ' @@ -1437,6 +1438,7 @@ class CMailFile * If format 2: 'john@doe.com' * If format 3: '' or '"John Doe" ' or '"=?UTF-8?B?Sm9obiBEb2U=?=" ' * If format 4: 'John Doe' or 'john@doe.com' if no label exists + * If format 5: John Doe or john@doe.com if no label exists */ public static function getValidAddress($address, $format, $encode = 0, $maxnumberofemail = 0) { @@ -1466,6 +1468,10 @@ class CMailFile $i++; $newemail=''; + if ($format == 5) { + $newemail = $name?$name:$email; + $newemail = ''.$newemail.''; + } if ($format == 4) { $newemail = $name?$name:$email; From b15e00cae798c8792a7b5c7aef104bdfa94f665b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2019 21:39:09 +0100 Subject: [PATCH 36/92] FIX Autodetect buy price for invoices autogenerated with templates. --- htdocs/compta/facture/card.php | 2 +- htdocs/compta/facture/class/facture.class.php | 31 +++++++++++++++++-- htdocs/product/class/product.class.php | 7 +++-- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 1df96583ce3..e37d2c3d2a9 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1129,7 +1129,7 @@ if (empty($reshook)) // Source facture $object->fac_rec = GETPOST('fac_rec', 'int'); - $id = $object->create($user); // This include recopy of links from recurring invoice and invoice lines + $id = $object->create($user); // This include recopy of links from recurring invoice and recurring invoice lines } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dda877d0a1f..86ee5482261 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -723,7 +723,7 @@ class Facture extends CommonInvoice } /* - * Insert lines of predefined invoices + * Insert lines of template invoices */ if (! $error && $this->fac_rec > 0) { @@ -749,6 +749,31 @@ class Facture extends CommonInvoice $localtax1_tx = $_facrec->lines[$i]->localtax1_tx; $localtax2_tx = $_facrec->lines[$i]->localtax2_tx; + $fk_product_fournisseur_price = empty($_facrec->lines[$i]->fk_product_fournisseur_price)?null:$_facrec->lines[$i]->fk_product_fournisseur_price; + $buyprice = empty($_facrec->lines[$i]->buyprice)?0:$_facrec->lines[$i]->buyprice; + // If buyprice not defined from template invoice, we try to guess the best value + if (! $buyprice && $_facrec->lines[$i]->fk_product > 0) + { + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; + $producttmp = new ProductFournisseur($this->db); + $producttmp->fetch($_facrec->lines[$i]->fk_product); + + // If margin module defined on costprice, we try the costprice + // If not defined or if module margin defined and pmp and stock module enabled, we try pmp price + // else we get the best supplier price + if ($conf->global->MARGIN_TYPE == 'costprice' && ! empty($producttmp->cost_price)) $buyprice = $producttmp->cost_price; + elseif (! empty($conf->stock->enabled) && ($conf->global->MARGIN_TYPE == 'costprice' || $conf->global->MARGIN_TYPE == 'pmp') && ! empty($producttmp->pmp)) $buyprice = $producttmp->pmp; + else { + if ($producttmp->find_min_price_product_fournisseur($_facrec->lines[$i]->fk_product) > 0) + { + if ($producttmp->product_fourn_price_id > 0) + { + $buyprice = price2num($producttmp->fourn_unitprice * (1 - $producttmp->fourn_remise_percent/100) + $producttmp->fourn_remise, 'MU'); + } + } + } + } + $result_insert = $this->addline( $_facrec->lines[$i]->desc, $_facrec->lines[$i]->subprice, @@ -771,8 +796,8 @@ class Facture extends CommonInvoice '', 0, 0, - null, - 0, + $fk_product_fournisseur_price, + $buyprice, $_facrec->lines[$i]->label, empty($_facrec->lines[$i]->array_options)?null:$_facrec->lines[$i]->array_options, $_facrec->lines[$i]->situation_percent, diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 316a911d5a3..88b410da7fa 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1528,8 +1528,8 @@ class Product extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Read price used by a provider. - * We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref. + * Read price used by a provider. + * We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref. * This also set some properties on product like ->buyprice, ->fourn_pu, ... * * @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price @@ -1537,7 +1537,8 @@ class Product extends CommonObject * @param int $product_id Filter on a particular product id * @param string $fourn_ref Filter on a supplier price ref. 'none' to exclude ref in search. * @param int $fk_soc If of supplier - * @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) + * @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) + * @see find_min_price_product_fournisseur() */ function get_buyprice($prodfournprice, $qty, $product_id=0, $fourn_ref='', $fk_soc=0) { From 96b8da0d6247fd0d12f77f71ba664e2dc485dee2 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 22:04:01 +0100 Subject: [PATCH 37/92] fix supllier discount --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 61818d4deb9..d598c18a33e 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -268,7 +268,7 @@ else { } else { - $ajaxoptions = array(); + $ajaxoptions = array('update' => array('remise_percent' => 'discount')); $alsoproductwithnosupplierprice=1; } From c31318f29d36e41cb3a24d97bcab641d1ea99a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timote=CC=81=20Fallais?= Date: Thu, 7 Mar 2019 09:15:43 +0100 Subject: [PATCH 38/92] Update libelle of user (making Mailman working correctly) --- htdocs/adherents/class/adherent.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 688b2c9741a..15cb81f8474 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -563,6 +563,18 @@ class Adherent extends CommonObject $sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest $sql.= " WHERE rowid = ".$this->id; + $sql2 = "SELECT libelle"; + $sql2.= " FROM ".MAIN_DB_PREFIX."adherent_type"; + $sql2.= " WHERE rowid = ".$this->typeid; + $resql2 = $this->db->query($sql2); + if($resql2) + { + while ($obj=$this->db->fetch_object($resql2)) + { + $this->type=$obj->libelle; + } + } + dol_syslog(get_class($this)."::update update member", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) From c5131167171cd9c1f977599c47ea18fc88e5f722 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 10:56:48 +0100 Subject: [PATCH 39/92] FIX missing vat_src_code when inserting an expense report line --- htdocs/expensereport/class/expensereport.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index a8e5f80244c..dd2818f28bf 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1729,6 +1729,7 @@ class ExpenseReport extends CommonObject $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type); $this->line->value_unit = $up; + $this->line->vat_src_code = $vat_src_code; $this->line->vatrate = price2num($vatrate); $this->line->total_ttc = $tmp[2]; $this->line->total_ht = $tmp[0]; From 2cd09aaf0929181894da2660e46e3deed8df9901 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 10:57:15 +0100 Subject: [PATCH 40/92] Prepare version 9.0.2 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b2213c5d03c..03f949c6fe6 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','9.0.1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION','9.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO',chr(128)); From 96d4e2847324d093a1fd7709ea637ef0f750e8a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 11:08:01 +0100 Subject: [PATCH 41/92] FIX Vat src code lost after editing expense report line --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index eb71a30e083..fab70b1200a 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2137,7 +2137,7 @@ else // VAT print ''; // Unit price From e67890bd22037d5ee077d850a07df7ab9b6035c8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 11:09:04 +0100 Subject: [PATCH 42/92] NEW Can enter price with or without tax when entering expense repor line --- htdocs/admin/dict.php | 2 +- htdocs/expensereport/card.php | 121 ++++++++++++------ .../class/expensereport.class.php | 24 ++-- .../install/mysql/migration/9.0.0-10.0.0.sql | 3 + .../mysql/tables/llx_expensereport_det.sql | 3 +- 5 files changed, 100 insertions(+), 53 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 11134f70194..541262b2bf5 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1912,7 +1912,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { - print ''; + print ''; } elseif ($fieldlist[$field]=='unit') { print ''; // User to inform for approval - if ($object->fk_statut < 3) // informed + if ($object->fk_statut <= ExpenseReport::STATUS_VALIDATED) // informed { print ''; print ''; // approver @@ -1760,7 +1764,7 @@ else } print ''; } - elseif($object->fk_statut == 4) + elseif($object->fk_statut == ExpenseReport::STATUS_CANCELED) { print ''; print ''; @@ -1854,11 +1858,11 @@ else print ''; print ''; $rowspan = 5; - if ($object->fk_statut < 3) $rowspan++; - elseif($object->fk_statut == 4) $rowspan+=2; + if ($object->fk_statut <= ExpenseReport::STATUS_VALIDATED) $rowspan++; + elseif($object->fk_statut == ExpenseReport::STATUS_CANCELED) $rowspan+=2; else $rowspan+=2; - if ($object->fk_statut==99 || !empty($object->detail_refuse)) $rowspan+=2; - if($object->fk_statut==6) $rowspan+=2; + if ($object->fk_statut == ExpenseReport::STATUS_REFUSED || !empty($object->detail_refuse)) $rowspan+=2; + if ($object->fk_statut == ExpenseReport::STATUS_CLOSED) $rowspan+=2; print ""; print ''; @@ -2016,6 +2020,7 @@ else print ''; print ''; print ''; + print ''; print ''; print ''; if ($action != 'editline') @@ -2071,6 +2076,7 @@ else print ''; print ''; print ''; + print ''; print ''; print ''; @@ -2081,7 +2087,7 @@ else } // Ajout des boutons de modification/suppression - if (($object->fk_statut < 2 || $object->fk_statut == 99) && $user->rights->expensereport->creer) + if (($object->fk_statut < ExpenseReport::STATUS_VALIDATED || $object->fk_statut == ExpenseReport::STATUS_REFUSED) && $user->rights->expensereport->creer) { print ''; // Unit price print ''; + + // Unit price with tax + print ''; // Quantity @@ -2178,6 +2189,7 @@ else print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -2225,9 +2237,14 @@ else print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', false, 1); print ''; - // Unit price + // Unit price net print ''; + + // Unit price with tax + print ''; // Quantity @@ -2249,6 +2266,26 @@ else print '
'.$langs->trans("Entities").'
'; + $out.= ''; // Model if (! empty($modellist)) { + asort($modellist); $out.= ''.$langs->trans('Model').' '; if (is_array($modellist) && count($modellist) == 1) // If there is only one element { From 8f8fe0648ebe771fe9b25cbf3691a5929304f38f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 17:24:50 +0100 Subject: [PATCH 20/92] fix bad copy paste --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index a3134f641a1..2577d70e549 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -677,7 +677,7 @@ class FormFile $out.= '
'; + $out.= ''; // Model if (! empty($modellist)) From 414bac6fb48e394cb35555a30c9e590c4d05acc2 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 17:56:43 +0100 Subject: [PATCH 21/92] avoid logging empty query --- htdocs/core/db/mysqli.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 6c3bfd2362f..1b040ddfa18 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -256,6 +256,8 @@ class DoliDBMysqli extends DoliDB $query = trim($query); + if (empty($query)) return null; + if (! in_array($query, array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG); if (! $this->database_name) From 8743b43fdbcc3c3433ede604318e007f6f4cc063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 18:01:18 +0100 Subject: [PATCH 22/92] add oldcopy of category before updating --- htdocs/categories/edit.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index a85c320a992..9416ddae748 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -81,6 +81,7 @@ if ($cancel) // Action mise a jour d'une categorie if ($action == 'update' && $user->rights->categorie->creer) { + $object->oldcopy = dol_clone($object); $object->label = $label; $object->description = dol_htmlcleanlastbr($description); $object->color = $color; From 8246c79b15fa039a79c0e48af63b734d6bcfc2be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 18:20:44 +0100 Subject: [PATCH 23/92] Update bom_card.php --- htdocs/bom/bom_card.php | 45 ++++++----------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 0054e427996..28deae35d86 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -1,6 +1,6 @@ - * Copyright (C) ---Put here your own copyright and developer email--- +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2019 Frédéric France * * 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 @@ -17,50 +17,17 @@ */ /** - * \file bom_card.php + * \file htdocs/bom/bom_card.php * \ingroup bom * \brief Page to create/edit/view bom */ -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too. -//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("FORCECSP")) define('FORCECSP','none'); // Disable all Content Security Policies - - // Load Dolibarr environment -$res=0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; -while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } -if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; -if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; -// Try main.inc.php using relative path -if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; -if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; -if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; -if (! $res) die("Include of main fails"); - +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -dol_include_once('/bom/class/bom.class.php'); -dol_include_once('/bom/lib/bom_bom.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom_bom.lib.php'; // Load translation files required by the page $langs->loadLangs(array("mrp","other")); From 6067994119a42eb355cba41f61ec5e458e77fb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 18:23:25 +0100 Subject: [PATCH 24/92] Update bom_document.php --- htdocs/bom/bom_document.php | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index b13277cd82b..ff8887bb4e8 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -1,6 +1,6 @@ - * Copyright (C) ---Put here your own copyright and developer email--- +/* Copyright (C) 2007-2017 Laurent Destailleur + * Copyright (C) 2019 Frédéric France * * 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 @@ -23,26 +23,13 @@ */ // Load Dolibarr environment -$res=0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; -while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } -if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; -if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; -// Try main.inc.php using relative path -if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; -if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; -if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; -if (! $res) die("Include of main fails"); - +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -dol_include_once('/bom/class/bom.class.php'); -dol_include_once('/bom/lib/bom_bom.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom_bom.lib.php'; // Load translation files required by the page $langs->loadLangs(array("mrp","companies","other","mails")); From e4de89e3eb17ec315f5802c191fa2c4576109235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 18:25:02 +0100 Subject: [PATCH 25/92] Update bom_list.php --- htdocs/bom/bom_list.php | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 25fad036b65..6aec37c5f2c 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -17,49 +17,16 @@ */ /** - * \file bom_list.php + * \file htdocs/bom/bom_list.php * \ingroup bom * \brief List page for bom */ - -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs -//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters -//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters -//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on). -//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on) -//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data -//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip -//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu -//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php -//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library -//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session) -//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value -//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message -//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL' - // Load Dolibarr environment -$res=0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; -while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } -if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; -if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; -// Try main.inc.php using relative path -if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; -if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; -if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; -if (! $res) die("Include of main fails"); - +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -dol_include_once('/bom/class/bom.class.php'); +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; // Load translation files required by the page $langs->loadLangs(array("mrp", "other")); From cf00b2a2df5e69b84261e6253826415bbb52ad7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 18:26:23 +0100 Subject: [PATCH 26/92] Update bom_note.php --- htdocs/bom/bom_note.php | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/htdocs/bom/bom_note.php b/htdocs/bom/bom_note.php index fb0d58509d7..4c45512c064 100644 --- a/htdocs/bom/bom_note.php +++ b/htdocs/bom/bom_note.php @@ -1,6 +1,6 @@ - * Copyright (C) ---Put here your own copyright and developer email--- +/* Copyright (C) 2007-2017 Laurent Destailleur + * Copyright (C) 2019 Frédéric France * * 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 @@ -23,22 +23,9 @@ */ // Load Dolibarr environment -$res=0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; -while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } -if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; -if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; -// Try main.inc.php using relative path -if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php"; -if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; -if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; -if (! $res) die("Include of main fails"); - -dol_include_once('/bom/class/bom.class.php'); -dol_include_once('/bom/lib/bom_bom.lib.php'); +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom_bom.lib.php'; // Load translation files required by the page $langs->loadLangs(array("mrp","companies")); From 02d4a234b71b3fd07279c971adc698aada23c8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 18:30:34 +0100 Subject: [PATCH 27/92] Update bom.lib.php --- htdocs/bom/lib/bom.lib.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 0085d06b69c..98f5370217e 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2019 Maxime Kohlhaas + * Copyright (C) 2019 Frédéric France * * 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 @@ -16,7 +17,7 @@ */ /** - * \file bom/lib/bom.lib.php + * \file htdocs/bom/lib/bom.lib.php * \ingroup bom * \brief Library files with common functions for BillOfMaterials */ @@ -40,7 +41,7 @@ function bomAdminPrepareHead() $head[$h][2] = 'settings'; $h++; - /*$head[$h][0] = dol_buildpath("/bom/admin/about.php", 1); + /*$head[$h][0] = DOL_URL_ROOT."/bom/admin/about.php"; $head[$h][1] = $langs->trans("About"); $head[$h][2] = 'about'; $h++; @@ -77,7 +78,7 @@ function bomPrepareHead($object) $h = 0; $head = array(); - $head[$h][0] = dol_buildpath("/bom/bom_card.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT."/bom/bom_card.php?id=".$object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; @@ -87,7 +88,7 @@ function bomPrepareHead($object) $nbNote = 0; if (!empty($object->note_private)) $nbNote++; if (!empty($object->note_public)) $nbNote++; - $head[$h][0] = dol_buildpath('/bom/bom_note.php', 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id=".$object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; @@ -99,13 +100,13 @@ function bomPrepareHead($object) $upload_dir = $conf->bom->dir_output . "/bom/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); - $head[$h][0] = dol_buildpath("/bom/bom_document.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT."/bom/bom_document.php?id=".$object->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; $head[$h][2] = 'document'; $h++; - $head[$h][0] = dol_buildpath("/bom/bom_agenda.php", 1).'?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT."/bom/bom_agenda.php?id=".$object->id; $head[$h][1] = $langs->trans("Events"); $head[$h][2] = 'agenda'; $h++; From e57a67493905f7c050d0886f849d3b61ca7aa517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 18:36:48 +0100 Subject: [PATCH 28/92] Update setup.php --- htdocs/bom/admin/setup.php | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/htdocs/bom/admin/setup.php b/htdocs/bom/admin/setup.php index 561b44fa262..a484718ac32 100644 --- a/htdocs/bom/admin/setup.php +++ b/htdocs/bom/admin/setup.php @@ -1,6 +1,7 @@ - * Copyright (C) 2019 Maxime Kohlhaas +/* Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2019 Maxime Kohlhaas + * Copyright (C) 2019 Frédéric France * * 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 @@ -23,21 +24,7 @@ */ // Load Dolibarr environment -$res=0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; -while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } -if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php"; -if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"; -// Try main.inc.php using relative path -if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; -if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php"; -if (! $res) die("Include of main fails"); - -global $langs, $user; - +require '../../main.inc.php'; // Libraries require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; require_once '../lib/bom.lib.php'; @@ -62,11 +49,7 @@ $arrayofparameters=array( /* * Actions */ -if ((float) DOL_VERSION >= 6) -{ - include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; -} - +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; /* * View From 2185f129cd3b78007f5b95ee49acf8340b94c99b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 18:44:03 +0100 Subject: [PATCH 29/92] syntax error --- htdocs/bom/lib/bom.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/lib/bom.lib.php b/htdocs/bom/lib/bom.lib.php index 98f5370217e..20f9fccfb01 100644 --- a/htdocs/bom/lib/bom.lib.php +++ b/htdocs/bom/lib/bom.lib.php @@ -88,7 +88,7 @@ function bomPrepareHead($object) $nbNote = 0; if (!empty($object->note_private)) $nbNote++; if (!empty($object->note_public)) $nbNote++; - $head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; @@ -100,13 +100,13 @@ function bomPrepareHead($object) $upload_dir = $conf->bom->dir_output . "/bom/" . dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); - $head[$h][0] = DOL_URL_ROOT."/bom/bom_document.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT.'/bom/bom_document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; $head[$h][2] = 'document'; $h++; - $head[$h][0] = DOL_URL_ROOT."/bom/bom_agenda.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id; $head[$h][1] = $langs->trans("Events"); $head[$h][2] = 'agenda'; $h++; From 9e6a5a0b8171ae83215b14cae07b57f889c971e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 18:49:03 +0100 Subject: [PATCH 30/92] Update eldy.lib.php --- htdocs/core/menus/standard/eldy.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 04f379b746f..1db6dc01ab4 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Frédéric France * * 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 @@ -65,6 +65,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); } + $menu_arr = array(); // Home $menu_arr[] = array( 'name' => 'Home', From edf9913c20c5d606fe545145c772384d23ebff1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 19:00:12 +0100 Subject: [PATCH 31/92] Update bom_list.php --- htdocs/bom/bom_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 6aec37c5f2c..cf9ad7ffaf2 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -56,7 +56,7 @@ $pagenext = $page + 1; //if (! $sortorder) $sortorder="DESC"; // Initialize technical objects -$object = new BillOfMaterials($db); +$object = new BOM($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->bom->dir_output . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array @@ -146,7 +146,7 @@ if (empty($reshook)) } // Mass actions - $objectclass='BillOfMaterials'; + $objectclass='BOM'; $objectlabel='BillOfMaterials'; $permtoread = $user->rights->bom->read; $permtodelete = $user->rights->bom->delete; From 7b0956297636057d4f976ebc96722c3f20884b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 19:05:13 +0100 Subject: [PATCH 32/92] Update bom_card.php --- htdocs/bom/bom_card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 28deae35d86..19d7fdaa60b 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -42,7 +42,7 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard $backtopage = GETPOST('backtopage', 'alpha'); // Initialize technical objects -$object=new BillOfMaterials($db); +$object=new BOM($db); $extrafields = new ExtraFields($db); $diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array @@ -86,10 +86,10 @@ if (empty($reshook)) $permissiontoadd = $user->rights->bom->write; $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); - $backurlforlist = dol_buildpath('/bom/bom_list.php', 1); + $backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php'; if (empty($backtopage)) { if (empty($id)) $backtopage = $backurlforlist; - else $backtopage = dol_buildpath('/bom/bom_card.php', 1).($id > 0 ? $id : '__ID__'); + else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.$id; } $triggermodname = 'BILLOFMATERIALS_BILLOFMATERIALS_MODIFY'; // Name of trigger action code to execute when we modify record From e163849d05ec8f28c64bdc94f4cb9cb04f80b71e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2019 19:13:59 +0100 Subject: [PATCH 33/92] Fix label --- htdocs/langs/en_US/blockedlog.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index 5081b1c0384..9e8771ad68b 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -14,9 +14,9 @@ OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to prev AddedByAuthority=Stored into remote authority NotAddedByAuthorityYet=Not yet stored into remote authority ShowDetails=Show stored details -logPAYMENT_VARIOUS_CREATE=Payment (not assigned to invoice) created -logPAYMENT_VARIOUS_MODIFY=Payment (not assigned to invoice) modified -logPAYMENT_VARIOUS_DELETE=Payment (not assigned to invoice) logical deletion +logPAYMENT_VARIOUS_CREATE=Payment (not assigned to an invoice) created +logPAYMENT_VARIOUS_MODIFY=Payment (not assigned to an invoice) modified +logPAYMENT_VARIOUS_DELETE=Payment (not assigned to an invoice) logical deletion logPAYMENT_ADD_TO_BANK=Payment added to bank logPAYMENT_CUSTOMER_CREATE=Customer payment created logPAYMENT_CUSTOMER_DELETE=Customer payment logical deletion From 31c296f44b795503858b9aa26682b05f6dd29430 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2019 20:01:21 +0100 Subject: [PATCH 34/92] Fix bad tooltip to rm file --- htdocs/admin/system/filecheck.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index ba8307792fc..f00164698e8 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -339,8 +339,8 @@ if (! $error && $xml) $out.=''.$i.''.$file['filename']; if (! preg_match('/^win/i',PHP_OS)) { - $htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.'/'.$file['filename']); - $out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'); + $htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.$file['filename']); // The slash is included int file['filename'] + $out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i); } $out.=''.$file['expectedmd5'].''; - print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, ''); + print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, '', 0, 0, '', false, 1); print ''; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 2ce6ca0f70a..3c7253f9065 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -133,6 +133,7 @@ if (empty($reshook)) $date=''; $comments=''; $vatrate=''; + $value_unit_ht=''; $value_unit=''; $qty=1; $fk_c_type_fees=-1; @@ -1095,10 +1096,16 @@ if (empty($reshook)) // if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary. if (empty($vatrate)) $vatrate = "0.000"; - $vatrate = price2num($vatrate); + $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $vatrate)); + $value_unit_ht=price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); $value_unit=price2num(GETPOST('value_unit', 'alpha'), 'MU'); - $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int'); + if (empty($value_unit)) + { + $value_unit = price2num($value_unit_ht + ($value_unit_ht * $tmpvat / 100), 'MU'); + } + + $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int'); $qty = GETPOST('qty', 'int'); if (empty($qty)) $qty=1; @@ -1110,23 +1117,13 @@ if (empty($reshook)) $action=''; } - if ($vatrate < 0 || $vatrate == '') + if ((int) $tmpvat < 0 || $tmpvat == '') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors'); $action=''; } - /* Projects are never required. To force them, check module forceproject - if ($conf->projet->enabled) - { - if (empty($object_ligne->fk_projet) || $object_ligne->fk_projet==-1) - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Project")), null, 'errors'); - } - }*/ - // Si aucune date n'est rentrée if (empty($date) || $date=="--") { @@ -1134,7 +1131,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); } // Si aucun prix n'est rentré - if ($value_unit==0) + if ($value_unit == 0) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors'); @@ -1171,6 +1168,7 @@ if (empty($reshook)) } unset($qty); + unset($value_unit_ht); unset($value_unit); unset($vatrate); unset($comments); @@ -1240,12 +1238,18 @@ if (empty($reshook)) $projet_id = $fk_projet; $comments = GETPOST('comments', 'none'); $qty = GETPOST('qty', 'int'); - $value_unit = price2num(GETPOST('value_unit', 'alpha'), 'MU'); $vatrate = GETPOST('vatrate', 'alpha'); - // if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary. - if (empty($vatrate)) $vatrate = "0.000"; - $vatrate = price2num($vatrate); + // if VAT is not used in Dolibarr, set VAT rate to 0 because VAT rate is necessary. + if (empty($vatrate)) $vatrate = "0.000"; + $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $vatrate)); + + $value_unit_ht=price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); + $value_unit=price2num(GETPOST('value_unit', 'alpha'), 'MU'); + if (empty($value_unit)) + { + $value_unit = price2num($value_unit_ht + ($value_unit_ht * $tmpvat / 100), 'MU'); + } if (! GETPOST('fk_c_type_fees', 'int') > 0) { @@ -1253,7 +1257,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); $action=''; } - if ((int) $vatrate < 0 || $vatrate == '') + if ((int) $tmpvat < 0 || $tmpvat == '') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors'); @@ -1742,7 +1746,7 @@ else print '
'.$langs->trans("VALIDATOR").'
'.$langs->trans("CANCEL_USER").''.$langs->trans("AmountHT").''.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).'
'.$langs->trans('Type').''.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').''.dol_escape_htmltag($line->comments).''.vatrate($line->vatrate, true).''.price($line->value_unit_ht).''.price($line->value_unit).''.dol_escape_htmltag($line->qty).''; @@ -2137,12 +2143,17 @@ else // VAT print ''; - print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, ''); + print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, '', 0, 0, '', false, 1); print ''; - print ''; + print ''; + print ''; + print ''; print ''.$langs->trans('Type').''.$langs->trans('Description').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''.$langs->trans('PriceUTTC').''.$langs->trans('Qty').''; - print ''; + print ''; + print ''; + print ''; print '
'; print ''; + print ''; + print '
'; dol_fiche_end(); @@ -2286,7 +2323,7 @@ if ($action != 'create' && $action != 'edit') * ET fk_user_author == user courant * Afficher : "Enregistrer" / "Modifier" / "Supprimer" */ - if ($user->rights->expensereport->creer && $object->fk_statut==0) + if ($user->rights->expensereport->creer && $object->fk_statut == ExpenseReport::STATUS_DRAFT) { if (in_array($object->fk_user_author, $user->getAllChildIds(1)) || !empty($user->rights->expensereport->writeall_advance)) { @@ -2306,7 +2343,7 @@ if ($action != 'create' && $action != 'edit') * ET fk_user_author == user courant * Afficher : "Enregistrer" / "Modifier" / "Supprimer" */ - if($user->rights->expensereport->creer && $object->fk_statut==99) + if($user->rights->expensereport->creer && $object->fk_statut == ExpenseReport::STATUS_REFUSED) { if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { @@ -2320,7 +2357,7 @@ if ($action != 'create' && $action != 'edit') } } - if ($user->rights->expensereport->to_paid && $object->fk_statut==5) + if ($user->rights->expensereport->to_paid && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { @@ -2334,7 +2371,7 @@ if ($action != 'create' && $action != 'edit') * ET fk_user_validator == user courant * Afficher : "Valider" / "Refuser" / "Supprimer" */ - if ($object->fk_statut == 2) + if ($object->fk_statut == ExpenseReport::STATUS_VALIDATED) { if (in_array($object->fk_user_author, $user->getAllChildIds(1))) { @@ -2343,7 +2380,7 @@ if ($action != 'create' && $action != 'edit') } } - if ($user->rights->expensereport->approve && $object->fk_statut == 2) + if ($user->rights->expensereport->approve && $object->fk_statut == ExpenseReport::STATUS_VALIDATED) { //if($object->fk_user_validator==$user->id) //{ @@ -2364,13 +2401,13 @@ if ($action != 'create' && $action != 'edit') // If status is Appoved // -------------------- - if ($user->rights->expensereport->approve && $object->fk_statut == 5) + if ($user->rights->expensereport->approve && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { print ''; } // If bank module is used - if ($user->rights->expensereport->to_paid && ! empty($conf->banque->enabled) && $object->fk_statut == 5) + if ($user->rights->expensereport->to_paid && ! empty($conf->banque->enabled) && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { // Pay if ($remaintopay == 0) @@ -2384,7 +2421,7 @@ if ($action != 'create' && $action != 'edit') } // If bank module is not used - if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == 5) + if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { //if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) if ($object->paid == 0) @@ -2393,14 +2430,14 @@ if ($action != 'create' && $action != 'edit') } } - if ($user->rights->expensereport->creer && ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) && $object->fk_statut == 5) + if ($user->rights->expensereport->creer && ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { // Cancel print ''; } // TODO Replace this. It should be SetUnpaid and should go back to status unpaid not canceled. - if (($user->rights->expensereport->approve || $user->rights->expensereport->to_paid) && $object->fk_statut == 6) + if (($user->rights->expensereport->approve || $user->rights->expensereport->to_paid) && $object->fk_statut == ExpenseReport::STATUS_CLOSED) { // Cancel print ''; @@ -2412,12 +2449,12 @@ if ($action != 'create' && $action != 'edit') } /* If draft, validated, cancel, and user can create, he can always delete its card before it is approved */ - if ($user->rights->expensereport->creer && $user->id == $object->fk_user_author && $object->fk_statut <= 4) + if ($user->rights->expensereport->creer && $user->id == $object->fk_user_author && $object->fk_statut < ExpenseReport::STATUS_APPROVED) { // Delete print ''; } - elseif($user->rights->expensereport->supprimer && $object->fk_statut != 6) + elseif($user->rights->expensereport->supprimer && $object->fk_statut != ExpenseReport::STATUS_CLOSED) { // Delete print ''; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index bbada0e22f7..dc0ffefe4ff 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -115,6 +115,11 @@ class ExpenseReport extends CommonObject */ const STATUS_VALIDATED = 2; + /** + * Classified canceled + */ + const STATUS_CANCELED = 4; + /** * Classified approved */ @@ -1442,12 +1447,12 @@ class ExpenseReport extends CommonObject // phpcs:enable $error = 0; $this->date_cancel = $this->db->idate(gmmktime()); - if ($this->fk_statut != 4) + if ($this->fk_statut != ExpenseReport::STATUS_CANCELED) { $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - $sql.= " SET fk_statut = 4, fk_user_cancel = ".$fuser->id; + $sql.= " SET fk_statut = ".ExpenseReport::STATUS_CANCELED.", fk_user_cancel = ".$fuser->id; $sql.= ", date_cancel='".$this->db->idate($this->date_cancel)."'"; $sql.= " ,detail_cancel='".$this->db->escape($detail)."'"; $sql.= ' WHERE rowid = '.$this->id; @@ -1676,10 +1681,10 @@ class ExpenseReport extends CommonObject /** * addline * - * @param real $qty Qty + * @param float $qty Qty * @param double $up Value init * @param int $fk_c_type_fees Type payment - * @param double $vatrate Vat rate + * @param string $vatrate Vat rate (Can be '10' or '10 (ABC)') * @param string $date Date * @param string $comments Description * @param int $fk_project Project id @@ -1703,8 +1708,8 @@ class ExpenseReport extends CommonObject if (empty($fk_project)) $fk_project = 0; $qty = price2num($qty); - if (!preg_match('/\((.*)\)/', $vatrate)) { - $vatrate = price2num($vatrate); // $txtva can have format '5.0(XXX)' or '5' + if (! preg_match('/\s*\((.*)\)/', $vatrate)) { + $vatrate = price2num($vatrate); // $txtva can have format '5.0 (XXX)' or '5' } $up = price2num($up); @@ -1715,7 +1720,7 @@ class ExpenseReport extends CommonObject $localtaxes_type=getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty); $vat_src_code = ''; - if (preg_match('/\((.*)\)/', $vatrate, $reg)) + if (preg_match('/\s*\((.*)\)/', $vatrate, $reg)) { $vat_src_code = $reg[1]; $vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate. @@ -1727,6 +1732,7 @@ class ExpenseReport extends CommonObject $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller, $localtaxes_type); $this->line->value_unit = $up; + $this->line->vat_src_code = $vat_src_code; $this->line->vatrate = price2num($vatrate); $this->line->total_ttc = $tmp[2]; $this->line->total_ht = $tmp[0]; @@ -1928,9 +1934,9 @@ class ExpenseReport extends CommonObject * @param int $rowid Line to edit * @param int $type_fees_id Type payment * @param int $projet_id Project id - * @param double $vatrate Vat rate. Can be '8.5* (8.5NPROM...)' + * @param double $vatrate Vat rate. Can be '8.5' or '8.5* (8.5NPROM...)' * @param string $comments Description - * @param real $qty Qty + * @param float $qty Qty * @param double $value_unit Value init * @param int $date Date * @param int $expensereport_id Expense report id diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 7dd893b8dab..72330e09b92 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -237,3 +237,6 @@ ALTER TABLE llx_facturedet_rec ADD COLUMN fk_product_fournisseur_price integer D ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_author integer; ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_modif integer; +ALTER TABLE llx_expensereport_det MODIFY COLUMN value_unit double(24,8) NOT NULL; +ALTER TABLE llx_expensereport_det ADD COLUMN subprice double(24,8) NOT NULL after qty; + diff --git a/htdocs/install/mysql/tables/llx_expensereport_det.sql b/htdocs/install/mysql/tables/llx_expensereport_det.sql index fc0bd6e697f..1000e10955f 100644 --- a/htdocs/install/mysql/tables/llx_expensereport_det.sql +++ b/htdocs/install/mysql/tables/llx_expensereport_det.sql @@ -27,7 +27,8 @@ CREATE TABLE llx_expensereport_det comments text NOT NULL, product_type integer DEFAULT -1, qty real NOT NULL, - value_unit real NOT NULL, + subprice double(24,8), -- P.U. HT (example 100) + value_unit double(24,8) NOT NULL, -- P.U. TTC (example 120) remise_percent real, vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here. tva_tx double(6,3), -- Vat rate From 5a98207998376413f698f22e8e82459f4af3449f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 7 Mar 2019 11:19:55 +0100 Subject: [PATCH 43/92] avoid timeout --- htdocs/core/modules/export/export_csv.modules.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 249d1563988..5bdc2f384ac 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -24,6 +24,8 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/export/modules_export.php'; +// avoid timeout for big export +set_time_limit(0); /** * Class to build export files with format CSV From 1b26f1fa08327dd93aa518cd0acaa20a49ecc877 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 7 Mar 2019 11:26:21 +0100 Subject: [PATCH 44/92] remove avoid timeout --- htdocs/core/modules/export/export_csv.modules.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 5bdc2f384ac..249d1563988 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -24,8 +24,6 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/export/modules_export.php'; -// avoid timeout for big export -set_time_limit(0); /** * Class to build export files with format CSV From a6bb1cf5f6dc33e473eaca7adff899197c251f76 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 7 Mar 2019 11:27:06 +0100 Subject: [PATCH 45/92] avoid timeout --- htdocs/core/modules/export/export_csv.modules.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 249d1563988..5bdc2f384ac 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -24,6 +24,8 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/export/modules_export.php'; +// avoid timeout for big export +set_time_limit(0); /** * Class to build export files with format CSV From f54eb78260a58b414961c3cc13afcd201bebf7a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 12:22:24 +0100 Subject: [PATCH 46/92] NEW Show the latest date of subscription in member statistics reports --- htdocs/adherents/stats/byproperties.php | 16 ++++---- htdocs/adherents/stats/geo.php | 37 ++++++++++++------- .../install/mysql/migration/9.0.0-10.0.0.sql | 2 + htdocs/langs/en_US/users.lang | 2 +- 4 files changed, 35 insertions(+), 22 deletions(-) diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 164606431ff..6ba88e7771b 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -58,15 +58,16 @@ llxHeader('', $langs->trans("MembersStatisticsByProperties"), '', '', 0, 0, arra $title=$langs->trans("MembersStatisticsByProperties"); -print load_fiche_titre($title, $mesg); +print load_fiche_titre($title, ''); dol_mkdir($dir); $tab='byproperties'; $data = array(); -$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, d.morphy as code"; +$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, d.morphy as code"; $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; +$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY d.morphy"; @@ -87,7 +88,7 @@ if ($resql) if ($obj->code == 'phy') $foundphy++; if ($obj->code == 'mor') $foundmor++; - $data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate)); + $data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)); $i++; } @@ -120,22 +121,21 @@ print ''; print ''; print ''; print ''; +print ''; print ''; print ''; -if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>''); -if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>''); +if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>''); +if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>''); -$oldyear=0; foreach ($data as $val) { - $year = $val['year']; print ''; print ''; print ''; print ''; + print ''; print ''; - $oldyear=$year; } print '
'.$langs->trans("Nature").''.$langs->trans("NbOfMembers").''.$langs->trans("LastMemberDate").''.$langs->trans("LatestSubscriptionDate").'
'.$memberstatic->getmorphylib($val['label']).''.$val['nb'].''.dol_print_date($val['lastdate'], 'dayhour').''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'
'; diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index f5816f46aca..79aa5ab6a82 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -77,8 +77,10 @@ if ($mode) $tab='statscountry'; $data = array(); - $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label"; - $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; + $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label"; + $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY c.label, c.code"; @@ -92,10 +94,12 @@ if ($mode) $tab='statsstate'; $data = array(); - $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, c.nom as label2"; // - $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; + $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; // + $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY co.label, co.code, c.nom"; @@ -108,10 +112,12 @@ if ($mode) $tab='statsregion'; //onglet $data = array(); //tableau de donnée - $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, r.nom as label2"; - $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; + $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2"; + $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY co.label, co.code, r.nom"; //+ @@ -124,9 +130,10 @@ if ($mode) $tab='statstown'; $data = array(); - $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label, d.town as label2"; + $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2"; $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; + $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid"; $sql.=" WHERE d.entity IN (".getEntity('adherent').")"; $sql.=" AND d.statut = 1"; $sql.=" GROUP BY c.label, c.code, d.town"; @@ -154,7 +161,8 @@ if ($mode) 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'code'=>$obj->code, 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate) + 'lastdate'=>$db->jdate($obj->lastdate), + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) ); } if ($mode == 'memberbyregion') //+ @@ -164,7 +172,8 @@ if ($mode) 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate) + 'lastdate'=>$db->jdate($obj->lastdate), + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) ); } if ($mode == 'memberbystate') @@ -173,7 +182,8 @@ if ($mode) 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate) + 'lastdate'=>$db->jdate($obj->lastdate), + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) ); } if ($mode == 'memberbytown') @@ -182,7 +192,8 @@ if ($mode) 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))), 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")), 'nb'=>$obj->nb, - 'lastdate'=>$db->jdate($obj->lastdate) + 'lastdate'=>$db->jdate($obj->lastdate), + 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate) ); } @@ -289,9 +300,9 @@ if ($mode) if ($label2) print ''.$label2.''; print ''.$langs->trans("NbOfMembers").''; print ''.$langs->trans("LastMemberDate").''; + print ''.$langs->trans("LatestSubscriptionDate").''; print ''; - $oldyear=0; foreach ($data as $val) { $year = $val['year']; @@ -300,8 +311,8 @@ if ($mode) if ($label2) print ''.$val['label2'].''; print ''.$val['nb'].''; print ''.dol_print_date($val['lastdate'], 'dayhour').''; + print ''.dol_print_date($val['lastsubscriptiondate'], 'dayhour').''; print ''; - $oldyear=$year; } print ''; diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 72330e09b92..19c6d2b386c 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -58,6 +58,8 @@ CREATE TABLE llx_pos_cash_fence( -- For 10.0 +DROP TABLE llx_cotisation; + ALTER TABLE llx_loan ADD COLUMN insurance_amount double(24,8) DEFAULT 0; ALTER TABLE llx_facture DROP INDEX idx_facture_uk_facnumber; diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 53ac720d862..fb35cb5e112 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -109,4 +109,4 @@ UserLogoff=User logout UserLogged=User logged DateEmployment=Employment Start Date DateEmploymentEnd=Employment End Date -CantDisableYourself=You can disable your own user record \ No newline at end of file +CantDisableYourself=You can't disable your own user record \ No newline at end of file From e3fb228a4d148265945c5a0008019f9534b18221 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 12:28:19 +0100 Subject: [PATCH 47/92] Update fournisseur.facture.class.php --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b0351252c0b..4642c0bf753 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1481,7 +1481,7 @@ class FactureFournisseur extends CommonInvoice $this->line->total_localtax1=$total_localtax1; $this->line->total_localtax2=$total_localtax2; $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); - $this->line->special_code=!empty($special_code) ? $special_code : $this->special_code; + $this->line->special_code=((string) $special_code != '' ? $special_code : $this->special_code); $this->line->fk_parent_line=$this->fk_parent_line; $this->line->origin=$this->origin; $this->line->origin_id=$origin_id; From b4bdbda9f5058eb4394cf80134ca6405439392d5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 12:36:57 +0100 Subject: [PATCH 48/92] Update mysqli.class.php --- htdocs/core/db/mysqli.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 1b040ddfa18..1e244df883f 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -256,9 +256,8 @@ class DoliDBMysqli extends DoliDB $query = trim($query); - if (empty($query)) return null; - if (! in_array($query, array('BEGIN','COMMIT','ROLLBACK'))) dol_syslog('sql='.$query, LOG_DEBUG); + if (empty($query)) return false; // Return false = error if empty request if (! $this->database_name) { From a0bc6672d8e034a8ce5ef0da736a46a7bec57f74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 12:43:17 +0100 Subject: [PATCH 49/92] Try to avoid to make subquery when not necessary --- htdocs/adherents/class/adherent.class.php | 28 +++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 15cb81f8474..47526d7cf70 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -563,18 +563,22 @@ class Adherent extends CommonObject $sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest $sql.= " WHERE rowid = ".$this->id; - $sql2 = "SELECT libelle"; - $sql2.= " FROM ".MAIN_DB_PREFIX."adherent_type"; - $sql2.= " WHERE rowid = ".$this->typeid; - $resql2 = $this->db->query($sql2); - if($resql2) - { - while ($obj=$this->db->fetch_object($resql2)) - { - $this->type=$obj->libelle; - } - } - + // If we change the type of membership, we set also label of new type + if (! empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid) + { + $sql2 = "SELECT libelle as label"; + $sql2.= " FROM ".MAIN_DB_PREFIX."adherent_type"; + $sql2.= " WHERE rowid = ".$this->typeid; + $resql2 = $this->db->query($sql2); + if ($resql2) + { + while ($obj=$this->db->fetch_object($resql2)) + { + $this->type=$obj->label; + } + } + } + dol_syslog(get_class($this)."::update update member", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) From 1fb86e12e5bf10177f510d75b28c45494374af25 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 13:02:51 +0100 Subject: [PATCH 50/92] Merge manually some enhancement from #10507 --- htdocs/compta/compta-files.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index 3917cad6133..647348269a2 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -25,15 +25,14 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -$langs->loadLangs(array("accountancy","bills")); +$langs->loadLangs(array("accountancy", "bills", "companies")); $date_start =GETPOST('date_start', 'alpha'); $date_startDay= GETPOST('date_startday', 'int'); @@ -49,7 +48,7 @@ $date_stop=($date_stopDay)?dol_mktime(0, 0, 0, $date_stopMonth, $date_stopDay, $ $action =GETPOST('action', 'alpha'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('comptafileslist','globallist')); +$hookmanager->initHooks(array('comptafileslist', 'globallist')); // Load variable for pagination $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; @@ -92,7 +91,7 @@ $filesarray=array(); $result=false; if(($action=="searchfiles" || $action=="dl" ) && $date_start && $date_stop) { $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; - $sql="SELECT rowid as id, ref as ref,paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; + $sql="SELECT rowid as id, ref as ref, paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; $sql.=" WHERE datef between ".$wheretail; $sql.=" AND entity IN (".($entity==1?'0,1':$entity).')'; $sql.=" AND fk_statut <> ".Facture::STATUS_DRAFT; @@ -189,6 +188,7 @@ if(($action=="searchfiles" || $action=="dl" ) && $date_start && $date_stop) { //var_dump($upload_dir); if (count($files) < 1) { + $nofile['id']=$objd->id; $nofile['date']=$db->idate($objd->date); $nofile['paid']=$objd->paid; $nofile['amount']=$objd->total_ttc; @@ -202,6 +202,7 @@ if(($action=="searchfiles" || $action=="dl" ) && $date_start && $date_stop) { { foreach ($files as $key => $file) { + $file['id']=$objd->id; $file['date']=$db->idate($objd->date); $file['paid']=$objd->paid; $file['amount']=$objd->total_ttc; @@ -236,6 +237,12 @@ if(($action=="searchfiles" || $action=="dl" ) && $date_start && $date_stop) { if ($result && $action == "dl") { + if (! extension_loaded('zip')) + { + setEventMessages('PHPZIPExtentionNotLoaded', null, 'errors'); + exit; + } + $dirfortmpfile = ($conf->accounting->dir_temp ? $conf->accounting->dir_temp : $conf->compta->dir_temp); dol_mkdir($dirfortmpfile); From 0349f9bfaae2331f818d3c97f7a13aa15af88457 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 13:26:25 +0100 Subject: [PATCH 51/92] Update objectline_create.tpl.php --- htdocs/core/tpl/objectline_create.tpl.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index d598c18a33e..73d06b3e0aa 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -260,15 +260,17 @@ else { if ($senderissupplier != 2) { $ajaxoptions=array( - 'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key - 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done - 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo) + 'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with each ajax json response key + 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done + 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo) ); $alsoproductwithnosupplierprice=0; } else { - $ajaxoptions = array('update' => array('remise_percent' => 'discount')); + $ajaxoptions = array( + 'update' => array('remise_percent' => 'discount') // html id tags that will be edited with each ajax json response key + ); $alsoproductwithnosupplierprice=1; } From 9a9fd15077dfe3eacac754f537ffeda956601747 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 14:10:33 +0100 Subject: [PATCH 52/92] Fix doxygen --- htdocs/fourn/class/fournisseur.facture.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index d08e8efd919..3a27690e7ac 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1501,6 +1501,7 @@ class FactureFournisseur extends CommonInvoice * @param int $origin_id id origin document * @param double $pu_ht_devise Amount in currency * @param string $ref_supplier Supplier ref + * @param string $special_code Special code * @return int >0 if OK, <0 if KO */ public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='', $special_code='') From b9408baef3c286fc42a97c7b674d26f6a4aa2845 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 14:27:20 +0100 Subject: [PATCH 53/92] Fix if price net was not saved, we recalculate it at output --- htdocs/expensereport/card.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 3c7253f9065..ff55935ea09 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2076,8 +2076,22 @@ else print ''; print ''.dol_escape_htmltag($line->comments).''; print ''.vatrate($line->vatrate, true).''; - print ''.price($line->value_unit_ht).''; + // Unit price HT + print ''; + if (! empty($line->value_unit_ht)) + { + print price($line->value_unit_ht); + } + else + { + $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $line->vatrate)); + $pricenettoshow = price2num($line->value_unit / (1 + $tmpvat / 100), 'MU'); + print $pricenettoshow; + } + print ''; + print ''.price($line->value_unit).''; + print ''.dol_escape_htmltag($line->qty).''; if ($action != 'editline') @@ -2148,12 +2162,12 @@ else // Unit price print ''; - print ''; + print ''; print ''; // Unit price with tax print ''; - print ''; + print ''; print ''; // Quantity From 31e1ad48e3fcce5434443212fa146517c1bc7003 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 14:28:09 +0100 Subject: [PATCH 54/92] css --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index ff55935ea09..e883620f3bc 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2172,7 +2172,7 @@ else // Quantity print ''; - print ''; + print ''; print ''; if ($action != 'editline') From 25fa729e4ed12d6ce69c35ccf7013dcb96d7793f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 14:32:03 +0100 Subject: [PATCH 55/92] NEW Add the now link when creating expense report --- htdocs/expensereport/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index e883620f3bc..7d2b725c101 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2215,7 +2215,7 @@ else // Select date print ''; - print $form->selectDate($date?$date:-1, 'date'); + print $form->selectDate($date?$date:-1, 'date', 0, 0, 0, '', 1, 1); print ''; // Select project From d414e3eb488f74f000d57436fce474fa3c37bc09 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 7 Mar 2019 15:00:48 +0100 Subject: [PATCH 56/92] add product extrafields --- htdocs/core/modules/modExpedition.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index e096d840864..f0b302d7a29 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -283,6 +283,8 @@ class modExpedition extends DolibarrModules include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $keyforselect='expeditiondet'; $keyforelement='shipment_line'; $keyforaliasextra='extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extraprod'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'expedition as c'; @@ -295,6 +297,7 @@ class modExpedition extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'expeditiondet_extrafields as extra2 ON ed.rowid = extra2.fk_object'; $this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'commandedet as cd'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on cd.fk_product = p.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extraprod ON p.rowid = extraprod.fk_object'; if ($idcontacts && ! empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) { $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'element_contact as ee ON ee.element_id = cd.fk_commande AND ee.fk_c_type_contact IN ('.$idcontacts.')'; From d88fc8cf91601ddfd7276dd4bc97196cee5e1518 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 17:32:10 +0100 Subject: [PATCH 57/92] Fix bad link --- htdocs/projet/element.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index dccc3df312f..54906249234 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -436,7 +436,7 @@ $listofreferent=array( 'table'=>'projet_task', 'datefieldname'=>'task_date', 'disableamount'=>0, - 'urlnew'=>DOL_URL_ROOT.'/projet/tasks.php?id='.$id, + 'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?id='.$id, 'buttonnew'=>'AddTimeSpent', 'testnew'=>$user->rights->projet->creer, 'test'=>($conf->projet->enabled && $user->rights->projet->lire && empty($conf->global->PROJECT_HIDE_TASKS))), From 1917adb98051610ff6e4caa4ebe5f66e8640a1d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 7 Mar 2019 17:35:02 +0100 Subject: [PATCH 58/92] Update stats.class.php The property _lastfetchdate is declared private in Stats and cannot be accessed from this context. --- htdocs/core/class/stats.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index b06f1deb4c3..07d644f083d 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -30,7 +30,7 @@ abstract class Stats { protected $db; - private $_lastfetchdate=array(); // Dates of cache file read by methods + protected $_lastfetchdate=array(); // Dates of cache file read by methods public $cachefilesuffix=''; // Suffix to add to name of cache file (to avoid file name conflicts) /** From d02cec95798c54d595d64cdbd72f5f2dcc39d364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 7 Mar 2019 18:13:21 +0100 Subject: [PATCH 59/92] phpcs fix v9 --- htdocs/fourn/class/fournisseur.facture.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 2f25481acd7..22d430919e3 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1555,6 +1555,7 @@ class FactureFournisseur extends CommonInvoice * @param int $origin_id id origin document * @param double $pu_ht_devise Amount in currency * @param string $ref_supplier Supplier ref + * @param string $special_code Special code * @return int >0 if OK, <0 if KO */ public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='', $special_code='') From d96cc53f97e275b8d5ba2b7dc040f294cc81130d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 7 Mar 2019 20:46:38 +0100 Subject: [PATCH 60/92] replace html by html5 in fourn --- htdocs/compta/compta-files.php | 6 +- htdocs/compta/recap-compta.php | 10 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/fourn/card.php | 42 +++---- htdocs/fourn/commande/dispatch.php | 38 +++---- htdocs/fourn/commande/index.php | 20 ++-- htdocs/fourn/commande/list.php | 76 ++++++------- htdocs/fourn/commande/orderstoinvoice.php | 26 ++--- .../commande/tpl/linkedobjectblock.tpl.php | 18 +-- htdocs/fourn/facture/card.php | 76 ++++++------- htdocs/fourn/facture/impayees.php | 42 +++---- htdocs/fourn/facture/list.php | 106 +++++++++--------- htdocs/fourn/facture/paiement.php | 78 ++++++------- htdocs/fourn/facture/rapport.php | 8 +- .../facture/tpl/linkedobjectblock.tpl.php | 18 +-- htdocs/fourn/index.php | 20 ++-- htdocs/fourn/product/list.php | 16 +-- htdocs/fourn/recap-fourn.php | 24 ++-- 18 files changed, 313 insertions(+), 313 deletions(-) diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index 647348269a2..87efafd3405 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -419,11 +419,11 @@ if (!empty($date_start) && !empty($date_stop)) //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; print ''; - print ""; + print ""; print dol_print_date($data['date'], 'day'); print "\n"; - print ''.$langs->trans($data['item']).''; - print ''.$data['ref'].''; + print ''.$langs->trans($data['item']).''; + print ''.$data['ref'].''; // File link print '".$data['name']."\n"; diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index f7b2ec89008..19ac65cbd4e 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -252,22 +252,22 @@ if ($id > 0) print ''; - print ""; + print ""; if (!empty($data['fk_facture'])) print dol_print_date($data['date'], 'day'); elseif (!empty($data['fk_paiement'])) print dol_print_date($data['date'], 'dayhour'); print "\n"; print ''.$data['link']."\n"; - print ''.$data['status'].''; + print ''.$data['status'].''; print ''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."\n"; - + $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0; - + print ''.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."\n"; $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']); - + // Balance print ''.price($data['balance'])."\n"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0618e15afe8..e2d7fbc11a2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6651,7 +6651,7 @@ class Form $objp = $this->db->fetch_object($resqllist); print ''; - print ''; + print ''; print ''; print ''; print '' . $objp->ref . ''; diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 3cb2e585db6..ae17cdecd46 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -232,7 +232,7 @@ if ($object->id > 0) print ''; + if (($action != 'editconditions') && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('PaymentConditions'); print ''; - if (($action != 'editconditions') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; print ''; if ($action == 'editconditions') @@ -251,7 +251,7 @@ if ($object->id > 0) print ''; + if (($action != 'editmode') && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('PaymentMode'); print ''; - if (($action != 'editmode') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; print ''; if ($action == 'editmode') @@ -269,7 +269,7 @@ if ($object->id > 0) print ''; print ''; if ($action != 'editmode' && $user->rights->fournisseur->facture->creer) { - print ''; + print ''; } print '
'; print $langs->trans("CustomerRelativeDiscountShort"); - print ''; + print ''; if ($user->rights->societe->creer && !$user->societe_id > 0) { print ''.img_edit($langs->trans("Modify")).''; @@ -283,7 +283,7 @@ if ($object->id > 0) print ''; print ''; print ''; print '
'; print $langs->trans("CustomerAbsoluteDiscountShort"); - print ''; + print ''; if ($user->rights->societe->creer && !$user->societe_id > 0) { print ''.img_edit($langs->trans("Modify")).''; @@ -442,7 +442,7 @@ if ($object->id > 0) print ''; print ''; print ''; + print '
'; - print '
'.$langs->trans("Summary").''.$langs->trans("ShowSupplierPreview").'
'.$langs->trans("ShowSupplierPreview").'
'; print '
'; @@ -471,7 +471,7 @@ if ($object->id > 0) print ''; print ''; - print ''; @@ -498,8 +498,8 @@ if ($object->id > 0) print ''; - //print ''; - print ''; + print ''; print ''; } @@ -565,7 +565,7 @@ if ($object->id > 0) $proposalstatic->total_ttc = $obj->total_ttc; print $proposalstatic->getNomUrl(1); print ''; - print ''; - print ''; + print ''; print ''; $i++; } @@ -649,8 +649,8 @@ if ($object->id > 0) print ''; print ''; } @@ -668,7 +668,7 @@ if ($object->id > 0) $orderstatic->total_ttc = $obj->total_ttc; print $orderstatic->getNomUrl(1); print ''; - print ''; - print ''; + print ''; print ''; $i++; } @@ -721,8 +721,8 @@ if ($object->id > 0) print ''; print ''; } @@ -745,9 +745,9 @@ if ($object->id > 0) print $obj->ref_supplier?' - '.$obj->ref_supplier:''; print ($obj->libelle?' - ':'').dol_trunc($obj->libelle, 14); print ''; - print ''; - print ''; - print ''; + print ''; + print ''; print ''; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index fab8aa705de..7a8bb2bcd22 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -523,12 +523,12 @@ if ($id > 0 || ! empty($ref)) { print ''; print ''; } - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; - print ''; + print ''; print "\n"; } @@ -595,17 +595,17 @@ if ($id > 0 || ! empty($ref)) { $up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU'); // Supplier ref - print ''; + print ''; // Qty ordered - print ''; + print ''; // Already dispatched - print ''; + print ''; if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) { $type = 'batch'; - print ''; // Qty to dispatch print ''; // Qty to dispatch print ''; @@ -691,7 +691,7 @@ if ($id > 0 || ! empty($ref)) { print ''; // Warehouse - print ''; print ''; } - print ''; + print ''; print ''; print ''; print ''; if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) || !empty($conf->reception->enabled)) - print ''; + print ''; print "\n"; @@ -836,7 +836,7 @@ if ($id > 0 || ! empty($ref)) { } // Qty - print ''; + print ''; print ''; // Warehouse @@ -851,14 +851,14 @@ if ($id > 0 || ! empty($ref)) { // Status if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS) && empty($reception->rowid)) { - print ''; // Add button to check/uncheck disaptching - print ''; }elseif(!empty($conf->reception->enabled)){ - print ''; - print ''; diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index c846ff16b5f..6c2b66bc7f3 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -119,13 +119,13 @@ if ($resql) print ''; print ''; - print ''; + print ''; print "\n"; } } if ($conf->use_javascript_ajax) { - print ''; } //if ($totalinprocess != $total) - //print ''; - print ''; + //print ''; + print ''; print "
'.$langs->trans("ProductsAndServices").''; + print ''.$langs->trans("ProductsAndServices").''; print ''.$langs->trans("AllProductReferencesOfSupplier").' '.$object->nbOfProductRefs().''; print '
'; print dol_trunc(dol_htmlentities($objp->label), 30); print ''.dol_print_date($objp->tms, 'day').''; + //print ''.dol_print_date($objp->tms, 'day').''; //print (isset($objp->unitprice) ? price($objp->unitprice) : ''); if (isset($objp->price)) { @@ -546,8 +546,8 @@ if ($object->id > 0) print '
'; print ''; - print ''; - print ''; + print ''; + print ''; print '
'.$langs->trans("LastSupplierProposals", ($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPriceRequests").' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').''.$langs->trans("AllPriceRequests").' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; print '
'; + print ''; if ($obj->dc) { print dol_print_date($db->jdate($obj->dc), 'day'); @@ -575,7 +575,7 @@ if ($object->id > 0) print "-"; } print ''.$proposalstatic->LibStatut($obj->fk_statut, 5).''.$proposalstatic->LibStatut($obj->fk_statut, 5).'
'; print ''; - print ''; - print ''; + print ''; + print ''; print '
'.$langs->trans("LastSupplierOrders", ($num<$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; print '
'; + print ''; if ($obj->dc) { print dol_print_date($db->jdate($obj->dc), 'day'); @@ -678,7 +678,7 @@ if ($object->id > 0) print "-"; } print ''.$orderstatic->LibStatut($obj->fk_statut, 5).''.$orderstatic->LibStatut($obj->fk_statut, 5).'
'; - print ''; - print ''; + print '
'.$langs->trans('LastSuppliersBills', ($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; + print ''; print '
'.$langs->trans('LastSuppliersBills', ($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans('AllBills').' '.$num.''.img_picto($langs->trans("Statistics"), 'stats').'
'; print '
'.dol_print_date($db->jdate($obj->df), 'day').''.price($obj->amount).''; + print ''.dol_print_date($db->jdate($obj->df), 'day').''.price($obj->amount).''; print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $obj->am); print '
' . $langs->trans("SupplierRef") . '' . $langs->trans("QtyOrdered") . '' . $langs->trans("QtyDispatchedShort") . '' . $langs->trans("QtyToDispatchShort") . '' . $langs->trans("SupplierRef") . '' . $langs->trans("QtyOrdered") . '' . $langs->trans("QtyDispatchedShort") . '' . $langs->trans("QtyToDispatchShort") . '' . $langs->trans("Warehouse") . '' . $langs->trans("Warehouse") . '
'.$objp->sref.''.$objp->sref.'' . $objp->qty . '' . $objp->qty . '' . $products_dispatched[$objp->rowid] . '' . $products_dispatched[$objp->rowid] . ''; + print ''; print ''; //print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); @@ -645,7 +645,7 @@ if ($id > 0 || ! empty($ref)) { } else { $type = 'dispatch'; - print ''; + print ''; print ''; //print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); @@ -672,7 +672,7 @@ if ($id > 0 || ! empty($ref)) { } // Qty to dispatch - print ''; + print ''; print ''; print ''; + print ''; if (count($listwarehouses) > 1) { print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix); } elseif (count($listwarehouses) == 1) { @@ -796,12 +796,12 @@ if ($id > 0 || ! empty($ref)) { print '' . $langs->trans("EatByDate") . '' . $langs->trans("SellByDate") . '' . $langs->trans("QtyDispatched") . '' . $langs->trans("QtyDispatched") . '' . $langs->trans("Warehouse") . '' . $langs->trans("Comment") . '' . $langs->trans("Status") . '' . $langs->trans("Status") . '
' . $objp->qty . '' . $objp->qty . ' '; + print ''; $supplierorderdispatch->status = (empty($objp->status) ? 0 : $objp->status); // print $supplierorderdispatch->status; print $supplierorderdispatch->getLibStatut(5); print ''; + print ''; if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))) { if (empty($objp->status)) { @@ -887,13 +887,13 @@ if ($id > 0 || ! empty($ref)) { } print ''; + print ''; if(!empty($reception->id)){ print $reception->getLibStatut(5); } } print ''; + print ''; print '
'.$commandestatic->LibStatut($statut, 0).''.(isset($vals[$statut])?$vals[$statut]:0).''.(isset($vals[$statut])?$vals[$statut]:0).'
'; + print '
'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); @@ -140,8 +140,8 @@ if ($resql) print '
'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'
'.$langs->trans("Total").' ('.$langs->trans("SuppliersOrdersRunning").')'.$totalinprocess.'
'.$langs->trans("Total").''.$total.'

"; } @@ -176,7 +176,7 @@ if ($resql) print ''; print ''; - print ''; + print ''; print "\n"; while ($i < $num) @@ -185,7 +185,7 @@ if ($resql) print ''; print ''; - print ''; + print ''; print "\n"; $i++; @@ -341,7 +341,7 @@ if ($resql) print ' '; print ''; - print ''; print ''; - print ''; + print ''; print ''; $i++; } @@ -408,7 +408,7 @@ print ''; -print ''; print ''; -print ''; +print ''; print ''; $i++; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 48d6cd28a1e..a2351dd7d9a 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -791,21 +791,21 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; } // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; } // Date order if (! empty($arrayfields['cf.date_commande']['checked'])) { - print ''; } if (! empty($arrayfields['cf.total_vat']['checked'])) { // Amount - print ''; } if (! empty($arrayfields['cf.total_ttc']['checked'])) { // Amount - print ''; } @@ -863,19 +863,19 @@ if ($resql) // Status if (! empty($arrayfields['cf.fk_statut']['checked'])) { - print ''; } // Status billed if (! empty($arrayfields['cf.billed']['checked'])) { - print ''; } // Action column - print ''; @@ -891,25 +891,25 @@ if ($resql) if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['cf.fk_author']['checked'])) print_liste_field_titre($arrayfields['cf.fk_author']['label'], $_SERVER["PHP_SELF"], "cf.fk_author", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['cf.date_commande']['checked'])) print_liste_field_titre($arrayfields['cf.date_commande']['label'], $_SERVER["PHP_SELF"], "cf.date_commande", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.date_delivery']['checked'])) print_liste_field_titre($arrayfields['cf.date_delivery']['label'], $_SERVER["PHP_SELF"], 'cf.date_livraison', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.total_ht']['checked'])) print_liste_field_titre($arrayfields['cf.total_ht']['label'], $_SERVER["PHP_SELF"], "cf.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.total_vat']['checked'])) print_liste_field_titre($arrayfields['cf.total_vat']['label'], $_SERVER["PHP_SELF"], "cf.tva", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.total_ttc']['checked'])) print_liste_field_titre($arrayfields['cf.total_ttc']['label'], $_SERVER["PHP_SELF"], "cf.total_ttc", "", $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['cf.date_commande']['checked'])) print_liste_field_titre($arrayfields['cf.date_commande']['label'], $_SERVER["PHP_SELF"], "cf.date_commande", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['cf.date_delivery']['checked'])) print_liste_field_titre($arrayfields['cf.date_delivery']['label'], $_SERVER["PHP_SELF"], 'cf.date_livraison', '', $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['cf.total_ht']['checked'])) print_liste_field_titre($arrayfields['cf.total_ht']['label'], $_SERVER["PHP_SELF"], "cf.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['cf.total_vat']['checked'])) print_liste_field_titre($arrayfields['cf.total_vat']['label'], $_SERVER["PHP_SELF"], "cf.tva", "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['cf.total_ttc']['checked'])) print_liste_field_titre($arrayfields['cf.total_ttc']['label'], $_SERVER["PHP_SELF"], "cf.total_ttc", "", $param, '', $sortfield, $sortorder, 'right '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['cf.datec']['checked'])) print_liste_field_titre($arrayfields['cf.datec']['label'], $_SERVER["PHP_SELF"], "cf.date_creation", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.tms']['checked'])) print_liste_field_titre($arrayfields['cf.tms']['label'], $_SERVER["PHP_SELF"], "cf.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.fk_statut']['checked'])) print_liste_field_titre($arrayfields['cf.fk_statut']['label'], $_SERVER["PHP_SELF"], "cf.fk_statut", "", $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['cf.billed']['checked'])) print_liste_field_titre($arrayfields['cf.billed']['label'], $_SERVER["PHP_SELF"], 'cf.billed', '', $param, 'align="center"', $sortfield, $sortorder, ''); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['cf.datec']['checked'])) print_liste_field_titre($arrayfields['cf.datec']['label'], $_SERVER["PHP_SELF"], "cf.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['cf.tms']['checked'])) print_liste_field_titre($arrayfields['cf.tms']['label'], $_SERVER["PHP_SELF"], "cf.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['cf.fk_statut']['checked'])) print_liste_field_titre($arrayfields['cf.fk_statut']['label'], $_SERVER["PHP_SELF"], "cf.fk_statut", "", $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['cf.billed']['checked'])) print_liste_field_titre($arrayfields['cf.billed']['label'], $_SERVER["PHP_SELF"], 'cf.billed', '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -952,7 +952,7 @@ if ($resql) //print ''; // Other picto tool - print ''; @@ -1036,7 +1036,7 @@ if ($resql) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; @@ -1046,7 +1046,7 @@ if ($resql) // Order date if (! empty($arrayfields['cf.date_commande']['checked'])) { - print ''; @@ -1055,7 +1055,7 @@ if ($resql) // Plannned date of delivery if (! empty($arrayfields['cf.date_delivery']['checked'])) { - print '\n"; + print '\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; $totalarray['totalht'] += $obj->total_ht; @@ -1074,7 +1074,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['cf.total_vat']['checked'])) { - print '\n"; + print '\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; $totalarray['totalvat'] += $obj->total_tva; @@ -1082,7 +1082,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['cf.total_ttc']['checked'])) { - print '\n"; + print '\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; @@ -1097,7 +1097,7 @@ if ($resql) // Date creation if (! empty($arrayfields['cf.datec']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -1105,7 +1105,7 @@ if ($resql) // Date modification if (! empty($arrayfields['cf.tms']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -1113,18 +1113,18 @@ if ($resql) // Status if (! empty($arrayfields['cf.fk_statut']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Billed if (! empty($arrayfields['cf.billed']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Action column - print ''; else print ''; } - elseif ($totalarray['totalhtfield'] == $i) print ''; - elseif ($totalarray['totalvatfield'] == $i) print ''; - elseif ($totalarray['totalttcfield'] == $i) print ''; + elseif ($totalarray['totalhtfield'] == $i) print ''; + elseif ($totalarray['totalvatfield'] == $i) print ''; + elseif ($totalarray['totalttcfield'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 8c8452b51ce..6e3a30507dc 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -500,10 +500,10 @@ if (($action != 'create' && $action != 'add') && !$error) { print ''; print_liste_field_titre('Ref', 'orderstoinvoice.php', 'c.ref', '', '&socid=' . $socid, '', $sortfield, $sortorder); print_liste_field_titre('RefSupplier', 'orderstoinvoice.php', 'c.ref_supplier', '', '&socid=' . $socid, '', $sortfield, $sortorder); - print_liste_field_titre('OrderDate', 'orderstoinvoice.php', 'c.date_commande', '', '&socid=' . $socid, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre('DeliveryDate', 'orderstoinvoice.php', 'c.date_livraison', '', '&socid=' . $socid, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre('Status', '', '', '', '', 'align="right"'); - print_liste_field_titre('GenerateBill', '', '', '', '', 'align="center"'); + print_liste_field_titre('OrderDate', 'orderstoinvoice.php', 'c.date_commande', '', '&socid=' . $socid, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre('DeliveryDate', 'orderstoinvoice.php', 'c.date_livraison', '', '&socid=' . $socid, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre('Status', '', '', '', '', '', '', '', 'right '); + print_liste_field_titre('GenerateBill', '', '', '', '', '', '', '', 'center '); print "\n"; // Lignes des champs de filtre @@ -513,27 +513,27 @@ if (($action != 'create' && $action != 'add') && !$error) { print ''; print ''; // print ''; // DATE ORDER - print ''; // DATE DELIVERY - print ''; // SEARCH BUTTON - print ''; // ALL/NONE - print ''; @@ -556,7 +556,7 @@ if (($action != 'create' && $action != 'add') && !$error) { print $generic_commande->getNomUrl(1, $objp->fk_statut); print ''; - print ''; // Order date - print ''; // Delivery date - print ''; // Statut - print ''; + print ''; // Checkbox print ' - - + - - + + 1) - - - - - + + + + + trans('PaymentConditions'); print ''; + print ''; } print '
'.$langs->trans("Status").''.$langs->trans("Nb").''.$langs->trans("Nb").'
'.$commandestatic->LibStatut($row[1]).''.$row[0].' '.$commandestatic->LibStatut($row[1], 3).''.$row[0].' '.$commandestatic->LibStatut($row[1], 3).'
'; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -352,7 +352,7 @@ if ($resql) print ''.img_object($langs->trans("ShowCompany"), "company").' '.$obj->name.''.dol_print_date($db->jdate($obj->tms), 'day').''.$commandestatic->LibStatut($obj->fk_statut, 5).''.$commandestatic->LibStatut($obj->fk_statut, 5).'
'; print ' '; print ''; +print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -419,7 +419,7 @@ print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).'
'; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($search_orderyear?$search_orderyear:-1, 'search_orderyear', 1, 20, 5); @@ -814,7 +814,7 @@ if ($resql) // Date delivery if (! empty($arrayfields['cf.date_delivery']['checked'])) { - print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($search_deliveryyear?$search_deliveryyear:-1, 'search_deliveryyear', 1, 20, 5); @@ -823,21 +823,21 @@ if ($resql) if (! empty($arrayfields['cf.total_ht']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; $formorder->selectSupplierOrderStatus((strstr($search_status, ',')?-1:$search_status), 1, 'search_status'); print ''; + print ''; print $form->selectyesno('search_billed', $search_billed, 1, 0, 1); print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print '
'; //print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->commande->dir_output.'/' . dol_sanitizeFileName($obj->ref); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); @@ -1027,7 +1027,7 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; + print ''; if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; + print ''; if ($obj->date_commande) print dol_print_date($db->jdate($obj->date_commande), 'day'); else print ''; print ''; + print ''; print dol_print_date($db->jdate($obj->date_delivery), 'day'); if ($objectstatic->hasDelay() && ! empty($objectstatic->date_delivery)) { print ' '.img_picto($langs->trans("Late").' : '.$objectstatic->showDelay(), "warning"); @@ -1066,7 +1066,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['cf.total_ht']['checked'])) { - print ''.price($obj->total_ht)."'.price($obj->total_ht)."'.price($obj->total_tva)."'.price($obj->total_tva)."'.price($obj->total_ttc)."'.price($obj->total_ttc)."'; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''.$objectstatic->LibStatut($obj->fk_statut, 5, $obj->billed).''.yn($obj->billed).''.yn($obj->billed).''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -1151,9 +1151,9 @@ if ($resql) if ($num < $limit) print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).''.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totalttc']).'
'; - print ''; + print ''; print ''; print ''; + print ''; print $period; print ''; + print ''; print $periodely; print ''; + print ''; print ''; print ''; + print ''; if ($conf->use_javascript_ajax) print '' . $langs->trans("All") . ' / ' . $langs->trans("None") . ''; print ''; + print ''; $filename = dol_sanitizeFileName($objp->ref); $filedir = $conf->fournisseur->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref); $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $objp->rowid; @@ -567,17 +567,17 @@ if (($action != 'create' && $action != 'add') && !$error) { print '' . $objp->ref_supplier . ''; + print ''; print dol_print_date($db->jdate($objp->date_commande), 'day'); print ''; + print ''; print dol_print_date($db->jdate($objp->date_livraison), 'day'); print '' . $generic_commande->LibStatut($objp->fk_statut, 5) . '' . $generic_commande->LibStatut($objp->fk_statut, 5) . ''; diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index 7a7d7d51b80..f46c5d20b81 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -49,14 +49,14 @@ foreach($linkedObjectBlock as $key => $objectlink) trans("SupplierOrder"); ?> trans("ShowOrder"), "order").' '.$objectlink->ref; ?> ref_supplier; ?>date, 'day'); ?>date, 'day'); ?>rights->fournisseur->commande->lire) { $total = $total + $objectlink->total_ht; echo price($objectlink->total_ht); } ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
trans("Total"); ?>
'; if ($action != 'editconditions' && $user->rights->fournisseur->facture->creer) { - print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; print '
'; @@ -2524,7 +2524,7 @@ else print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; print ''; @@ -2548,7 +2548,7 @@ else print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print ''; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon)) - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; print ''; if ($action == 'editmulticurrencycode') { @@ -2565,7 +2565,7 @@ else print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . ''; print ''; print ''; if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { @@ -2590,7 +2590,7 @@ else print $langs->trans('BankAccount'); print ''; if ($action != 'editbankaccount' && $user->rights->fournisseur->facture->creer) - print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; + print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).''; print ''; print ''; if ($action == 'editbankaccount') { @@ -2607,7 +2607,7 @@ else print ''; print '
'; print $langs->trans('IncotermLabel'); - print ''; + print ''; if ($user->rights->fournisseur->facture->creer) print ''.img_edit().''; else print ' '; print '
'; @@ -2730,8 +2730,8 @@ else print '' . ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')) . ''; print ''.$langs->trans('Date').''; print ''.$langs->trans('Type').''; - if (! empty($conf->banque->enabled)) print ''.$langs->trans('BankAccount').''; - print ''.$langs->trans('Amount').''; + if (! empty($conf->banque->enabled)) print ''.$langs->trans('BankAccount').''; + print ''.$langs->trans('Amount').''; print ' '; print ''; @@ -2770,12 +2770,12 @@ else $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); } - print ''; + print ''; if ($objp->baid > 0) print $bankaccountstatic->getNomUrl(1, 'transactions'); print ''; } - print '' . price($sign * $objp->amount) . ''; - print ''; + print '' . price($sign * $objp->amount) . ''; + print ''; if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->societe_id == 0) { print 'rowid.'">'; @@ -2796,13 +2796,13 @@ else /* if ($object->paye == 0) { - print ''.$langs->trans('AlreadyPaid').' :'.price($totalpaye).''; - print ''.$langs->trans("Billed").' :'.price($object->total_ttc).''; + print ''.$langs->trans('AlreadyPaid').' :'.price($totalpaye).''; + print ''.$langs->trans("Billed").' :'.price($object->total_ttc).''; $resteapayer = $object->total_ttc - $totalpaye; - print ''.$langs->trans('RemainderToPay').' :'; - print ''.price($resteapayer).''; + print ''.$langs->trans('RemainderToPay').' :'; + print ''.price($resteapayer).''; } */ @@ -2816,12 +2816,12 @@ else if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE) { // Total already paid - print ''; + print ''; if ($object->type != FactureFournisseur::TYPE_DEPOSIT) print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); else print $langs->trans('AlreadyPaid'); - print ' : 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' '; + print ' : 0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' '; //$resteapayer = $object->total_ttc - $totalpaye; $resteapayeraffiche = $resteapayer; @@ -2845,15 +2845,15 @@ else while ($i < $num) { $obj = $db->fetch_object($resql); $invoice->fetch($obj->fk_invoice_supplier_source); - print ''; + print ''; if ($invoice->type == FactureFournisseur::TYPE_CREDIT_NOTE) print $langs->trans("CreditNote") . ' '; if ($invoice->type == FactureFournisseur::TYPE_DEPOSIT) print $langs->trans("Deposit") . ' '; print $invoice->getNomUrl(0); print ' :'; - print '' . price($obj->amount_ttc) . ''; - print ''; + print '' . price($obj->amount_ttc) . ''; + print ''; print 'rowid . '">' . img_delete() . ''; print ''; $i ++; @@ -2868,51 +2868,51 @@ else // Paye partiellement 'escompte' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'discount_vat') { - print ''; + print ''; print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; $resteapayeraffiche = 0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'badsupplier' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'badsupplier') { - print ''; + print ''; print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; // $resteapayeraffiche=0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'product_returned' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'product_returned') { - print ''; + print ''; print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; $resteapayeraffiche = 0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'abandon' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'abandon') { - print ''; + print ''; $text = $langs->trans("HelpAbandonOther"); if ($object->close_note) $text .= '

' . $langs->trans("Reason") . ':' . $object->close_note; print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1); - print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; + print '' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' '; $resteapayeraffiche = 0; $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Billed - print '' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' '; + print '' . $langs->trans("Billed") . ' :' . price($object->total_ttc) . ' '; // Remainder to pay - print ''; + print ''; if ($resteapayeraffiche >= 0) print $langs->trans('RemainderToPay'); else print $langs->trans('ExcessPaid'); print ' :'; - print '' . price($resteapayeraffiche) . ''; + print '' . price($resteapayeraffiche) . ''; print ' '; } else // Credit note @@ -2920,26 +2920,26 @@ else $cssforamountpaymentcomplete='amountpaymentneutral'; // Total already paid back - print ''; + print ''; print $langs->trans('AlreadyPaidBack'); - print ' :' . price($sign * $totalpaye) . ' '; + print ' :' . price($sign * $totalpaye) . ' '; // Billed - print '' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' '; + print '' . $langs->trans("Billed") . ' :' . price($sign * $object->total_ttc) . ' '; // Remainder to pay back - print ''; + print ''; if ($resteapayeraffiche <= 0) print $langs->trans('RemainderToPayBack'); else print $langs->trans('ExcessPaid'); print ' :'; - print '' . price($sign * $resteapayeraffiche) . ''; + print '' . price($sign * $resteapayeraffiche) . ''; print ' '; // Sold credit note - // print ''.$langs->trans('TotalTTC').' :'; - // print ''.price($sign * + // print ''.$langs->trans('TotalTTC').' :'; + // print ''.price($sign * // $object->total_ttc).' '; } diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php index 919c5b75663..27a659300cc 100644 --- a/htdocs/fourn/facture/impayees.php +++ b/htdocs/fourn/facture/impayees.php @@ -189,13 +189,13 @@ if ($user->rights->fournisseur->facture->lire) print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "f.rowid", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("DateDue", $_SERVER["PHP_SELF"], "f.date_lim_reglement", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("DateDue", $_SERVER["PHP_SELF"], "f.date_lim_reglement", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "f.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("AmountTTC", $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("AlreadyPaid", $_SERVER["PHP_SELF"], "am", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "fk_statut,paye,am", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "f.total_ht", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("AmountTTC", $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("AlreadyPaid", $_SERVER["PHP_SELF"], "am", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "fk_statut,paye,am", "", $param, '', $sortfield, $sortorder, 'right '); print "\n"; // Lines with filter fields @@ -206,14 +206,14 @@ if ($user->rights->fournisseur->facture->lire) print ''; print ' '; print ' '; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -245,8 +245,8 @@ if ($user->rights->fournisseur->facture->lire) print ''.dol_trunc($objp->ref_supplier, 12).''; - print ''.dol_print_date($db->jdate($objp->df), 'day')."\n"; - print ''.dol_print_date($db->jdate($objp->datelimite), 'day'); + print ''.dol_print_date($db->jdate($objp->df), 'day')."\n"; + print ''.dol_print_date($db->jdate($objp->datelimite), 'day'); if ($facturestatic->hasDelay()) { print img_warning($langs->trans("Late")); } @@ -258,12 +258,12 @@ if ($user->rights->fournisseur->facture->lire) print $companystatic->getNomUrl(1, 'supplier', 32); print ''; - print "".price($objp->total_ht).""; - print "".price($objp->total_ttc).""; - print "".price($objp->am).""; + print "".price($objp->total_ht).""; + print "".price($objp->total_ttc).""; + print "".price($objp->am).""; // Show invoice status - print ''; + print ''; print $facturestatic->LibStatut($objp->paye, $objp->fk_statut, 5, $objp->am); print ''; @@ -276,11 +276,11 @@ if ($user->rights->fournisseur->facture->lire) } print ''; - print "".$langs->trans("Total").": "; - print "".price($total_ht).""; - print "".price($total_ttc).""; - print "".price($total_paid).""; - print ' '; + print "".$langs->trans("Total").": "; + print "".price($total_ht).""; + print "".price($total_ttc).""; + print "".price($total_paid).""; + print ' '; print "\n"; } diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 73d5a4b3a4d..3a710642b03 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -589,7 +589,7 @@ if ($resql) // Ref if (! empty($arrayfields['f.ref']['checked'])) { - print ''; + print ''; print ''; print ''; } @@ -630,7 +630,7 @@ if ($resql) // Date invoice if (! empty($arrayfields['f.datef']['checked'])) { - print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($year?$year:-1, 'year', 1, 20, 5); @@ -639,7 +639,7 @@ if ($resql) // Date due if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($year_lim?$year_lim:-1, 'year_lim', 1, 20, 5); @@ -670,67 +670,67 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100'); print ''; } // Company type if (! empty($arrayfields['typent.code']['checked'])) { - print ''; + print ''; print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print ''; } // Payment mode if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) { - print ''; + print ''; $form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10); print ''; } if (! empty($arrayfields['f.total_ht']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['f.total_vat']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['f.total_localtax1']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['f.total_localtax2']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['f.total_ttc']['checked'])) { // Amount - print ''; + print ''; print ''; print ''; } if (! empty($arrayfields['dynamount_payed']['checked'])) { - print ''; + print ''; print ''; } if (! empty($arrayfields['rtp']['checked'])) { - print ''; + print ''; print ''; } // Extra fields @@ -755,13 +755,13 @@ if ($resql) // Status if (! empty($arrayfields['f.fk_statut']['checked'])) { - print ''; + print ''; $liststatus=array('0'=>$langs->trans("Draft"),'1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid")); print $form->selectarray('search_status', $liststatus, $search_status, 1); print ''; } // Action column - print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -773,33 +773,33 @@ if ($resql) if (! empty($arrayfields['f.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['f.ref_supplier']['label'], $_SERVER["PHP_SELF"], 'f.ref_supplier', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['f.type']['checked'])) print_liste_field_titre($arrayfields['f.type']['label'], $_SERVER["PHP_SELF"], 'f.type', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['f.label']['checked'])) print_liste_field_titre($arrayfields['f.label']['label'], $_SERVER['PHP_SELF'], "f.libelle,f.rowid", '', $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['f.datef']['checked'])) print_liste_field_titre($arrayfields['f.datef']['label'], $_SERVER['PHP_SELF'], 'f.datef,f.rowid', '', $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'], $_SERVER['PHP_SELF'], "f.date_lim_reglement", '', $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['f.datef']['checked'])) print_liste_field_titre($arrayfields['f.datef']['label'], $_SERVER['PHP_SELF'], 'f.datef,f.rowid', '', $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'], $_SERVER['PHP_SELF'], "f.date_lim_reglement", '', $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER['PHP_SELF'], "p.ref", '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], 's.nom', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center '); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_mode_reglement", "", $param, "", $sortfield, $sortorder); - if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); - if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder); + if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "fk_statut,paye,type", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER["PHP_SELF"], "f.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER["PHP_SELF"], "f.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'], $_SERVER["PHP_SELF"], "fk_statut,paye,type", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $facturestatic=new FactureFournisseur($db); @@ -853,7 +853,7 @@ if ($resql) //print ''; //print ''; // Other picto tool - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->fournisseur->facture->dir_output.'/'.get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); $subdir = get_exdir($obj->facid, 2, 0, 0, $facturestatic, 'invoice_supplier').dol_sanitizeFileName($obj->ref); @@ -894,7 +894,7 @@ if ($resql) // Date if (! empty($arrayfields['f.datef']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->datef), 'day'); print ''; if (! $i) $totalarray['nbfield']++; @@ -903,7 +903,7 @@ if ($resql) // Date limit if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''.dol_print_date($datelimit, 'day'); + print ''.dol_print_date($datelimit, 'day'); if ($facturestatic->hasDelay()) { print img_warning($langs->trans('Late')); @@ -960,7 +960,7 @@ if ($resql) // Country if (! empty($arrayfields['country.code_iso']['checked'])) { - print ''; + print ''; $tmparray=getCountry($obj->fk_pays, 'all'); print $tmparray['label']; print ''; @@ -969,7 +969,7 @@ if ($resql) // Type ent if (! empty($arrayfields['typent.code']['checked'])) { - print ''; + print ''; if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1); print $typenArray[$obj->typent_code]; print ''; @@ -988,7 +988,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['f.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; $totalarray['totalht'] += $obj->total_ht; @@ -996,7 +996,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['f.total_vat']['checked'])) { - print ''.price($obj->total_vat)."\n"; + print ''.price($obj->total_vat)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; $totalarray['totalvat'] += $obj->total_vat; @@ -1004,7 +1004,7 @@ if ($resql) // Amount LocalTax1 if (! empty($arrayfields['f.total_localtax1']['checked'])) { - print ''.price($obj->total_localtax1)."\n"; + print ''.price($obj->total_localtax1)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totallocaltax1field']=$totalarray['nbfield']; $totalarray['totallocaltax1'] += $obj->total_localtax1; @@ -1012,7 +1012,7 @@ if ($resql) // Amount LocalTax2 if (! empty($arrayfields['f.total_localtax2']['checked'])) { - print ''.price($obj->total_localtax2)."\n"; + print ''.price($obj->total_localtax2)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totallocaltax2field']=$totalarray['nbfield']; $totalarray['totallocaltax2'] += $obj->total_localtax2; @@ -1020,7 +1020,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['f.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; + print ''.price($obj->total_ttc)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; @@ -1028,7 +1028,7 @@ if ($resql) if (! empty($arrayfields['dynamount_payed']['checked'])) { - print ''.(! empty($totalpay)?price($totalpay, 0, $langs):' ').''; // TODO Use a denormalized field + print ''.(! empty($totalpay)?price($totalpay, 0, $langs):' ').''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalamfield']=$totalarray['nbfield']; $totalarray['totalam'] += $totalpay; @@ -1036,7 +1036,7 @@ if ($resql) if (! empty($arrayfields['rtp']['checked'])) { - print ''.(! empty($remaintopay)?price($remaintopay, 0, $langs):' ').''; // TODO Use a denormalized field + print ''.(! empty($remaintopay)?price($remaintopay, 0, $langs):' ').''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield']; $totalarray['totalrtp'] += $remaintopay; @@ -1052,7 +1052,7 @@ if ($resql) // Date creation if (! empty($arrayfields['f.datec']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); print ''; if (! $i) $totalarray['nbfield']++; @@ -1060,7 +1060,7 @@ if ($resql) // Date modification if (! empty($arrayfields['f.tms']['checked'])) { - print ''; + print ''; print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); print ''; if (! $i) $totalarray['nbfield']++; @@ -1068,7 +1068,7 @@ if ($resql) // Status if (! empty($arrayfields['f.fk_statut']['checked'])) { - print ''; + print ''; // TODO $paiement is not yet defined print $facturestatic->LibStatut($obj->paye, $obj->fk_statut, 5, $paiement, $obj->type); print ""; @@ -1076,7 +1076,7 @@ if ($resql) } // Action column - print ''; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected=0; @@ -1111,13 +1111,13 @@ if ($resql) if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; } - elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; - elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; - elseif ($totalarray['totallocaltax1field'] == $i) print ''.price($totalarray['totallocaltax1']).''; - elseif ($totalarray['totallocaltax2field'] == $i) print ''.price($totalarray['totallocaltax2']).''; - elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; - elseif ($totalarray['totalamfield'] == $i) print ''.price($totalarray['totalam']).''; - elseif ($totalarray['totalrtpfield'] == $i) print ''.price($totalarray['totalrtp']).''; + elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; + elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; + elseif ($totalarray['totallocaltax1field'] == $i) print ''.price($totalarray['totallocaltax1']).''; + elseif ($totalarray['totallocaltax2field'] == $i) print ''.price($totalarray['totallocaltax2']).''; + elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalamfield'] == $i) print ''.price($totalarray['totalam']).''; + elseif ($totalarray['totalrtpfield'] == $i) print ''.price($totalarray['totalrtp']).''; else print ''; } print ''; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 6e307f67b31..fa4500b8c31 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -513,17 +513,17 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''.$langs->trans('Invoice').''; print ''.$langs->trans('RefSupplier').''; - print ''.$langs->trans('Date').''; - print ''.$langs->trans('DateMaxPayment').''; + print ''.$langs->trans('Date').''; + print ''.$langs->trans('DateMaxPayment').''; if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('Currency').''; - if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAmountTTC').''; - if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAlreadyPaid').''; - if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyRemainderToPay').''; - print ''.$langs->trans('AmountTTC').''; - print ''.$langs->trans('AlreadyPaid').''; - print ''.$langs->trans('RemainderToPay').''; - print ''.$langs->trans('PaymentAmount').''; - if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyPaymentAmount').''; + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAmountTTC').''; + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAlreadyPaid').''; + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyRemainderToPay').''; + print ''.$langs->trans('AmountTTC').''; + print ''.$langs->trans('AlreadyPaid').''; + print ''.$langs->trans('RemainderToPay').''; + print ''.$langs->trans('PaymentAmount').''; + if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyPaymentAmount').''; print ''; $total=0; @@ -566,18 +566,18 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Date if ($objp->df > 0 ) { - print ''; + print ''; print dol_print_date($db->jdate($objp->df), 'day').''; } else { - print '!!!'; + print '!!!'; } // Date Max Payment if ($objp->dlr > 0 ) { - print ''; + print ''; print dol_print_date($db->jdate($objp->dlr), 'day'); if ($invoice->hasDelay()) @@ -589,30 +589,30 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } else { - print '--'; + print '--'; } // Multicurrency if (!empty($conf->multicurrency->enabled)) { // Currency - print ''.$objp->multicurrency_code."\n"; + print ''.$objp->multicurrency_code."\n"; - print ''; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { print price($objp->multicurrency_total_ttc); } print ''; - print ''; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { print price($objp->multicurrency_am); } print ''; - print ''; + print ''; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { print price($objp->multicurrency_total_ttc - $objp->multicurrency_am); @@ -620,17 +620,17 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; } - print ''.price($objp->total_ttc).''; + print ''.price($objp->total_ttc).''; - print ''.price($objp->am); + print ''.price($objp->am); if ($creditnotes) print '+'.price($creditnotes); if ($deposits) print '+'.price($deposits); print ''; - print ''.price($remaintopay).''; + print ''.price($remaintopay).''; // Amount - print ''; + print ''; $namef = 'amount_'.$objp->facid; $nameRemain = 'remain_'.$objp->facid; @@ -652,7 +652,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Multicurrency Price if (! empty($conf->multicurrency->enabled)) { - print ''; + print ''; // Add remind multicurrency amount $namef = 'multicurrency_amount_'.$objp->facid; @@ -688,19 +688,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { // Print total print ''; - print ''.$langs->trans('TotalTTC').':'; + print ''.$langs->trans('TotalTTC').':'; if (!empty($conf->multicurrency->enabled)) print ' '; if (!empty($conf->multicurrency->enabled)) print ' '; if (!empty($conf->multicurrency->enabled)) print ' '; if (!empty($conf->multicurrency->enabled)) print ' '; - print ''.price($total_ttc).''; - print ''.price($totalrecu); + print ''.price($total_ttc).''; + print ''.price($totalrecu); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecudeposits) print '+'.price($totalrecudeposits); print ''; - print ''.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).''; - print ''; // Autofilled - if (!empty($conf->multicurrency->enabled)) print ''; + print ''.price(price2num($total_ttc - $totalrecu - $totalrecucreditnote - $totalrecudeposits, 'MT')).''; + print ''; // Autofilled + if (!empty($conf->multicurrency->enabled)) print ''; print "\n"; } print "\n"; @@ -874,30 +874,30 @@ if (empty($action)) // Lines for filters fields print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; print ''; $formother->select_year($year?$year:-1, 'year', 1, 20, 5); print ''; - print ''; + print ''; print ''; print ''; print ''; $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1); print ''; - print ''; + print ''; print ''; print ''; print ''; $form->select_comptes($search_account, 'search_account', 0, '', 1); print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -905,12 +905,12 @@ if (empty($action)) print ''; print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], 'p.rowid', '', $param, '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], 'dp', '', $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], 'dp', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], 'c.libelle', '', $param, '', $sortfield, $sortorder); print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "p.num_paiement", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Account", $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], 'p.amount', '', $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], 'p.amount', '', $param, '', $sortfield, $sortorder, 'right '); //print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],'ref_supplier','',$param,'',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; @@ -927,7 +927,7 @@ if (empty($action)) // Date $dateformatforpayment = 'day'; if (! empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment='dayhour'; - print ''.dol_print_date($db->jdate($objp->dp), $dateformatforpayment)."\n"; + print ''.dol_print_date($db->jdate($objp->dp), $dateformatforpayment)."\n"; // Thirdparty print ''; @@ -947,7 +947,7 @@ if (empty($action)) else print ' '; print ''; - print ''.price($objp->pamount).''; + print ''.price($objp->pamount).''; // Ref invoice /*$invoicesupplierstatic->ref=$objp->ref_supplier; diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index bb6297f32d3..26e0884bdd6 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -143,8 +143,8 @@ if ($year) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; if (is_resource($handle)) @@ -156,8 +156,8 @@ if ($year) $tfile = $dir . '/'.$year.'/'.$file; $relativepath = $year.'/'.$file; print ''.''; - print ''; - print ''; + print ''; + print ''; } } closedir($handle); diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 48efee3ddf3..745dd231bd0 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -51,8 +51,8 @@ foreach($linkedObjectBlock as $key => $objectlink) - - + - - + + 1) - - - - - + + + + + '; - print ''; + print ''; print "\n"; while ($i < $num) @@ -80,8 +80,8 @@ if ($resql) print ''; print ''; - print ''; - print ''; + print ''; + print ''; print "\n"; $i++; @@ -139,14 +139,14 @@ if (! empty($conf->fournisseur->enabled)) $companystatic->client=0; print $companystatic->getNomUrl(1, '', 16); print ''; - print ''; + print ''; $i++; $total += $obj->total_ttc; } if ($total>0) { - print '"; + print '"; } print "
'.$langs->trans("Reporting").''.$langs->trans("Size").''.$langs->trans("Date").''.$langs->trans("Size").''.$langs->trans("Date").'
'.img_pdf().' '.$file.''.dol_print_size(dol_filesize($tfile)).''.dol_print_date(dol_filemtime($tfile), "dayhour").'
'.dol_print_size(dol_filesize($tfile)).''.dol_print_date(dol_filemtime($tfile), "dayhour").'
trans("SupplierInvoice"); ?> trans("ShowBill"), "bill").' '.$objectlink->ref; ?> ref_supplier; ?>date, 'day'); ?>date, 'day'); ?>rights->fournisseur->facture->lire) { $sign = 1; if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $sign = -1; @@ -66,8 +66,8 @@ foreach($linkedObjectBlock as $key => $objectlink) echo ''.price($objectlink->total_ht).''; } } ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>getLibStatut(3); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
trans("Total"); ?>
'.$langs->trans("Orders").''.$langs->trans("Nb").' 
'.$langs->trans("Orders").''.$langs->trans("Nb").' 
'.$commandestatic->LibStatut($row[1]).''.$row[0].''.$commandestatic->LibStatut($row[1], 3).''.$row[0].''.$commandestatic->LibStatut($row[1], 3).'
'.price($obj->total_ttc).'
'.price($obj->total_ttc).'
'.$langs->trans("Total").''.price($total)."
'.$langs->trans("Total").''.price($total)."
"; print "
\n"; @@ -197,14 +197,14 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $companystatic->client=0; print $companystatic->getNomUrl(1, '', 16); print ''; - print ''.price($obj->total_ttc).''; + print ''.price($obj->total_ttc).''; print ''; $tot_ttc+=$obj->total_ttc; $i++; } print ''.$langs->trans("Total").''; - print ''.price($tot_ttc).''; + print ''.price($tot_ttc).''; print ''; print ""; @@ -250,7 +250,7 @@ if ($resql) print ''; print ''; print '\n"; - print '\n"; + print '\n"; print "\n"; while ($obj = $db->fetch_object($resql) ) @@ -259,7 +259,7 @@ if ($resql) print '\n"; print ''; - print ''; + print ''; print "\n"; } print "
'.$langs->trans("BoxTitleLastSuppliers", min($max, $num))."'.$langs->trans("DateModification")."'.$langs->trans("DateModification")."
'.img_object($langs->trans("ShowSupplier"), "company").''; print " socid."\">".$obj->name."'.$obj->code_fournisseur.' '.dol_print_date($db->jdate($obj->tms), 'day').''.dol_print_date($db->jdate($obj->tms), 'day').'
\n"; @@ -298,7 +298,7 @@ if (count($companystatic->SupplierCategories)) print ''."\n"; // TODO this page not exist /* - print ''; + print ''; print '('.$langs->trans("Stats").')'; print "\n"; */ diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 254bc97c28f..864e590dedb 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -243,7 +243,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; print ''; @@ -255,9 +255,9 @@ if ($resql) print_liste_field_titre("RefSupplierShort", $_SERVER["PHP_SELF"], "ppf.ref_fourn", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Supplier", $_SERVER["PHP_SELF"], "ppf.fk_soc", $param, "", "", $sortfield, $sortorder); - print_liste_field_titre("BuyingPrice", $_SERVER["PHP_SELF"], "ppf.price", $param, "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "ppf.quantity", $param, "", 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("UnitPrice", $_SERVER["PHP_SELF"], "ppf.unitprice", $param, "", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("BuyingPrice", $_SERVER["PHP_SELF"], "ppf.price", $param, "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "ppf.quantity", $param, "", '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("UnitPrice", $_SERVER["PHP_SELF"], "ppf.unitprice", $param, "", '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"]); print "\n"; @@ -287,13 +287,13 @@ if ($resql) if ($companystatic->id > 0) print $companystatic->getNomUrl(1, 'supplier'); print ''; - print ''.(isset($objp->price) ? price($objp->price) : '').''; + print ''.(isset($objp->price) ? price($objp->price) : '').''; - print ''.$objp->qty.''; + print ''.$objp->qty.''; - print ''.(isset($objp->unitprice) ? price($objp->unitprice) : '').''; + print ''.(isset($objp->unitprice) ? price($objp->unitprice) : '').''; - print ''; + print ''; print "\n"; $i++; diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index 1d9fdf1721f..f5d862f48e5 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -87,12 +87,12 @@ if ($socid > 0) $num = $db->num_rows($resql); print ''; - print ''.$langs->trans("Date").''; + print ''.$langs->trans("Date").''; print ' '; print ''.$langs->trans("Status").''; - print ''.$langs->trans("Debit").''; - print ''.$langs->trans("Credit").''; - print ''.$langs->trans("Balance").''; + print ''.$langs->trans("Debit").''; + print ''.$langs->trans("Credit").''; + print ''.$langs->trans("Balance").''; print ' '; print ''; @@ -119,15 +119,15 @@ if ($socid > 0) print ''; - print "".dol_print_date($fac->date)."\n"; + print "".dol_print_date($fac->date)."\n"; print "id\">".img_object($langs->trans("ShowBill"), "bill")." ".$fac->ref."\n"; - print ''.$fac->getLibStatut(2, $totalpaye).''; - print ''.price($fac->total_ttc)."\n"; + print ''.$fac->getLibStatut(2, $totalpaye).''; + print ''.price($fac->total_ttc)."\n"; $solde = $solde + $fac->total_ttc; - print ' '; - print ''.price($solde)."\n"; + print ' '; + print ''.price($solde)."\n"; // Author print ''.img_object($langs->trans("ShowUser"), 'user').' '.$objf->login.''; @@ -154,15 +154,15 @@ if ($socid > 0) $objp = $db->fetch_object($resqlp); // print ''; - print ''.dol_print_date($db->jdate($objp->dp))."\n"; + print ''.dol_print_date($db->jdate($objp->dp))."\n"; print ''; print '      '; // Decalage print ''.img_object($langs->trans("ShowPayment"), "payment").' '.$langs->trans("Payment").' '.$objp->rowid.''; print " \n"; print " \n"; - print ''.price($objp->amount).''; + print ''.price($objp->amount).''; $solde = $solde - $objp->amount; - print ''.price($solde)."\n"; + print ''.price($solde)."\n"; // Auteur print ''.img_object($langs->trans("ShowUser"), 'user').' '.$objp->login.''; From 0798f7b7193f37e4fcbd36c32194e3c9d7d65cfe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 20:53:03 +0100 Subject: [PATCH 61/92] NEW Can upload files from the edit page of expense report --- htdocs/core/actions_linkedfiles.inc.php | 2 +- htdocs/core/class/html.formfile.class.php | 52 +++++---- htdocs/expensereport/card.php | 103 +++++++++++++++--- .../class/expensereport.class.php | 4 +- htdocs/expensereport/document.php | 2 +- htdocs/langs/en_US/trips.lang | 8 +- 6 files changed, 120 insertions(+), 51 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 73cbd572e9d..272ac1532a6 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -29,7 +29,7 @@ // Submit file/link if (GETPOST('sendit', 'alpha') && ! empty($conf->global->MAIN_UPLOAD_DOC)) { - if (! empty($_FILES)) + if (! empty($_FILES)) { if (is_array($_FILES['userfile']['tmp_name'])) $userfiles=$_FILES['userfile']['tmp_name']; else $userfiles=array($_FILES['userfile']['tmp_name']); diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2577d70e549..1ea48c90091 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -77,9 +77,10 @@ class FormFile * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM) * @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*') * @param string $sectiondir If upload must be done inside a particular directory (is sectiondir defined, sectionid must not be) + * @param int $usewithoutform 0=Default, 1=Disable
and style to use in existing area * @return int <0 if KO, >0 if OK */ - public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '') + public function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '', $usewithoutform = 0) { // phpcs:enable global $conf,$langs, $hookmanager; @@ -114,10 +115,13 @@ class FormFile if (empty($title)) $title=$langs->trans("AttachANewFile"); if ($title != 'none') $out.=load_fiche_titre($title, null, null); - $out .= ''; - $out .= ''; - $out .= ''; - $out .= ''; + if (empty($usewithoutform)) + { + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + } $out .= ''; $out .= ''; @@ -176,13 +180,7 @@ class FormFile if ($savingdocmask) { //add a global variable for disable the auto renaming on upload - if (! empty($conf->global->MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT)) - { - $rename=''; - } - else { - $rename='checked'; - } + $rename=(empty($conf->global->MAIN_DOC_UPLOAD_NOT_RENAME_BY_DEFAULT)?'checked':''); $out .= ''; if (! empty($options)) $out .= ''; @@ -194,8 +192,11 @@ class FormFile $out .= "
'.$options.'
"; - $out .= '
'; - if (empty($sectionid)) $out .= '
'; + if (empty($usewithoutform)) + { + $out .= ''; + if (empty($sectionid)) $out .= '
'; + } $out .= "\n\n"; @@ -205,12 +206,16 @@ class FormFile $langs->load('link'); $title = $langs->trans("LinkANewFile"); $out .= load_fiche_titre($title, null, null); - $out .= '