From 53347d197be6bb834da67bd576ae0eb2a4064f1a Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 8 Jan 2018 11:56:47 +0530 Subject: [PATCH] course details changes done --- .../controllers/Course_Controller.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Apollo/api/application/controllers/Course_Controller.php b/Apollo/api/application/controllers/Course_Controller.php index 8bf24541..99170bb3 100755 --- a/Apollo/api/application/controllers/Course_Controller.php +++ b/Apollo/api/application/controllers/Course_Controller.php @@ -49,8 +49,12 @@ class Course_Controller extends REST_Controller { $jsonLateralFeesData=$this->post('lateralFeesAmounts'); $jsonSemFeesData=$this->post('semFeesAmounts'); // push regular,lateral fees into same array - array_push($jsonSemFeesData,$jsonRegularFeesData); - array_push($jsonSemFeesData,$jsonLateralFeesData); + if($jsonRegularFeesData['FeesAmount'] != 0 AND $jsonRegularFeesData['FeesAmount'] != '' AND $jsonRegularFeesData['FeesAmount'] != 'undefined'){ + array_push($jsonSemFeesData,$jsonRegularFeesData); + } + if($jsonLateralFeesData['FeesAmount'] != 0 AND $jsonLateralFeesData['FeesAmount'] != '' AND $jsonLateralFeesData['FeesAmount'] != 'undefined'){ + array_push($jsonSemFeesData,$jsonLateralFeesData); + } $courseDetails = $this->course_model->addCourse($details,$jsonSemFeesData);// Check if the users data store contains users (in case the database result returns NULL) if ($courseDetails) { @@ -117,8 +121,14 @@ class Course_Controller extends REST_Controller { $jsonLateralFeesData=$this->post('lateralFeesAmounts'); $jsonSemFeesData=$this->post('semFeesAmounts'); // push regular,lateral fees into same array - array_push($jsonSemFeesData,$jsonRegularFeesData); - array_push($jsonSemFeesData,$jsonLateralFeesData); + if($jsonRegularFeesData != '' AND $jsonRegularFeesData != null AND $jsonRegularFeesData != 'undefined'){ + array_push($jsonSemFeesData,$jsonRegularFeesData); + + } + if($jsonLateralFeesData != '' AND $jsonLateralFeesData != null AND $jsonLateralFeesData != 'undefined'){ + array_push($jsonSemFeesData,$jsonLateralFeesData); + + } $updateDetails = $this->course_model->updateCourse($details,$jsonSemFeesData);// Check if the users data store contains users (in case the database result returns NULL) if ($updateDetails)