From a295d4f39679fb30fddef72aa099a8fa0036d475 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 2 Nov 2019 23:10:06 +0100 Subject: [PATCH] Use connection and not global --- include/class/acc_currency.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/class/acc_currency.class.php b/include/class/acc_currency.class.php index 0de9a09c6..7c170920c 100644 --- a/include/class/acc_currency.class.php +++ b/include/class/acc_currency.class.php @@ -140,14 +140,14 @@ class Acc_Currency */ function get_rate_date($p_date) { - global $cn; + if (isDate($p_date) == null ) return -1; $sql="select ch_value from currency_history where ch_from=(select max(ch_from) from currency_history where ch_from <= to_date($1,'DD.MM.YYYY') and currency_id=$2) and currency_id=$2"; - $value=$cn->get_value($sql,[$p_date,$this->get_id()]); + $value=$this->cn->get_value($sql,[$p_date,$this->get_id()]); if ($value == "") return -2; return $value; }