Photograph Details : ps
This commit is contained in:
parent
7ed86279f0
commit
ea55e0de37
@ -243,7 +243,8 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
||||
$this->SMC_Credit_PD_Model->updateRecords(array('is_pdf' => 1, 'is_edited' => 0),SMC_CREDIT_PD,array('smc_credit_pd' => $smc_credit_pd));
|
||||
### Automation CET Data Push Credit PD
|
||||
sleep(10);
|
||||
$result = $this->dataSynchronization($smc_credit_pd);
|
||||
$result = $this->dataSynchronization($smc_credit_pd,0);
|
||||
$data['CETresponse'] = $result;
|
||||
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");
|
||||
@ -311,10 +312,10 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
||||
$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)){
|
||||
$response = $this->dataSynchronization($smc_credit_pd);
|
||||
$response = $this->dataSynchronization($smc_credit_pd,1);
|
||||
$data['CETresponse'] = $response;
|
||||
if($response){
|
||||
log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') status '.$response." Data Transfered");
|
||||
log_message('ERROR', '#### Credit PD ('.$smc_credit_pd.') status '.json_encode($response)." 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));
|
||||
$data['dataStatus'] = true;
|
||||
@ -371,10 +372,10 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
||||
if(!empty($details)){
|
||||
$flag = 0;$ids=array();
|
||||
for ($i = 0; $i < count($details); $i++) {
|
||||
log_message('ERROR', "smcCreditPD inx = $i ".$smc_credit_pd);
|
||||
$smc_credit_pd = $details[$i]['pd_id'];
|
||||
log_message('ERROR', "smcCreditPD inx = $i ".$smc_credit_pd);
|
||||
// echo $smc_credit_pd;
|
||||
$result = $this->dataSynchronization($smc_credit_pd);
|
||||
$result = $this->dataSynchronization($smc_credit_pd,1);
|
||||
$data['CETresponse'][$smc_credit_pd] = $result;
|
||||
sleep(2);
|
||||
// $flag = $result == true ? $flag+1 : $flag;
|
||||
@ -414,7 +415,7 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
||||
}
|
||||
|
||||
}
|
||||
function dataSynchronization($smc_credit_pd)
|
||||
function dataSynchronization($smc_credit_pd,$dummy_flag)
|
||||
{
|
||||
$this->load->helper('smc_creditpd');
|
||||
$mater_details = $this->PD_Model->getPDMasterDetails($smc_credit_pd);
|
||||
@ -505,48 +506,52 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
$photograph_data = $this->SMC_Credit_PD_Model->selectCustomRecords(array('img_name','IF(img_name="satellite","satellite.png",rand_name) AS img'),array('fk_smc_credit_pd_id' => $smc_credit_pd,'isactive' => 1),SMC_CREDIT_PD_DOCS);
|
||||
if(count($photograph_data)>0){
|
||||
$CETAPP_creditPD_data['Photograph Details']['photo']=$photograph_data;
|
||||
}
|
||||
if($dummy_flag == 0){
|
||||
$photograph_data = $this->SMC_Credit_PD_Model->selectCustomRecords(array('img_name','IF(img_name="satellite","satellite.png",rand_name) AS img'),array('fk_smc_credit_pd_id' => $smc_credit_pd,'isactive' => 1),SMC_CREDIT_PD_DOCS);
|
||||
if(count($photograph_data)>0){
|
||||
$CETAPP_creditPD_data['Photograph Details']['photo']=$photograph_data;
|
||||
}
|
||||
}
|
||||
|
||||
$result = cet_creditpd::pushwithcetcreditpdapi($common_fields, $CETAPP_creditPD_data);
|
||||
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');
|
||||
$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');
|
||||
$stt_fields = $common_fields;
|
||||
$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";
|
||||
// $json = json_decode($view_data['pd_section_data'],true);
|
||||
// $fp = fopen($path, 'w');
|
||||
// fwrite($fp, $jsonString);
|
||||
// fclose($fp);
|
||||
// if(file_put_contents($path, $output_data))
|
||||
// {
|
||||
// $message = "<label class='text-success'>File createed and data added Success fully</p>";
|
||||
// echo $message;
|
||||
// }die();
|
||||
$result->imageStatus = $j.'/'.$totalimages;
|
||||
return $result;
|
||||
if(isset($result->status) && $result->status == 200){
|
||||
// if($dummy_flag == 1){
|
||||
// $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');
|
||||
// $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');
|
||||
// $stt_fields = $common_fields;
|
||||
// $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";
|
||||
// // $json = json_decode($view_data['pd_section_data'],true);
|
||||
// // $fp = fopen($path, 'w');
|
||||
// // fwrite($fp, $jsonString);
|
||||
// // fclose($fp);
|
||||
// // if(file_put_contents($path, $output_data))
|
||||
// // {
|
||||
// // $message = "<label class='text-success'>File createed and data added Success fully</p>";
|
||||
// // echo $message;
|
||||
// // }die();
|
||||
// $result->imageStatus = $j.'/'.$totalimages;
|
||||
// }
|
||||
return $result;
|
||||
}else{
|
||||
log_message('ERROR', '#### Section Details pushed Images Details Not Pushed');
|
||||
$data['dataStatus'] = false;
|
||||
@ -2351,6 +2356,9 @@ public function filterSalesPDList_post() {
|
||||
}
|
||||
$CET_response = cet_creditpd::repushwithcetphotographapi($common_fields);
|
||||
$CET_api_response[$credit_pd_id] = $CET_response;
|
||||
$CET_api_response[$credit_pd_id]->totalImages = count($photograph_data);
|
||||
$a = array();
|
||||
|
||||
|
||||
if(isset($CET_response->status) && $CET_response->status == 200){
|
||||
foreach ($photograph_data as $key => $value){
|
||||
@ -2363,7 +2371,9 @@ public function filterSalesPDList_post() {
|
||||
$gcp_result = $this->googlecloud->uploadFileToGCPBucket($gcpBucketName,$objectName,$source);
|
||||
if($gcp_result == true) log_message('ERROR', '### Credit-PD ('.$credit_pd_id.') '.$value['img_name'].' Image Stored In GCP');
|
||||
else log_message('ERROR', '### Credit-PD ('.$credit_pd_id.') '.$records['img_name'].' Image Not Stored In GCP');
|
||||
if($gcp_result == true && $value['img_name'] != 'satellite') $this->Sales_PD_Model->updateRecords(array('rand_name' => $rand_name),SMC_CREDIT_PD_DOCS,array('doc_id'=>$value['doc_id']));
|
||||
if($gcp_result == true && $value['img_name'] != 'satellite') $this->SMC_Credit_PD_Model->updateRecords(array('rand_name' => $rand_name),SMC_CREDIT_PD_DOCS,array('doc_id'=>$value['doc_id']));
|
||||
array_push($a,$value['img']);
|
||||
$CET_api_response[$credit_pd_id]->images = $a;
|
||||
}
|
||||
log_message('ERROR', '#### Credit PD ('.$credit_pd_id.') - CET response - '.json_encode($CET_response,true));
|
||||
} else log_message('ERROR', '#### Credit PD ('.$credit_pd_id.') - CET response - '.json_encode($CET_response,true));
|
||||
|
||||
@ -1990,6 +1990,8 @@ public function filterSalesPDList_post() {
|
||||
}
|
||||
$CET_response = cet_salespd::repushwithcetphotographapi($section_fields);
|
||||
$CET_api_response[$sales_pd_id] = $CET_response;
|
||||
$CET_api_response[$sales_pd_id]->totalImages = count($photograph_data);
|
||||
$a = array();
|
||||
if(isset($CET_response->status) && $CET_response->status == 200){
|
||||
foreach ($photograph_data as $key => $value){
|
||||
$rand_name = $value['rand_name'];
|
||||
@ -2016,6 +2018,8 @@ public function filterSalesPDList_post() {
|
||||
$update_fields2 = array('rand_name' => $rand_name);
|
||||
$this->Sales_PD_Model->updateRecords($update_fields2,SALEPD_DOCS,array('doc_id'=>$value['doc_id']));
|
||||
}
|
||||
array_push($a,$value['img']);
|
||||
$CET_api_response[$sales_pd_id]->images = $a;
|
||||
}
|
||||
log_message('ERROR', '#### Sales PD ('.$sales_pd_id.') - CET response - '.json_encode($CET_response,true));
|
||||
}
|
||||
|
||||
@ -17,19 +17,18 @@ class smc_creditpd
|
||||
|
||||
case 4://General Business
|
||||
$json = json_decode($section['json'],true);
|
||||
if(isset($json['business_entity'])){
|
||||
for($i=0;$i<count($json['business_entity']);$i++)
|
||||
{
|
||||
$value = $json['business_entity'][$i]['company_name'];
|
||||
$json['business_entity'][$i]['name_of_the_company'] = (isset($value) ? $company[$value] : 'NA');
|
||||
}
|
||||
$json['business_entity'][$i]['name_of_the_company'] = (isset($json['business_entity'][$i]['company_name']) ? $company[$json['business_entity'][$i]['company_name']] : 'NA');
|
||||
}}
|
||||
$return_data = $json;
|
||||
break;
|
||||
case 5://Key Stakeholders
|
||||
$json = json_decode($section['json'],true);
|
||||
for($i=0;$i<count($json['key_stakeholders']);$i++)
|
||||
{
|
||||
$value = $json['key_stakeholders'][$i]['company_name'];
|
||||
$json['key_stakeholders'][$i]['name_of_the_company'] = (isset($value) ? $company[$value] : 'NA');
|
||||
$json['key_stakeholders'][$i]['name_of_the_company'] = (isset($json['key_stakeholders'][$i]['company_name']) ? $company[$json['key_stakeholders'][$i]['company_name']] : 'NA');
|
||||
}
|
||||
$return_data = $json;
|
||||
break;
|
||||
@ -37,8 +36,7 @@ class smc_creditpd
|
||||
$json = json_decode($section['json'],true);
|
||||
for($i=0;$i<count($json['key_products_contribution']);$i++)
|
||||
{
|
||||
$value = $json['key_products_contribution'][$i]['company_name'];
|
||||
$json['key_products_contribution'][$i]['name_of_the_company'] = (isset($value) ? $company[$value] : 'NA');
|
||||
$json['key_products_contribution'][$i]['name_of_the_company'] = (isset($json['key_products_contribution'][$i]['company_name']) ? $company[$json['key_products_contribution'][$i]['company_name']] : 'NA');
|
||||
}
|
||||
$return_data = $json;
|
||||
break;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user