diff --git a/Apollo/api/application/models/SeesionMaster_model.php b/Apollo/api/application/models/SeesionMaster_model.php index 5b83bc62..2de03cc8 100755 --- a/Apollo/api/application/models/SeesionMaster_model.php +++ b/Apollo/api/application/models/SeesionMaster_model.php @@ -20,6 +20,7 @@ class SeesionMaster_model extends CI_Model { $this->db->select('SessionName'); $this->db->where('SessionName', $arrayDetails['SessionName']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); if($this->db->get(SESSIONMASTER)->first_row()){ $result['sessionStatus'] = false; $result['message'] ="This sessions is already exist."; @@ -30,6 +31,7 @@ class SeesionMaster_model extends CI_Model { $insertMaster['CreatedBy']=$arrayDetails['CreatedBy']; $insertMaster['IsActive']=$arrayDetails['IsActive']; $insertMaster['CreatedOn']=$arrayDetails['CreatedOn']; + $insertMaster['BranchCode']=$arrayDetails['BranchCode']; $this->db->insert(SESSIONMASTER, $insertMaster); @@ -66,13 +68,15 @@ class SeesionMaster_model extends CI_Model { * created by kms * */ - public function getSession() + public function getSession($requestedBy=null,$branchCode=null) { $this->db->select('SM.SessionID,SM.SessionDate,SM.SessionName,GROUP_CONCAT(SD.UniversityID) as UniversityID,GROUP_CONCAT(SM.SessionID) as GrpID,SM.IsActive,GROUP_CONCAT(US.UniversityName) as UniversityName'); $this->db->from(SESSIONMASTER.' as SM'); $this->db->join(SESSIONDETAILS.' as SD', 'SM.SessionID = SD.SessionID'); $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = SD.UniversityID'); $this->db->where('SD.IsActive','1'); + $this->db->where('SM.BranchCode',$branchCode); + $this->db->where('US.BranchCode',$branchCode); $this->db->order_by('SM.SessionID','DESC'); $this->db->group_by('SM.SessionID','DESC'); $sessionDetails = $this->db->get(); @@ -87,7 +91,7 @@ class SeesionMaster_model extends CI_Model { } // load batch model for get university details $this->load->model('Batch_model', 'batch'); - $result['universityDetails'] = $this->batch->getUniversityDetails(); + $result['universityDetails'] = $this->batch->getUniversityDetails($requestedBy,$branchCode); return $result; @@ -102,6 +106,7 @@ class SeesionMaster_model extends CI_Model { { $this->db->select('SessionName'); $this->db->where('SessionName', $arrayDetails['SessionName']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); $this->db->where('SessionID !=', $arrayDetails['SessionID']); if($this->db->get(SESSIONMASTER)->first_row()){ $result['sessionStatus'] = false; @@ -109,6 +114,7 @@ class SeesionMaster_model extends CI_Model { } else{ $this->db->where('SessionID', $arrayDetails['SessionID']); + $this->db->where('BranchCode', $arrayDetails['BranchCode']); $upateStatus=$this->db->update(SESSIONMASTER, $arrayDetails); if($upateStatus){ @@ -174,11 +180,12 @@ class SeesionMaster_model extends CI_Model { * Get university details * created by kms * */ - public function getUniversityDetails()//doubt + public function getUniversityDetails($requestedBy,$branchCode) { $this->db->select('UniversityID,UniversityName'); $this->db->order_by('UniversityID','ASC'); $this->db->where('IsActive','1'); + $this->db->where('BranchCode',$branchCode); // $this->db->where_not_in('ID', $id); $universityDetails = $this->db->get(UNIVERSITY); return $universityDetails->result();