From d4fd234b7589f14b65185dbc6e42e96a606d3dc1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 15 Jan 2024 15:11:27 +0100 Subject: [PATCH 1/2] FIX missing entity filter for check if period exists --- htdocs/expensereport/class/expensereport.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 9a1866247eb..8af62d14736 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2340,10 +2340,13 @@ class ExpenseReport extends CommonObject */ public function periode_existe($fuser, $date_debut, $date_fin) { + global $conf; + // phpcs:enable $sql = "SELECT rowid, date_debut, date_fin"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " WHERE fk_user_author = ".((int) $fuser->id); + $sql .= " WHERE entity = ".((int) $conf->entity); // not shared, only for the current entity + $sql .= " AND fk_user_author = ".((int) $fuser->id); dol_syslog(get_class($this)."::periode_existe sql=".$sql); $result = $this->db->query($sql); From 82bc2e2d7192886c964862cdd206d657523c5d70 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Mon, 15 Jan 2024 21:22:59 +0100 Subject: [PATCH 2/2] phpstan Property ProductCombination2ValuePair::$fk_prod_attr (int) does not accept string. Property ProductCombination2ValuePair::$fk_prod_attr_val (int) does not accept string. --- htdocs/variants/combinations.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index ee667ea4c49..a7850bd660b 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -175,8 +175,8 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( $sanit_features[$explode[0]] = $explode[1]; $tmp = new ProductCombination2ValuePair($db); - $tmp->fk_prod_attr = $explode[0]; - $tmp->fk_prod_attr_val = $explode[1]; + $tmp->fk_prod_attr = (int) $explode[0]; + $tmp->fk_prod_attr_val = (int) $explode[1]; $productCombination2ValuePairs1[] = $tmp; }