From 89f7359e03f2eeea9c2587e1c63c0ff84fa3d2d4 Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Mon, 25 Oct 2021 14:35:47 +0530 Subject: [PATCH] live fixed (bcoz pdf title changes missing) : ps --- api/application/controllers/Sales_PD_Controller.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index a41452c3..5a336bf6 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -232,6 +232,15 @@ class Sales_PD_Controller extends REST_Controller { if($api) { $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes'); + ## NEW KEY BECAUSE TITLE-RENAME + if(curl_init($singed_uri) !== false){ ##THERE IS NO FILE in NEW KEY means we using OLD KEY. So that using if Cond. + $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'; + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$old_key,'30 minutes'); + } + $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; $data['records'] = $singed_uri;