reverted : ps

This commit is contained in:
VE10-Sanjeev 2023-02-08 16:34:25 +05:30
parent f0a84af025
commit c44f65d5fb

View File

@ -967,27 +967,7 @@ class Sales_PD_Controller extends REST_Controller {
public function saveSalesPDsection_post() public function saveSalesPDsection_post()
{ {
$records = $this->post('records'); $records = $this->post('records');
$is_entry_created = $this->salesPDsection($records);
if($is_entry_created)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $is_entry_created;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'Something went wrong! Try Later';
$this->response($data,REST_Controller::HTTP_OK);
}
}
public function salesPDsection($records)
{
$sales_pd_id = $records['sales_pd_id']; $sales_pd_id = $records['sales_pd_id'];
$section_id = $records['section_id']; $section_id = $records['section_id'];
$fk_createdby = $records['fk_createdby']; $fk_createdby = $records['fk_createdby'];
@ -1098,7 +1078,21 @@ class Sales_PD_Controller extends REST_Controller {
//insert new record //insert new record
$fields = array('sales_pd_id' => $sales_pd_id, 'section_id' => $section_id, 'status' =>$status ,'section_data' => $section_data,'createdby' => $fk_createdby); $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); $is_entry_created = $this->Sales_PD_Model->saveRecords($fields,SALESPD_SECTION_DATA);
return $is_entry_created; if($is_entry_created)
{
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['records'] = $is_entry_created;
$this->response($data,REST_Controller::HTTP_OK);
}
else
{
$data['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
$data['msg'] = 'Something went wrong! Try Later';
$this->response($data,REST_Controller::HTTP_OK);
}
} }
public function getSalesPDSectionData_post() public function getSalesPDSectionData_post()
@ -1703,7 +1697,14 @@ public function filterSalesPDList_post() {
} }
if(!empty($section_data)){ if(!empty($section_data)){
foreach ($section_data as $key => $data_value){ foreach ($section_data as $key => $data_value){
$reponse = $this->salesPDsection($data_value); $check=$this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' =>$id,'section_id' => $data_value['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' =>$id,'section_id' => $data_value['section_id'] ));
}
//insert new record
$section_data_arr = json_encode($data_value);
$fields = array('sales_pd_id' => $id, 'section_id' => $data_value['section_id'], 'status' =>1,'section_data' => $section_data_arr,'createdby' => $createdby);
$reponse = $this->Sales_PD_Model->saveRecords($fields,SALESPD_SECTION_DATA);
$msg = $msg." ( ".$data_value['section_name']." ID : ".$reponse. " )"; $msg = $msg." ( ".$data_value['section_name']." ID : ".$reponse. " )";
} }
} }