From a6fa6c9cd6de740322d3046f498cf7b2010369a0 Mon Sep 17 00:00:00 2001 From: jekkos Date: Tue, 8 Mar 2016 08:11:10 +0100 Subject: [PATCH] Add group operator to giftcard query --- application/models/Giftcard.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/application/models/Giftcard.php b/application/models/Giftcard.php index 2ada354d8..2706bf41a 100644 --- a/application/models/Giftcard.php +++ b/application/models/Giftcard.php @@ -218,11 +218,13 @@ class Giftcard extends CI_Model $this->db->from('giftcards'); $this->db->join('people', 'giftcards.person_id=people.person_id', 'left'); $this->db->like('first_name', $this->db->escape_like_str($search)); + $this->db->or_group_start(); $this->db->or_like('last_name', $this->db->escape_like_str($search)); $this->db->or_like('CONCAT(first_name, " ", last_name)', $this->db->escape_like_str($search)); $this->db->or_like('giftcard_number', $this->db->escape_like_str($search)); $this->db->or_like('giftcards.person_id', $this->db->escape_like_str($search)); - $this->db->where('deleted', 0); + $this->db->group_end(); + $this->db->where('giftcards.deleted', 0); $this->db->order_by('giftcard_number', 'asc'); if ($rows > 0) @@ -238,12 +240,13 @@ class Giftcard extends CI_Model $this->db->from('giftcards'); $this->db->join('people', 'giftcards.person_id=people.person_id', 'left'); $this->db->like('first_name', $this->db->escape_like_str($search)); + $this->db->or_group_start(); $this->db->or_like('last_name', $this->db->escape_like_str($search)); $this->db->or_like('CONCAT(first_name, " ", last_name)', $this->db->escape_like_str($search)); $this->db->or_like('giftcard_number', $this->db->escape_like_str($search)); $this->db->or_like('giftcards.person_id', $this->db->escape_like_str($search)); - $this->db->where('deleted', 0); - + $this->db->group_end(); + $this->db->where('giftcards.deleted', 0); return $this->db->get()->num_rows(); }