From 7d9013cb2d12b57e2398af4de17b2f018568f5f0 Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Tue, 29 Mar 2016 09:24:58 +0100 Subject: [PATCH] Fix error message when searching for non existing customer in sales (#430) --- application/controllers/Sales.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/application/controllers/Sales.php b/application/controllers/Sales.php index 40cc230a0..1e793a1ed 100644 --- a/application/controllers/Sales.php +++ b/application/controllers/Sales.php @@ -147,8 +147,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(); } @@ -497,7 +499,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));