|
@@ -137,13 +137,13 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
|
|
|
$sql .= ", s.canvas";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p,";
|
|
|
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
|
|
|
$sql .= " AND p.fk_soc = s.rowid";
|
|
|
$sql .= " AND p.fk_statut = ".Propal::STATUS_DRAFT;
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid) {
|
|
@@ -235,13 +235,13 @@ if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "l
|
|
|
$sql .= ", s.canvas";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p,";
|
|
|
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE p.entity IN (".getEntity($supplierproposalstatic->element).")";
|
|
|
$sql .= " AND p.fk_statut = ".SupplierProposal::STATUS_DRAFT;
|
|
|
$sql .= " AND p.fk_soc = s.rowid";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid) {
|
|
@@ -332,13 +332,13 @@ if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
|
|
|
$sql .= ", s.canvas";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c,";
|
|
|
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")";
|
|
|
$sql .= " AND c.fk_statut = ".Commande::STATUS_DRAFT;
|
|
|
$sql .= " AND c.fk_soc = s.rowid";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid) {
|
|
@@ -430,13 +430,13 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
|
|
|
$sql .= ", s.canvas";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf,";
|
|
|
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE cf.entity IN (".getEntity($supplierorderstatic->element).")";
|
|
|
$sql .= " AND cf.fk_statut = ".CommandeFournisseur::STATUS_DRAFT;
|
|
|
$sql .= " AND cf.fk_soc = s.rowid";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid) {
|
|
@@ -527,7 +527,7 @@ if (isModEnabled('ficheinter')) {
|
|
|
$sql .= ", s.canvas";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
|
|
@@ -536,7 +536,7 @@ if (isModEnabled('ficheinter')) {
|
|
|
if ($socid) {
|
|
|
$sql .= " AND f.fk_soc = ".((int) $socid);
|
|
|
}
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
|
|
@@ -608,12 +608,12 @@ if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) {
|
|
|
$sql .= ", s.canvas";
|
|
|
$sql .= ", s.datec, s.tms";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE s.entity IN (".getEntity($companystatic->element).")";
|
|
|
$sql .= " AND s.client IN (".Societe::CUSTOMER.", ".Societe::PROSPECT.", ".Societe::CUSTOMER_AND_PROSPECT.")";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
// Add where from hooks
|
|
@@ -714,12 +714,12 @@ if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $use
|
|
|
$sql .= ", s.canvas";
|
|
|
$sql .= ", s.datec as dc, s.tms as dm";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE s.entity IN (".getEntity($companystatic->element).")";
|
|
|
$sql .= " AND s.fournisseur = ".Societe::SUPPLIER;
|
|
|
- if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
|
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
// Add where from hooks
|
|
@@ -829,13 +829,13 @@ if (isModEnabled('contrat') && $user->hasRight("contrat", "lire") && 0) { // TOD
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."contrat as c";
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."product as p";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE c.entity IN (".getEntity($staticcontrat->element).")";
|
|
|
$sql .= " AND c.fk_soc = s.rowid";
|
|
|
$sql .= " AND c.fk_product = p.rowid";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid) {
|
|
@@ -904,13 +904,13 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
|
|
|
$sql .= ", s.canvas";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p";
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE p.entity IN (".getEntity($propalstatic->element).")";
|
|
|
$sql .= " AND p.fk_soc = s.rowid";
|
|
|
$sql .= " AND p.fk_statut = ".Propal::STATUS_VALIDATED;
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid) {
|
|
@@ -1023,13 +1023,13 @@ if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) {
|
|
|
$sql .= ", s.canvas";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE c.entity IN (".getEntity($orderstatic->element).")";
|
|
|
$sql .= " AND c.fk_soc = s.rowid";
|
|
|
$sql .= " AND c.fk_statut IN (".Commande::STATUS_VALIDATED.", ".Commande::STATUS_SHIPMENTONPROCESS.")";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid) {
|