From c17736423de8c190e03c3bf3e5e84b46b06b029f Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Fri, 9 Sep 2022 09:37:31 +0530 Subject: [PATCH] Code committed : ps --- .../controllers/SMC_Credit_PD_Controller.php | 35 ++++++++++++++----- .../helpers/smc_creditpd_helper.php | 11 ++++-- 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 018ff16d..999da10b 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -767,7 +767,12 @@ class SMC_Credit_PD_Controller extends REST_Controller { $records['completed_date'] = date('Y-m-d H:i:s'); //echo 'final';die(); $id = $this->SMC_Credit_PD_Model->updateRecords($records,SMC_CREDIT_PD,array('smc_credit_pd' => $records['smc_credit_pd'])); - + log_message('ERROR','####COMPLETE SMC Credit PD = '.$records['smc_credit_pd']); + $random_string = $records['random_string']; + $ZIP = smc_creditpd::covertSMCImgs2ZIP($records['smc_credit_pd'],$random_string,array(),0); + log_message('ERROR','####COMPLETE SMC IMAGE ZIP = '.$ZIP); + $PDF = smc_creditpd::covertSMCImgs2PDF($records['smc_credit_pd'],$random_string,array(),0); + log_message('ERROR','####COMPLETE SMC IMAGE PDF = '.$PDF); //$this->prepareSalesPDReport($records['smc_credit_pd'],false); // sleep(10); // log_message('ERROR','####SALESPD AFTER 10 PREPARED REPORT'.$records['smc_credit_pd']); @@ -1114,7 +1119,8 @@ class SMC_Credit_PD_Controller extends REST_Controller { // } - +// updatepdstatus +// zip auto generate script public function testAPISalesPD_post() { //PDALERTS::sendSalesPDMail($this,32);die(); @@ -2022,12 +2028,18 @@ public function filterSalesPDList_post() { $this->load->helper('smc_creditpd'); $res_data = smc_creditpd::covertSMCImgs2ZIP($pdid,$random_string,array(),$regenerate); - - $response_data['dataStatus'] = true; - $response_data['status'] = REST_Controller::HTTP_OK; - $response_data['records'] = $res_data; + + if(!empty($res_data)){ + $response_data['dataStatus'] = true; + $response_data['status'] = REST_Controller::HTTP_OK; + $response_data['records'] = $res_data; + } else { + $response_data['dataStatus'] = false; + $response_data['status'] = REST_Controller::HTTP_NOT_FOUND; + $response_data['msg'] = 'NO Image Found'; + } $this->response($response_data,REST_Controller::HTTP_OK); - + } @@ -2043,12 +2055,17 @@ public function filterSalesPDList_post() { $regenerate = isset($records['regenerate']) ? $records['regenerate'] : 0; $res_data = smc_creditpd::covertSMCImgs2PDF($pdid,$random_string,array(),$regenerate); - + if(!empty($res_data)){ $response_data['dataStatus'] = true; $response_data['status'] = REST_Controller::HTTP_OK; $response_data['records'] = $res_data; - $this->response($response_data,REST_Controller::HTTP_OK); + } else { + $response_data['dataStatus'] = false; + $response_data['status'] = REST_Controller::HTTP_NOT_FOUND; + $response_data['msg'] = 'NO Image Found'; + } + $this->response($response_data,REST_Controller::HTTP_OK); } } diff --git a/api/application/helpers/smc_creditpd_helper.php b/api/application/helpers/smc_creditpd_helper.php index 5b04a3b4..65101a57 100644 --- a/api/application/helpers/smc_creditpd_helper.php +++ b/api/application/helpers/smc_creditpd_helper.php @@ -616,7 +616,7 @@ class smc_creditpd { $all_pd_images = $CI->PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $pdid,'isactive' => 1 ),SMC_CREDIT_PD_DOCS); - + if(count($all_pd_images)>0){ // $all_form_names = array('pd_form_id'=>19,'pd_form_name'=>"photograph"); // $form_name[19] = "photograph"; @@ -663,6 +663,7 @@ class smc_creditpd unlink($CI->external_path.'/pd_reports/'.$pdid.'/'.$temp_path); } return $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes'); + }else return ""; } } @@ -694,7 +695,8 @@ class smc_creditpd { $all_pd_images = $CI->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $pdid,'isactive' => 1),SMC_CREDIT_PD_DOCS); // $all_pd_images = $CI->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $pdid,'isactive' => 1),SMC_CREDIT_PD_DOCS); - + if(count($all_pd_images)>0){ + $data_to_view['all_pd_images'] = $all_pd_images; $img_pdf_data = $CI->load->view('report_templates/PDSMCIMG_PDF',$data_to_view,true); //print_r($img_pdf_data);die(); @@ -718,7 +720,10 @@ class smc_creditpd } return $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+7 days'); + } + else return ""; + } - }} + } } ?> \ No newline at end of file