From 887f8e666c145f01186958218bb3370d8a2fdce3 Mon Sep 17 00:00:00 2001
From: VE10-Sanjeev
Date: Fri, 6 Jan 2023 13:40:51 +0530
Subject: [PATCH 1/6] CET app Credit PD fIXES: ps
---
.../controllers/SMC_Credit_PD_Controller.php | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php
index 47d17a54..4388a067 100644
--- a/api/application/controllers/SMC_Credit_PD_Controller.php
+++ b/api/application/controllers/SMC_Credit_PD_Controller.php
@@ -270,6 +270,7 @@ class SMC_Credit_PD_Controller extends REST_Controller {
function uploadCreditPDDataToCETApp_get()
{
log_message('ERROR', '#### upload SMC Credit PDData To CETApp Called');
+
$smc_credit_pd = $this->uri->segment(2);
$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');
@@ -283,12 +284,13 @@ class SMC_Credit_PD_Controller extends REST_Controller {
foreach ($pd_section_data as $key => $value) {
if (isset($value['json']) && $value['json'] != '') {
$filter_form_id[$key] = $value['fk_form_id'];
- $CETAPP_creditPD_data[$value['form_name']] = $value['json'];
+
+ $CETAPP_creditPD_data[$value['form_name']] = json_decode($value['json'],true);
} else {
if (in_array($value['fk_form_id'], $forms_data_to_be_get_direct_from_excel_sheet)) {
$data_from_excel = $this->loadDataFromExcelBusiProcess($mater_details, $value['fk_form_id']);
$filter_form_id[$key] = $value['fk_form_id'];
- $CETAPP_creditPD_data[$value['form_name']] = $data_from_excel;
+ $CETAPP_creditPD_data[$value['form_name']] = json_decode($data_from_excel,true);
}
}
}
@@ -356,7 +358,18 @@ class SMC_Credit_PD_Controller extends REST_Controller {
}
}
cet_creditpd::pushwithcetcreditpdapi($common_fields, $CETAPP_creditPD_data);
-
+ // 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 = "
";
+ // echo $message;
+ // }die();
+
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
$data['msg'] = 'Data Shared Successfully';
From 413dee02559ad350a9be10f992099edd90643f39 Mon Sep 17 00:00:00 2001
From: VE10-Sanjeev
Date: Fri, 6 Jan 2023 17:12:18 +0530
Subject: [PATCH 2/6] CETapp credit pd FIxes : PS
---
.../controllers/SMC_Credit_PD_Controller.php | 39 +++++++++++++------
.../helpers/cet_creditpd_helper.php | 10 +++++
2 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php
index 4388a067..60a8cb3c 100644
--- a/api/application/controllers/SMC_Credit_PD_Controller.php
+++ b/api/application/controllers/SMC_Credit_PD_Controller.php
@@ -270,27 +270,46 @@ class SMC_Credit_PD_Controller extends REST_Controller {
function uploadCreditPDDataToCETApp_get()
{
log_message('ERROR', '#### upload SMC Credit PDData To CETApp Called');
-
+ $this->load->helper('smc_creditpd');
$smc_credit_pd = $this->uri->segment(2);
$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', '#### Total Credit PD is ' . count($pd_section_data));
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']);
- foreach ($pd_section_data as $key => $value) {
+ // foreach ($pd_section_data as $key => $value) {
+ // if (isset($value['json']) && $value['json'] != '') {
+ // $filter_form_id[$key] = $value['fk_form_id'];
+ // $CETAPP_creditPD_data[$value['form_name']] = json_decode($value['json'],true);
+ // } else {
+ // if (in_array($value['fk_form_id'], $forms_data_to_be_get_direct_from_excel_sheet)) {
+ // $data_from_excel = $this->loadDataFromExcelBusiProcess($mater_details, $value['fk_form_id']);
+ // $filter_form_id[$key] = $value['fk_form_id'];
+ // $CETAPP_creditPD_data[$value['form_name']] = json_decode($data_from_excel,true);
+ // }
+ // }
+ // }
+ foreach ($pd_section_data as $key => $value)
+ {
if (isset($value['json']) && $value['json'] != '') {
+ $value['json'] = smc_creditpd::getSMCCreditPDReportContent($value,$smc_credit_pd,$companylist);
$filter_form_id[$key] = $value['fk_form_id'];
-
- $CETAPP_creditPD_data[$value['form_name']] = json_decode($value['json'],true);
- } else {
- if (in_array($value['fk_form_id'], $forms_data_to_be_get_direct_from_excel_sheet)) {
+ // $view_data['pd_section_data'][$value['fk_form_id']] = $value['json'];
+ $CETAPP_creditPD_data[$value['form_name']] = $value['json'];
+ }
+ else
+ {
+ if (in_array($value['fk_form_id'], $forms_data_to_be_get_direct_from_excel_sheet)) {
$data_from_excel = $this->loadDataFromExcelBusiProcess($mater_details, $value['fk_form_id']);
- $filter_form_id[$key] = $value['fk_form_id'];
+ //print_r($data_from_excel);die();
+ // $view_data['pd_section_data'][$value['fk_form_id']] = $data_from_excel;
$CETAPP_creditPD_data[$value['form_name']] = json_decode($data_from_excel,true);
+ $filter_form_id[$key] = $value['fk_form_id'];
}
}
}
@@ -342,9 +361,7 @@ class SMC_Credit_PD_Controller extends REST_Controller {
$CETAPP_creditPD_data['Key Stakeholders in Business']['key_stakeholders'] = $temp_arr;
}
} // ### LFMP key_stakeholders ends
- if ((in_array(1, $filter_form_id)) && (in_array(21, $filter_form_id)))
- // && (in_array(4,$filter_form_id)))
- {
+ // print_r($filter_form_id);die();
$officer_id = isset($mater_details[0]['fk_updatedby']) ? $mater_details[0]['fk_updatedby'] : '';
$visit_date = isset($mater_details[0]['pd_visit_date']) ? $mater_details[0]['pd_visit_date'] : '';
if (!empty($officer_id)) {
@@ -356,7 +373,7 @@ class SMC_Credit_PD_Controller extends REST_Controller {
}
}
}
- }
+
cet_creditpd::pushwithcetcreditpdapi($common_fields, $CETAPP_creditPD_data);
// 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";
diff --git a/api/application/helpers/cet_creditpd_helper.php b/api/application/helpers/cet_creditpd_helper.php
index 9e5cc907..ff8d5d90 100644
--- a/api/application/helpers/cet_creditpd_helper.php
+++ b/api/application/helpers/cet_creditpd_helper.php
@@ -26,6 +26,16 @@ class CET_CREDITPD
$headers = array('Content-Type: application/json');
$ch = curl_init();
$output_data = json_encode( $fields );
+ // log_message('ERROR','#### output_data '.$output_data);
+ // $path = $path ."/tmp/".$fields['pdid'].".json";
+ // $fp = fopen($path, 'w');
+ // fwrite($fp, $output_data);
+ // if(file_put_contents($path, $output_data))
+ // {
+ // $message = "