From 2fbb6b112513078edf4b7620f34770e9c2f9c207 Mon Sep 17 00:00:00 2001 From: x Date: Mon, 21 Sep 2020 09:29:52 +0200 Subject: [PATCH 01/69] 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/69] 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/69] 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/69] 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/69] 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/69] 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/69] 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/69] 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/69] 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/69] 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/69] 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/69] 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/69] 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/69] 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)){