From 8b61a732b536245b2989d4d5cae46be0d9b7ef63 Mon Sep 17 00:00:00 2001 From: velz Date: Sat, 18 Aug 2018 19:38:28 +0530 Subject: [PATCH] ISSUE 1321 FIXED --- .../controllers/HallTickets_Controller.php | 3 ++- .../application/models/Hallticket_model.php | 21 +++++++++++-------- Apollo/assets/js/controllers/schCtrl.js | 7 ++++--- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Apollo/api/application/controllers/HallTickets_Controller.php b/Apollo/api/application/controllers/HallTickets_Controller.php index 1ddb8a7d..099f77ce 100755 --- a/Apollo/api/application/controllers/HallTickets_Controller.php +++ b/Apollo/api/application/controllers/HallTickets_Controller.php @@ -317,7 +317,8 @@ class HallTickets_Controller extends REST_Controller { { $schedulearray = $this->post('updatescheduledetails'); $updateBy = $this->post('createdBy'); - $res = $this->Hallticket_model->scheduleUpdate($schedulearray,$updateBy); + $scheduleID = $this->post('scheduleID'); + $res = $this->Hallticket_model->scheduleUpdate($schedulearray,$updateBy,$scheduleID); if(count($res) > 0 ) { diff --git a/Apollo/api/application/models/Hallticket_model.php b/Apollo/api/application/models/Hallticket_model.php index 9761e348..055c008c 100755 --- a/Apollo/api/application/models/Hallticket_model.php +++ b/Apollo/api/application/models/Hallticket_model.php @@ -791,11 +791,12 @@ class Hallticket_model extends CI_Model else if(strcasecmp($ind['Type'],'sem') == 0 && strcasecmp($ind['SubType'],'year') == 0) { //GET Year Based Semester + if($ind['SemID'] == 1)//First Year { - $i = 1; - // for($i = 1;$i <= 1; $i++) - // { + //$i = 1; + for($i = 1;$i <= 1; $i++) + { $sql = "SELECT T_SemSubMap_Child.SubjectID,T_SubjectMaster.SubjectCode,T_SubjectMaster.SubjectName,T_SemSubMap_Master.SemesterID,T_Batch_Schedule_Child.ScheduleDate,T_Batch_Schedule_Child.FromTime,T_Batch_Schedule_Child.ToTime FROM T_SemSubMap_Child JOIN T_SubjectMaster on T_SemSubMap_Child.SubjectID = T_SubjectMaster.SubjectID JOIN T_SemSubMap_Master on T_SemSubMap_Child.MapID = T_SemSubMap_Master.MapID and T_SemSubMap_Master.UniversityID = ? and T_SemSubMap_Master.CourseID = ? and T_SemSubMap_Master.SemesterID = ? and T_SemSubMap_Master.BranchCode = ? and T_SemSubMap_Child.IsActive = 1 @@ -808,7 +809,7 @@ class Hallticket_model extends CI_Model //array_push($id['FeeDetails'][$key2],$ind); - // } + } array_splice($id['FeeDetails'][$key2],0,6,$in1); } @@ -1248,9 +1249,9 @@ class Hallticket_model extends CI_Model } - public function scheduleUpdate($schedulearray,$up) + public function scheduleUpdate($schedulearray,$up,$scheduleID) { - + //print_r($schedulearray);die(); $MasterID = ""; foreach($schedulearray as $shed) { @@ -1259,7 +1260,7 @@ class Hallticket_model extends CI_Model $sudate = $shed['scheduleDate']; $SubDate = date("Y-m-d", strtotime($sudate)); $MasterID = $shed['SchId']; - //echo $SchId; + $SubjectID = $shed['SubjectID']; $scheduleStart = $shed['scheduleStart']; $scheduleEnd = $shed['scheduleEnd']; @@ -1268,17 +1269,19 @@ class Hallticket_model extends CI_Model { $schedulchildUpdate = array('ScheduleDate'=>$SubDate,'FromTime'=>$scheduleStart,'ToTime'=>$scheduleEnd); - //print_r($schedulchild); + $this->db->trans_start(); $this->db->where('T_Batch_Schedule_Child.SchChildId',$ChildID); $this->db->where('T_Batch_Schedule_Child.SubjectID',$SubjectID); + $this->db->where('T_Batch_Schedule_Child.SchId',$MasterID); $this->db->update('T_Batch_Schedule_Child',$schedulchildUpdate); $this->db->trans_complete(); } else { - $schedulchildInsert = array('SchId'=>$MasterID,'SubjectID'=>$SubjectID,'ScheduleDate'=>$SubDate,'FromTime'=>$scheduleStart,'ToTime'=>$scheduleEnd,'IsActive'=>$isactive); + + $schedulchildInsert = array('SchId'=>$scheduleID,'SubjectID'=>$SubjectID,'ScheduleDate'=>$SubDate,'FromTime'=>$scheduleStart,'ToTime'=>$scheduleEnd,'IsActive'=>$isactive); $this->db->trans_start(); $this->db->insert('T_Batch_Schedule_Child',$schedulchildInsert); $this->db->trans_complete(); diff --git a/Apollo/assets/js/controllers/schCtrl.js b/Apollo/assets/js/controllers/schCtrl.js index fba35298..555194ad 100755 --- a/Apollo/assets/js/controllers/schCtrl.js +++ b/Apollo/assets/js/controllers/schCtrl.js @@ -50,7 +50,7 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP $scope.editId = pid; $scope.courseCode = cid; - var mappingid = schid; + $scope.mappingid = schid; //alert(mappingid+'n'); var getsheduledetails = { method: 'POST', @@ -60,7 +60,7 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP }, data: { //requestedBy: JSON.parse(localStorage.getItem('localObj')).localUserID, - mapid:mappingid, + mapid:$scope.mappingid, subid:subid, branchcode:branchid, @@ -449,7 +449,8 @@ app.controller('schCtrl', ["$scope","$rootScope","toaster", "$filter", "ngTableP updatescheduledetails : $scope.UpdatescheduledDetails, //status: myModel.IsActive, - createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID + createdBy: JSON.parse(localStorage.getItem('localObj')).localUserID, + scheduleID:$scope.mappingid } }; $http(update).then(function (response) {