CET credit PD 2 : ps

This commit is contained in:
VE10-Sanjeev 2022-05-16 18:29:06 +05:30
parent 14ce6cc8ca
commit aae1a6d2d2
2 changed files with 30 additions and 8 deletions

View File

@ -1570,6 +1570,21 @@ public function filterSalesPDList_post() {
// print_r($view_data['pd_section_data'][15]);die();
$view_data['smc_images'] = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $records['pd_id'],'isactive' => 1,'img_name!=' => 'satellite'),SMC_CREDIT_PD_DOCS);
$view_data['satellite'] = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $records['pd_id'],'isactive' => 1,'img_name=' => 'satellite'),SMC_CREDIT_PD_DOCS);
if(count($view_data['smc_images']>0)){
for ($i = 0; $i < count($view_data['smc_images']); $i++){
$img_fields = $common_fields;
$img_fields['img_name'] = $view_data['smc_images'][$i]['img_name'];
$img_split = explode( ',', $view_data['smc_images'][$i]['img']);
$img_fields['img'] = $img_split[1];
// $img_fields[0]['img'] = $view_data['section9'][$i]['img'];
cet_creditpd::pushwithcetphotographapi($img_fields,$i);
}}
if(!empty($view_data['satellite'])){
$stt_fields = $common_fields;
$stt_fields['img_name'] = $view_data['satellite'][0]['img_name'];
$stt_fields['img'] = $view_data['satellite'][0]['img'];
cet_creditpd::pushwithcetphotographapi($stt_fields,0);
}
// print_r($view_data['smc_images']);die();
//print_r(count($view_data['smc_images']));die();

View File

@ -8,16 +8,23 @@ class CET_CREDITPD
public static function pushwithcetcreditpdapi($fields,$data)
{
log_message('ERROR','#### Inside cet creditpd helper fns');
// if(array_key_exists("Photograph's",$data)){
// unlink($data["Photograph's"]);
// }
if (array_key_exists("Photograph's", $data)) {
unset($data["Photograph's"]);
}
$key_check = array("Supplier details","Clients details","Stock details", "Neighbourhood Details", "Existing Loan Obligations","Business Assets");
for($i=0;$i<count($key_check);$i++){
if(array_key_exists($key_check[$i],$data)){
if(array_key_exists('display_data', $data[$key_check[$i]]))
unset($data[$key_check[$i]]['display_data']); }
}
$fields['data'] = $data;
$pdid = $fields['pdid'];
$headers = array('Content-Type: application/json');
$ch = curl_init();
$output_data = json_encode( $fields );
log_message('ERROR',"PullcreditPDData api Request Format : ".$output_data);
curl_setopt( $ch,CURLOPT_URL, "https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdData");
// log_message('ERROR',"PullcreditPDData api Request Format : ".$output_data);
// curl_setopt( $ch,CURLOPT_URL, "https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdData");
curl_setopt( $ch,CURLOPT_URL, CET_CREDIT_PD_INTEGRATION_URL);
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
@ -25,7 +32,7 @@ class CET_CREDITPD
curl_setopt( $ch,CURLOPT_POSTFIELDS, $output_data);
$result = curl_exec($ch );
$response = json_decode($result);
log_message('ERROR',"CET APP CREDIT PDID (".$pdid.") curl result : ".json_encode($result)." response :".json_encode($response));
log_message('ERROR',"CET APP CREDIT PDID (".$pdid.") response :".json_encode($response));
curl_close( $ch );
}
@ -33,7 +40,7 @@ class CET_CREDITPD
// multipart/form-data;
public static function pushwithcetphotographapi($fields,$index)
{
// log_message('ERROR','#### pushwithcetphotographapi Helper FNS');
log_message('ERROR','#### pushwithcetphotographapi Helper FNS');
$CI =&get_instance();
$img = $fields['img'];
$pdid = $fields['pdid'];
@ -56,7 +63,7 @@ class CET_CREDITPD
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$result=curl_exec($ch);
$response = json_decode($result);
log_message('ERROR',"###CET APP PDID (".$pdid.") ".$log_msg."response :".json_encode($response));
log_message('ERROR',"###CET APP CREDIT PDID (".$pdid.") ".$log_msg."response :".json_encode($response));
curl_close( $ch );
unlink($file);
// unlink($file_name_with_full_path);