From 560398c88254eca069c63d160c9583378cb5cea9 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Wed, 8 Apr 2020 10:31:01 +0200 Subject: [PATCH] Corrected model batch querying. --- application/models/Customers_model.php | 6 ++---- application/models/Providers_model.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/application/models/Customers_model.php b/application/models/Customers_model.php index 25ebecbd..918c9e4b 100644 --- a/application/models/Customers_model.php +++ b/application/models/Customers_model.php @@ -351,7 +351,7 @@ class Customers_Model extends CI_Model { */ public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL) { - $customers_role_id = $this->get_customers_role_id(); + $role_id = $this->get_customers_role_id(); if ($where !== NULL) { @@ -363,9 +363,7 @@ class Customers_Model extends CI_Model { $this->db->order_by($order_by); } - $this->db->where('id_roles', $customers_role_id); - - return $this->db->get('ea_users', $limit, $offset)->result_array(); + return $this->db->get_where('ea_users', ['id_roles' => $role_id], $limit, $offset)->result_array(); } /** diff --git a/application/models/Providers_model.php b/application/models/Providers_model.php index 3fc8b98b..bfac563e 100755 --- a/application/models/Providers_model.php +++ b/application/models/Providers_model.php @@ -471,7 +471,7 @@ class Providers_Model extends CI_Model { $this->db->order_by($order_by); } - $batch = $this->db->get('ea_users', ['id_roles' => $role_id], $limit, $offset)->result_array(); + $batch = $this->db->get_where('ea_users', ['id_roles' => $role_id], $limit, $offset)->result_array(); // Include each provider services and settings. foreach ($batch as &$provider)