diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 0d1a7c0b..cafdecd3 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -952,8 +952,10 @@ class Sales_PD_Controller extends REST_Controller { } //make inactive previous records + $check=$this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' =>$sales_pd_id,'section_id' => $section_id,'isactive' => 1 ),SALESPD_SECTION_DATA); + if(count($check)>0){ $this->Sales_PD_Model->updateRecords(array('isactive' => 0),SALESPD_SECTION_DATA,array('sales_pd_id' =>$sales_pd_id,'section_id' => $section_id )); - + } //insert new record $fields = array('sales_pd_id' => $sales_pd_id, 'section_id' => $section_id, 'status' =>$status ,'section_data' => $section_data,'createdby' => $fk_createdby); $is_entry_created = $this->Sales_PD_Model->saveRecords($fields,SALESPD_SECTION_DATA);