Merge pull request #11517 from hregis/9.0_bug2
FIX better compatibility with Multicompany
This commit is contained in:
commit
a3b746bcb9
@ -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 '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
$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)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user