From 3bb2ab7f6608a26829ad0021ec55e06983ee083d Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Wed, 2 May 2018 18:29:32 +0530 Subject: [PATCH] branch access --- Apollo/api/application/models/Employee_model.php | 9 ++++++--- Apollo/api/application/models/Login_model.php | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Apollo/api/application/models/Employee_model.php b/Apollo/api/application/models/Employee_model.php index 9deb1444..8e969308 100755 --- a/Apollo/api/application/models/Employee_model.php +++ b/Apollo/api/application/models/Employee_model.php @@ -276,6 +276,8 @@ class Employee_model extends CI_Model // get branch details based on login user public function get_req_master_branch_detail($reqRoleId, $reqUserID,$branchId) { + + $listcode="R003"; if ($reqRoleId == SUPER_ADMIN) { // res for SuperAdmin $this->db->select('BranchCode, BranchName'); @@ -290,10 +292,11 @@ class Employee_model extends CI_Model $subQuery = "SELECT t1.BranchCode, t1.BranchName FROM T_BranchMaster as t1 LEFT JOIN T_Staff_BranchAccess as t2 ON t2.StaffID = '$staffId' - WHERE t1.BranchCode='$branchId' and t2.ListCode='$listcode' - WHERE t2.BranchCode = t1.BranchCode + WHERE t1.BranchCode='$branchId' and t2.ListCode='$listcode' + AND t1.IsActive = 1 - AND t2.IsActive = 1"; + AND t2.IsActive = 1 + group by t1.BranchCode"; $mBranchDetails = $this->db->query($subQuery); $results['MeasterBranchDetailStatus'] = true; $results['branch_details'] = $mBranchDetails->result(); diff --git a/Apollo/api/application/models/Login_model.php b/Apollo/api/application/models/Login_model.php index f2168169..a5f829fe 100755 --- a/Apollo/api/application/models/Login_model.php +++ b/Apollo/api/application/models/Login_model.php @@ -25,13 +25,17 @@ class Login_model extends CI_Model $this->db->select('t1.MobileNumber, t1.Password,t1.ListCode'); $this->db->from('' . LOGIN . ' as t1'); $this->db->where('t1.MobileNumber', $mobile); + $this->db->or_where('t1.StaffID', $mobile); // $this->db->join('' . STAFF . ' as t2', 't1.StaffID = t2.StaffID', 'LEFT'); $this->db->where('t1.IsActive', 1); //$this->db->where('t2.IsActive', 1); $loginDetails = $this->db->get(LOGIN)->first_row(); - // print_r($loginDetails);exit(); - if ($loginDetails) { - if ($mobile == $loginDetails->MobileNumber) { + $mobileno= $loginDetails->MobileNumber; + + // print_r($loginDetails); + + if($loginDetails) { + if ($mobile == $loginDetails->MobileNumber || $mobile == $loginDetails->StaffID) { if ($password == $loginDetails->Password) { if($loginDetails->ListCode == SUPER_ADMIN){