reverted codes : ps

This commit is contained in:
sanjeev 2022-02-24 21:51:02 +05:30
parent dc188a3071
commit 45ef40633f
4 changed files with 47 additions and 48 deletions

View File

@ -4894,6 +4894,7 @@ public function getPDFormDetailsJSON_post()
$is_generate = isset($records['is_generate']) ? 1 : 0;
$random_string = $records['random_string'];
$is_qc_edited = 0;
echo "step1.Function Entered";
$this->load->helper('report_attachments');
@ -4938,12 +4939,10 @@ public function getPDFormDetailsJSON_post()
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
$main_applicant_name = $pd_master_details[0]['main_applicant'];
$pdf_name = 'PD_REPORTS_'.$main_applicant_name;
// $key = 'pd'.$pdid.'/pd_reports/'.$main_applicant_name.'.pdf';
$type1_key = 'pd'.$pdid.'/pd_reports/'.$main_applicant_name.'.pdf';
$type2_key = 'pd'.$pdid.'/pd_reports/'.$pdf_name.'.pdf';
$pdf_name = 'PD_Report_'.$main_applicant_name;
$key = 'pd'.$pdid.'/pd_reports/'.$main_applicant_name.'.pdf';
$newkey = 'pd'.$pdid.'/pd_reports/'.$pdf_name.'.pdf';
if($pd_master_details[0]['is_qc_edited'])
@ -4999,7 +4998,7 @@ public function getPDFormDetailsJSON_post()
{
$sourcefile = $output_file2;
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$type2_key,'sourcefile'=>$sourcefile);
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$newkey,'sourcefile'=>$sourcefile);
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
//print_r($s3result);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
@ -5013,13 +5012,13 @@ public function getPDFormDetailsJSON_post()
// $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type2_key,'30 minutes');
// $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
$headers = @get_headers($_uri);
if($headers && strpos( $headers[0], '200')) {
$singed_uri = $_uri;
}else {
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type1_key,'30 minutes');
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$newkey,'30 minutes');
}
@ -5052,12 +5051,12 @@ public function getPDFormDetailsJSON_post()
{
// $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type2_key,'+30 minutes');
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes');
$headers = @get_headers($_uri);
if($headers && strpos( $headers[0], '200')) {
$singed_uri = $_uri;
}else {
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type1_key,'+30 minutes');
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$newkey,'+30 minutes');
}
if($singed_uri != null || $singed_uri != "" )

View File

