diff --git a/application/controllers/Employees.php b/application/controllers/Employees.php index 3267f5c13..ab68faff8 100644 --- a/application/controllers/Employees.php +++ b/application/controllers/Employees.php @@ -121,7 +121,7 @@ class Employees extends Persons } //Password has been changed OR first time password set - if($this->input->post('password') != '') + if($this->input->post('password') != '' && ENVIRONMENT != 'testing') { $exploded = explode(":", $this->input->post('language')); $employee_data = array( diff --git a/application/models/Employee.php b/application/models/Employee.php index f5678d666..aa4dd9f07 100644 --- a/application/models/Employee.php +++ b/application/models/Employee.php @@ -119,11 +119,9 @@ class Employee extends Person //Now insert the new grants if($success) { - $count = 0; foreach($grants_data as $grant) { $success = $this->db->insert('grants', array('permission_id' => $grant['permission_id'], 'person_id' => $employee_id, 'menu_group' => $grant['menu_group'])); - $count = $count+ 1; } } } @@ -366,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'); @@ -433,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'); @@ -443,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. */ @@ -473,15 +470,18 @@ class Employee extends Person { $success = FALSE; - //Run these queries as a transaction, we want to make sure we do all or nothing - $this->db->trans_start(); + 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->where('person_id', $employee_id); + $success = $this->db->update('employees', $employee_data); - $this->db->trans_complete(); + $this->db->trans_complete(); - $success &= $this->db->trans_status(); + $success &= $this->db->trans_status(); + } return $success; }