Merge branch '20.0' of git@github.com:Dolibarr/dolibarr.git into 21.0

This commit is contained in:
Laurent Destailleur
2025-01-27 01:30:34 +01:00
76 changed files with 289 additions and 227 deletions

View File

@@ -2763,16 +2763,16 @@ class Commande extends CommonOrder
$sql = "SELECT s.rowid, s.nom as name, s.client,";
$sql .= " c.rowid as cid, c.ref";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", sc.fk_soc, sc.fk_user";
}
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX.$this->table_element." as c";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.entity IN (".getEntity('commande').")";
$sql .= " AND c.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
@@ -3599,7 +3599,7 @@ class Commande extends CommonOrder
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as c";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = " AND";
@@ -3774,6 +3774,7 @@ class Commande extends CommonOrder
/**
* getTooltipContentArray
*
* @param array<string,mixed> $params params to construct tooltip data
* @since v18
* @return array{picto?:string,ref?:string,refsupplier?:string,label?:string,date?:string,date_echeance?:string,amountht?:string,total_ht?:string,totaltva?:string,amountlt1?:string,amountlt2?:string,amountrevenustamp?:string,totalttc?:string}|array{optimize:string}
@@ -4108,7 +4109,7 @@ class Commande extends CommonOrder
$sql = "SELECT count(co.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as co";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid";
if (!$user->hasRight('societe', 'client', 'voir')) {
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = "AND";