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)