From 0b3ac942dcbd39792a5d071a55948dade925c810 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 23 Mar 2018 15:21:14 +0530 Subject: [PATCH] default batch done in model --- Apollo/api/application/models/Batch_model.php | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/Apollo/api/application/models/Batch_model.php b/Apollo/api/application/models/Batch_model.php index 098d03ae..9353c76f 100755 --- a/Apollo/api/application/models/Batch_model.php +++ b/Apollo/api/application/models/Batch_model.php @@ -47,7 +47,7 @@ class Batch_model extends CI_Model { public function getBatch() { - $this->db->select('CU.BatchCode,CU.BatchName,CU.IsActive,CU.BatchDate,US.UniversityID,US.UniversityName'); + $this->db->select('CU.BatchCode,CU.BatchName,CU.IsActive,CU.BatchDate,CU.IsDefault,US.UniversityID,US.UniversityName'); $this->db->from(BATCH.' as CU'); $this->db->join(UNIVERSITY.' as US', 'US.UniversityID = CU.UniversityID'); $this->db->order_by('CU.CreatedOn','DESC'); @@ -106,6 +106,35 @@ class Batch_model extends CI_Model { $universityDetails = $this->db->get(UNIVERSITY); return $universityDetails->result(); } + /* + * update default batch + * created by kms + * */ + + public function updateDefaultBatch($details=null){ + + $setDefaultBatch['IsDefault']=false; + $setDefaultBatch['UpdatedBy'] = $details['UpdatedBy']; + $setDefaultBatch['UpdatedOn'] = $details['UpdatedOn']; + // $this->db->where('BatchCode',$details['BatchCode']); + $this->db->where('UniversityID',$details['UniversityID']); + $upateStatus=$this->db->update(BATCH, $setDefaultBatch); + if($upateStatus){ + $this->db->where('BatchCode',$details['BatchCode']); + $this->db->where('UniversityID',$details['UniversityID']); + $upateAfterStatus=$this->db->update(BATCH, $details); + $result['batchStatus'] = true; + $result['message'] = "Successfully Batch details updated"; + } + + else { + $result['batchStatus'] = false; + $result['message'] = "Something went wrong.please try again"; + + } + return $result; + + }