From 9c3c7a9c773d5cf0e073ad7b7bb2553ea704faed Mon Sep 17 00:00:00 2001 From: FrancescoUK Date: Sat, 18 Aug 2018 12:35:29 +0100 Subject: [PATCH] Update Employee.php --- application/models/Employee.php | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/application/models/Employee.php b/application/models/Employee.php index 32a11f3d6..aa4dd9f07 100644 --- a/application/models/Employee.php +++ b/application/models/Employee.php @@ -364,7 +364,7 @@ class Employee extends Person /* Determines whether the employee has access to at least one submodule - */ + */ public function has_module_grant($permission_id, $person_id) { $this->db->from('grants'); @@ -431,8 +431,8 @@ class Employee extends Person } /* - Gets employee permission grants - */ + Gets employee permission grants + */ public function get_employee_grants($person_id) { $this->db->from('grants'); @@ -441,7 +441,6 @@ class Employee extends Person return $this->db->get()->result_array(); } - /* Attempts to login employee and set session. Returns boolean based on outcome. */ @@ -471,20 +470,19 @@ class Employee extends Person { $success = FALSE; - if (ENVIRONMENT == 'testing') { - return $success; + if(ENVIRONMENT != 'testing') + { + //Run these queries as a transaction, we want to make sure we do all or nothing + $this->db->trans_start(); + + $this->db->where('person_id', $employee_id); + $success = $this->db->update('employees', $employee_data); + + $this->db->trans_complete(); + + $success &= $this->db->trans_status(); } - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); - - $this->db->where('person_id', $employee_id); - $success = $this->db->update('employees', $employee_data); - - $this->db->trans_complete(); - - $success &= $this->db->trans_status(); - return $success; } }