diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 6c20d641..04be13a1 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -2038,16 +2038,26 @@ public function filterSalesPDList_post() { }else { $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes'); } - ### Automation CET Data Push Credit-PD - sleep(10); - $result = $this->dataSynchronization($smc_credit_pd,0); - log_message('ERROR', '#### Automation CET Data Push Credit-PD ('.$smc_credit_pd.') status '.$result->status.' Data Transfered'); - if(isset($result->status) && $result->status == 200){ - log_message('ERROR', '#### Credit-PD ('.$smc_credit_pd.') status '.$result->status." Data Transfered"); - $update_fields2 = array('is_the_data_transfer_cet' => 1); - $this->SMC_Credit_PD_Model->updateRecords($update_fields2,PDTRIGGER,array('pd_id' => $smc_credit_pd)); + $columns = array('PDTRIGGER.pd_id'); + $table = PDTRIGGER . ' as PDTRIGGER'; + $where_arr = array('PDTRIGGER.is_the_data_transfer_cet'=>0,'PDTRIGGER.pd_status' => COMPLETED,'PDTRIGGER.pd_id'=>$smc_credit_pd); + $details = $this->SMC_Credit_PD_Model->selectCustomRecords($columns, $where_arr, $table); + if(!empty($details)){ + ### Automation CET Data Push Credit-PD + sleep(10); + $result = $this->dataSynchronization($smc_credit_pd,0); + log_message('ERROR', '#### Automation CET Data Push Credit-PD ('.$smc_credit_pd.') status '.$result->status.' Data Transfered'); + if(isset($result->status) && $result->status == 200){ + log_message('ERROR', '#### Credit-PD ('.$smc_credit_pd.') status '.$result->status." Data Transfered"); + $update_fields2 = array('is_the_data_transfer_cet' => 1); + $this->SMC_Credit_PD_Model->updateRecords($update_fields2,PDTRIGGER,array('pd_id' => $smc_credit_pd)); + }else{ + log_message('ERROR', '#### Credit-PD ('.$smc_credit_pd.') status '.$result->status); + } }else{ - log_message('ERROR', '#### Credit-PD ('.$smc_credit_pd.') status '.$result->status); + $result = 'CET Data Push ('.$smc_credit_pd.') Credit-PD Already Done'; + log_message('ERROR', '#### '.$result); + } $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK;