From c9fe91138d42963e6343923b0b812bfcb893051b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 16 Jul 2019 12:39:43 +0200 Subject: [PATCH] FIX better compatibility with Multicompany --- htdocs/opensurvey/index.php | 16 +++------------- htdocs/ticket/index.php | 4 ++-- htdocs/ticket/list.php | 3 +-- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/htdocs/opensurvey/index.php b/htdocs/opensurvey/index.php index 4c60a807445..1ddfc47d99a 100644 --- a/htdocs/opensurvey/index.php +++ b/htdocs/opensurvey/index.php @@ -37,18 +37,6 @@ $langs->load("opensurvey"); llxHeader(); -$nbsondages=0; -$sql='SELECT COUNT(*) as nb FROM '.MAIN_DB_PREFIX.'opensurvey_sondage'; -$resql=$db->query($sql); -if ($resql) -{ - $obj=$db->fetch_object($resql); - $nbsondages=$obj->nb; -} -else dol_print_error($db,''); - - - print load_fiche_titre($langs->trans("OpenSurveyArea")); @@ -56,7 +44,9 @@ print '
'; $nbsondages=0; -$sql='SELECT COUNT(*) as nb FROM '.MAIN_DB_PREFIX.'opensurvey_sondage'; +$sql = 'SELECT COUNT(*) as nb'; +$sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_sondage'; +$sql.= ' WHERE entity IN ('.getEntity('survey').')'; $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 086ea63bc0e..59a2bae5f46 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -127,7 +127,7 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } -$sql .= ' WHERE t.entity IN (' . getEntity('ticket', 1) . ')'; +$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')'; $sql .= " AND t.fk_statut IS NOT NULL"; $sql .= " AND date_format(datec,'%Y') = '" . $endyear . "'"; if (!$user->rights->societe->client->voir && !$socid) { @@ -271,7 +271,7 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } -$sql .= ' WHERE t.entity IN (' . getEntity('ticket', 1) . ')'; +$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')'; $sql .= " AND t.fk_statut=0"; if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 64ec859cc0c..965677ded0e 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -209,8 +209,7 @@ $sql.=$hookmanager->resPrint; $sql=preg_replace('/, $/','', $sql); $sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; -if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")"; -else $sql.=" WHERE 1 = 1"; +$sql.= " WHERE t.entity IN (".getEntity($object->element).")"; foreach($search as $key => $val) { if ($key == 'fk_statut' && $search[$key] == -1) continue;