From aee0618dd39fd00a6b04ce207862c8bd24bad817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 15 Feb 2024 16:44:27 +0100 Subject: [PATCH] fix phpstan salary.class.php (#28164) * fix phpstan salary.class.php * Update salary.class.php * fix * fix --- htdocs/salaries/class/salary.class.php | 30 ++++++++++++-------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 6e147c59d72..4e186387a23 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -70,6 +70,7 @@ class Salary extends CommonObject public $salary; public $amount; + /** * @var int ID */ @@ -117,7 +118,8 @@ class Salary extends CommonObject public $user; /** - * 1 if salary paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code) + * @var int 1 if salary paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code) + * @deprecated */ public $paye; @@ -188,11 +190,9 @@ class Salary extends CommonObject // Update extrafield if (!$error) { - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } } @@ -342,11 +342,11 @@ class Salary extends CommonObject $this->amount = price2num(trim($this->amount)); $this->label = trim($this->label); $this->note = trim($this->note); - $this->fk_bank = trim($this->fk_bank); - $this->fk_user_author = trim($this->fk_user_author); - $this->fk_user_modif = trim($this->fk_user_modif); - $this->accountid = trim($this->accountid); - $this->paye = trim($this->paye); + $this->fk_bank = (int) $this->fk_bank; + $this->fk_user_author = (int) $this->fk_user_author; + $this->fk_user_modif = (int) $this->fk_user_modif; + $this->accountid = (int) $this->accountid; + $this->paye = (int) $this->paye; // Check parameters if (!$this->label) { @@ -413,11 +413,9 @@ class Salary extends CommonObject if ($this->id > 0) { // Update extrafield if (!$error) { - if (!$error) { - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } }