pd_report string added : ps
This commit is contained in:
parent
a1a6216259
commit
02712ed2c9
@ -168,20 +168,27 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
|||||||
|
|
||||||
$where_condition_array = array('SMC_CREDIT_PD.smc_credit_pd' => $smc_credit_pd);
|
$where_condition_array = array('SMC_CREDIT_PD.smc_credit_pd' => $smc_credit_pd);
|
||||||
$SMC_CREDIT_PD = $this->SMC_Credit_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
|
$SMC_CREDIT_PD = $this->SMC_Credit_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array);
|
||||||
//print_r($SMC_CREDIT_PD);die();
|
|
||||||
|
|
||||||
if($SMC_CREDIT_PD)
|
if($SMC_CREDIT_PD)
|
||||||
{
|
{
|
||||||
ini_set('max_execution_time', 0);
|
ini_set('max_execution_time', 0);
|
||||||
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$SMC_CREDIT_PD[0]['lender_id'];
|
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$SMC_CREDIT_PD[0]['lender_id'];
|
||||||
$pdf_name = strtolower(trim($SMC_CREDIT_PD[0]['applicant_name']));
|
|
||||||
$pdf_name .= '-'.$SMC_CREDIT_PD[0]['abbr'];
|
// 1st Type Key name. (name,abbr and date).
|
||||||
$pdf_name .= '-'.(date('dmY',strtotime($SMC_CREDIT_PD[0]['completed_date'])));
|
$type1_pdf_name = strtolower(trim($SMC_CREDIT_PD[0]['applicant_name']));
|
||||||
$this->PD_Model->updateRecords(array('pd_report_filename' => $pdf_name),SMC_CREDIT_PD,array('SMC_CREDIT_PD.smc_credit_pd' => $smc_credit_pd));
|
$type1_pdf_name .= '-'.$SMC_CREDIT_PD[0]['abbr'];
|
||||||
|
$type1_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'])));
|
||||||
|
|
||||||
|
// $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);
|
//$pdf_name = str_replace(' ', '_', $pdf_name);
|
||||||
|
|
||||||
|
$type1_key = 'sales_pd/'.$smc_credit_pd.'/'.$type1_pdf_name.'.pdf';
|
||||||
$key = 'sales_pd/'.$smc_credit_pd.'/'.$pdf_name.'.pdf';
|
$type2_key = 'sales_pd/'.$smc_credit_pd.'/'.$type2_pdf_name.'.pdf';
|
||||||
|
|
||||||
if(!file_exists($this->external_path.'/sales_pd/'.$smc_credit_pd))
|
if(!file_exists($this->external_path.'/sales_pd/'.$smc_credit_pd))
|
||||||
{
|
{
|
||||||
@ -217,7 +224,7 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
|||||||
$bytes = file_put_contents($output_file, $pdf_doc);
|
$bytes = file_put_contents($output_file, $pdf_doc);
|
||||||
// echo $bytes;
|
// echo $bytes;
|
||||||
// die();
|
// die();
|
||||||
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$this->external_path.'/sales_pd/'.$smc_credit_pd.'/temp.pdf');
|
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$type2_key,'sourcefile'=>$this->external_path.'/sales_pd/'.$smc_credit_pd.'/temp.pdf');
|
||||||
log_message('ERROR','####SALES PD REPORT UPLOAD TO S3'.$smc_credit_pd);
|
log_message('ERROR','####SALES PD REPORT UPLOAD TO S3'.$smc_credit_pd);
|
||||||
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
|
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
|
||||||
|
|
||||||
@ -227,7 +234,14 @@ class SMC_Credit_PD_Controller extends REST_Controller {
|
|||||||
$this->SMC_Credit_PD_Model->updateRecords(array('is_pdf' => 1, 'is_edited' => 0),SMC_CREDIT_PD,array('smc_credit_pd' => $smc_credit_pd));
|
$this->SMC_Credit_PD_Model->updateRecords(array('is_pdf' => 1, 'is_edited' => 0),SMC_CREDIT_PD,array('smc_credit_pd' => $smc_credit_pd));
|
||||||
if($api)
|
if($api)
|
||||||
{
|
{
|
||||||
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
|
// $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
|
||||||
|
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type1_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');
|
||||||
|
}
|
||||||
$data['dataStatus'] = true;
|
$data['dataStatus'] = true;
|
||||||
$data['status'] = REST_Controller::HTTP_OK;
|
$data['status'] = REST_Controller::HTTP_OK;
|
||||||
$data['records'] = $singed_uri;
|
$data['records'] = $singed_uri;
|
||||||
|
|||||||
@ -180,16 +180,26 @@ class Sales_PD_Controller extends REST_Controller {
|
|||||||
{
|
{
|
||||||
ini_set('max_execution_time', 0);
|
ini_set('max_execution_time', 0);
|
||||||
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$sales_pd_data[0]['lender_id'];
|
$bucket_name = LENDER_BUCKET_NAME_PREFIX.$sales_pd_data[0]['lender_id'];
|
||||||
$pdf_name = strtolower(trim($sales_pd_data[0]['applicant_name']));
|
// 1st Type Key name. (name,abbr and date).
|
||||||
$pdf_name .= '-'.$pd_type.$sales_pd_data[0]['abbr'];
|
$type1_pdf_name = strtolower(trim($sales_pd_data[0]['applicant_name']));
|
||||||
$pdf_name .= '-'.(date('dmY',strtotime($sales_pd_data[0]['completed_date'])));
|
$type1_pdf_name .= '-'.$sales_pd_data[0]['abbr'];
|
||||||
//$pdf_name = str_replace(' ', '_', $pdf_name);
|
$type1_pdf_name .= '-'.(date('dmY',strtotime($sales_pd_data[0]['completed_date'])));
|
||||||
$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';
|
// 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'])));
|
||||||
|
|
||||||
|
// 3rd Type Key name. (string,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 .= 'PD_Report-'.(date('dmY',strtotime($sales_pd_data[0]['completed_date'])));
|
||||||
|
|
||||||
|
//$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';
|
||||||
|
$type3_key = 'sales_pd/'.$sales_pd_id.'/'.$type3_pdf_name.'.pdf';
|
||||||
|
|
||||||
if(!file_exists($this->external_path.'/sales_pd/'.$sales_pd_id))
|
if(!file_exists($this->external_path.'/sales_pd/'.$sales_pd_id))
|
||||||
{
|
{
|
||||||
@ -223,7 +233,7 @@ class Sales_PD_Controller extends REST_Controller {
|
|||||||
$bytes = file_put_contents($output_file, $pdf_doc);
|
$bytes = file_put_contents($output_file, $pdf_doc);
|
||||||
//echo $bytes;
|
//echo $bytes;
|
||||||
//die();
|
//die();
|
||||||
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$this->external_path.'/sales_pd/'.$sales_pd_id.'/temp.pdf');
|
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$type3_key,'sourcefile'=>$this->external_path.'/sales_pd/'.$sales_pd_id.'/temp.pdf');
|
||||||
log_message('ERROR','####SALES PD REPORT UPLOAD TO S3'.$sales_pd_id);
|
log_message('ERROR','####SALES PD REPORT UPLOAD TO S3'.$sales_pd_id);
|
||||||
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
|
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
|
||||||
|
|
||||||
@ -233,12 +243,16 @@ 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));
|
$this->Sales_PD_Model->updateRecords(array('is_pdf' => 1, 'is_edited' => 0),SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id));
|
||||||
if($api)
|
if($api)
|
||||||
{
|
{
|
||||||
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
|
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type3_key,'30 minutes');
|
||||||
$headers = @get_headers($_uri);
|
$headers = @get_headers($_uri);
|
||||||
if($headers && strpos( $headers[0], '200')) {
|
if($headers && strpos( $headers[0], '200')) {
|
||||||
$singed_uri = $_uri;
|
$singed_uri = $_uri;
|
||||||
}else {
|
}else {
|
||||||
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$old_key,'30 minutes');
|
if($headers && strpos( $headers[0], '200')) {
|
||||||
|
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type2_key,'30 minutes');
|
||||||
|
}else {
|
||||||
|
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type1_key,'30 minutes');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$data['dataStatus'] = true;
|
$data['dataStatus'] = true;
|
||||||
$data['status'] = REST_Controller::HTTP_OK;
|
$data['status'] = REST_Controller::HTTP_OK;
|
||||||
@ -252,12 +266,16 @@ class Sales_PD_Controller extends REST_Controller {
|
|||||||
if($api)
|
if($api)
|
||||||
{
|
{
|
||||||
## NEW KEY BECAUSE TITLE-RENAME
|
## NEW KEY BECAUSE TITLE-RENAME
|
||||||
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes');
|
$_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type3_key,'30 minutes');
|
||||||
$headers = @get_headers($_uri);
|
$headers = @get_headers($_uri);
|
||||||
if($headers && strpos( $headers[0], '200')) {
|
if($headers && strpos( $headers[0], '200')) {
|
||||||
$singed_uri = $_uri;
|
$singed_uri = $_uri;
|
||||||
}else {
|
}else {
|
||||||
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$old_key,'30 minutes');
|
if($headers && strpos( $headers[0], '200')) {
|
||||||
|
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type2_key,'30 minutes');
|
||||||
|
}else {
|
||||||
|
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$type3_key,'30 minutes');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$data['dataStatus'] = true;
|
$data['dataStatus'] = true;
|
||||||
$data['status'] = REST_Controller::HTTP_OK;
|
$data['status'] = REST_Controller::HTTP_OK;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user