From 2fbb6b112513078edf4b7620f34770e9c2f9c207 Mon Sep 17 00:00:00 2001 From: x Date: Mon, 21 Sep 2020 09:29:52 +0200 Subject: [PATCH 01/82] new handle trigger method --- ...ace_99_modMyModule_MyModuleTriggers.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index 4c5951dad70..28adb0a78f7 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -102,6 +102,22 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers // Put here code you want to execute when a Dolibarr business events occurs. // Data and type of action are stored into $object and $action + /** + * new method to handle triggers + * you can now create a method for the interface + * this method should be named like the trigger in camelCase + * for example : COMPANY_CREATE => public function companyCreate($action, $object, User $user, Translate $langs, Conf $conf) + */ + $methodName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($action))))); + $callback = array($this, $methodName); + if(is_callable($callback)){ + dol_syslog( + "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id + ); + + return call_user_func($callback, $action, $object, $user, $langs, $conf); + }; + switch ($action) { // Users //case 'USER_CREATE': From 4cbe8d8623176f056907c6fbcc40b3b3f9ca036e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 21 Sep 2020 07:34:00 +0000 Subject: [PATCH 02/82] Fixing style errors. --- .../interface_99_modMyModule_MyModuleTriggers.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index 28adb0a78f7..add80d58af3 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -110,7 +110,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers */ $methodName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($action))))); $callback = array($this, $methodName); - if(is_callable($callback)){ + if (is_callable($callback)){ dol_syslog( "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id ); From 815d0c25895165800b675d172755c1b20242b9cc Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Wed, 23 Sep 2020 13:18:09 +0200 Subject: [PATCH 03/82] Fix that a admin can remove all his user rights --- htdocs/user/class/user.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 786af8c81d1..3b4a91b2f2f 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -701,6 +701,15 @@ class User extends CommonObject $sql .= " AND ".$wherefordel; } + // avoid admin can remove his own important rights + if($this->admin == 1) + { + $sql .= " AND id NOT IN (251, 252, 253, 254, 255, 256)"; // other users rights + $sql .= " AND id NOT IN (341, 342, 343, 344)"; // own rights + $sql .= " AND id NOT IN (351, 352, 353, 354)"; // groups rights + $sql .= " AND id NOT IN (358)"; // user export + } + $result = $this->db->query($sql); if ($result) { From a88c0b97a860f550941f0c28b3e6c18438160dbb Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 23 Sep 2020 11:31:17 +0000 Subject: [PATCH 04/82] Fixing style errors. --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 3b4a91b2f2f..923102f6df5 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -702,7 +702,7 @@ class User extends CommonObject } // avoid admin can remove his own important rights - if($this->admin == 1) + if ($this->admin == 1) { $sql .= " AND id NOT IN (251, 252, 253, 254, 255, 256)"; // other users rights $sql .= " AND id NOT IN (341, 342, 343, 344)"; // own rights From 2bf15b3a929370d87974692282576925c6afbc55 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Mon, 28 Sep 2020 10:42:49 +0200 Subject: [PATCH 05/82] Show category filter only on rights to read it --- htdocs/adherents/list.php | 2 +- htdocs/comm/propal/list.php | 4 ++-- htdocs/commande/list.php | 4 ++-- htdocs/compta/bank/list.php | 2 +- htdocs/compta/facture/list.php | 4 ++-- htdocs/contact/list.php | 27 +++++++++++++-------------- htdocs/contrat/list.php | 2 +- htdocs/expedition/list.php | 4 ++-- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/facture/list.php | 2 +- htdocs/product/list.php | 2 +- htdocs/product/stock/list.php | 2 +- htdocs/projet/list.php | 2 +- htdocs/projet/tasks/list.php | 2 +- htdocs/societe/list.php | 4 ++-- htdocs/supplier_proposal/list.php | 2 +- htdocs/user/list.php | 2 +- 17 files changed, 34 insertions(+), 35 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 75c9c731810..c6477f01eb1 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -425,7 +425,7 @@ if ($sall) { // Filter on categories $moreforfilter = ''; -if (!empty($conf->categorie->enabled)) { +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('Categories').': '; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 3396cd6270b..1adb7691f6e 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -542,7 +542,7 @@ if ($resql) $moreforfilter .= '
'; } // If the user can view products - if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; @@ -551,7 +551,7 @@ if ($resql) $moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); $moreforfilter .= '
'; } - if (!empty($conf->categorie->enabled)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 875b72a8dd2..01052c00834 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -583,7 +583,7 @@ if ($resql) $moreforfilter .= '
'; } // If the user can view prospects other than his' - if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; @@ -592,7 +592,7 @@ if ($resql) $moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); $moreforfilter .= '
'; } - if (!empty($conf->categorie->enabled)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index ace8a327768..be764248b1f 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -281,7 +281,7 @@ if ($sall) $moreforfilter = ''; -if (!empty($conf->categorie->enabled)) +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $moreforfilter .= $form->getFilterBox(Categorie::TYPE_ACCOUNT, $search_category_list); } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index b4bfa70a287..549e680193f 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -725,7 +725,7 @@ if ($resql) $moreforfilter .= '
'; } // If the user can view prospects other than his' - if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; @@ -734,7 +734,7 @@ if ($resql) $moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); $moreforfilter .= '
'; } - if (!empty($conf->categorie->enabled)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 1332bc5e100..f8f8f37669d 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -573,7 +573,7 @@ if ($search_firstlast_only) } $moreforfilter = ''; -if (!empty($conf->categorie->enabled)) +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; @@ -596,21 +596,20 @@ if (!empty($conf->categorie->enabled)) $moreforfilter .= $formother->select_categories(Categorie::TYPE_SUPPLIER, $search_categ_supplier, 'search_categ_supplier', 1); $moreforfilter .= '
'; } - $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('Roles').': '; - $moreforfilter .= $formcompany->showRoles("search_roles", $objecttmp, 'edit', $search_roles); - $moreforfilter .= '
'; -} -if ($moreforfilter) -{ - print '
'; - print $moreforfilter; - $parameters = array('type'=>$type); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print '
'; } +$moreforfilter .= '
'; +$moreforfilter .= $langs->trans('Roles').': '; +$moreforfilter .= $formcompany->showRoles("search_roles", $objecttmp, 'edit', $search_roles); +$moreforfilter .= '
'; + +print '
'; +print $moreforfilter; +$parameters = array('type'=>$type); +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +print '
'; + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 531642f81f7..a8781a5aaf3 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -418,7 +418,7 @@ if ($user->rights->user->user->lire) $moreforfilter .= '
'; } // If the user can view categories of products -if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 77796fc9bc1..ddf71330e77 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -408,7 +408,7 @@ if ($resql) $moreforfilter .= '
'; } // If the user can view prospects other than his' - if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; @@ -417,7 +417,7 @@ if ($resql) $moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); $moreforfilter .= '
'; } - if (!empty($conf->categorie->enabled)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index c900431d910..6a655eb220e 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -739,7 +739,7 @@ if ($resql) $moreforfilter .= '
'; } // If the user can view prospects other than his' - if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index bbc4f45e4b2..c594be95af5 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -597,7 +597,7 @@ if ($resql) $moreforfilter .= '
'; } // If the user can view prospects other than his' - if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 18e6e1c3500..227a9508b9c 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -598,7 +598,7 @@ if ($resql) // Filter on categories $moreforfilter = ''; - if (!empty($conf->categorie->enabled)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $moreforfilter .= '
'; $moreforfilter .= $langs->trans('Categories').': '; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index b0f593f82d9..f717e541229 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -375,7 +375,7 @@ if ($search_all) $moreforfilter = ''; -if (!empty($conf->categorie->enabled)) +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $formcategory = new FormCategory($db); $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_WAREHOUSE, $search_category_list); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 8a7645941d5..8964796dee9 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -489,7 +489,7 @@ if ($search_all) $moreforfilter = ''; // Filter on categories -if (!empty($conf->categorie->enabled)) +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $formcategory = new FormCategory($db); $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 20d917b2ae8..d5e1c02ceac 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -462,7 +462,7 @@ if ($search_all) $morehtmlfilter = ''; // Filter on categories -if (!empty($conf->categorie->enabled)) +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index ad9813c4fec..34e8f7a87ff 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -660,7 +660,7 @@ if ($search_all) $moreforfilter = ''; if (empty($type) || $type == 'c' || $type == 'p') { - if (!empty($conf->categorie->enabled)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; @@ -671,7 +671,7 @@ if (empty($type) || $type == 'c' || $type == 'p') } if (empty($type) || $type == 'f') { - if (!empty($conf->categorie->enabled)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 1340dce3b3b..df8e85787e6 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -465,7 +465,7 @@ if ($resql) $moreforfilter .= '
'; } // If the user can view products - if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire)) + if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 92826eac19e..38940c1213d 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -341,7 +341,7 @@ if ($sall) $moreforfilter = ''; // Filter on categories -if (!empty($conf->categorie->enabled)) +if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $moreforfilter .= '
'; $moreforfilter .= $langs->trans('Categories').': '; From 711339945ce8a43f2f771a24e56e707053d1e8bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 2 Oct 2020 21:41:05 +0200 Subject: [PATCH 06/82] use create instead edit on create contract --- htdocs/contrat/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 9581d625f80..dbdba874dda 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -9,7 +9,7 @@ * Copyright (C) 2014-2018 Ferran Marcet * Copyright (C) 2014-2016 Marcos García * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 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 @@ -1264,7 +1264,7 @@ if ($action == 'create') // Other attributes if (empty($reshook)) { - print $object->showOptionals($extrafields, 'edit', $parameters); + print $object->showOptionals($extrafields, 'create', $parameters); } print "\n"; From 3840d6c0a7bcea82a540b75cba696342be2c7975 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 13:52:52 +0200 Subject: [PATCH 07/82] Fix entity in ordre box --- htdocs/core/boxes/box_commandes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index c48e79bb4bd..372dba8081a 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -105,7 +105,7 @@ class box_commandes extends ModeleBoxes $sql.= ", ".MAIN_DB_PREFIX."commande as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; + $sql.= " AND c.entity IN (".getEntity('commande').")"; if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql.=" AND c.fk_statut = 1"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; From e9c101349b6ca215d947ee27e291bf32c522dd3f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 13:57:37 +0200 Subject: [PATCH 08/82] Fix multicompany in propal box --- htdocs/core/boxes/box_propales.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 7e73166ed90..12e1166120c 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -91,7 +91,7 @@ class box_propales extends ModeleBoxes $sql.= ", ".MAIN_DB_PREFIX."propal as p"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE p.fk_soc = s.rowid"; - $sql.= " AND p.entity = ".$conf->entity; + $sql .= " AND p.entity IN (".getEntity('propal').")"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC "; From 26a2fea8c70f9ff9d6dce01641c6819a343fcab9 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 14:00:23 +0200 Subject: [PATCH 09/82] Fix multicompany in supplier order box --- htdocs/core/boxes/box_supplier_orders.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 85ee2e6f71c..f69f6e10099 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -95,7 +95,7 @@ class box_supplier_orders extends ModeleBoxes $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; + $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; From 331db5e367a1faa82ea9eb735b375d09711ecead Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 14:01:46 +0200 Subject: [PATCH 10/82] Fix multicompany in supplier order awaiting box --- htdocs/core/boxes/box_supplier_orders_awaiting_reception.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php index 416dc7f2f2a..b1f53d2de20 100644 --- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php +++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php @@ -95,7 +95,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; - $sql.= " AND c.entity = ".$conf->entity; + $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; $sql.= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; From 69660d1a9d407b94d54c9ef70507ba94a5c2c9d4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 14:02:59 +0200 Subject: [PATCH 11/82] Update box_supplier_orders.php --- htdocs/core/boxes/box_supplier_orders.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index f69f6e10099..b71b5b660b5 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -95,7 +95,7 @@ class box_supplier_orders extends ModeleBoxes $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.rowid"; - $sql .= " AND c.entity IN (".getEntity('supplier_order').")"; + $sql.= " AND c.entity IN (".getEntity('supplier_order').")"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; From af2bd76500bf83d2e5a22a03ac817aca86fc46ff Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Oct 2020 14:06:33 +0200 Subject: [PATCH 12/82] Fix multicompany in shipment box --- htdocs/core/boxes/box_shipments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_shipments.php b/htdocs/core/boxes/box_shipments.php index 26f45bc08db..4603450b482 100644 --- a/htdocs/core/boxes/box_shipments.php +++ b/htdocs/core/boxes/box_shipments.php @@ -104,7 +104,7 @@ class box_shipments extends ModeleBoxes $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; - $sql .= " WHERE e.entity = ".$conf->entity; + $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND sc.fk_user = ".$user->id; else $sql .= " ORDER BY e.date_delivery, e.ref DESC "; From dd1904c521d5e6bfe058801a355934bf9d43b91e Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 4 Oct 2020 13:58:46 +0200 Subject: [PATCH 13/82] Fix multicompany in last action box --- htdocs/core/lib/agenda.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index c6bc31956d6..2892469d61c 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -225,7 +225,7 @@ function show_array_actions_to_do($max = 5) $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE a.entity = ".$conf->entity; + $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; @@ -322,7 +322,7 @@ function show_array_last_actions_done($max = 5) $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action "; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE a.entity = ".$conf->entity; + $sql .= " WHERE a.entity IN (".getEntity('agenda').")"; $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; From 36fc987f1e36b97262d367bb61bbb97c2bb0c83b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 4 Oct 2020 14:04:44 +0200 Subject: [PATCH 14/82] Fix multicurrency modal + avoid loud page if not used --- htdocs/takepos/index.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index dd96a8ae333..459225fda03 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -865,6 +865,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
+if (!empty($conf->multicurrency->enabled)){ '; + print ''; + print '
'; } // END IF not edit print '
'; From 243d576f833b255493183c8fa466ab2f50972b37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Oct 2020 16:38:40 +0200 Subject: [PATCH 41/82] Update invoice.php Log for debug --- htdocs/takepos/invoice.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 6f75df49c1a..22a301035a9 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -716,6 +716,7 @@ function Print(id, gift){ function TakeposPrinting(id){ var receipt; + console.log("TakeposPrinting" + id); $.get("receipt.php?facid="+id, function(data, status){ receipt=data.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, ''); $.ajax({ @@ -727,6 +728,7 @@ function TakeposPrinting(id){ } function TakeposConnector(id){ + console.log("TakeposConnector" + id); $.get("ajax/ajax.php?action=printinvoiceticket&term=&id="+id, function(data, status){ $.ajax({ type: "POST", From ad087ac3609564bdbfb8ebd0735c436810ba30b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Oct 2020 17:24:47 +0200 Subject: [PATCH 42/82] Use color of RH module for type "employee" --- htdocs/theme/eldy/info-box.inc.php | 2 +- htdocs/theme/md/info-box.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index e77dc0a9d92..8f189326ab3 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -269,7 +269,7 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = border-radius: 3px; } .user-back { - background-color: #af4850 !important; + background-color: #79633f !important; color: #FFF !important; padding: 2px; margin: 2px; diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index f1e1a0cfab6..9b4b0618dd9 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -34,7 +34,7 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) $conf->global->THEME_SATURATE_RATIO = border-radius: 3px; } .user-back { - background-color: #af4850 !important; + background-color: #79633f !important; color: #FFF !important; padding: 2px; margin: 2px; From 25b9460521f3a36d89d8187c9e5a9e20e0b07ee5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Oct 2020 18:05:26 +0200 Subject: [PATCH 43/82] Look and feel v12 --- htdocs/accountancy/admin/subaccount.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index b2e27156ee3..67175261f02 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -266,10 +266,9 @@ if ($resql) print ''; print ''; print ''; - print ''; print ''; - print_barre_liste($langs->trans('ReportThirdParty'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit); + print_barre_liste($langs->trans('ReportThirdParty'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 0, 0, 1); print '
'.$langs->trans("WarningCreateSubAccounts").'
'; From 73b40828c8bbc39d1b852b19c2a7e27407329898 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Oct 2020 18:15:37 +0200 Subject: [PATCH 44/82] Trans --- htdocs/langs/en_US/accountancy.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 76c02245b6f..3d9b36d58b6 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -34,8 +34,8 @@ OtherInfo=Other information DeleteCptCategory=Remove accounting account from group ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account from the accounting account group? JournalizationInLedgerStatus=Status of journalization -AlreadyInGeneralLedger=Already journalized in ledgers -NotYetInGeneralLedger=Not yet journalized in ledgers +AlreadyInGeneralLedger=Already transferred in accounting journals and ledger +NotYetInGeneralLedger=Not yet transferred in accouting journals and ledger GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accounting group DetailByAccount=Show detail by account AccountWithNonZeroValues=Accounts with non-zero values @@ -218,7 +218,7 @@ ConfirmDeleteMvtPartial=This will delete the transaction from the Ledger (all li FinanceJournal=Finance journal ExpenseReportsJournal=Expense reports journal DescFinanceJournal=Finance journal including all the types of payments by bank account -DescJournalOnlyBindedVisible=This is a view of record that are bound to an accounting account and can be recorded into the Ledger. +DescJournalOnlyBindedVisible=This is a view of record that are bound to an accounting account and can be recorded into the Journals and Ledger. VATAccountNotDefined=Account for VAT not defined ThirdpartyAccountNotDefined=Account for third party not defined ProductAccountNotDefined=Account for product not defined From bb0b9dc1286301423e9cbd2c1fc88a37299027e0 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 5 Oct 2020 18:16:32 +0200 Subject: [PATCH 45/82] FIX php error in takepos --- htdocs/takepos/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 459225fda03..3585d25eee7 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -865,7 +865,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
-if (!empty($conf->multicurrency->enabled)){ +multicurrency->enabled)){ ?> -} +
From 005cc093b992579779572d164f73a12bdb5dfce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 5 Oct 2020 20:02:23 +0200 Subject: [PATCH 46/82] fix typo --- htdocs/core/modules/mailings/fraise.modules.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 7b9eeb02c0d..efec11c0ba7 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -266,7 +266,7 @@ class mailing_fraise extends MailingTargets if ($dateendsubscriptionbefore > 0) $sql .= " AND datefin < '".$this->db->idate($dateendsubscriptionbefore)."'"; $sql .= " AND a.fk_adherent_type = ta.rowid"; // Filter on type - if (GETPOSTISET('filter_type')) $sql .= " AND ta.rowid='".$this->db->escape(GETPOST('filter_type'))."'"; + if (GETPOSTISSET('filter_type')) $sql .= " AND ta.rowid='".$this->db->escape(GETPOST('filter_type'))."'"; // Filter on category if (GETPOSTISSET('filter_category')) $sql .= " AND c.rowid='".$this->db->escape(GETPOST('filter_category'))."'"; $sql .= " ORDER BY a.email"; @@ -302,7 +302,7 @@ class mailing_fraise extends MailingTargets 'source_url' => $this->url($obj->id), 'source_id' => $obj->id, 'source_type' => 'member' - ); + ); $old = $obj->email; $j++; } From 83eb7a8d8dba0033fa8ed97fd560b6513d710c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 5 Oct 2020 20:16:18 +0200 Subject: [PATCH 47/82] doxygen --- htdocs/expedition/class/expedition.class.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 9b6a07a5435..bdf79081fe2 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -11,7 +11,7 @@ * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2020 Lenin Rivas * * This program is free software; you can redistribute it and/or modify @@ -82,6 +82,13 @@ class Expedition extends CommonObject public $socid; + /** + * @var string Customer ref + * @deprecated + * @see $ref_customer + */ + public $ref_client; + /** * @var string Customer ref */ From d83d9895e039e9ecd2cff39d4a6313cc4b0ca848 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 5 Oct 2020 20:52:31 +0200 Subject: [PATCH 48/82] NEW Vat report - Invert constant to show by default zero vat in reports --- htdocs/core/lib/tax.lib.php | 20 +++++++++---------- .../install/mysql/migration/12.0.0-13.0.0.sql | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index d56d2260afc..3b261bd0814 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -170,7 +170,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql .= " AND (d.product_type = 0"; // Limit to products $sql .= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products - if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; + if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture; } else { // Count on payments date @@ -208,7 +208,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di if ($date_start && $date_end) $sql .= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'"; $sql .= " AND (d.product_type = 0"; // Limit to products $sql .= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products - if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; + if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid"; } @@ -312,7 +312,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql .= " AND (d.product_type = 1"; // Limit to services $sql .= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service - if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; + if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture; } else { // Count on payments date @@ -350,7 +350,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di if ($date_start && $date_end) $sql .= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'"; $sql .= " AND (d.product_type = 1"; // Limit to services $sql .= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service - if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; + if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid"; } @@ -451,7 +451,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di if ($date_start && $date_end) $sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; $sql .= " AND (d.product_type = -1"; $sql .= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service - if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)"; + if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)"; $sql .= " ORDER BY e.rowid"; if (!$sql) @@ -622,7 +622,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql .= " AND (d.product_type = 0"; // Limit to products $sql .= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products - if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; + if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture; } else { // Count on payments date @@ -660,7 +660,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire if ($date_start && $date_end) $sql .= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'"; $sql .= " AND (d.product_type = 0"; // Limit to products $sql .= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products - if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; + if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid"; } @@ -764,7 +764,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire if ($date_start && $date_end) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql .= " AND (d.product_type = 1"; // Limit to services $sql .= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service - if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; + if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture; } else { // Count on payments date @@ -802,7 +802,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire if ($date_start && $date_end) $sql .= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'"; $sql .= " AND (d.product_type = 1"; // Limit to services $sql .= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service - if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; + if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid"; } @@ -903,7 +903,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire if ($date_start && $date_end) $sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; $sql .= " AND (d.product_type = -1"; $sql .= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service - if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)"; + if (!empty($conf->global->MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)"; $sql .= " ORDER BY e.rowid"; if (!$sql) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 88c17cc0619..7c32a370c45 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -355,3 +355,5 @@ CREATE TABLE llx_ecm_directories_extrafields ALTER TABLE llx_ecm_directories_extrafields ADD INDEX idx_ecm_directories_extrafields (fk_object); ALTER TABLE llx_website_page ADD COLUMN object_type varchar(255); ALTER TABLE llx_website_page ADD COLUMN fk_object varchar(255); + +DELETE FROM llx_const WHERE name in ('MAIN_INCLUDE_ZERO_VAT_IN_REPORTS'); From 6a0f2233a69a70cb9e78ee63cf880e52f190aa7b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 5 Oct 2020 21:44:39 +0200 Subject: [PATCH 49/82] NEW Accountancy - Move to real ledger, real journals, menu disposition --- htdocs/accountancy/bookkeeping/list.php | 2 +- .../accountancy/bookkeeping/listbyaccount.php | 2 +- .../class/accountingaccount.class.php | 12 ++++----- htdocs/core/menus/init_menu_auguria.sql | 8 +++--- htdocs/core/menus/standard/eldy.lib.php | 26 ++++++++++--------- htdocs/langs/en_US/accountancy.lang | 6 ++--- 6 files changed, 30 insertions(+), 26 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 813dbd4a37f..d5603a7a075 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -638,7 +638,7 @@ $newcardbutton .= ''.$langs->trans("I $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export); -$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param); +// $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param); $url = './card.php?action=create'; if (!empty($socid)) $url .= '&socid='.$socid; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index e0e16e00d12..b99d913a6ff 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -373,7 +373,7 @@ print ''; print ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); +// $newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create'); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 24f14d2ebd2..199899f89d5 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -448,7 +448,7 @@ class AccountingAccount extends CommonObject * @param int $notooltip 1=Disable tooltip * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $withcompletelabel 0=Short label (field short label), 1=Complete label (field label) - * @param string $option 'bookkeeping', 'bookkeepinglistbyaccount', 'accountcard' + * @param string $option 'ledger', 'journals', 'accountcard' * @return string String with URL */ public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0, $option = '') @@ -460,12 +460,12 @@ class AccountingAccount extends CommonObject $result = ''; - if (empty($option) || $option == 'bookkeeping') { - $url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number; - $labelurl = $langs->trans("ShowAccountingAccountInBookKeeping"); - } elseif ($option == 'bookkeepinglistbyaccount') { + if (empty($option) || $option == 'ledger') { $url = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number; - $labelurl = $langs->trans("ShowAccountingAccountInBookKeepingByAccount"); + $labelurl = $langs->trans("ShowAccountingAccountInLedger"); + } elseif ($option == 'journals') { + $url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number; + $labelurl = $langs->trans("ShowAccountingAccountInJournals"); } elseif ($option == 'accountcard') { $url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id; $labelurl = $langs->trans("ShowAccountingAccount"); diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 25ef112b39b..818198fc035 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -289,10 +289,12 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/expensereportsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=6', 'ExpenseReportJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 2, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2709__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=2', 'PurchasesJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 3, __ENTITY__); --insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/sellsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=1', 'SellsJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 4, __ENTITY__); - -- General Ledger - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__); -- Balance - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 10, __ENTITY__); + -- General Ledger + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2432__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 12, __ENTITY__); + -- Journals + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2434__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Journals', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__); -- Export accounting documents insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 17, __ENTITY__); -- Reports diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 3f99754b5cd..57b93c70d77 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1315,13 +1315,21 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Accounting $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire, '', $mainmenu, 'accountancy', 1); - - // General Ledger - $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire); - // Balance $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire); + // General Ledger + $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire); + + // Journals + $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire); + + // Files + if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) + { + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); + } + // Closure if (!empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) { $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure'); @@ -1331,12 +1339,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM } } - // Files - if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) - { - $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); - } - // Reports $newmenu->add("/accountancy/index.php?leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); @@ -1430,11 +1432,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report", $langs->trans("ReportPurchaseTurnover"), 1, $user->rights->compta->resultat->lire); $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); - // Journaux + // Journals $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50); $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 51); } - //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journaux"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); + //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journals"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); } // Assets diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 3d9b36d58b6..2897c62333d 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -20,7 +20,7 @@ CantSuggest=Can't suggest AccountancySetupDoneFromAccountancyMenu=Most setup of the accountancy is done from the menu %s ConfigAccountingExpert=Configuration of the module accounting (double entry) Journalization=Journalization -Journaux=Journals +Journals=Journals JournalFinancial=Financial journals BackToChartofaccounts=Return chart of accounts Chartofaccounts=Chart of accounts @@ -90,8 +90,8 @@ SubledgerAccount=Subledger account SubledgerAccountLabel=Subledger account label ShowAccountingAccount=Show accounting account ShowAccountingJournal=Show accounting journal -ShowAccountingAccountInBookKeeping=Show accounting account in ledger -ShowAccountingAccountInBookKeepingByAccount=Show accounting account in ledger by account +ShowAccountingAccountInLedger=Show accounting account in ledger +ShowAccountingAccountInJournals=Show accounting account in journals AccountAccountingSuggest=Accounting account suggested MenuDefaultAccounts=Default accounts MenuBankAccounts=Bank accounts From 6745c377a695ba506536f3b971449332c8d8cfaa Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 5 Oct 2020 22:35:12 +0200 Subject: [PATCH 50/82] Double line --- htdocs/accountancy/bookkeeping/listbyaccount.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index b99d913a6ff..58a696be1ae 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -33,7 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; // Load translation files required by the page From 609a29219dd79d9d5a578ece4a788d94cd160bd5 Mon Sep 17 00:00:00 2001 From: Pierre Penelon Date: Mon, 5 Oct 2020 23:54:37 +0200 Subject: [PATCH 51/82] FIX|Missing require in API : markAsCreditAvailable Quick fix of a problem I encountered earlier when using `markAsCreditAvailable` API method for invoice routes. The method was using the `DiscountAbsolute` class without importing it resulting in a 500 HTTP error. --- htdocs/compta/facture/class/api_invoices.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 643fb7eddd0..3c9f0af29bc 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -996,6 +996,8 @@ class Invoices extends DolibarrApi */ public function markAsCreditAvailable($id) { + require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; + if (!DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); } From b9cc780c3c3897e6c0575f6e94536915f48cde1b Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 5 Oct 2020 21:58:00 +0000 Subject: [PATCH 52/82] Fixing style errors. --- htdocs/compta/facture/class/api_invoices.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 3c9f0af29bc..b913b405734 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -997,7 +997,7 @@ class Invoices extends DolibarrApi public function markAsCreditAvailable($id) { require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; - + if (!DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); } From 33b7d06bb9b796bd82aa8ff07a80b5113e6eb45f Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Tue, 6 Oct 2020 08:46:53 +0200 Subject: [PATCH 53/82] address feedback + tooltip + reduce indent --- htdocs/compta/paiement/list.php | 586 ++++++++++++++++---------------- 1 file changed, 302 insertions(+), 284 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index e45f8f3a14a..90f3458918a 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -63,16 +63,18 @@ $search_account = GETPOST("search_account", "int"); $search_paymenttype = GETPOST("search_paymenttype"); $search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x" $search_company = GETPOST("search_company", 'alpha'); +$search_payment_num = GETPOST('search_payment_num', 'alpha'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1) $page = 0; // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; + if (!$sortorder) $sortorder = "DESC"; if (!$sortfield) $sortfield = "p.rowid"; @@ -82,14 +84,15 @@ $hookmanager->initHooks(array('paymentlist')); $extrafields = new ExtraFields($db); $arrayfields = array( - 'p.rowid'=>array('label'=>"RefPayment", 'checked'=>1, 'position'=>10), - 'p.datep'=>array('label'=>"Date", 'checked'=>1, 'position'=>20), - 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30), - 'c.libelle'=>array('label'=>"Type", 'checked'=>1, 'position'=>40), - 'transaction'=>array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>50, 'enabled'=>(!empty($conf->banque->enabled))), - 'ba.label'=>array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enabled'=>(!empty($conf->banque->enabled))), - 'p.amount'=>array('label'=>"Amount", 'checked'=>1, 'position'=>70), - 'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>80, 'enabled'=>(!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))), + 'p.rowid' => array('label'=>"RefPayment", 'checked'=>1, 'position'=>10), + 'p.datep' => array('label'=>"Date", 'checked'=>1, 'position'=>20), + 's.nom' => array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30), + 'c.libelle' => array('label'=>"Type", 'checked'=>1, 'position'=>40), + 'transaction' => array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>50, 'enabled'=>(!empty($conf->banque->enabled))), + 'ba.label' => array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enabled'=>(!empty($conf->banque->enabled))), + 'p.num_payment' => array('label'=>"Numero", 'checked'=>1, 'position'=>70, 'tooltip'=>"ChequeOrTransferNumber"), + 'p.amount' => array('label'=>"Amount", 'checked'=>1, 'position'=>80), + 'p.statut' => array('label'=>"Status", 'checked'=>1, 'position'=>90, 'enabled'=>(!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))), ); $arrayfields = dol_sort_array($arrayfields, 'position'); @@ -103,26 +106,28 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -if(empty($reshook)) -{ +if(empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers - { - $search_ref = ""; - $search_account = ""; - $search_amount = ""; - $search_paymenttype = ""; - $search_company = ""; + // All tests are required to be compatible with all browsers + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + $search_ref = ''; + $search_account = ''; + $search_amount = ''; + $search_paymenttype = ''; + $search_payment_num = ''; + $search_company = ''; $day = ''; $year = ''; $month = ''; + $option = ''; + $toselect = ''; $search_array_options = array(); } } /* - * View + * View */ $form = new Form($db); @@ -133,11 +138,11 @@ $bankline = new AccountLine($db); llxHeader('', $langs->trans('ListPayment')); -if (GETPOST("orphelins", "alpha")) -{ +if (GETPOST("orphelins", "alpha")) { // Payments not linked to an invoice. Should not happend. For debug only. - $sql = "SELECT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut"; + $sql = "SELECT p.rowid, p.ref, p.datep, p.amount, p.statut, p.num_paiement as num_payment"; $sql .= ", c.code as paiement_code"; + // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook @@ -146,18 +151,18 @@ if (GETPOST("orphelins", "alpha")) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; $sql .= " WHERE p.entity IN (".getEntity('invoice').")"; $sql .= " AND pf.fk_facture IS NULL"; + // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -} -else -{ +} else { // DISTINCT is to avoid duplicate when there is a link to sales representatives - $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut"; + $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep, p.fk_bank, p.amount, p.statut, p.num_paiement as num_payment"; $sql .= ", c.code as paiement_code"; $sql .= ", ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal"; $sql .= ", s.rowid as socid, s.nom as name, s.email"; + // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook @@ -169,28 +174,30 @@ else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$socid) - { + if (!$user->rights->societe->client->voir && !$socid) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; } $sql .= " WHERE p.entity IN (".getEntity('invoice').")"; - if (!$user->rights->societe->client->voir && !$socid) - { + if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND sc.fk_user = ".$user->id; } - if ($socid > 0) $sql .= " AND f.fk_soc = ".$socid; - if ($userid) - { - if ($userid == -1) $sql .= " AND f.fk_user_author IS NULL"; - else $sql .= " AND f.fk_user_author = ".$userid; + if ($socid > 0) { + $sql .= " AND f.fk_soc = ".$socid; } + if ($userid) { + if ($userid == -1) $sql .= " AND f.fk_user_author IS NULL"; + else $sql .= " AND f.fk_user_author = ".$userid; + } + // Search criteria $sql .= dolSqlDateFilter("p.datep", $day, $month, $year); if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_account > 0) $sql .= " AND b.fk_account=".$search_account; - if ($search_paymenttype != "") $sql .= " AND c.code='".$db->escape($search_paymenttype)."'"; + if ($search_paymenttype != '') $sql .= " AND c.code='".$db->escape($search_paymenttype)."'"; + if ($search_payment_num != '') $sql .= natural_search('p.num_paiement', $search_payment_num); if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1); if ($search_company) $sql .= natural_search('s.nom', $search_company); + // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook @@ -199,12 +206,12 @@ else $sql .= $db->order($sortfield, $sortorder); $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) -{ +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 - { + + // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { $page = 0; $offset = 0; } @@ -213,253 +220,264 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); -if ($resql) -{ - $num = $db->num_rows($resql); - - $param = ''; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); - $param .= (GETPOST("orphelins") ? "&orphelins=1" : ""); - $param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : ""); - $param .= ($search_company ? "&search_company=".urlencode($search_company) : ""); - $param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : ""); - if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); - - print ''; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1); - - $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); - - print '
'; - print ''; - - print ''; - - // Filters: Lines (placeholder) - print ''; - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''; - } - - // Filter: Ref - if (!empty($arrayfields['p.rowid']['checked'])) { - print ''; - } - - // Filter: Date - if (!empty($arrayfields['p.datep']['checked'])) { - print ''; - } - - // Filter: Thirdparty - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - } - - // Filter: Payment type - if (!empty($arrayfields['c.libelle']['checked'])) { - print ''; - } - - // Filter: Bank transaction number - if (!empty($arrayfields['transaction']['checked'])) { - print ''; - } - - // Filter: Bank account - if (!empty($arrayfields['ba.label']['checked'])) { - print ''; - } - - // Filter: Amount - if (!empty($arrayfields['p.amount']['checked'])) { - print ''; - } - - // Filter: Status (only placeholder) - if (!empty($arrayfields['p.statut']['checked'])) { - print ''; - } - - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print ''; - - print ""; - - print ''; - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['p.rowid']['checked'])) print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"], "p.rowid", "", $param, "", $sortfield, $sortorder); - if (!empty($arrayfields['p.datep']['checked'])) print_liste_field_titre($arrayfields['p.datep']['label'], $_SERVER["PHP_SELF"], "p.datep", "", $param, '', $sortfield, $sortorder, 'center '); - 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['c.libelle']['checked'])) print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", "", $param, "", $sortfield, $sortorder); - if (!empty($arrayfields['transaction']['checked'])) print_liste_field_titre($arrayfields['transaction']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); - if (!empty($arrayfields['ba.label']['checked'])) print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); - if (!empty($arrayfields['p.amount']['checked'])) print_liste_field_titre($arrayfields['p.amount']['label'], $_SERVER["PHP_SELF"], "p.amount", "", $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", "", $param, 'class="right"', $sortfield, $sortorder); - - // 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; - - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); - - print ""; - - $i = 0; - $totalarray = array(); - while ($i < min($num, $limit)) - { - $objp = $db->fetch_object($resql); - - $object->id = $objp->rowid; - $object->ref = $objp->ref; - - $companystatic->id = $objp->socid; - $companystatic->name = $objp->name; - $companystatic->email = $objp->email; - - print ''; - - // No - if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { - print ''; - } - - // Ref - if (!empty($arrayfields['p.rowid']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // Date - if (!empty($arrayfields['p.datep']['checked'])) { - $dateformatforpayment = 'day'; - if (!empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment = 'dayhour'; - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // Thirdparty - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // Payment type - if (!empty($arrayfields['c.libelle']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // Bank transaction - if (!empty($arrayfields['transaction']['checked'])) { - $bankline->fetch($objp->fk_bank); - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // Bank account - if (!empty($arrayfields['ba.label']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // Amount - if (!empty($arrayfields['p.amount']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; - $totalarray['pos'][7] = 'amount'; - $totalarray['val']['amount'] += $objp->amount; - } - - // Status - if (!empty($arrayfields['p.statut']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // Buttons - print ''; - if (!$i) $totalarray['nbfield']++; - - print ''; - - $i++; - } - - // Show total line - include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; - - - 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 ''; - $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1); - print ''; - print ''; - $form->select_comptes($search_account, 'search_account', 0, '', 1); - print ''; - print ''; - print ''; - print ''; - print $form->showFilterAndCheckAddButtons(0); - print '
'.(($offset * $limit) + $i).''.print $object->getNomUrl(1).''.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).''; - if ($objp->socid > 0) - { - print $companystatic->getNomUrl(1, '', 24); - } - print ''.$langs->trans("PaymentTypeShort".$objp->paiement_code).''.$bankline->getNomUrl(1, 0).''; - if ($objp->bid > 0) - { - $accountstatic->id = $objp->bid; - $accountstatic->ref = $objp->bref; - $accountstatic->label = $objp->blabel; - $accountstatic->number = $objp->number; - $accountstatic->account_number = $objp->account_number; - - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($objp->accountancy_journal); - $accountstatic->accountancy_journal = $accountingjournal->code; - - print $accountstatic->getNomUrl(1); - } - print ''.price($objp->amount).''; - if ($objp->statut == 0) print ''; - print $object->LibStatut($objp->statut, 5); - if ($objp->statut == 0) print ''; - print '
"; - print "
"; - print ""; -} -else -{ +if (!$resql) { dol_print_error($db); + llxFooter(); + $db->close(); + exit; } +$num = $db->num_rows($resql); + +$param = ''; +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); +$param .= (GETPOST("orphelins") ? "&orphelins=1" : ''); +$param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : ''); +$param .= ($search_company ? "&search_company=".urlencode($search_company) : ''); +$param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : ''); +$param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : ''); +if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + +print '
'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1); + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); + +print '
'; +print ''; + +print ''; + +// Filters: Lines (placeholder) +print ''; +if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''; +} + +// Filter: Ref +if (!empty($arrayfields['p.rowid']['checked'])) { + print ''; +} + +// Filter: Date +if (!empty($arrayfields['p.datep']['checked'])) { + print ''; +} + +// Filter: Thirdparty +if (!empty($arrayfields['s.nom']['checked'])) { + print ''; +} + +// Filter: Payment type +if (!empty($arrayfields['c.libelle']['checked'])) { + print ''; +} + +// Filter: Bank transaction number +if (!empty($arrayfields['transaction']['checked'])) { + print ''; +} + +// Filter: Cheque number (fund transfer) +if (!empty($arrayfields['p.num_payment']['checked'])) { + print ''; +} + +// Filter: Bank account +if (!empty($arrayfields['ba.label']['checked'])) { + print ''; +} + +// Filter: Amount +if (!empty($arrayfields['p.amount']['checked'])) { + print ''; +} + +// Filter: Status (only placeholder) +if (!empty($arrayfields['p.statut']['checked'])) { + print ''; +} + +// Fields from hook +$parameters = array('arrayfields'=>$arrayfields); +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print ''; + +print ""; + +print ''; +if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['p.rowid']['checked'])) print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"], "p.rowid", '', $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['p.datep']['checked'])) print_liste_field_titre($arrayfields['p.datep']['label'], $_SERVER["PHP_SELF"], "p.datep", '', $param, '', $sortfield, $sortorder, 'center '); +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['c.libelle']['checked'])) print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], "c.libelle", '', $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['p.num_payment']['checked'])) print_liste_field_titre($arrayfields['p.num_payment']['label'], $_SERVER["PHP_SELF"], "p.num_payment", '', $param, '', $sortfield, $sortorder, '', $arrayfields['p.num_payment']['tooltip']); +if (!empty($arrayfields['transaction']['checked'])) print_liste_field_titre($arrayfields['transaction']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['ba.label']['checked'])) print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], "ba.label", '', $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['p.amount']['checked'])) print_liste_field_titre($arrayfields['p.amount']['label'], $_SERVER["PHP_SELF"], "p.amount", '', $param, 'class="right"', $sortfield, $sortorder); +if (!empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", '', $param, 'class="right"', $sortfield, $sortorder); + +// 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; + +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); +print ""; + +$i = 0; +$totalarray = array(); +while ($i < min($num, $limit)) { + $objp = $db->fetch_object($resql); + + $object->id = $objp->rowid; + $object->ref = $objp->ref; + + $companystatic->id = $objp->socid; + $companystatic->name = $objp->name; + $companystatic->email = $objp->email; + + print ''; + + // No + if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Ref + if (!empty($arrayfields['p.rowid']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Date + if (!empty($arrayfields['p.datep']['checked'])) { + $dateformatforpayment = 'day'; + if (!empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment = 'dayhour'; + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Thirdparty + if (!empty($arrayfields['s.nom']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Payment type + if (!empty($arrayfields['c.libelle']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Filter: Cheque number (fund transfer) + if (!empty($arrayfields['p.num_payment']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Bank transaction + if (!empty($arrayfields['transaction']['checked'])) { + $bankline->fetch($objp->fk_bank); + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Bank account + if (!empty($arrayfields['ba.label']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Amount + if (!empty($arrayfields['p.amount']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + $totalarray['pos'][8] = 'amount'; + $totalarray['val']['amount'] += $objp->amount; + } + + // Status + if (!empty($arrayfields['p.statut']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Buttons + print ''; + if (!$i) $totalarray['nbfield']++; + + print ''; + + $i++; +} + +// Show total line +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + +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 ''; + $form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1); + print ''; + print ''; + print ''; + print ''; + $form->select_comptes($search_account, 'search_account', 0, '', 1); + print ''; + print ''; + print ''; + print ''; +print $form->showFilterAndCheckAddButtons(0); +print '
'.(($offset * $limit) + $i).''.$object->getNomUrl(1).''.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).''; + if ($objp->socid > 0) { + print $companystatic->getNomUrl(1, '', 24); + } + print ''.$langs->trans("PaymentTypeShort".$objp->paiement_code).''.$objp->num_payment.''.$bankline->getNomUrl(1, 0).''; + if ($objp->bid > 0) { + $accountstatic->id = $objp->bid; + $accountstatic->ref = $objp->bref; + $accountstatic->label = $objp->blabel; + $accountstatic->number = $objp->number; + $accountstatic->account_number = $objp->account_number; + + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($objp->accountancy_journal); + $accountstatic->accountancy_journal = $accountingjournal->code; + + print $accountstatic->getNomUrl(1); + } + print ''.price($objp->amount).''; + if ($objp->statut == 0) print ''; + print $object->LibStatut($objp->statut, 5); + if ($objp->statut == 0) print ''; + print '
"; +print "
"; +print "
"; + // End of page llxFooter(); $db->close(); From 8f542a857215b34e5a8f8b10e4c8cf188522f0a4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 6 Oct 2020 06:56:08 +0000 Subject: [PATCH 54/82] Fixing style errors. --- htdocs/compta/paiement/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 90f3458918a..e2f3ea9012b 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -106,7 +106,7 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -if(empty($reshook)) { +if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // All tests are required to be compatible with all browsers @@ -186,7 +186,7 @@ if (GETPOST("orphelins", "alpha")) { } if ($userid) { if ($userid == -1) $sql .= " AND f.fk_user_author IS NULL"; - else $sql .= " AND f.fk_user_author = ".$userid; + else $sql .= " AND f.fk_user_author = ".$userid; } // Search criteria From 7c6c319607b0e9a0c54ec5d25eb64a6b985cb76d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Oct 2020 09:31:54 +0200 Subject: [PATCH 55/82] Trans --- htdocs/langs/en_US/companies.lang | 1 + htdocs/societe/card.php | 12 ++++++------ htdocs/societe/class/societe.class.php | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 923ce91d74a..4145d7184c5 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -354,6 +354,7 @@ VATIntraManualCheck=You can also check manually on the European Commission websi ErrorVATCheckMS_UNAVAILABLE=Check not possible. Check service is not provided by the member state (%s). NorProspectNorCustomer=Not prospect, nor customer JuridicalStatus=Legal Entity Type +Workforce=Workforce Staff=Employees ProspectLevelShort=Potential ProspectLevel=Prospect potential diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 9e6ad514da6..d6a6d202fb0 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1431,14 +1431,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; } - // Type - Size + // Type - Workforce/Staff print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"': '').'>'."\n"; $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; if ($conf->browser->layout == 'phone') print ''; - print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"': '').'>'; + print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).'browser->layout == 'phone' ? ' colspan="3"': '').'>'; print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; @@ -2054,13 +2054,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; print ''; - // Type - Size + // Type - Workforce/Staff print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''; print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; if ($conf->browser->layout == 'phone') print ''; - print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; + print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).''; print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; @@ -2450,11 +2450,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; print ''; - // Type + Staff + // Type + Workforce/Staff $arr = $formcompany->typent_array(1); $object->typent = $arr[$object->typent_code]; print ''.$langs->trans("ThirdPartyType").''.$object->typent.''; - print ''.$langs->trans("Staff").''.$object->effectif.''; + print ''.$langs->trans("Workforce").''.$object->effectif.''; print ''; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a8b2caa59c1..686e83f104f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -161,8 +161,8 @@ class Societe extends CommonObject 'instagram' =>array('type'=>'varchar(255)', 'label'=>'Instagram', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'facebook' =>array('type'=>'varchar(255)', 'label'=>'Facebook', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'twitter' =>array('type'=>'varchar(255)', 'label'=>'Twitter', 'enabled'=>1, 'visible'=>-1, 'position'=>165),*/ - 'fk_effectif' =>array('type'=>'integer', 'label'=>'Fk effectif', 'enabled'=>1, 'visible'=>-1, 'position'=>170), - 'fk_typent' =>array('type'=>'integer', 'label'=>'Fk typent', 'enabled'=>1, 'visible'=>-1, 'position'=>175), + 'fk_effectif' =>array('type'=>'integer', 'label'=>'Workforce', 'enabled'=>1, 'visible'=>-1, 'position'=>170), + 'fk_typent' =>array('type'=>'integer', 'label'=>'TypeOfCompany', 'enabled'=>1, 'visible'=>-1, 'position'=>175), 'fk_forme_juridique' =>array('type'=>'integer', 'label'=>'JuridicalStatus', 'enabled'=>1, 'visible'=>-1, 'position'=>180), 'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'siren' =>array('type'=>'varchar(128)', 'label'=>'Idprof1', 'enabled'=>1, 'visible'=>-1, 'position'=>190), @@ -173,7 +173,7 @@ class Societe extends CommonObject 'idprof6' =>array('type'=>'varchar(128)', 'label'=>'Idprof6', 'enabled'=>1, 'visible'=>-1, 'position'=>207), 'tva_intra' =>array('type'=>'varchar(20)', 'label'=>'Tva intra', 'enabled'=>1, 'visible'=>-1, 'position'=>210), 'capital' =>array('type'=>'double(24,8)', 'label'=>'Capital', 'enabled'=>1, 'visible'=>-1, 'position'=>215), - 'fk_stcomm' =>array('type'=>'integer', 'label'=>'Fk stcomm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), + 'fk_stcomm' =>array('type'=>'integer', 'label'=>'CommercialStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225), 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230), 'prefix_comm' =>array('type'=>'varchar(5)', 'label'=>'Prefix comm', 'enabled'=>'$conf->global->SOCIETE_USEPREFIX', 'visible'=>-1, 'position'=>235), From 42903953758291432917f1853535a7c4ae036b3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Oct 2020 09:53:10 +0200 Subject: [PATCH 56/82] Fix according to PR #14939 --- htdocs/fichinter/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 650fdc2be15..97dc2626280 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1625,7 +1625,7 @@ if ($action == 'create') } // Reopen - if ($object->statut > Fichinter::STATUS_CLOSED) + if ($object->statut >= Fichinter::STATUS_CLOSED) { if ($user->rights->ficheinter->creer) { @@ -1645,7 +1645,7 @@ if ($action == 'create') } // create intervention model - if ($conf->global->MAIN_FEATURES_LEVEL >= 2 && $object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) { + if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && $object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) { print ''; From 054c58df16dc3c1b67f165bca6ebabc1c9d58438 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Oct 2020 09:53:29 +0200 Subject: [PATCH 57/82] Add currency into the select --- htdocs/compta/accounting-files.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 2a8a0358744..3b074298b56 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -149,7 +149,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Customer invoices if (GETPOST('selectinvoices')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total as total_ht, t.total_ttc, t.tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_CREDIT." as sens"; + $sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total as total_ht, t.total_ttc, t.tva as total_vat, t.multicurrency_code as currency, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_CREDIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql .= " WHERE datef between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -158,7 +158,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Vendor invoices if (GETPOST('selectsupplierinvoices')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_DEBIT." as sens"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.multicurrency_code as currency, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum, ".PAY_DEBIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; $sql .= " WHERE datef between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -167,7 +167,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Expense reports if (GETPOST('selectexpensereports')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_user_author as fk_soc, t.date_fin as date, t.date_fin as date_due, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.multicurrency_code as currency, t.fk_user_author as fk_soc, t.date_fin as date, t.date_fin as date_due, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql .= " WHERE date_fin between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -176,7 +176,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Donations if (GETPOST('selectdonations')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, t.datedon as date, t.datedon as date_due, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_CREDIT." as sens"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.datedon as date, t.datedon as date_due, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_CREDIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country"; $sql .= " WHERE datedon between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -185,7 +185,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Paiements of salaries if (GETPOST('selectpaymentsofsalaries')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; + $sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; $sql .= " WHERE datep between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -194,7 +194,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Social contributions if (GETPOST('selectsocialcontributions')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.date_ech as date, t.periode as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; + $sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.date_ech as date, t.periode as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t"; $sql .= " WHERE t.date_ech between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -203,7 +203,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Various payments if (GETPOST('selectvariouspayment')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.datep as date, t.datep as date_due, 'VariousPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, sens"; + $sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.datep as date, t.datep as date_due, 'VariousPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, sens"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_various as t"; $sql .= " WHERE datep between ".$wheretail; $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; @@ -211,7 +211,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { // Loan payments if (GETPOST('selectloanspayment')) { if (!empty($sql)) $sql .= " UNION ALL"; - $sql .= " SELECT t.rowid as id, l.entity, l.label as ref, 1 as paid, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ht, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ttc, 0 as total_tva, 0 as fk_soc, t.datep as date, t.datep as date_due, 'LoanPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; + $sql .= " SELECT t.rowid as id, l.entity, l.label as ref, 1 as paid, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ht, (t.amount_capital+t.amount_insurance+t.amount_interest) as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.datep as date, t.datep as date_due, 'LoanPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, ".PAY_DEBIT." as sens"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_loan as t LEFT JOIN ".MAIN_DB_PREFIX."loan as l ON l.rowid = t.fk_loan"; $sql .= " WHERE datep between ".$wheretail; $sql .= " AND l.entity IN (".($entity == 1 ? '0,1' : $entity).')'; From 351f80c540beec56b3bb342927f109fed39d22ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Oct 2020 09:57:04 +0200 Subject: [PATCH 58/82] Update index.php --- htdocs/takepos/index.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 3585d25eee7..06472abe0cd 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -865,12 +865,12 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
-multicurrency->enabled)){ ?> +multicurrency->enabled)) { ?> - +
From 38acd83f4d3b0997ef653576b37e144401f58b41 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Oct 2020 12:17:33 +0200 Subject: [PATCH 59/82] Review some titles and tooltip help to be more clear. --- htdocs/accountancy/bookkeeping/list.php | 17 +++++++++-------- .../accountancy/bookkeeping/listbyaccount.php | 15 +++++++++------ htdocs/compta/accounting-files.php | 3 +++ htdocs/fourn/facture/document.php | 19 ++++++++----------- htdocs/langs/en_US/accountancy.lang | 4 +++- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index d5603a7a075..f2c7d3ea548 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -529,7 +529,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { $formother = new FormOther($db); $formfile = new FormFile($db); -$title_page = $langs->trans("Bookkeeping"); +$title_page = $langs->trans("Operations").' - '.$langs->trans("Journals"); // Count total nb of records $nbtotalofrecords = ''; @@ -613,17 +613,17 @@ if ($action == 'delbookkeepingyear') { } //$param=''; param started before -if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; -if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); print '
'; print ''; print ''; -if ($optioncss != '') print ''; +if ($optioncss != '') print ''; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList"); else $buttonLabel = $langs->trans("ExportList"); @@ -638,7 +638,8 @@ $newcardbutton .= ''.$langs->trans("I $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param ? '&'.$param : ''), $user->rights->accounting->mouvements->export); -// $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss'=>'btnTitleSelected')); +$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss'=>'marginleftonly')); $url = './card.php?action=create'; if (!empty($socid)) $url .= '&socid='.$socid; diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 58a696be1ae..5b14f71cf51 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -293,7 +293,7 @@ $formfile = new FormFile($db); $formother = new FormOther($db); $form = new Form($db); -$title_page = $langs->trans("Bookkeeping").' '.strtolower($langs->trans("By")).' '.strtolower($langs->trans("AccountAccounting")); +$title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccounting").' ('.$langs->trans("Bookkeeping").')'; llxHeader('', $title_page); @@ -369,16 +369,19 @@ if ($optioncss != '') print ''; print ''; print ''; -print ''; -// $newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); +$newcardbutton .= dolGetButtonTitle($langs->trans('VueByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss'=>'marginleftonly btnTitleSelected')); + +$newcardbutton .= '   '; + $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create'); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); -print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit); +print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $viewflat.$newcardbutton, '', $limit, 0, 0, 1); $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields @@ -696,10 +699,10 @@ while ($i < min($num, $limit)) print ''; if (empty($line->date_export)) { if ($user->rights->accounting->mouvements->creer) { - print ''.img_edit().''; + print ''.img_edit().''; } if ($user->rights->accounting->mouvements->supprimer) { - print ' '.img_delete().''; + print '   '.img_delete().''; } } print ''; diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 3b074298b56..61c0b855c75 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -525,6 +525,9 @@ dol_fiche_head($head, 'AccountancyFiles'); print ''."\n"; print ''; +print ''.$langs->trans("ExportAccountingSourceDocHelp", $langs->transnoentitiesnoconv("Accounting"), $langs->transnoentitiesnoconv("Journals")).'
'; +print '
'; + print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0); print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n"; diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 39bb12c1ed1..2887298cae7 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -215,15 +215,15 @@ if ($object->id > 0) // Amount Local Taxes //TODO: Place into a function to control showing by country or study better option - if ($societe->localtax1_assuj == "1") //Localtax1 + if ($mysoc->localtax1_assuj == "1") //Localtax1 { - print ''.$langs->transcountry("AmountLT1", $societe->country_code).''; + print ''.$langs->transcountry("AmountLT1", $mysoc->country_code).''; print ''.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).''; print ''; } - if ($societe->localtax2_assuj == "1") //Localtax2 + if ($mysoc->localtax2_assuj == "1") //Localtax2 { - print ''.$langs->transcountry("AmountLT2", $societe->country_code).''; + print ''.$langs->transcountry("AmountLT2", $mysoc->country_code).''; print ''.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).''; print ''; } @@ -252,16 +252,14 @@ if ($object->id > 0) $permission = $user->rights->fournisseur->facture->creer; $permtoedit = $user->rights->fournisseur->facture->creer; $param = '&facid='.$object->id; - + + $defaulttpldir = '/core/tpl'; $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach ($dirtpls as $module => $reldir) { - if (!empty($module)) - { + if (!empty($module)) { $tpl = dol_buildpath($reldir.'/document_actions_post_headers.tpl.php'); - } - else - { + } else { $tpl = DOL_DOCUMENT_ROOT.$reldir.'/document_actions_post_headers.tpl.php'; } @@ -272,7 +270,6 @@ if ($object->id > 0) } if ($res) break; } - } else { print $langs->trans('ErrorUnknown'); } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 2897c62333d..b2eb665d027 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -44,7 +44,9 @@ CountriesInEEC=Countries in EEC CountriesNotInEEC=Countries not in EEC CountriesInEECExceptMe=Countries in EEC except %s CountriesExceptMe=All countries except %s -AccountantFiles=Export accounting documents +AccountantFiles=Export source documents +ExportAccountingSourceDocHelp=With this tool, you can export the source events (list and PDFs) that were used to generate your accountancy. To export your journals, use the menu entry %s - %s. +VueByAccountAccounting=View by accounting account MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup MainAccountForSuppliersNotDefined=Main accounting account for vendors not defined in setup From 1c38379622b9808d600b9c967f3be46ddc2153da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Oct 2020 12:22:58 +0200 Subject: [PATCH 60/82] Better message --- htdocs/accountancy/bookkeeping/card.php | 2 +- htdocs/accountancy/bookkeeping/list.php | 2 +- htdocs/accountancy/bookkeeping/listbyaccount.php | 2 +- htdocs/langs/en_US/accountancy.lang | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index ef105b6709a..8ca880de25f 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -328,7 +328,7 @@ llxHeader('', $langs->trans("CreateMvts")); // Confirmation to delete the command if ($action == 'delete') { - $formconfirm = $html->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&mode='.$mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1); + $formconfirm = $html->formconfirm($_SERVER["PHP_SELF"].'?id='.$id.'&mode='.$mode, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'confirm_delete', '', 0, 1); print $formconfirm; } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index f2c7d3ea548..3acd0ddd4d9 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -608,7 +608,7 @@ if ($action == 'delbookkeepingyear') { 'default' => $deljournal ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, '', 1, 300); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300); print $formconfirm; } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 5b14f71cf51..32121ae6c02 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -357,7 +357,7 @@ if ($action == 'delbookkeepingyear') { 'default' => $deljournal ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, '', 1, 300); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300); print $formconfirm; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index b2eb665d027..9ad088e4c31 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -215,8 +215,8 @@ DeleteMvt=Delete Ledger lines DelMonth=Month to delete DelYear=Year to delete DelJournal=Journal to delete -ConfirmDeleteMvt=This will delete all lines of the Ledger for the year/month and/or from a specific journal (At least one criterion is required). You will have to reuse the feature 'Registration in accounting' to have the deleted record back in the ledger. -ConfirmDeleteMvtPartial=This will delete the transaction from the Ledger (all lines related to same transaction will be deleted) +ConfirmDeleteMvt=This will delete all operation lines of the accounting for the year/month and/or for a specific journal (At least one criterion is required). You will have to reuse the feature '%s' to have the deleted record back in the ledger. +ConfirmDeleteMvtPartial=This will delete the transaction from the accounting (all operation lines related to the same transaction will be deleted) FinanceJournal=Finance journal ExpenseReportsJournal=Expense reports journal DescFinanceJournal=Finance journal including all the types of payments by bank account From a32456afc509deea3610ce7fe05afc2cd6112b2e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Oct 2020 12:35:18 +0200 Subject: [PATCH 61/82] Update interface_99_modMyModule_MyModuleTriggers.class.php --- .../interface_99_modMyModule_MyModuleTriggers.class.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index add80d58af3..be6d42047ce 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -102,12 +102,8 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers // Put here code you want to execute when a Dolibarr business events occurs. // Data and type of action are stored into $object and $action - /** - * new method to handle triggers - * you can now create a method for the interface - * this method should be named like the trigger in camelCase - * for example : COMPANY_CREATE => public function companyCreate($action, $object, User $user, Translate $langs, Conf $conf) - */ + // You can isolate code for each action in a separate method: this method should be named like the trigger in camelCase. + // For example : COMPANY_CREATE => public function companyCreate($action, $object, User $user, Translate $langs, Conf $conf) $methodName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($action))))); $callback = array($this, $methodName); if (is_callable($callback)){ @@ -118,6 +114,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers return call_user_func($callback, $action, $object, $user, $langs, $conf); }; + // Or you can execute some code here switch ($action) { // Users //case 'USER_CREATE': From 3ceb5c217f48af4f221447ce8398d8838a412d1b Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Tue, 6 Oct 2020 12:56:28 +0200 Subject: [PATCH 62/82] Show count on project overview tab --- htdocs/core/lib/project.lib.php | 68 ++++++++++++++++++--------- htdocs/projet/class/project.class.php | 39 +++++++++++++++ 2 files changed, 85 insertions(+), 22 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 782e18151b2..91cf281c83c 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -30,23 +30,23 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs - * @return array Array of tabs to show + * @param Project $object Object related to tabs + * @return array Array of tabs to show */ -function project_prepare_head($object) +function project_prepare_head(Project $project) { global $db, $langs, $conf, $user; $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.$project->id; $head[$h][1] = $langs->trans("Project"); $head[$h][2] = 'project'; $h++; - $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); - $head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$object->id; + $nbContact = count($project->liste_contact(-1, 'internal')) + count($project->liste_contact(-1, 'external')); + $head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$project->id; $head[$h][1] = $langs->trans("ProjectContact"); if ($nbContact > 0) $head[$h][1] .= ''.$nbContact.''; $head[$h][2] = 'contact'; @@ -55,12 +55,12 @@ function project_prepare_head($object) if (empty($conf->global->PROJECT_HIDE_TASKS)) { // Then tab for sub level of projet, i mean tasks - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$project->id; $head[$h][1] = $langs->trans("Tasks"); require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; $taskstatic = new Task($db); - $nbTasks = count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0)); + $nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0)); if ($nbTasks > 0) $head[$h][1] .= ''.($nbTasks).''; $head[$h][2] = 'tasks'; $h++; @@ -71,7 +71,7 @@ function project_prepare_head($object) //$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt"; $sql .= " WHERE t.fk_task = pt.rowid"; - $sql .= " AND pt.fk_projet =".$object->id; + $sql .= " AND pt.fk_projet =".$project->id; $resql = $db->query($sql); if ($resql) { @@ -79,7 +79,7 @@ function project_prepare_head($object) if ($obj) $nbTimeSpent = 1; } else dol_print_error($db); - $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$project->id; $head[$h][1] = $langs->trans("TimeSpent"); if ($nbTimeSpent > 0) $head[$h][1] .= '...'; $head[$h][2] = 'timespent'; @@ -91,8 +91,32 @@ function project_prepare_head($object) || !empty($conf->facture->enabled) || !empty($conf->contrat->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled)) { - $head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id; + $count = 0; + + if (!empty($conf->propal->enabled)) $count += $project->getElementCount('propal', 'propal'); + if (!empty($conf->commande->enabled)) $count += $project->getElementCount('order', 'commande'); + if (!empty($conf->facture->enabled)) $count += $project->getElementCount('invoice', 'facture'); + if (!empty($conf->facture->enabled)) $count += $project->getElementCount('invoice_predefined', 'facture_rec'); + if (!empty($conf->supplier_proposal->enabled)) $count += $project->getElementCount('proposal_supplier', 'supplier_proposal'); + if (!empty($conf->supplier_order->enabled)) $count += $project->getElementCount('order_supplier', 'commande_fournisseur'); + if (!empty($conf->supplier_invoice->enabled)) $count += $project->getElementCount('invoice_supplier', 'facture_fourn'); + if (!empty($conf->contrat->enabled)) $count += $project->getElementCount('contract', 'contrat'); + if (!empty($conf->ficheinter->enabled)) $count += $project->getElementCount('intervention', 'fichinter'); + if (!empty($conf->expedition->enabled)) $count += $project->getElementCount('shipping', 'expedition'); + if (!empty($conf->mrp->enabled)) $count += $project->getElementCount('mrp', 'mrp_mo', 'fk_project'); + if (!empty($conf->deplacement->enabled)) $count += $project->getElementCount('trip', 'deplacement'); + if (!empty($conf->expensereport->enabled)) $count += $project->getElementCount('expensereport', 'expensereport'); + if (!empty($conf->don->enabled)) $count += $project->getElementCount('donation', 'don'); + if (!empty($conf->loan->enabled)) $count += $project->getElementCount('loan', 'loan'); + if (!empty($conf->tax->enabled)) $count += $project->getElementCount('chargesociales', 'chargesociales'); + if (!empty($conf->projet->enabled)) $count += $project->getElementCount('project_task', 'projet_task'); + if (!empty($conf->stock->enabled)) $count += $project->getElementCount('stock_mouvement', 'stock'); + if (!empty($conf->salaries->enabled)) $count += $project->getElementCount('salaries', 'payment_salary'); + if (!empty($conf->banque->enabled)) $count += $project->getElementCount('variouspayment', 'payment_various'); + + $head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$project->id; $head[$h][1] = $langs->trans("ProjectOverview"); + if ($count > 0) $head[$h][1] .= ''.$count.''; $head[$h][2] = 'element'; $h++; } @@ -101,15 +125,15 @@ function project_prepare_head($object) // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'project'); + complete_head_from_modules($conf, $langs, $project, $head, $h, 'project'); if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { $nbNote = 0; - if (!empty($object->note_private)) $nbNote++; - if (!empty($object->note_public)) $nbNote++; - $head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id; + if (!empty($project->note_private)) $nbNote++; + if (!empty($project->note_public)) $nbNote++; + $head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$project->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) $head[$h][1] .= ''.$nbNote.''; $head[$h][2] = 'notes'; @@ -118,10 +142,10 @@ function project_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($object->ref); + $upload_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($project->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.'/projet/document.php?id='.$object->id; + $nbLinks = Link::count($db, $project->element, $project->id); + $head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$project->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ''.($nbFiles + $nbLinks).''; $head[$h][2] = 'document'; @@ -130,15 +154,15 @@ function project_prepare_head($object) // Manage discussion if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT)) { - $nbComments = $object->getNbComments(); - $head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id; + $nbComments = $project->getNbComments(); + $head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$project->id; $head[$h][1] = $langs->trans("CommentLink"); if ($nbComments > 0) $head[$h][1] .= ''.$nbComments.''; $head[$h][2] = 'project_comment'; $h++; } - $head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$project->id; $head[$h][1] .= $langs->trans("Events"); if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { @@ -148,7 +172,7 @@ function project_prepare_head($object) $head[$h][2] = 'agenda'; $h++; - complete_head_from_modules($conf, $langs, $object, $head, $h, 'project', 'remove'); + complete_head_from_modules($conf, $langs, $project, $head, $h, 'project', 'remove'); return $head; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 30a2a0c242b..83bd4e3b2a4 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -806,6 +806,45 @@ class Project extends CommonObject } } + /** + * Return the count of a type of linked elements of this project + * + * @param string $type The type of the linked elements (e.g. 'propal', 'order', 'invoice', 'order_supplier', 'invoice_supplier') + * @param string $tablename The name of table associated of the type + * @param string $projectkey (optional) Equivalent key to fk_projet for actual type + * @return integer The count of the linked elements (the count is zero on request error too) + */ + public function getElementCount($type, $tablename, $projectkey = 'fk_projet') + { + if ($this->id <= 0) return 0; + + if ($type == 'agenda') { + $sql = "SELECT COUNT(id) as nb FROM ".MAIN_DB_PREFIX."actioncomm WHERE fk_project = ".$this->id." AND entity IN (".getEntity('agenda').")"; + } elseif ($type == 'expensereport') { + $sql = "SELECT COUNT(ed.rowid) as nb FROM ".MAIN_DB_PREFIX."expensereport as e, ".MAIN_DB_PREFIX."expensereport_det as ed WHERE e.rowid = ed.fk_expensereport AND e.entity IN (".getEntity('expensereport').") AND ed.fk_projet = ".$this->id; + } elseif ($type == 'project_task') { + $sql = "SELECT DISTINCT COUNT(pt.rowid) as nb FROM ".MAIN_DB_PREFIX."projet_task as pt WHERE pt.fk_projet = ".$this->id; + } elseif ($type == 'project_task_time') { // Case we want to duplicate line foreach user + $sql = "SELECT DISTINCT COUNT(pt.rowid) as nb FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt WHERE pt.rowid = ptt.fk_task AND pt.fk_projet = ".$this->id; + } elseif ($type == 'stock_mouvement') { + $sql = 'SELECT COUNT(ms.rowid) as nb FROM '.MAIN_DB_PREFIX."stock_mouvement as ms, ".MAIN_DB_PREFIX."entrepot as e WHERE e.rowid = ms.fk_entrepot AND e.entity IN (".getEntity('stock').") AND ms.origintype = 'project' AND ms.fk_origin = ".$this->id." AND ms.type_mouvement = 1"; + } elseif ($type == 'loan') { + $sql = 'SELECT COUNT(l.rowid) as nb FROM '.MAIN_DB_PREFIX."loan as l WHERE l.entity IN (".getEntity('loan').") AND l.fk_projet = ".$this->id; + } else { + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.$tablename." WHERE ".$projectkey." = ".$this->id." AND entity IN (".getEntity($type).")"; + } + + $result = $this->db->query($sql); + + if (!$result) return 0; + + $obj = $this->db->fetch_object($result); + + $this->db->free($result); + + return $obj->nb; + } + /** * Delete tasks with no children first, then task with children recursively * From 4701656d950c6f3e9ac318b15e1036e6a57b4519 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Oct 2020 13:08:20 +0200 Subject: [PATCH 63/82] Fix look and field v13 --- htdocs/accountancy/bookkeeping/list.php | 34 +++++++------------ .../accountancy/bookkeeping/listbyaccount.php | 18 ++++++---- htdocs/core/menus/standard/auguria.lib.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/core/menus/standard/empty.php | 4 +-- htdocs/langs/en_US/accountancy.lang | 2 +- 6 files changed, 29 insertions(+), 33 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 3acd0ddd4d9..642d47b09e4 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -108,7 +108,7 @@ $hookmanager->initHooks(array('bookkeepinglist')); $formaccounting = new FormAccounting($db); $form = new Form($db); -if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !isset($_POST['begin']) && !isset($_GET['begin']) && !isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export) +if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export) { if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values')) { @@ -671,12 +671,10 @@ if (!empty($arrayfields['t.doc_date']['checked'])) { print ''; print '
'; - print $langs->trans('From').' '; - print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1); + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print '
'; print '
'; - print $langs->trans('to').' '; - print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1); + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); print '
'; print ''; } @@ -704,25 +702,25 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) { print ''; print '
'; - print $langs->trans('From').' '; // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not // use setup of keypress to select thirdparty and this hang browser on large database. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { + print $langs->trans('From').' '; print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); } else { - print ''; + print ''; } print '
'; print '
'; - print $langs->trans('to').' '; // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not // use setup of keypress to select thirdparty and this hang browser on large database. if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { + print $langs->trans('to').' '; print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); } else { - print ''; + print ''; } print '
'; print ''; @@ -772,12 +770,10 @@ if (!empty($arrayfields['t.date_creation']['checked'])) { print ''; print '
'; - print $langs->trans('From').' '; - print $form->selectDate($search_date_creation_start, 'date_creation_start', 0, 0, 1); + print $form->selectDate($search_date_creation_start, 'date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print '
'; print '
'; - print $langs->trans('to').' '; - print $form->selectDate($search_date_creation_end, 'date_creation_end', 0, 0, 1); + print $form->selectDate($search_date_creation_end, 'date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); print '
'; print ''; } @@ -786,12 +782,10 @@ if (!empty($arrayfields['t.tms']['checked'])) { print ''; print '
'; - print $langs->trans('From').' '; - print $form->selectDate($search_date_modification_start, 'date_modification_start', 0, 0, 1); + print $form->selectDate($search_date_modification_start, 'date_modification_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print '
'; print '
'; - print $langs->trans('to').' '; - print $form->selectDate($search_date_modification_end, 'date_modification_end', 0, 0, 1); + print $form->selectDate($search_date_modification_end, 'date_modification_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print '
'; print ''; } @@ -800,12 +794,10 @@ if (!empty($arrayfields['t.date_export']['checked'])) { print ''; print '
'; - print $langs->trans('From').' '; - print $form->selectDate($search_date_export_start, 'date_export_start', 0, 0, 1); + print $form->selectDate($search_date_export_start, 'date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print '
'; print '
'; - print $langs->trans('to').' '; - print $form->selectDate($search_date_export_end, 'date_export_end', 0, 0, 1); + print $form->selectDate($search_date_export_end, 'date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); print '
'; print ''; } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 32121ae6c02..4ed055be0b1 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -54,6 +54,7 @@ if ($search_accountancy_code_end == - 1) { } $search_doc_ref = GETPOST('search_doc_ref', 'alpha'); $search_label_operation = GETPOST('search_label_operation', 'alpha'); +$search_mvt_num = GETPOST('search_mvt_num', 'int'); $search_direction = GETPOST('search_direction', 'alpha'); $search_ledger_code = GETPOST('search_ledger_code', 'alpha'); $search_debit = GETPOST('search_debit', 'alpha'); @@ -85,7 +86,7 @@ $hookmanager->initHooks(array('bookkeepingbyaccountlist')); $formaccounting = new FormAccounting($db); $form = new Form($db); -if (empty($search_date_start) && empty($search_date_end) && GETPOSTISSET('search_date_startday') && GETPOSTISSET('search_date_startmonth') && GETPOSTISSET('search_date_starthour')) { +if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('search_date_startday') && !GETPOSTISSET('search_date_startmonth') && !GETPOSTISSET('search_date_starthour')) { $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'"; $sql .= $db->plimit(1); @@ -148,6 +149,7 @@ if (empty($reshook)) $search_label_account = ''; $search_doc_ref = ''; $search_label_operation = ''; + $search_mvt_num = ''; $search_direction = ''; $search_ledger_code = ''; $search_date_start = ''; @@ -192,6 +194,10 @@ if (empty($reshook)) $filter['t.label_compte'] = $search_label_account; $param .= '&search_label_compte=' . urlencode($search_label_account); } + if (!empty($search_mvt_num)) { + $filter['t.piece_num'] = $search_mvt_num; + $param .= '&search_mvt_num=' . urlencode($search_mvt_num); + } if (!empty($search_doc_ref)) { $filter['t.doc_ref'] = $search_doc_ref; $param .= '&search_doc_ref=' . urlencode($search_doc_ref); @@ -396,10 +402,10 @@ $moreforfilter = ''; // Accountancy account $moreforfilter .= '
'; $moreforfilter .= $langs->trans('AccountAccounting').': '; -$moreforfilter .= '
'; +$moreforfilter .= '
'; $moreforfilter .= $langs->trans('From').' '; $moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, 'maxwidth200'); -$moreforfilter .= $langs->trans('to').' '; +$moreforfilter .= ' '.$langs->trans('to').' '; $moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, 'maxwidth200'); $moreforfilter .= '
'; $moreforfilter .= '
'; @@ -427,12 +433,10 @@ if (!empty($arrayfields['t.code_journal']['checked'])) { if (!empty($arrayfields['t.doc_date']['checked'])) { print ''; print '
'; - print $langs->trans('From') . ': '; - print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1); + print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From")); print '
'; print '
'; - print $langs->trans('to') . ': '; - print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1); + print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to")); print '
'; print ''; } diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 8bde6d6fa61..a124759faa8 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -551,7 +551,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t { print '