Fix error message when searching for nonexistant customer in sales

(#430)
This commit is contained in:
jekkos committed 2016-03-29 08:43:58 +02:00
1 parent d51d1b458a
commit 51b776354a
1 file changed
+5 -2
+5 -2
View File
@@ -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));