Mysqli errors: Trying to access array offset on value of type bool. Fixed. Please...
[fa-stable.git] / sales / includes / db / customers_db.inc
index 0dfc17e28e85fa9ddf1ad0de89fa026fb6b9b700..3f16159e46ddc434fe45048405ca60005e89fab7 100644 (file)
@@ -132,7 +132,7 @@ function get_customer_name($customer_id)
 
        $row = db_fetch_row($result);
 
-       return $row[0];
+       return is_array($row) ? $row[0] : false;
 }
 
 function get_customer_habit($customer_id)
@@ -165,6 +165,8 @@ function get_current_cust_credit($customer_id)
 {
        $custdet = get_customer_details($customer_id);
 
+       if (!is_array($custdet))
+               return 0;
        return $custdet['credit_limit']-$custdet['Balance'];
 
 }
@@ -197,7 +199,7 @@ function get_customer_currency($customer_id=null, $branch_id=null)
        $result = db_query($sql, "Retreive currency of customer $customer_id");
 
        $myrow=db_fetch_row($result);
-       return $myrow[0];
+       return $myrow ? $myrow[0] : get_company_currency();
 }
 
 function get_customers_search($customer)