|
@@ -1393,7 +1393,7 @@ class Product extends CommonObject
|
|
|
$this->error = "Object must be fetched before calling delete";
|
|
|
return -1;
|
|
|
}
|
|
|
- if (($this->type == Product::TYPE_PRODUCT && empty($user->rights->produit->supprimer)) || ($this->type == Product::TYPE_SERVICE && empty($user->rights->service->supprimer))) {
|
|
|
+ if (($this->type == Product::TYPE_PRODUCT && !$user->hasRight('produit', 'supprimer')) || ($this->type == Product::TYPE_SERVICE && !$user->hasRight('service', 'supprimer'))) {
|
|
|
$this->error = "ErrorForbidden";
|
|
|
return 0;
|
|
|
}
|
|
@@ -2802,7 +2802,7 @@ class Product extends CommonObject
|
|
|
$sql .= " SUM(mp.qty) as qty";
|
|
|
$sql .= " FROM ".$this->db->prefix()."mrp_mo as c";
|
|
|
$sql .= " INNER JOIN ".$this->db->prefix()."mrp_production as mp ON mp.fk_mo=c.rowid";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " INNER JOIN ".$this->db->prefix()."societe_commerciaux as sc ON sc.fk_soc=c.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
$sql .= " WHERE ";
|
|
@@ -2925,14 +2925,14 @@ class Product extends CommonObject
|
|
|
$sql .= " FROM ".$this->db->prefix()."propaldet as pd";
|
|
|
$sql .= ", ".$this->db->prefix()."propal as p";
|
|
|
$sql .= ", ".$this->db->prefix()."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE p.rowid = pd.fk_propal";
|
|
|
$sql .= " AND p.fk_soc = s.rowid";
|
|
|
$sql .= " AND p.entity IN (".getEntity('propal').")";
|
|
|
$sql .= " AND pd.fk_product = ".((int) $this->id);
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
//$sql.= " AND pr.fk_statut != 0";
|
|
@@ -3000,14 +3000,14 @@ class Product extends CommonObject
|
|
|
$sql .= " FROM ".$this->db->prefix()."supplier_proposaldet as pd";
|
|
|
$sql .= ", ".$this->db->prefix()."supplier_proposal as p";
|
|
|
$sql .= ", ".$this->db->prefix()."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE p.rowid = pd.fk_supplier_proposal";
|
|
|
$sql .= " AND p.fk_soc = s.rowid";
|
|
|
$sql .= " AND p.entity IN (".getEntity('supplier_proposal').")";
|
|
|
$sql .= " AND pd.fk_product = ".((int) $this->id);
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
//$sql.= " AND pr.fk_statut != 0";
|
|
@@ -3056,14 +3056,14 @@ class Product extends CommonObject
|
|
|
$sql .= " FROM ".$this->db->prefix()."commandedet as cd";
|
|
|
$sql .= ", ".$this->db->prefix()."commande as c";
|
|
|
$sql .= ", ".$this->db->prefix()."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE c.rowid = cd.fk_commande";
|
|
|
$sql .= " AND c.fk_soc = s.rowid";
|
|
|
$sql .= " AND c.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'commande').")";
|
|
|
$sql .= " AND cd.fk_product = ".((int) $this->id);
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) {
|
|
|
$sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -3184,14 +3184,14 @@ class Product extends CommonObject
|
|
|
$sql .= " FROM ".$this->db->prefix()."commande_fournisseurdet as cd";
|
|
|
$sql .= ", ".$this->db->prefix()."commande_fournisseur as c";
|
|
|
$sql .= ", ".$this->db->prefix()."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE c.rowid = cd.fk_commande";
|
|
|
$sql .= " AND c.fk_soc = s.rowid";
|
|
|
$sql .= " AND c.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'supplier_order').")";
|
|
|
$sql .= " AND cd.fk_product = ".((int) $this->id);
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) {
|
|
|
$sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -3247,7 +3247,7 @@ class Product extends CommonObject
|
|
|
$sql .= ", ".$this->db->prefix()."commande as c";
|
|
|
$sql .= ", ".$this->db->prefix()."expedition as e";
|
|
|
$sql .= ", ".$this->db->prefix()."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE e.rowid = ed.fk_expedition";
|
|
@@ -3256,7 +3256,7 @@ class Product extends CommonObject
|
|
|
$sql .= " AND e.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'expedition').")";
|
|
|
$sql .= " AND ed.fk_origin_line = cd.rowid";
|
|
|
$sql .= " AND cd.fk_product = ".((int) $this->id);
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) {
|
|
|
$sql .= " AND e.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -3331,14 +3331,14 @@ class Product extends CommonObject
|
|
|
$sql .= " FROM ".$this->db->prefix()."commande_fournisseur_dispatch as fd";
|
|
|
$sql .= ", ".$this->db->prefix()."commande_fournisseur as cf";
|
|
|
$sql .= ", ".$this->db->prefix()."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE cf.rowid = fd.fk_commande";
|
|
|
$sql .= " AND cf.fk_soc = s.rowid";
|
|
|
$sql .= " AND cf.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'supplier_order').")";
|
|
|
$sql .= " AND fd.fk_product = ".((int) $this->id);
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) {
|
|
|
$sql .= " AND cf.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -3392,13 +3392,13 @@ class Product extends CommonObject
|
|
|
$sql .= " FROM ".$this->db->prefix()."mrp_production as mp";
|
|
|
$sql .= ", ".$this->db->prefix()."mrp_mo as m";
|
|
|
$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON s.rowid = m.fk_soc";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE m.rowid = mp.fk_mo";
|
|
|
$sql .= " AND m.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'mrp').")";
|
|
|
$sql .= " AND mp.fk_product = ".((int) $this->id);
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid && !$forVirtualStock) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) {
|
|
|
$sql .= " AND m.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -3488,14 +3488,14 @@ class Product extends CommonObject
|
|
|
$sql .= " FROM ".$this->db->prefix()."contratdet as cd";
|
|
|
$sql .= ", ".$this->db->prefix()."contrat as c";
|
|
|
$sql .= ", ".$this->db->prefix()."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE c.rowid = cd.fk_contrat";
|
|
|
$sql .= " AND c.fk_soc = s.rowid";
|
|
|
$sql .= " AND c.entity IN (".getEntity('contract').")";
|
|
|
$sql .= " AND cd.fk_product = ".((int) $this->id);
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
//$sql.= " AND c.statut != 0";
|
|
@@ -3562,14 +3562,14 @@ class Product extends CommonObject
|
|
|
$sql .= " FROM ".$this->db->prefix()."facturedet as fd";
|
|
|
$sql .= ", ".$this->db->prefix()."facture as f";
|
|
|
$sql .= ", ".$this->db->prefix()."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE f.rowid = fd.fk_facture";
|
|
|
$sql .= " AND f.fk_soc = s.rowid";
|
|
|
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
|
|
$sql .= " AND fd.fk_product = ".((int) $this->id);
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
//$sql.= " AND f.fk_statut != 0";
|
|
@@ -3637,14 +3637,14 @@ class Product extends CommonObject
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet_rec as fd";
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."facture_rec 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.rowid = fd.fk_facture";
|
|
|
$sql .= " AND f.fk_soc = s.rowid";
|
|
|
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
|
|
$sql .= " AND fd.fk_product = ".((int) $this->id);
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
//$sql.= " AND f.fk_statut != 0";
|
|
@@ -3711,14 +3711,14 @@ class Product extends CommonObject
|
|
|
$sql .= " FROM ".$this->db->prefix()."facture_fourn_det as fd";
|
|
|
$sql .= ", ".$this->db->prefix()."facture_fourn as f";
|
|
|
$sql .= ", ".$this->db->prefix()."societe as s";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE f.rowid = fd.fk_facture_fourn";
|
|
|
$sql .= " AND f.fk_soc = s.rowid";
|
|
|
$sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
|
|
|
$sql .= " AND fd.fk_product = ".((int) $this->id);
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
//$sql.= " AND f.fk_statut != 0";
|
|
@@ -3849,7 +3849,7 @@ class Product extends CommonObject
|
|
|
if ($filteronproducttype >= 0) {
|
|
|
$sql .= ", ".$this->db->prefix()."product as p";
|
|
|
}
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE f.rowid = d.fk_facture";
|
|
@@ -3863,7 +3863,7 @@ class Product extends CommonObject
|
|
|
}
|
|
|
$sql .= " AND f.fk_soc = s.rowid";
|
|
|
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -3903,7 +3903,7 @@ class Product extends CommonObject
|
|
|
if ($filteronproducttype >= 0) {
|
|
|
$sql .= ", ".$this->db->prefix()."product as p";
|
|
|
}
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE f.rowid = d.fk_facture_fourn";
|
|
@@ -3917,7 +3917,7 @@ class Product extends CommonObject
|
|
|
}
|
|
|
$sql .= " AND f.fk_soc = s.rowid";
|
|
|
$sql .= " AND f.entity IN (".getEntity('facture_fourn').")";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -3955,7 +3955,7 @@ class Product extends CommonObject
|
|
|
if ($filteronproducttype >= 0) {
|
|
|
$sql .= ", ".$this->db->prefix()."product as prod";
|
|
|
}
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE p.rowid = d.fk_propal";
|
|
@@ -3969,7 +3969,7 @@ class Product extends CommonObject
|
|
|
}
|
|
|
$sql .= " AND p.fk_soc = s.rowid";
|
|
|
$sql .= " AND p.entity IN (".getEntity('propal').")";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -4008,7 +4008,7 @@ class Product extends CommonObject
|
|
|
if ($filteronproducttype >= 0) {
|
|
|
$sql .= ", ".$this->db->prefix()."product as prod";
|
|
|
}
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE p.rowid = d.fk_supplier_proposal";
|
|
@@ -4022,7 +4022,7 @@ class Product extends CommonObject
|
|
|
}
|
|
|
$sql .= " AND p.fk_soc = s.rowid";
|
|
|
$sql .= " AND p.entity IN (".getEntity('supplier_proposal').")";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -4060,7 +4060,7 @@ class Product extends CommonObject
|
|
|
if ($filteronproducttype >= 0) {
|
|
|
$sql .= ", ".$this->db->prefix()."product as p";
|
|
|
}
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE c.rowid = d.fk_commande";
|
|
@@ -4074,7 +4074,7 @@ class Product extends CommonObject
|
|
|
}
|
|
|
$sql .= " AND c.fk_soc = s.rowid";
|
|
|
$sql .= " AND c.entity IN (".getEntity('commande').")";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -4112,7 +4112,7 @@ class Product extends CommonObject
|
|
|
if ($filteronproducttype >= 0) {
|
|
|
$sql .= ", ".$this->db->prefix()."product as p";
|
|
|
}
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE c.rowid = d.fk_commande";
|
|
@@ -4126,7 +4126,7 @@ class Product extends CommonObject
|
|
|
}
|
|
|
$sql .= " AND c.fk_soc = s.rowid";
|
|
|
$sql .= " AND c.entity IN (".getEntity('supplier_order').")";
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -4164,7 +4164,7 @@ class Product extends CommonObject
|
|
|
if ($filteronproducttype >= 0) {
|
|
|
$sql .= ", ".$this->db->prefix()."product as p";
|
|
|
}
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
|
|
@@ -4181,7 +4181,7 @@ class Product extends CommonObject
|
|
|
}
|
|
|
$sql .= " AND c.fk_soc = s.rowid";
|
|
|
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -4218,7 +4218,7 @@ class Product extends CommonObject
|
|
|
if ($filteronproducttype >= 0) {
|
|
|
$sql .= ", ".$this->db->prefix()."product as p";
|
|
|
}
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= ", ".$this->db->prefix()."societe_commerciaux as sc";
|
|
|
}
|
|
|
|
|
@@ -4234,7 +4234,7 @@ class Product extends CommonObject
|
|
|
$sql .= " AND p.rowid = d.fk_product AND p.fk_product_type = ".((int) $filteronproducttype);
|
|
|
}
|
|
|
|
|
|
- if (empty($user->rights->societe->client->voir) && !$socid) {
|
|
|
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
|
|
$sql .= " AND d.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
if ($socid > 0) {
|
|
@@ -6101,7 +6101,7 @@ class Product extends CommonObject
|
|
|
if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) {
|
|
|
$dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
|
|
|
foreach ($dirsociete as $dirroot) {
|
|
|
- $res = dol_include_once($dirroot.$conf->global->BARCODE_PRODUCT_ADDON_NUM.'.php');
|
|
|
+ $res = dol_include_once($dirroot . getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php');
|
|
|
if ($res) {
|
|
|
break;
|
|
|
}
|