From 42860d752c167e49e8810c918dbe1f3bbfe1bfef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Jun 2020 22:11:22 +0200 Subject: [PATCH] Fix templates --- htdocs/bom/class/api_boms.class.php | 6 +++--- htdocs/modulebuilder/template/class/api_mymodule.class.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index d21d82b5ca9..806b75cb9eb 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -24,11 +24,11 @@ require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; /** * \file bom/class/api_boms.class.php * \ingroup bom - * \brief File for API management of bom. + * \brief File for API management of BOM. */ /** - * API class for bom + * API class for BOM * * @access protected * @class DolibarrApiAccess {@requires user,external} @@ -120,7 +120,7 @@ class Boms extends DolibarrApi //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; - if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity('bom').')'; + if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity($tmpobject->element).')'; if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc"; if ($restrictonsocid && $socid) $sql .= " AND t.fk_soc = ".$socid; if ($restrictonsocid && $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index f84210b9198..8498fc4a636 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -108,7 +108,7 @@ class MyModuleApi extends DolibarrApi $obj_ret = array(); $tmpobject = new MyObject($db); - if (!DolibarrApiAccess::$user->rights->bbb->read) { + if (!DolibarrApiAccess::$user->rights->mymodule->myobject->read) { throw new RestException(401); } @@ -131,7 +131,7 @@ class MyModuleApi extends DolibarrApi //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; - if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity('myobject').')'; + if ($tmpobject->ismultientitymanaged) $sql .= ' AND t.entity IN ('.getEntity($tmpobject->element).')'; if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc"; if ($restrictonsocid && $socid) $sql .= " AND t.fk_soc = ".$socid; if ($restrictonsocid && $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale