2
0
forked from Wavyzz/dolibarr

Fix warnings

This commit is contained in:
Laurent Destailleur
2023-11-27 13:26:44 +01:00
parent 06736918de
commit 1d589fd74e
45 changed files with 241 additions and 240 deletions

View File

@@ -169,7 +169,7 @@ class Reception extends CommonObject
if (getDolGlobalString('RECEPTION_ADDON_NUMBER')) {
$mybool = false;
$file = $conf->global->RECEPTION_ADDON_NUMBER.".php";
$file = getDolGlobalString('RECEPTION_ADDON_NUMBER') . ".php";
$classname = $conf->global->RECEPTION_ADDON_NUMBER;
// Include file with class
@@ -505,8 +505,8 @@ class Reception extends CommonObject
return 0;
}
if (!((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->creer))
|| (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->reception_advance->validate)))) {
if (!((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'creer'))
|| (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'reception_advance', 'validate')))) {
$this->error = 'Permission denied';
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
return -1;
@@ -1420,7 +1420,7 @@ class Reception extends CommonObject
public function setDeliveryDate($user, $delivery_date)
{
// phpcs:enable
if ($user->rights->reception->creer) {
if ($user->hasRight('reception', 'creer')) {
$sql = "UPDATE ".MAIN_DB_PREFIX."reception";
$sql .= " SET date_delivery = ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : 'null');
$sql .= " WHERE rowid = ".((int) $this->id);
@@ -1853,8 +1853,8 @@ class Reception extends CommonObject
return 0;
}
if (!((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->creer))
|| (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->reception->reception_advance->validate)))) {
if (!((!getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'creer'))
|| (getDolGlobalInt('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('reception', 'reception_advance', 'validate')))) {
$this->error = 'Permission denied';
return -1;
}

View File

@@ -70,7 +70,7 @@ class ReceptionStats extends Stats
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
$this->where .= " AND c.entity IN (".getEntity('reception').")";
if (empty($user->rights->societe->client->voir) && !$this->socid) {
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
$this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($this->socid) {
@@ -94,7 +94,7 @@ class ReceptionStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@@ -118,7 +118,7 @@ class ReceptionStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE ".$this->where;
@@ -141,7 +141,7 @@ class ReceptionStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, SUM(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@@ -165,7 +165,7 @@ class ReceptionStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%m') as dm, AVG(c.".$this->field.")";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE c.date_valid BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
@@ -187,7 +187,7 @@ class ReceptionStats extends Stats
$sql = "SELECT date_format(c.date_valid,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg";
$sql .= " FROM ".$this->from;
if (empty($user->rights->societe->client->voir) && !$this->socid) {
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= " WHERE ".$this->where;