From c581c341acef33881e44252e76f13c29bfc65308 Mon Sep 17 00:00:00 2001 From: "alextselegidis@gmail.com" Date: Fri, 26 Jul 2013 06:16:24 +0000 Subject: [PATCH] * Fixed compatibility with PHP 5.3 --- src/application/libraries/Unit_tests/Unit_tests.php | 2 ++ src/application/models/customers_model.php | 8 ++++---- src/application/models/providers_model.php | 10 ++++++---- src/application/models/services_model.php | 3 ++- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/application/libraries/Unit_tests/Unit_tests.php b/src/application/libraries/Unit_tests/Unit_tests.php index 7f5870d9..2f47d5d1 100644 --- a/src/application/libraries/Unit_tests/Unit_tests.php +++ b/src/application/libraries/Unit_tests/Unit_tests.php @@ -33,6 +33,8 @@ class Unit_tests extends CI_Driver_Library { * If a new group of tests is added, it should be also added in * this method, in order to be executed when all the tests need to * be run. + * + * @task In order to run the tests the user must be logged in as admin. */ public function run_all_tests() { $this->run_model_tests(false); diff --git a/src/application/models/customers_model.php b/src/application/models/customers_model.php index c1072141..a6bb0858 100644 --- a/src/application/models/customers_model.php +++ b/src/application/models/customers_model.php @@ -28,8 +28,7 @@ class Customers_Model extends CI_Model { // :: CHECK IF CUSTOMER ALREADY EXIST (FROM EMAIL). if ($this->exists($customer) && !isset($customer['id'])) { // Find the customer id from the database. - $customer['id'] = $this->get_batch( - array('email' => $customer['email']))[0]['id']; + $customer['id'] = $this->find_record_id($customer); } // :: INSERT OR UPDATE CUSTOMER RECORD @@ -260,8 +259,9 @@ class Customers_Model extends CI_Model { . 'exist in the database : ' . $field_name); } - return $this->db->get_where('ea_users', array('id' => $customer_id)) - ->row_array()[$field_name]; + $customer = $this->db->get_where('ea_users', array('id' => $customer_id))->row_array(); + + return $customer[$field_name]; } /** diff --git a/src/application/models/providers_model.php b/src/application/models/providers_model.php index 192703b3..69647d3f 100644 --- a/src/application/models/providers_model.php +++ b/src/application/models/providers_model.php @@ -53,8 +53,9 @@ class Providers_Model extends CI_Model { . 'database : ' . $field_name); } - return $this->db->get_where('ea_users', array('id' => $provider_id)) - ->row_array()[$field_name]; + $provider = $this->db->get_where('ea_users', array('id' => $provider_id))->row_array(); + + return $provider[$field_name]; } /** @@ -146,8 +147,9 @@ class Providers_Model extends CI_Model { * @return string Returs the value of the selected user setting. */ public function get_setting($setting_name, $provider_id) { - return $this->db->get_where('ea_user_settings', array('id_users' => $provider_id)) - ->row_array()[$setting_name]; + $provider_settings = $this->db->get_where('ea_user_settings', + array('id_users' => $provider_id))->row_array(); + return $provider_settings[$setting_name]; } /** diff --git a/src/application/models/services_model.php b/src/application/models/services_model.php index 39728d71..1cf9ab00 100644 --- a/src/application/models/services_model.php +++ b/src/application/models/services_model.php @@ -220,7 +220,8 @@ class Services_Model extends CI_Model { throw new Exception('The given $field_name argument does not exist in the database : ' . $field_name); } - return $this->db->get_where('ea_services', array('id' => $service_id))->row_array()[$field_name]; + $setting = $this->db->get_where('ea_services', array('id' => $service_id))->row_array(); + return $setting[$field_name]; } /**