LINKS ATTACHEMENTS IN REPORT CANCELPD REMARK
This commit is contained in:
parent
838343e68c
commit
f8fd727a68
@ -1048,7 +1048,7 @@ class PD_Controller extends REST_Controller {
|
||||
|
||||
if(isset($pd_details['pd_status']) && ($pd_details['pd_status'] == CANCELLED ))
|
||||
{
|
||||
$pd_cancel_remark = $pd_details['remark'];
|
||||
$pd_details['cancel_pd_remark'] = $pd_details['remark'];
|
||||
unset($pd_details['remark']);
|
||||
}
|
||||
$where_condition_array = array('pd_id' => $pd_details['pd_id'],'random_string' => $pd_details['random_string']);
|
||||
@ -4710,6 +4710,8 @@ public function getPDFormDetailsJSON_post()
|
||||
$is_generate = isset($records['is_generate']) ? 1 : 0;
|
||||
$random_string = $records['random_string'];
|
||||
$is_qc_edited = 0;
|
||||
$this->load->helper('report_attachments');
|
||||
|
||||
|
||||
if(!file_exists($this->external_path.'/pd_reports/'.$pdid))
|
||||
{
|
||||
@ -4717,6 +4719,38 @@ public function getPDFormDetailsJSON_post()
|
||||
}
|
||||
|
||||
$pd_master_details = $this->PD_Model->getPDMasterDetails($pdid,$random_string);
|
||||
// print_r($pd_master_details);
|
||||
// var_dump($pd_master_details[0]['is_img_pdf_created']);
|
||||
// check img zip link, img pdf link and vide links
|
||||
if(!$pd_master_details[0]['is_img_pdf_created'])
|
||||
{
|
||||
$data['msg'] = isset($data['msg']) ? ($data['msg'] . 'Image PDF'.', ') : 'Image PDF, ';
|
||||
}
|
||||
|
||||
if(!$pd_master_details[0]['is_zip_created'])
|
||||
{
|
||||
$data['msg'] = isset($data['msg']) ? ($data['msg'] . 'Image ZIP'.', ') : 'Image ZIP, ';
|
||||
}
|
||||
|
||||
if($pd_master_details[0]['fk_pd_type'] == 2)
|
||||
{
|
||||
$video_status = $this->PD_Model->selectCustomRecords(array('count(*) as count'),array('isactive' => 1,'twilo_status' => 'enqueued','fk_pd_id' => $pdid),VIDEO_ROOM_INFO);
|
||||
if($video_status[0]['count'] != 0)
|
||||
{
|
||||
$data['msg'] = isset($data['msg']) ? ($data['msg'] . 'Some videos'.', ') : 'Some videos, ';
|
||||
}
|
||||
}
|
||||
// print_r($data);
|
||||
// echo strrpos($data['msg'], ',');
|
||||
if(isset($data['msg']) && $data['msg'] != '')
|
||||
{
|
||||
$data['msg'] = substr_replace($data['msg'],'',-2);
|
||||
if(strrpos($data['msg'], ',')) { $data['msg'] = substr_replace($data['msg'],' and ', strrpos($data['msg'], ','),2); }
|
||||
$data['msg'] = ('The following item(s) yet to be complete :- ' . $data['msg']);
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
|
||||
$main_applicant_name = $pd_master_details[0]['main_applicant'];
|
||||
@ -4756,15 +4790,23 @@ public function getPDFormDetailsJSON_post()
|
||||
|
||||
//End Of Replace Span tags from HTML File
|
||||
|
||||
//Get attachment links and embed here...
|
||||
//get img pdf
|
||||
$report_attachments = (new report_attachments)->getReportAttchments($pd_master_details[0]['pd_id'],$pd_master_details[0]['random_string']);
|
||||
$temp = substr_replace($temp,$report_attachments,strpos($temp,'</body>'),0);
|
||||
//End Get attachment links
|
||||
|
||||
|
||||
|
||||
// echo $temp;
|
||||
// die();
|
||||
//PDF Gen using DOM PDF
|
||||
$pdf_doc = $this->pdfgenerator->generate($temp, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
|
||||
//End of PDF Gen using DOM PDF
|
||||
$output_file2 = $this->external_path."/pd_reports/". $pdid ."/sample.pdf";
|
||||
$bytes = file_put_contents($output_file2, $pdf_doc);
|
||||
|
||||
// echo $output_file2;
|
||||
// die();
|
||||
if(file_put_contents($output_file2, $pdf_doc))
|
||||
{
|
||||
|
||||
@ -5043,84 +5085,14 @@ public function getPDFormDetailsJSON_post()
|
||||
$records = $this->post('records');
|
||||
$pdid = $records['pd_id'];
|
||||
$random_string = $records['random_string'];
|
||||
$pd_master_details = $this->PD_Model->getPDMasterDetails($pdid,$random_string);
|
||||
|
||||
if(!file_exists($this->external_path.'/pd_reports/'.$pdid))
|
||||
{
|
||||
mkdir($this->external_path.'/pd_reports/'.$pdid,0777);
|
||||
}
|
||||
|
||||
|
||||
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
|
||||
$main_applicant_name = $pd_master_details[0]['main_applicant'];
|
||||
|
||||
//get zip url from s3 if any
|
||||
|
||||
$key = 'pd'.$pdid.'/'.$main_applicant_name.'_'.$pdid.'_'.'pd_images.zip';
|
||||
|
||||
//$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
|
||||
if($pd_master_details[0]['is_zip_created'])
|
||||
{
|
||||
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
|
||||
|
||||
$response_data['dataStatus'] = true;
|
||||
$response_data['status'] = REST_Controller::HTTP_OK;
|
||||
$response_data['records'] = $singed_uri;
|
||||
$this->response($response_data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
$all_pd_images = $this->PD_Model->getSignedPDDocsURL($pdid,null,null,null,null,'report');
|
||||
|
||||
$all_form_names = $this->PD_Model->selectCustomRecords(array('pd_form_id','pd_form_name'),array(),PDFORMS);
|
||||
$form_name = array();
|
||||
foreach($all_form_names as $form)
|
||||
{
|
||||
$form_name[ $form['pd_form_id'] ] = $form['pd_form_name'];
|
||||
}
|
||||
//print_r($form_name);die();
|
||||
//Generate zip file
|
||||
|
||||
$this->load->library('zip');
|
||||
|
||||
$this->zip->add_dir('pdimages');
|
||||
|
||||
foreach($all_pd_images as $image)
|
||||
{
|
||||
$temp_dir_name = isset($form_name[ $image['fk_form_id'] ]) ? $form_name[ $image['fk_form_id'] ] : 'Common';
|
||||
//replace colon with hyphen in doc name
|
||||
$doc_name = str_replace(':', '-', $image['pd_document_name']);
|
||||
$this->zip->add_data('pdimages/'.$doc_name,file_get_contents($image['doc_url']));
|
||||
}
|
||||
|
||||
$temp_path = $main_applicant_name.'_'.$pdid.'_'.'pd_images.zip';
|
||||
|
||||
$this->zip->archive($this->external_path.'/pd_reports/'.$pdid.'/'.$temp_path);
|
||||
|
||||
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>($this->external_path.'/pd_reports/'.$pdid.'/'.$temp_path));
|
||||
|
||||
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
|
||||
//print_r($s3result);
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
{
|
||||
//$result_array[0]['content']
|
||||
$where_condition_array = array("pd_id" => $pdid);
|
||||
$temp_array['is_zip_created'] = 1;
|
||||
$id = $this->PD_Model->updateRecords($temp_array,PDTRIGGER,$where_condition_array);
|
||||
- unlink($this->external_path.'/pd_reports/'.$pdid.'/'.$temp_path);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
|
||||
$this->load->helper('photo_zip_creator');
|
||||
$res_data = (new photo_zip_creator)->covertImgs2ZIP($pdid,$random_string);
|
||||
|
||||
$response_data['dataStatus'] = true;
|
||||
$response_data['status'] = REST_Controller::HTTP_OK;
|
||||
$response_data['records'] = $singed_uri;
|
||||
$response_data['records'] = $res_data;
|
||||
$this->response($response_data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -5129,75 +5101,18 @@ public function getPDFormDetailsJSON_post()
|
||||
public function imgPDFDownload_post()
|
||||
{
|
||||
$records = $this->post('records');
|
||||
$this->load->helper('photo_pdf_converter');
|
||||
|
||||
$pdid = $records['pd_id'];
|
||||
$random_string = $records['random_string'];
|
||||
$pd_master_details = $this->PD_Model->getPDMasterDetails($pdid,$random_string);
|
||||
set_time_limit(60);
|
||||
if(!file_exists($this->external_path.'/pd_reports/'.$pdid))
|
||||
{
|
||||
mkdir($this->external_path.'/pd_reports/'.$pdid,0777);
|
||||
}
|
||||
$res_data = (new photo_pdf_converter)->covertImgs2PDF($pdid,$random_string);
|
||||
|
||||
|
||||
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
|
||||
$main_applicant_name = $pd_master_details[0]['main_applicant'];
|
||||
|
||||
//get zip url from s3 if any
|
||||
|
||||
$key = 'pd'.$pdid.'/'.$main_applicant_name.'_'.$pdid.'_'.'pd_images.pdf';
|
||||
|
||||
//$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
|
||||
if($pd_master_details[0]['is_img_pdf_created'])
|
||||
{
|
||||
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
|
||||
|
||||
$response_data['dataStatus'] = true;
|
||||
$response_data['status'] = REST_Controller::HTTP_OK;
|
||||
$response_data['records'] = $singed_uri;
|
||||
$this->response($response_data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
$all_pd_images = $this->PD_Model->getSignedPDDocsURL($pdid,null,null,null,null,'report');
|
||||
//print_r(count($all_pd_images));die();
|
||||
// $all_form_names = $this->PD_Model->selectCustomRecords(array('pd_form_id','pd_form_name'),array(),PDFORMS);
|
||||
// $form_name = array();
|
||||
// foreach($all_form_names as $form)
|
||||
// {
|
||||
// $form_name[ $form['pd_form_id'] ] = $form['pd_form_name'];
|
||||
// }
|
||||
$data_to_view['all_pd_images'] = $all_pd_images;
|
||||
$img_pdf_data = $this->load->view('report_templates/PDIMG_PDF',$data_to_view,true);
|
||||
//print_r($img_pdf_data);die();
|
||||
$pdf_doc = $this->pdfgenerator->generate($img_pdf_data, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
|
||||
//End of PDF Gen using DOM PDF
|
||||
$output_file2 = $this->external_path ."/pd_reports/" . $pdid . "/pd_images_pdf.pdf";
|
||||
$ti = file_put_contents($output_file2, $pdf_doc);
|
||||
//echo $ti;die();
|
||||
|
||||
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>($output_file2));
|
||||
|
||||
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
|
||||
//print_r($s3result);
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
{
|
||||
//$result_array[0]['content']
|
||||
$where_condition_array = array("pd_id" => $pdid);
|
||||
$temp_array['is_img_pdf_created'] = 1;
|
||||
$id = $this->PD_Model->updateRecords($temp_array,PDTRIGGER,$where_condition_array);
|
||||
unlink($output_file2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
|
||||
$response_data['dataStatus'] = true;
|
||||
$response_data['status'] = REST_Controller::HTTP_OK;
|
||||
$response_data['records'] = $singed_uri;
|
||||
$response_data['records'] = $res_data;
|
||||
$this->response($response_data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -9731,38 +9646,11 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
{
|
||||
$pd_id = $this->post('pd_id');
|
||||
$random_string = $this->post('random_string');
|
||||
//$this->load->library('twlio');
|
||||
$result_data = array();
|
||||
$pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id,$random_string);
|
||||
|
||||
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
|
||||
$this->load->helper('video_grabber_helper');
|
||||
$pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id,$random_string);
|
||||
// print_r($pd_master_details);die();
|
||||
$result_data = (new video_grabber_helper)->grabAllVideo($pd_master_details[0]['pd_id'],$pd_master_details[0]['random_string'],$pd_master_details);
|
||||
|
||||
|
||||
$query = "SELECT * FROM ".VIDEO_ROOM_INFO." where fk_pd_id = $pd_id and isactive = 1";// and is_call_ended = 1 and composition_id is not null";
|
||||
$video_info = $this->db->query($query);
|
||||
if($video_info->num_rows())
|
||||
{
|
||||
$video_info = $video_info->result_array();
|
||||
//print_r($video_info);die();
|
||||
foreach ($video_info as $key => $value)
|
||||
{
|
||||
$video_name = $value['composition_id'].'.mp4';
|
||||
if($value['is_uploaded']){$video_name = $value['composition_id'];}
|
||||
$file_name = $video_name;
|
||||
if($value['s3_copied'])
|
||||
{
|
||||
$final_key = 'pd'.$pd_master_details[0]['pd_id'].'/video/'.$file_name;
|
||||
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$final_key,'+7 days');
|
||||
$result_data[] = array('video_name' => $video_name,'url' => $singed_uri,'status' => $value['twilo_status'],'room_id' => $value['room_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result_data[] = array('video_name' => $video_name, 'url' => '','status' =>'processing','room_id' => $value['room_id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
@ -11056,11 +10944,11 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
{
|
||||
$is_bucket_upload_sucess = 1;
|
||||
$id = $this->PD_Model->saveRecords(array('fk_pd_id' =>$records['fk_pd_id'],'room_id' => $modified_fname,'composition_id' => $modified_fname,'is_call_ended' => 1,'s3_copied' => 1,'is_uploaded' => 1),VIDEO_ROOM_INFO);
|
||||
$id = $this->PD_Model->saveRecords(array('fk_pd_id' =>$records['fk_pd_id'],'room_id' => $modified_fname,'composition_id' => $modified_fname,'twilo_status' => 'completed','is_call_ended' => 1,'s3_copied' => 1,'is_uploaded' => 1),VIDEO_ROOM_INFO);
|
||||
unlink($sourcefile);
|
||||
}
|
||||
}
|
||||
|
||||
// die();
|
||||
|
||||
if($is_bucket_upload_sucess && $id)
|
||||
{
|
||||
|
||||
88
api/application/helpers/photo_pdf_converter_helper.php
Normal file
88
api/application/helpers/photo_pdf_converter_helper.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
class photo_pdf_converter
|
||||
{
|
||||
protected $CI = '';
|
||||
function __construct()
|
||||
{
|
||||
//$CI =&get_instance();
|
||||
}
|
||||
|
||||
public function covertImgs2PDF($pdid,$random_string,$pd_master_details = array())
|
||||
{
|
||||
//echo 'this is from daiu';
|
||||
$CI =&get_instance();
|
||||
$CI->load->model('PD_Model');
|
||||
|
||||
if(!count($pd_master_details))
|
||||
{
|
||||
$pd_master_details = $CI->PD_Model->getPDMasterDetails($pdid,$random_string);
|
||||
}
|
||||
set_time_limit(60);
|
||||
if(!file_exists($CI->external_path.'/pd_reports/'.$pdid))
|
||||
{
|
||||
mkdir($CI->external_path.'/pd_reports/'.$pdid,0777);
|
||||
}
|
||||
|
||||
|
||||
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
|
||||
$main_applicant_name = $pd_master_details[0]['main_applicant'];
|
||||
|
||||
//get zip url from s3 if any
|
||||
|
||||
$key = 'pd'.$pdid.'/'.$main_applicant_name.'_'.$pdid.'_'.'pd_images.pdf';
|
||||
|
||||
//$singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
|
||||
if($pd_master_details[0]['is_img_pdf_created'])
|
||||
{
|
||||
return $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+7 days');
|
||||
|
||||
// $response_data['dataStatus'] = true;
|
||||
// $response_data['status'] = REST_Controller::HTTP_OK;
|
||||
// $response_data['records'] = $singed_uri;
|
||||
// $CI->response($response_data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
$all_pd_images = $CI->PD_Model->getSignedPDDocsURL($pdid,null,null,null,null,'report');
|
||||
//print_r(count($all_pd_images));die();
|
||||
// $all_form_names = $CI->PD_Model->selectCustomRecords(array('pd_form_id','pd_form_name'),array(),PDFORMS);
|
||||
// $form_name = array();
|
||||
// foreach($all_form_names as $form)
|
||||
// {
|
||||
// $form_name[ $form['pd_form_id'] ] = $form['pd_form_name'];
|
||||
// }
|
||||
$data_to_view['all_pd_images'] = $all_pd_images;
|
||||
$img_pdf_data = $CI->load->view('report_templates/PDIMG_PDF',$data_to_view,true);
|
||||
//print_r($img_pdf_data);die();
|
||||
$pdf_doc = $CI->pdfgenerator->generate($img_pdf_data, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
|
||||
//End of PDF Gen using DOM PDF
|
||||
$output_file2 = $CI->external_path ."/pd_reports/" . $pdid . "/pd_images_pdf.pdf";
|
||||
$ti = file_put_contents($output_file2, $pdf_doc);
|
||||
//echo $ti;die();
|
||||
|
||||
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>($output_file2));
|
||||
|
||||
$s3result= $CI->aws_s3->uploadFileToS3Bucket($bucket_data);
|
||||
//print_r($s3result);
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
{
|
||||
//$result_array[0]['content']
|
||||
$where_condition_array = array("pd_id" => $pdid);
|
||||
$temp_array['is_img_pdf_created'] = 1;
|
||||
$id = $CI->PD_Model->updateRecords($temp_array,PDTRIGGER,$where_condition_array);
|
||||
unlink($output_file2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+7 days');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
98
api/application/helpers/photo_zip_creator_helper.php
Normal file
98
api/application/helpers/photo_zip_creator_helper.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
class photo_zip_creator
|
||||
{
|
||||
protected $CI = '';
|
||||
function __construct()
|
||||
{
|
||||
//$CI =&get_instance();
|
||||
}
|
||||
|
||||
public function covertImgs2ZIP($pdid,$random_string,$pd_master_details = array())
|
||||
{
|
||||
//echo 'this is from daiu';
|
||||
$CI =&get_instance();
|
||||
$CI->load->model('PD_Model');
|
||||
|
||||
if(!count($pd_master_details))
|
||||
{
|
||||
$pd_master_details = $CI->PD_Model->getPDMasterDetails($pdid,$random_string,$pd_master_details);
|
||||
}
|
||||
|
||||
if(!file_exists($CI->external_path.'/pd_reports/'.$pdid))
|
||||
{
|
||||
mkdir($CI->external_path.'/pd_reports/'.$pdid,0777);
|
||||
}
|
||||
|
||||
|
||||
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
|
||||
$main_applicant_name = $pd_master_details[0]['main_applicant'];
|
||||
|
||||
//get zip url from s3 if any
|
||||
|
||||
$key = 'pd'.$pdid.'/'.$main_applicant_name.'_'.$pdid.'_'.'pd_images.zip';
|
||||
|
||||
//$singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
|
||||
if($pd_master_details[0]['is_zip_created'])
|
||||
{
|
||||
return $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
|
||||
|
||||
// $response_data['dataStatus'] = true;
|
||||
// $response_data['status'] = REST_Controller::HTTP_OK;
|
||||
// $response_data['records'] = $singed_uri;
|
||||
// $CI->response($response_data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// echo 'here...';
|
||||
$all_pd_images = $CI->PD_Model->getSignedPDDocsURL($pdid,null,null,null,null,'report');
|
||||
|
||||
$all_form_names = $CI->PD_Model->selectCustomRecords(array('pd_form_id','pd_form_name'),array(),PDFORMS);
|
||||
$form_name = array();
|
||||
foreach($all_form_names as $form)
|
||||
{
|
||||
$form_name[ $form['pd_form_id'] ] = $form['pd_form_name'];
|
||||
}
|
||||
//print_r($form_name);die();
|
||||
//Generate zip file
|
||||
|
||||
$CI->load->library('zip');
|
||||
|
||||
$CI->zip->add_dir('pdimages');
|
||||
|
||||
foreach($all_pd_images as $image)
|
||||
{
|
||||
$temp_dir_name = isset($form_name[ $image['fk_form_id'] ]) ? $form_name[ $image['fk_form_id'] ] : 'Common';
|
||||
//replace colon with hyphen in doc name
|
||||
$doc_name = str_replace(':', '-', $image['pd_document_name']);
|
||||
$CI->zip->add_data('pdimages/'.$doc_name,file_get_contents($image['doc_url']));
|
||||
}
|
||||
|
||||
$temp_path = $main_applicant_name.'_'.$pdid.'_'.'pd_images.zip';
|
||||
|
||||
$CI->zip->archive($CI->external_path.'/pd_reports/'.$pdid.'/'.$temp_path);
|
||||
|
||||
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>($CI->external_path.'/pd_reports/'.$pdid.'/'.$temp_path));
|
||||
|
||||
$s3result= $CI->aws_s3->uploadFileToS3Bucket($bucket_data);
|
||||
//print_r($s3result);
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
|
||||
{
|
||||
//$result_array[0]['content']
|
||||
$where_condition_array = array("pd_id" => $pdid);
|
||||
$temp_array['is_zip_created'] = 1;
|
||||
$id = $CI->PD_Model->updateRecords($temp_array,PDTRIGGER,$where_condition_array);
|
||||
unlink($CI->external_path.'/pd_reports/'.$pdid.'/'.$temp_path);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
48
api/application/helpers/report_attachments_helper.php
Normal file
48
api/application/helpers/report_attachments_helper.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
class report_attachments
|
||||
{
|
||||
protected $CI = '';
|
||||
function __construct()
|
||||
{
|
||||
//$CI =&get_instance();
|
||||
}
|
||||
|
||||
public function getReportAttchments($pdid,$random_string,$pd_master_details = array())
|
||||
{
|
||||
//echo 'this is from daiu';
|
||||
$CI =&get_instance();
|
||||
$CI->load->model('PD_Model');
|
||||
$CI->load->helper('photo_pdf_converter');
|
||||
$CI->load->helper('photo_zip_creator');
|
||||
$CI->load->helper('video_grabber_helper');
|
||||
|
||||
if(!count($pd_master_details))
|
||||
{
|
||||
$pd_master_details = $CI->PD_Model->getPDMasterDetails($pdid,$random_string);
|
||||
}
|
||||
$img_pdf_aws_uri = (new photo_pdf_converter)->covertImgs2PDF($pd_master_details[0]['pd_id'],$pd_master_details[0]['random_string'],$pd_master_details);
|
||||
|
||||
$img_zip_aws_uri = (new photo_zip_creator)->covertImgs2ZIP($pd_master_details[0]['pd_id'],$pd_master_details[0]['random_string'],$pd_master_details);
|
||||
|
||||
$video_uri = (new video_grabber_helper)->grabAllVideo($pd_master_details[0]['pd_id'],$pd_master_details[0]['random_string'],$pd_master_details);
|
||||
// print_r($video_uri) ;die();
|
||||
$attachment = '<div id="page_break"></div><h2>Data Links</h2><p><a target="_blank" href="'.$img_pdf_aws_uri.'">Click here for Image PDF Link</a></p> <p> <a target="_blank" href="'.$img_zip_aws_uri.'">Click here for Image ZIP Link</a> </p>';
|
||||
if($pd_master_details[0]['fk_pd_type'] == 2 && count($video_uri))// if smart pd
|
||||
{
|
||||
$attachment .='<h2>videos</h2>';
|
||||
foreach ($video_uri as $key => $value)
|
||||
{
|
||||
$attachment .= '<p><a target="_blank" href="'.$value['url'].'">'.$value['video_name'].'</a></p>';
|
||||
}
|
||||
|
||||
}
|
||||
$attachment.= '<br><br><br><p style="font-size:10px;text-align:center;">(Note all links will expire in 7 days from the date of report generation.)</p>';
|
||||
return $attachment;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
56
api/application/helpers/video_grabber_helper.php
Normal file
56
api/application/helpers/video_grabber_helper.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
class video_grabber_helper
|
||||
{
|
||||
protected $CI = '';
|
||||
function __construct()
|
||||
{
|
||||
//$CI =&get_instance();
|
||||
|
||||
}
|
||||
|
||||
public function grabAllVideo($pdid,$random_string,$pd_master_details = array())
|
||||
{
|
||||
$CI =&get_instance();
|
||||
|
||||
if(!count($pd_master_details))
|
||||
{
|
||||
$pd_master_details = $CI->PD_Model->getPDMasterDetails($pd_id,$random_string);
|
||||
}
|
||||
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
|
||||
|
||||
$result_data = array();
|
||||
$query = "SELECT * FROM ".VIDEO_ROOM_INFO." where fk_pd_id = $pdid and isactive = 1";
|
||||
$video_info = $CI->db->query($query);
|
||||
if($video_info->num_rows())
|
||||
{
|
||||
$video_info = $video_info->result_array();
|
||||
//print_r($video_info);die();
|
||||
foreach ($video_info as $key => $value)
|
||||
{
|
||||
$video_name = $value['composition_id'].'.mp4';
|
||||
if($value['is_uploaded']){$video_name = $value['composition_id'];}
|
||||
$file_name = $video_name;
|
||||
if($value['s3_copied'])
|
||||
{
|
||||
$final_key = 'pd'.$pd_master_details[0]['pd_id'].'/video/'.$file_name;
|
||||
$singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$final_key,'+7 days');
|
||||
$result_data[] = array('video_name' => $video_name,'url' => $singed_uri,'status' => $value['twilo_status'],'room_id' => $value['room_id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result_data[] = array('video_name' => $video_name, 'url' => '','status' =>'processing','room_id' => $value['room_id']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $result_data;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@ -951,6 +951,10 @@ class PD_Model extends SPARQ_Model {
|
||||
$actual_logs[$log_key]['meta_data'][] = array('display_name'=>'Remark of status change','display_value'=> $data_from_remarks[ $revert_remark_iteration ]['remark']);
|
||||
$revert_remark_iteration++;
|
||||
}
|
||||
else if($log['new_value'] == CANCELLED)
|
||||
{
|
||||
$actual_logs[$log_key]['meta_data'][] = array('display_name'=>'Remark of PD cancelleation','display_value'=> $pd_master_detials[0]['cancel_pd_remark']);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
@ -997,7 +1001,7 @@ class PD_Model extends SPARQ_Model {
|
||||
*/
|
||||
public function getPDMasterDetails($pdid,$random_string = null)
|
||||
{
|
||||
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,PDTRIGGER.imgc_fin_institute,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,ENTITY.is_score_card_enabled,ENTITY.is_otp_enabled, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PRODUCTS.prod_catagory,PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %h:%i:%s %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby,DESIGNATION.designation as updatedby_designation,PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.is_qc_enabled,AGENCY.full_name as agency_name,AGENCY.short_name as agency_short_name,PDTRIGGER.vendor_pdofficer,concat(VENDORPDOFFICER.first_name," ",VENDORPDOFFICER.last_name) as vendor_pdofficer_name,PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.lender_sales_person,concat(LENDERSALESPERSON.first_name," ",LENDERSALESPERSON.last_name) as lender_sales_person_name,LENDERSALESPERSON.mobile_no as lender_sales_contact_mobileno,LENDERSALESPERSON.email as lender_sales_person_email,PDTRIGGER.lender_credit_person,concat(LENDERCREDITPERSON.first_name," ",LENDERCREDITPERSON.last_name) as lender_credit_person_name,LENDERCREDITPERSON.mobile_no as lender_credit_person_contact_mobileno,LENDERCREDITPERSON.email as lender_credit_person_email,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,OTPREJECTION.rejection_reason,PDTRIGGER.otp_reject_other_reason,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.start_location,PDTRIGGER.satellite_image_base64_blob,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y %h:%i:%s %p") as pd_report_generated_date,DATE_FORMAT(PDTRIGGER.pd_visit_date,"%d/%m/%Y %h:%i:%s %p") as pd_visit_date,PDTRIGGER.random_string,PDTRIGGER.pd_report_html_filename,PDTRIGGER.is_qc_edited,PDTRIGGER.is_zip_created,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,AGENCY.is_vendor_visit_disabled,PDTRIGGER.is_notify_enabled,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_img_pdf_created,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status,PDTRIGGER.vendor_scheduled_on as vendor_scheduled_on_validation,DATE_FORMAT(PDTRIGGER.vendor_scheduled_on,"%d/%m/%Y %h:%i %p") as vendor_scheduled_on,PDTRIGGER.complete_override_data,PDTRIGGER.excel_file_id,SMC_EXCEL_FILELIST.file_name,SMC_EXCEL_FILELIST.modified_fname,PDTRIGGER.mwise_sales_person,PDTRIGGER.is_field_visit_done');
|
||||
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno,PDTRIGGER.fk_lender_id,PDTRIGGER.sub_entity_id,SUBENTITY.short_name as sub_entity_short_name,PDTRIGGER.imgc_fin_institute,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,ENTITY.is_score_card_enabled,ENTITY.is_otp_enabled, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PRODUCTS.prod_catagory,PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %h:%i:%s %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby,DESIGNATION.designation as updatedby_designation,PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.is_qc_enabled,AGENCY.full_name as agency_name,AGENCY.short_name as agency_short_name,PDTRIGGER.vendor_pdofficer,concat(VENDORPDOFFICER.first_name," ",VENDORPDOFFICER.last_name) as vendor_pdofficer_name,PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.lender_sales_person,concat(LENDERSALESPERSON.first_name," ",LENDERSALESPERSON.last_name) as lender_sales_person_name,LENDERSALESPERSON.mobile_no as lender_sales_contact_mobileno,LENDERSALESPERSON.email as lender_sales_person_email,PDTRIGGER.lender_credit_person,concat(LENDERCREDITPERSON.first_name," ",LENDERCREDITPERSON.last_name) as lender_credit_person_name,LENDERCREDITPERSON.mobile_no as lender_credit_person_contact_mobileno,LENDERCREDITPERSON.email as lender_credit_person_email,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,OTPREJECTION.rejection_reason,PDTRIGGER.otp_reject_other_reason,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id,PDTRIGGER.start_location,PDTRIGGER.satellite_image_base64_blob,DATE_FORMAT(PDTRIGGER.pd_report_generated_date,"%d/%m/%Y %h:%i:%s %p") as pd_report_generated_date,DATE_FORMAT(PDTRIGGER.pd_visit_date,"%d/%m/%Y %h:%i:%s %p") as pd_visit_date,PDTRIGGER.random_string,PDTRIGGER.pd_report_html_filename,PDTRIGGER.is_qc_edited,PDTRIGGER.is_zip_created,PDTRIGGER.pd_qc_note,ENTITY.is_sms_enabled,ENTITY.is_mail_enabled,ENTITY.is_app_notify_enabled,AGENCY.is_vendor_visit_disabled,PDTRIGGER.is_notify_enabled,ENTITYFININSTITUTION.institute_name as fin_institute_name,PDTRIGGER.is_img_pdf_created,PDTRIGGER.is_video_merged,PDTRIGGER.vendor_status,PDTRIGGER.vendor_scheduled_on as vendor_scheduled_on_validation,DATE_FORMAT(PDTRIGGER.vendor_scheduled_on,"%d/%m/%Y %h:%i %p") as vendor_scheduled_on,PDTRIGGER.complete_override_data,PDTRIGGER.excel_file_id,SMC_EXCEL_FILELIST.file_name,SMC_EXCEL_FILELIST.modified_fname,PDTRIGGER.mwise_sales_person,PDTRIGGER.is_field_visit_done,PDTRIGGER.cancel_pd_remark');
|
||||
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
|
||||
$this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id ','LEFT');
|
||||
$this->db->JOIN(ENTITY.' as SUBENTITY','PDTRIGGER.sub_entity_id = SUBENTITY.entity_id ','LEFT');
|
||||
|
||||
@ -44,8 +44,8 @@ class Sales_PD_Model extends SPARQ_Model {
|
||||
if(!empty($sales_pd_officer_id)) {
|
||||
$this->db->WHERE('SALES_PD_DATA.createdby',$sales_pd_officer_id);
|
||||
}
|
||||
if(!empty($sales_pd_type)) {
|
||||
$this->db->WHERE('SALES_PD_DATA.sales_pd_type',$sales_pd_type);
|
||||
if(!empty($sales_pd_type) && count($sales_pd_type)) {
|
||||
$this->db->WHERE_IN('SALES_PD_DATA.sales_pd_type',$sales_pd_type);
|
||||
}
|
||||
$this->db->WHERE('SALES_PD_DATA.isactive',1);
|
||||
$this->db->order_by('SALES_PD_DATA.sales_pd_id','desc');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user