From 5d6923e31b54fe07361b3d0e2eb9fdf1af7ac023 Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Tue, 31 Aug 2021 13:20:58 +0530 Subject: [PATCH] Live Fixes : ps --- api/application/controllers/PD_Controller.php | 6 +- .../controllers/SMC_Credit_PD_Controller.php | 76 +++++++++++++------ 2 files changed, 56 insertions(+), 26 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 74de48f3..8df0d01e 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -5007,7 +5007,11 @@ public function getPDFormDetailsJSON_post() $pd_type = $data['pd_master_details'][0]['fk_pd_type'] == 3 ? 3 : 1; $data['lender_disclaimer'] = $this->PD_Model->selectRecords(ENTITYDISCLAIMER,array('fk_entity_id' => ($data['pd_master_details'][0]['sub_entity_id'] ? $data['pd_master_details'][0]['sub_entity_id'] : $data['pd_master_details'][0]['fk_lender_id']),'fk_pd_type' => $pd_type)); //} - + if($data['pd_master_details'][0]['lender_short_name'] == 'CSLFL'){ + $entity_geo_location = $this->PD_Model->getEntityAddr($data['pd_master_details'][0]['fk_lender_id']); + $pd_location = $data['pd_master_details'][0]['start_location']; + $data['distances'] = satellite_image::getdistancematrix($entity_geo_location,$pd_location); + } //$data['lender_disclaimer'] = $this->PD_Model->selectRecords(ENTITYDISCLAIMER,array('fk_entity_id' => $data['pd_master_details'][0]['fk_lender_id'])); $data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid); $data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid); diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 532e9e15..7acc30ad 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -1380,19 +1380,23 @@ public function filterSalesPDList_post() { // $filename = 'C:\Users\Venba\Downloads\Test Demo17_dev.xlsx'; // echo $filename;die(); // $filename = '/home/venba/Downloads/Sample_CET_Upload4.xls'; - if(!file_exists($filename)) - { + if(is_file($filename)){ + if(!file_exists($filename)) + { - //echo 'getting it from s3'; - $bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_data[0]['fk_lender_id']; - $key = 'tmp/'. ($pd_master_data[0]['re_uploaded'] ? $pd_master_data[0]['re_uploaded_file_name'] : $pd_master_data[0]['modified_fname']); - $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'+5 minutes'); - //echo $singed_uri; - $sucess = file_put_contents($filename, file_get_contents($singed_uri)); - - //echo '*'.$sucess; - } - return $cur_section_data = readexceldata::getExcelSectionData($filename,$form_id,$pd_master_data[0]['pd_id']); + //echo 'getting it from s3'; + $bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_data[0]['fk_lender_id']; + $key = 'tmp/'. ($pd_master_data[0]['re_uploaded'] ? $pd_master_data[0]['re_uploaded_file_name'] : $pd_master_data[0]['modified_fname']); + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'+5 minutes'); + //echo $singed_uri; + $sucess = file_put_contents($filename, file_get_contents($singed_uri)); + + //echo '*'.$sucess; + } + return $cur_section_data = readexceldata::getExcelSectionData($filename,$form_id,$pd_master_data[0]['pd_id']); + }else{ + return []; + } } @@ -1728,20 +1732,42 @@ public function filterSalesPDList_post() { { $records = $this->post('records'); $pd_master_data = $this->PD_Model->getPDMasterDetails($records['pd_id'],$records['random_string']); - - $filename = ($pd_master_data[0]['re_uploaded'] ? XLPATH.'/tmp/'.$pd_master_data[0]['re_uploaded_file_name'] : XLPATH.'/tmp/'.$pd_master_data[0]['modified_fname']); + // $filename = ($pd_master_data[0]['re_uploaded'] ? XLPATH.'/tmp/'.$pd_master_data[0]['re_uploaded_file_name'] : XLPATH.'/tmp/'.$pd_master_data[0]['modified_fname']); // $filename = '/home/VenbaLap08/Downloads/Test Demo17_dev.xlsx'; - - if(!file_exists($filename)) - { - $bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_data[0]['fk_lender_id']; - $key = 'tmp/'. ($pd_master_data[0]['re_uploaded'] ? $pd_master_data[0]['re_uploaded_file_name'] : $pd_master_data[0]['modified_fname']); - $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'+5 minutes'); - - $sucess = file_put_contents($filename, file_get_contents($singed_uri)); - } - $cur_section_data = readexceldata::getCompanyListForSMCList($filename,$pd_master_data[0]['pd_id']); - + $filename = '/home/venba/Downloads/Sample_CET_Upload4.xls'; + if(is_file($filename)){ + if(!file_exists($filename)) + { + $bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_data[0]['fk_lender_id']; + $key = 'tmp/'. ($pd_master_data[0]['re_uploaded'] ? $pd_master_data[0]['re_uploaded_file_name'] : $pd_master_data[0]['modified_fname']); + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'+5 minutes'); + + $sucess = file_put_contents($filename, file_get_contents($singed_uri)); + } + $cur_section_data = readexceldata::getCompanyListForSMCList($filename,$pd_master_data[0]['pd_id']); + } + else{ + $arr = $this->PD_Model->getApplicantsDetails($pd_master_data[0]['pd_id']); + $new_arr = array_filter($arr, function ($var) { + return ($var['applicant_type'] != 0); + }); + if(!empty($new_arr)){ + for($i=0;$i