From 0430a2a51b84460c5b21c6783109b0bb481ba242 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Tue, 27 Sep 2022 17:19:00 +0530 Subject: [PATCH] Office Details live fixes : ps --- api/application/controllers/Sales_PD_Controller.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);