diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 6f0a603b..fe5b017a 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -350,7 +350,7 @@ class Data_Dump_Controller extends REST_Controller ## Default Status section; $pd_details['pd_status'] = TRIGGERED; $pd_details['pd_date_of_initiation'] = date('Y-m-d H-i-s'); - $pd_details['fk_createdby'] = 379; // default user created for admin. + $pd_details['fk_createdby'] = 318; // default user created for admin. ## Template ID Section. $fields = array('fk_template_id'); $where_condition_array = array('fk_lender_id' => $fk_lender_id, 'fk_product_id' => $fk_product_id, 'fk_customer_segment' => $fk_customer_segment, 'isactive' => 1); diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index b07c94a3..5a27bec2 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -289,6 +289,7 @@ class SMC_Credit_PD_Controller extends REST_Controller { $details = $this->SMC_Credit_PD_Model->selectCustomRecords($columns, $where_arr, $table); if(!empty($details)){ $response = $this->dataSynchronization($smc_credit_pd); + $data['CETresponse'] = $response; if($response){ log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') status '.$response." Data Transfered"); $update_fields2 = array('is_the_data_transfer_cet' => 1); @@ -298,6 +299,7 @@ class SMC_Credit_PD_Controller extends REST_Controller { $data['msg'] = 'Data Shared Successfully'; $this->response($data,REST_Controller::HTTP_OK); }else{ + log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') Data Not Transfered'); $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['msg'] = 'Something went wrong! Try Later'; @@ -349,15 +351,20 @@ class SMC_Credit_PD_Controller extends REST_Controller { $smc_credit_pd = $details[$i]['pd_id']; // echo $smc_credit_pd; $result = $this->dataSynchronization($smc_credit_pd); + $data['CETresponse'][$smc_credit_pd] = $result; + sleep(2); // $flag = $result == true ? $flag+1 : $flag; - if($result->status == 200){ - log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') status '.$result->status." Data Transfered"); + if(isset($result->status) && $result->status == 200){ + log_message('ERROR', '#### Smc Credit PD ('.$smc_credit_pd.') status '.$result->status." Data Transfered"); $flag = $flag+1; array_push($ids, $smc_credit_pd); //update here. $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', '#### Smc Credit PD ('.$smc_credit_pd.") Data Not Transfered"); + } } $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; @@ -388,14 +395,15 @@ class SMC_Credit_PD_Controller extends REST_Controller { $this->load->helper('smc_creditpd'); $mater_details = $this->PD_Model->getPDMasterDetails($smc_credit_pd); $pd_section_data = $this->SMC_Credit_PD_Model->getSMCTemplateForPD($smc_credit_pd,$mater_details[0]['fk_product_id'],null,null,'REPORT'); - log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') There are ' . count($pd_section_data).' Forms '); + log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') '); if (!empty($pd_section_data)) { $forms_data_to_be_get_direct_from_excel_sheet = array(3, 9, 10, 15); $companylist = $this->getCompanyName($pd_section_data[0]); if (count($pd_section_data) > 0) { $common_fields = array('pdid'=>$mater_details[0]['pd_id'], 'product'=>$mater_details[0]['product_abbr'], - 'caseno'=>$mater_details[0]['pd_sno']); + 'caseno'=>$mater_details[0]['pd_sno'], + 'completed_date'=>$mater_details[0]['completed_on']); // foreach ($pd_section_data as $key => $value) { // if (isset($value['json']) && $value['json'] != '') { // $filter_form_id[$key] = $value['fk_form_id']; @@ -476,14 +484,17 @@ class SMC_Credit_PD_Controller extends REST_Controller { if($result == true){ $photograph_data = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $smc_credit_pd,'isactive' => 1,'img_name!=' => 'satellite'),SMC_CREDIT_PD_DOCS); $satellite_image = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $smc_credit_pd,'isactive' => 1,'img_name=' => 'satellite'),SMC_CREDIT_PD_DOCS); - log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') There are ' . count($photograph_data).' Images'); + // log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') There are ' . count($photograph_data).' Images'); + $totalimages = count($satellite_image)+count($photograph_data); if(count($photograph_data)>0){ + $j=0; for ($i = 0; $i < count($photograph_data); $i++){ $img_fields = $common_fields; $img_fields['img_name'] = $photograph_data[$i]['img_name']; $img_split = explode( ',', $photograph_data[$i]['img']); $img_fields['img'] = $img_split[1]; $resultimages = cet_creditpd::pushwithcetphotographapi($img_fields,$i); + if(isset($resultimages->status) && ($resultimages->status == 200)){$j++;}else{ log_message('ERROR', '#### SMC Credit PD ('.$smc_credit_pd.') ' . $photograph_data[$i]['img_name'].' Image Not Transfer Check it'); } }} if(!empty($satellite_image)){ log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') satellite Available'); @@ -491,6 +502,7 @@ class SMC_Credit_PD_Controller extends REST_Controller { $stt_fields['img_name'] = $satellite_image[0]['img_name']; $stt_fields['img'] = $satellite_image[0]['img']; $resultstatellite = cet_creditpd::pushwithcetphotographapi($stt_fields,0); + if(isset($resultstatellite->status) && ($resultstatellite->status == 200)){$j++;}else{ log_message('ERROR', '#### SMC Credit PD ('.$smc_credit_pd.') ' . $satellite_image[0]['img_name'].' Images Not Transfer Check it'); } } // print_r($CETAPP_creditPD_data); // $path = $this->external_path ."/pd_reports/" . $mater_details[0]['pd_id'] . "/new-file-5-".$mater_details[0]['pd_id'].".json"; @@ -503,7 +515,7 @@ class SMC_Credit_PD_Controller extends REST_Controller { // $message = "