@ -175,20 +175,20 @@ class SMC_Credit_PD_Controller extends REST_Controller {
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$SMC_CREDIT_PD[0]['lender_id'];
// 1st Type Key name. (name,abbr and date).
$type1_pdf_name = strtolower(trim($SMC_CREDIT_PD[0]['applicant_name']));
$type1_pdf_name .= '-'.$SMC_CREDIT_PD[0]['abbr'];
$type1_pdf_name .= '-'.(date('dmY',strtotime($SMC_CREDIT_PD[0]['completed_date'])));
$pdf_name = strtolower(trim($SMC_CREDIT_PD[0]['applicant_name']));
$pdf_name .= '-'.$SMC_CREDIT_PD[0]['abbr'];
$pdf_name .= '-'.(date('dmY',strtotime($SMC_CREDIT_PD[0]['completed_date'])));
// 2nd Type Key name. (name,type,abbr and date).
$type2_pdf_name = strtolower(trim($SMC_CREDIT_PD[0]['applicant_name']));
$type2_pdf_name .= '-'.$SMC_CREDIT_PD[0]['abbr'];
$type2_pdf_name .= 'PD_Report-'.(date('dmY',strtotime($SMC_CREDIT_PD[0]['completed_date'])));
$new_pdf_name = strtolower(trim($SMC_CREDIT_PD[0]['applicant_name']));
$new_pdf_name .= '-'.$SMC_CREDIT_PD[0]['abbr'];
$new_pdf_name .= 'PD_Report-'.(date('dmY',strtotime($SMC_CREDIT_PD[0]['completed_date'])));
// $this->PD_Model->updateRecords(array('pd_report_filename' => $pdf_name),SMC_CREDIT_PD,array('smc_credit_pd' => $smc_credit_pd));
//$pdf_name = str_replace(' ', '_', $pdf_name);
$type1_key = 'sales_pd/'.$smc_credit_pd.'/'.$type1_pdf_name.'.pdf';
$type2_key = 'sales_pd/'.$smc_credit_pd.'/'.$type2_pdf_name.'.pdf';
$key = 'sales_pd/'.$smc_credit_pd.'/'.$pdf_name.'.pdf';
$new_key = 'sales_pd/'.$smc_credit_pd.'/'.$new_pdf_name.'.pdf';
if(!file_exists($this->external_path.'/sales_pd/'.$smc_credit_pd))
{
@ -224,7 +224,7 @@ class SMC_Credit_PD_Controller extends REST_Controller {
$bytes = file_put_contents($output_file, $pdf_doc);
// echo $bytes;
// die();
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$type2_key,'sourcefile'=>$this->external_path.'/sales_pd/'.$smc_credit_pd.'/temp.pdf');
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$new_key,'sourcefile'=>$this->external_path.'/sales_pd/'.$smc_credit_pd.'/temp.pdf');
log_message('ERROR','####SALES PD REPORT UPLOAD TO S3'.$smc_credit_pd);
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
@ -235,12 +235,12 @@ class SMC_Credit_PD_Controller extends REST_Controller {
if($api)
{
// $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type1_key,'30 minutes');
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
$headers = @get_headers($_uri);
if($headers && strpos( $headers[0], '200')) {
$singed_uri = $_uri;
}else {
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type2_key,'30 minutes');
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$new_key,'30 minutes');
}
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
@ -1644,17 +1644,20 @@ public function filterSalesPDList_post() {
}
// echo $html_content;exit();
$type1_pdf_name = $view_data['pd_master_details'][0]['main_applicant'];
$type2_pdf_name = "PD_Report_".$view_data['pd_master_details'][0]['main_applicant'];
$pdf_name = $view_data['pd_master_details'][0]['main_applicant'];
$new_pdf_name = "PD_Report_".$view_data['pd_master_details'][0]['main_applicant'];
$pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
//End of PDF Gen using DOM PDF
$output_file = $this->external_path ."/pd_reports/" . $records['pd_id'] . "/temp.pdf";
$bytes = file_put_contents($output_file, $pdf_doc);
//echo $bytes;die();
$bucket_name = LENDER_BUCKET_NAME_PREFIX.(ENVIRONMENT == 'production' ? 7 : 35);
$type1_key = 'pd'.$records['pd_id'].'/pd_reports/'.$type1_pdf_name.'.pdf';
$type2_key = 'pd'.$records['pd_id'].'/pd_reports/'.$type2_pdf_name.'.pdf';
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$type2_key,'sourcefile'=>$output_file);
$key = 'pd'.$records['pd_id'].'/pd_reports/'.$pdf_name.'.pdf';
$new_key = 'pd'.$records['pd_id'].'/pd_reports/'.$new_pdf_name.'.pdf';
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$new_key,'sourcefile'=>$output_file);
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{
@ -1662,12 +1665,12 @@ public function filterSalesPDList_post() {
// $this->Sales_PD_Model->updateRecords(array('is_pdf' => 1, 'is_edited' => 0),SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id));
// $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type2_key,'30 minutes');
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$new_key,'30 minutes');
$headers = @get_headers($_uri);
if($headers && strpos( $headers[0], '200')) {
$singed_uri = $_uri;
}else {
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type1_key,'30 minutes');
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
}
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;

View File

