From 51b776354acef9269bbf4a85eb07326002919fa9 Mon Sep 17 00:00:00 2001 From: jekkos Date: Tue, 29 Mar 2016 08:43:58 +0200 Subject: [PATCH] Fix error message when searching for nonexistant customer in sales (#430) --- application/controllers/Sales.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/application/controllers/Sales.php b/application/controllers/Sales.php index ab2046923..74bde6655 100644 --- a/application/controllers/Sales.php +++ b/application/controllers/Sales.php @@ -168,7 +168,10 @@ class Sales extends Secure_area function select_customer() { $customer_id = $this->input->post('customer'); - $this->sale_lib->set_customer($customer_id); + if ($this->Customer->exists($customer_id)) + { + $this->sale_lib->set_customer($customer_id); + } $this->_reload(); } @@ -513,7 +516,7 @@ class Sales extends Secure_area { // substitute customer info $customer_id = $this->sale_lib->get_customer(); - if($customer_id != -1 && $cust_info != '') + if($customer_id != -1 && $cust_info != '' && $cust_info->last_name != '' && $cust_info->first_name != '') { $text = str_replace('$CU',$cust_info->first_name . ' ' . $cust_info->last_name,$text); $words = preg_split("/\s+/", trim($cust_info->first_name . ' ' . $cust_info->last_name));