diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 1a02a1e9..87062aa6 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4676,9 +4676,12 @@ public function getPDFormDetailsJSON_post() $data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC'); $fields2 = array('*'); - $data['pd_images'][$i] = $this->PD_Model->getSignedPDDocsURL($pdid,$i); + $data['pd_images'][$i] = $this->PD_Model->getSignedPDDocsURL($pdid,$i,null,null,null,'report'); } - + + //Get Common Images + $data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid,null,null,'common',null,'report'); + if($data['pd_master_details'][0]['customer_segment_abbr'] == 'SE-RI') { $temp = $this->load->view('report_templates/JSONTOREPORT_RI',$data,true); @@ -5501,13 +5504,33 @@ public function getPDFormDetailsJSON_post() // //convert as base 64 image. $satellite_image_png_path = $this->external_path.'/pd_reports/'. $pdid .'/satellite.png'; - $type = pathinfo($satellite_image_png_path, PATHINFO_EXTENSION); - $satellite_img_content = file_get_contents($satellite_image_png_path); - $base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($satellite_img_content); + + $pd_details = $this->PD_Model->getPDMasterDetails($pdid); + $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details[0]['fk_lender_id']; + $key = 'pd'.$pdid.'/'.'satellite.png'; + $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$this->external_path.'/pd_reports/'.$pdid.'/satellite.png'); + + $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); + + if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) + { + + $record_data = array('fk_pd_id' => $pdid,'pd_document_title'=>'satellite','pd_document_name'=>'satellite.png','fk_form_id'=>null,'is_show_report' =>$is_show_report,'rental_count_id' => null,'location' => null); + $id = $this->PD_Model->saveRecords($record_data,PDDOCUMENTS); + + $custom_log_info = '###CUSTOM DEBUG SATELLITE IMAGE STORED IN S3 DONE - '. $id; + log_message('ERROR',$custom_log_info); + + + } + + // $type = pathinfo($satellite_image_png_path, PATHINFO_EXTENSION); + // $satellite_img_content = file_get_contents($satellite_image_png_path); + // $base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($satellite_img_content); //generate log $logger->info("Generate Satellite Called in (".ENVIRONMENT.")",array('script' => $satellite_script,'script_output' => $ou)); - return $base64_pdscore_chart_url; + //return $base64_pdscore_chart_url; } @@ -5670,6 +5693,42 @@ public function getPDFormDetailsJSON_post() { mkdir($this->external_path.'/pd_reports/'.$pdid,0761); } + + // for($i = 900;$i <= 1500;$i++) + // { + // //echo $this->external_path.'/pd_reports/'.$i; + // if(file_exists($this->external_path.'/pd_reports/'.$i.'/satellite.png')) + // { + // $custom_log_info = '###CUSTOM DEBUG Image Exists - '. $i; + // log_message('ERROR',$custom_log_info); + + // $pd_details = $this->PD_Model->getPDMasterDetails($i); + // $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_details[0]['fk_lender_id']; + // $key = 'pd'.$pd_id.'/'.'satellite.png'; + // $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$this->external_path.'/pd_reports/'.$i.'/satellite.png'); + // $custom_log_info = '###CUSTOM DEBUG bucket_name - '. $bucketname.' - Key - '.$key; + // log_message('ERROR',$custom_log_info); + // $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); + + // if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) + // { + + // $record_data = array('fk_pd_id' => $pd_id,'pd_document_title'=>'satellite','pd_document_name'=>'satellite.png','fk_form_id'=>null,'is_show_report' =>$is_show_report,'rental_count_id' => null,'location' => null); + + + + // $id = $this->PD_Model->saveRecords($record_data,PDDOCUMENTS); + + // $custom_log_info = '###CUSTOM DEBUG IMAGE S3 DONE - '. $id; + // log_message('ERROR',$custom_log_info); + + // if($id != null || $id != "") { $count++; $pks[] = $id;} + // } + // } + // } + // die(); + //$this->external_path.'/pd_reports/'. $pdid .'/satellite.png'; + //die(); // $pd_string = 'PD accessed-'.$pdid; // MYLOG::logFunction(null,$pdid)->info($pd_string,array('data' => 'Test LOg info')); // MYLOG::logFunction()->warning($pd_string,array('data' => 'Test LOg warn')); @@ -5706,6 +5765,7 @@ public function getPDFormDetailsJSON_post() $data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($pdid); $data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid); //print_r($data['pd_master_details']);die(); + //$data['satellite_path'] = $this->external_path.'/pd_reports/'. $pdid .'/satellite.png'; $data['lender_disclaimer'] = $this->PD_Model->selectRecords(ENTITYDISCLAIMER,array('fk_entity_id' => $data['pd_master_details'][0]['fk_lender_id'])); $data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid); @@ -5772,7 +5832,7 @@ public function getPDFormDetailsJSON_post() // print_r($this->db->last_query()); } //print_r(json_decode($data['pd_processed_forms'][18][0]['processed_json']));die(); - + $data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid,null,null,'common',null,'report'); //print_r($data['pd_images']);die(); //print_r(json_decode($data['pd_processed_forms'][14][0]['processed_json'],true)); //die(); //echo "*******************************************"; diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index bb1bb848..4efa1092 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -288,6 +288,7 @@ class PD_Model extends SPARQ_Model { if($is_common_api != null) { + $where_condition_array['company_id'] = null ; $where_condition_array['fk_form_id'] = null ; } @@ -298,7 +299,7 @@ class PD_Model extends SPARQ_Model { } //print_r($where_condition_array);die(); $document_lists = $this->selectRecords(PDDOCUMENTS,$where_condition_array); - //print_r($this->db->last_query());die(); + if(count($document_lists)) { diff --git a/api/application/views/js/phantomchart.js b/api/application/views/js/phantomchart.js index ed179a4d..75e25e94 100644 --- a/api/application/views/js/phantomchart.js +++ b/api/application/views/js/phantomchart.js @@ -1 +1 @@ -var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = 79;var url = 'http://localhost/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/xampp/htdocs/ssa_external_data/production/pd_reports/23/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);}); \ No newline at end of file +var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = 44.5;var url = 'http://localhost/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/xampp/htdocs/ssa_external_data/production/pd_reports/1/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);}); \ No newline at end of file diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index 2bf8ba84..e6650a4b 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -984,8 +984,21 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo '

GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location']; echo '

'; ?> + $com_value) + { + if($com_value['pd_document_title'] == 'satellite') + { + $satellite_url = $com_value['doc_url'];break; + } + } + } -  Satellite Image of location of Where PD was Done


+ ?> +  Satellite Image of location of Where PD was Done


diff --git a/api/application/views/report_templates/JSONTOREPORT_RI.php b/api/application/views/report_templates/JSONTOREPORT_RI.php index d67ae182..d1601d5b 100644 --- a/api/application/views/report_templates/JSONTOREPORT_RI.php +++ b/api/application/views/report_templates/JSONTOREPORT_RI.php @@ -808,8 +808,23 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo '

GPS Coordinates of location where PD Visit was done : '.$pd_master_details[0]['start_location']; echo '

'; ?> + $com_value) + { + if($com_value['pd_document_title'] == 'satellite') + { + $satellite_url = $com_value['doc_url'];break; + } + } + } -  Satellite Image of location of Where PD was Done


+ ?> + + +  Satellite Image of location of Where PD was Done