From 48ae3030ecafbba8febb15446df3a8058b63faf0 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 7 Dec 2024 18:19:49 +0100 Subject: [PATCH] FIX P0TVA when no data --- include/class/periode.class.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/class/periode.class.php b/include/class/periode.class.php index dee39238e..77beb78b5 100644 --- a/include/class/periode.class.php +++ b/include/class/periode.class.php @@ -100,15 +100,21 @@ EOF; function is_closed() { if ($this->jrn_def_id!=0) + { + $sql="select status from jrn_periode ". - " where jrn_def_id=".$this->jrn_def_id. - " and p_id =".$this->p_id; + " where jrn_def_id=$2 ". + " and p_id = $1"; + $status=$this->cn->get_value($sql,[$this->p_id,$this->jrn_def_id]); + } else + { $sql="select p_closed as status from parm_periode ". " where ". - " p_id =".$this->p_id; - $res=$this->cn->exec_sql($sql); - $status=Database::fetch_result($res, 0, 0); + " p_id = $1"; + $status=$this->cn->get_value($sql,[$this->p_id]); + + } if ($status=='CL'||$status=='t'||$status=='CE') return 1; return 0;