@ -181,19 +181,16 @@ class Sales_PD_Controller extends REST_Controller {
ini_set('max_execution_time', 0);
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$sales_pd_data[0]['lender_id'];
// 1st Type Key name. (name,abbr and date).
$type1_pdf_name = strtolower(trim($sales_pd_data[0]['applicant_name']));
$type1_pdf_name .= '-'.$sales_pd_data[0]['abbr'];
$type1_pdf_name .= '-'.(date('dmY',strtotime($sales_pd_data[0]['completed_date'])));
// 2nd Type Key name. (name,type,abbr and date).
$type2_pdf_name = strtolower(trim($sales_pd_data[0]['applicant_name']));
$type2_pdf_name .= '-'.$pd_type.$sales_pd_data[0]['abbr'];
$type2_pdf_name .= '-'.(date('dmY',strtotime($sales_pd_data[0]['completed_date'])));
$pdf_name = strtolower(trim($sales_pd_data[0]['applicant_name']));
$pdf_name .= '-'.$pd_type.$sales_pd_data[0]['abbr'];
$pdf_name .= '-'.(date('dmY',strtotime($sales_pd_data[0]['completed_date'])));
//$pdf_name = str_replace(' ', '_', $pdf_name);
$old_pdf_name = strtolower(trim($sales_pd_data[0]['applicant_name']));
$old_pdf_name .= '-'.$sales_pd_data[0]['abbr'];
$old_pdf_name .= '-'.(date('dmY',strtotime($sales_pd_data[0]['completed_date'])));
$old_key = 'sales_pd/'.$sales_pd_id.'/'.$old_pdf_name.'.pdf';
$key = 'sales_pd/'.$sales_pd_id.'/'.$pdf_name.'.pdf';
//$this->Sales_PD_Model->updateRecords(array('pd_report_filename' => 'PD_Report-'.$pdf_name),SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id));
$type1_key = 'sales_pd/'.$sales_pd_id.'/'.$type1_pdf_name.'.pdf';
$type2_key = 'sales_pd/'.$sales_pd_id.'/'.$type2_pdf_name.'.pdf';
if(!file_exists($this->external_path.'/sales_pd/'.$sales_pd_id))
{
@ -227,7 +224,7 @@ class Sales_PD_Controller extends REST_Controller {
$bytes = file_put_contents($output_file, $pdf_doc);
//echo $bytes;
//die();
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$type2_key,'sourcefile'=>$this->external_path.'/sales_pd/'.$sales_pd_id.'/temp.pdf');
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$this->external_path.'/sales_pd/'.$sales_pd_id.'/temp.pdf');
log_message('ERROR','####SALES PD REPORT UPLOAD TO S3'.$sales_pd_id);
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
@ -237,12 +234,12 @@ class Sales_PD_Controller extends REST_Controller {
$this->Sales_PD_Model->updateRecords(array('is_pdf' => 1, 'is_edited' => 0),SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id));
if($api)
{
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type2_key,'30 minutes');
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
$headers = @get_headers($_uri);
if($headers && strpos( $headers[0], '200')) {
$singed_uri = $_uri;
}else {
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type1_key,'30 minutes');
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$old_key,'30 minutes');
}
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;
@ -256,12 +253,12 @@ class Sales_PD_Controller extends REST_Controller {
if($api)
{
## NEW KEY BECAUSE TITLE-RENAME
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type2_key,'30 minutes');
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
$headers = @get_headers($_uri);
if($headers && strpos( $headers[0], '200')) {
$singed_uri = $_uri;
}else {
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type1_key,'30 minutes');
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$old_key,'30 minutes');
}
$data['dataStatus'] = true;
$data['status'] = REST_Controller::HTTP_OK;

View File

@ -1112,13 +1112,13 @@ class Template_Management_Controller extends REST_Controller {
$this->db->set('isactive',0);
$this->db->update(TEMPLATE_JSON_V2);
}
//draft means insert
//draft means insert.
$json = json_encode($records['json'],true);
$fields = array('form_id' => $form_id,'json' => $json,'map_id'=>$map_id,'is_form_status'=>$status);
$json_pk_id = $this->Template_Management_Model->saveTemplateMapping($fields,TEMPLATE_JSON_V2);
$msg = "Sucessfully Inserted";
}else if($status == "APPROVED" || $status == "COMPLETED"){
//status means update
//approve and completed status means just update the status only.
$json_pk_id = $json_table[0]['id'];
$this->db->where('isactive',1);
$this->db->where('id',$json_pk_id);