From fa66efe6c88c16aed3c83b4c063ccce4c6ac48e5 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Mon, 1 Jun 2020 18:18:45 +0530 Subject: [PATCH] CUS VIDEO SAVE API --- api/application/config/constants.php | 2 + api/application/config/routes.php | 3 +- api/application/controllers/PD_Controller.php | 72 ++++++++++++++++--- .../JSONTOREPORT_DI_AI_TELE_PD.php | 8 +-- 4 files changed, 69 insertions(+), 16 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 71838bbd..dd2f7100 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -617,5 +617,7 @@ defined('SALESPD_SECTION_DATA') OR define('SALESPD_SECTION_DATA','t_salespd_sect defined('CUS_LINK_META_DATA') OR define('CUS_LINK_META_DATA','t_cus_link_meta_data'); +defined('CUS_VIDEO') OR define('CUS_VIDEO','t_cus_video'); + diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 706bfd3c..b5199f0b 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -224,7 +224,8 @@ $route['getLenderContactPersons'] = 'PD_Controller/getLenderContactPersons'; $route['getLenderContactPersons'] = 'PD_Controller/getLenderContactPersons'; $route['saveApplicantFromGeneralForm'] = 'PD_Controller/saveApplicantFromGeneralForm'; $route['putSalCheck'] = 'PD_Controller/putSalCheck'; -$route['sendCusLinkViaSMS'] = 'PD_Controller/sendCusLinkViaSMS'; +$route['sendCusLinkViaSMS'] = 'PD_Controller/sendCusLinkViaSMS'; +$route['saveCusVideo'] = 'PD_Controller/saveCusVideo'; // $route['getPDFormDetailsJSON'] = 'PD_Controller/getPDFormDetailsJSON'; $route['smartyTestFunction'] = 'PD_Controller/smartyTestFunction'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 687c6e14..3850b980 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -20,7 +20,7 @@ class PD_Controller extends REST_Controller { //class level variable declaration //protected $external_path; - private $photo_names = array('selfie_with_person_met' => array('Person met','18'),'person_met_id' => array('Person met ID Proof','18'),'name_board_seen' => array('Name Board Seen','13'), 'stock_image' => array('Stock image','11'),'attendance_seen_pic' => array('Attendance Img','13'),'attendance_seen_pic' => array('Attendance Img','13'),'client_image' => array('Client Bills','2'),'supplier_image' => array('Supplier Bills','1'),'machinary_image' => array('Machinery Image','22'),'gst_Regn_cert_pic' => array('GST Regn Cert','13'),'pf_regn_pic' => array('PF Regn','13'),'esic_regn_pic' => array('ESIC Regn','13'),'export_import_cert_pic' => array('Export Import Cert','13'),'factory_cert_pic' => array('Factory Cert','13'),'shop_eat_act_cert_pic' => array('Shop Est Act Cert','13'),'eb_bill_pic' => array('EB Bill','13'),'practice_cert_pic' => array('Cert of Practice','13'),'fire_noc_pic' => array('Fire NOC','13')); + private $photo_names = array('selfie_with_person_met' => array('Person met','18'),'person_met_id' => array('Person met ID Proof','18'),'name_board_seen' => array('Name Board Seen','13'), 'stock_image' => array('Stock image','11'),'client_image' => array('Client Bills','2'),'supplier_image' => array('Supplier Bills','1'),'machinary_image' => array('Machinery Image','22'),'gst_Regn_cert_pic' => array('GST Regn Cert','13'),'pf_regn_pic' => array('PF Regn','13'),'esic_regn_pic' => array('ESIC Regn','13'),'export_import_cert_pic' => array('Export Import Cert','13'),'factory_cert_pic' => array('Factory Cert','13'),'shop_eat_act_cert_pic' => array('Shop Est Act Cert','13'),'eb_bill_pic' => array('EB Bill','13'),'practice_cert_pic' => array('Cert of Practice','13'),'fire_noc_pic' => array('Fire NOC','13')); private $existing_imges = array(); function __construct() @@ -7558,27 +7558,29 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() #####Address Form Questions######## $address_form = (json_decode($form_data[5][0]['processed_json'],true)); //print_r($address_form);die(); - + if(!$is_this_tele_pd) + { if(isset($address_form['is_pd_done_on_initiated_address']) && $address_form['is_pd_done_on_initiated_address'] != 1) { - if(!$is_this_tele_pd) - { + // 4 - QNO(1.2) - Comment on locality $score_questions['general']['comment_locality'] = $address_form['alternative_addresses'][0]['comment_locality_master']; // 5 - QNO(1.3) - pd location approach $score_questions['general']['pd_location_approach'] = $address_form['alternative_addresses'][0]['pd_location_master']; - } + } - else //get it from alternative address - { + else //get it from alternative address + { - // 4 - QNO(1.2) - Comment on locality - $score_questions['general']['comment_locality'] = $address_form['addresses'][0]['comment_locality_master']; - // 5 - QNO(1.3) - pd location approach - $score_questions['general']['pd_location_approach'] = $address_form['addresses'][0]['pd_location_master']; + // 4 - QNO(1.2) - Comment on locality + $score_questions['general']['comment_locality'] = $address_form['addresses'][0]['comment_locality_master']; + // 5 - QNO(1.3) - pd location approach + $score_questions['general']['pd_location_approach'] = $address_form['addresses'][0]['pd_location_master']; + + } } @@ -9038,6 +9040,12 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $docs_to_be_collected = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' =>$pd_id),PDDOCSTOBECOLLECTED); //print_r($docs_to_be_collected);//die(); + $pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id); + if($pd_master_details[0]['customer_segment_abbr'] == 'SAL') + { + $this->photo_names['attendance_seen_pic'] = array('Attendance Img','13'); + } + $final_data = array(); $common_images = array(); //print_r(($this->existing_imges));die(); @@ -9239,6 +9247,48 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() } } + + + public function saveCusVideo_post() + { + $records = $this->post('records'); + $id = null; + $pd_master_details = $this->PD_Model->getPDMasterDetails($records['pd_id']); + $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; + $key = 'pd'.$records['pd_id'].'/video/'.$records['filename']; + + + //$temp_file = XLPATH.'/pd_reports/'.$records['pd_id'].'/temp.txt'; + $sourcefile = $_FILES['video_file']['tmp_name']; + // $current_file = fopen($temp_file,'w'); + // fwrite($current_file, $records['video_blob']); + $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$temp_file); + $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); + + if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) + { + log_message('ERROR','###PDVIDEO stored in S3'.$records['pd_id']); + $record_data = array('fk_pd_id' => $records['pd_id'],'video_part_name'=>$records['filename']); + $id = $this->PD_Model->saveRecords($record_data,CUS_VIDEO); + + } + + if($id != null || $id != "") + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['msg'] = 'Video Saved Successfully'; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_FOUND; + $data['msg'] = 'Something Wrong. Try Later!'; + $this->response($data,REST_Controller::HTTP_OK); + } + + } } diff --git a/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php b/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php index 19e38af5..24117e20 100644 --- a/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php +++ b/api/application/views/report_templates/JSONTOREPORT_DI_AI_TELE_PD.php @@ -1109,17 +1109,17 @@ if ( isset($pdf) ) { $address_type = $pd_address['address_type'] == 1? $pd_address['address_type_others'] : $pd_address['address_type_master']; $estimated_area = $pd_address['estimated_area'].' '; $estimated_area .= isset($pd_address['uom_others']) && ($pd_address['uom_others'] != "" || $pd_address['uom_others'] != null) ? $pd_address['uom_others'] : $pd_address['uom_master']; - $locality = $pd_address['locality'] == 1 ? $pd_address['locality_others']: $pd_address['locality_master']; + $locality = $pd_address['locality'] == 1 ? $pd_address['locality_others']: $pd_address['locality_master']; - $locality = preg_match("/^[aeiouAEIOU]/U", $locality) ? 'an '.$locality : 'a '.$locality; - $comment_locality_master = preg_match("/^[aeiouAEIOU]/U", $pd_address['comment_locality_master']) ? 'an '.$pd_address['comment_locality_master'] : 'a '.$pd_address['comment_locality_master']; + $locality = preg_match("/^[aeiouAEIOU]/U", $locality) ? 'an '.$locality : 'a '.$locality; + // $comment_locality_master = preg_match("/^[aeiouAEIOU]/U", $pd_address['comment_locality_master']) ? 'an '.$pd_address['comment_locality_master'] : 'a '.$pd_address['comment_locality_master']; $property_owner_type = $business_assets_details['business_assets_for_address'][0]['business_ownership_type']; if($property_owner_type == 'rented') { $property_owner_type ='Rented (Rent '.$rupee_symbol.' '.$business_assets_details['business_assets_for_address'][0]['business_monthly_rented_amt'].' Per Month)'; }else{$property_owner_type = 'Owned'; } $yrs_being_run = $business_assets_details['business_assets_for_address'][0]['business_years'].' Years'; if($business_assets_details['business_assets_for_address'][0]['business_month'] != ""){ $yrs_being_run.= ' and '.$business_assets_details['business_assets_for_address'][0]['business_month'].' Months';} echo '

'; - echo 'he PD was telephonically done with the loan applicant(s) at '. $address_type. 'Address Form - Type of Address of the loan applicants.'; + echo 'the PD was telephonically done with the loan applicant(s) at '. $address_type. 'Address Form - Type of Address . '; echo 'The '.$address_type.'Address Form - Type of Address is '.$property_owner_type.'Business Assest Form - Owner of the Property and the business has been in operation from here for the last '.$yrs_being_run.'Business Assest Form - Business running Yrs in this premise .'; echo '

The '.$address_type.'Address Form - Type of Address is located in '.$locality.'Address Form - Locality of Address '.($estimated_area != 0? 'and the estimated area of the '.$address_type.'Address Form - Type of Address is '.$estimated_area.'Address Form - Estimated Area .' : ''); // echo '

The PD location was '. $pd_address['pd_location_master'].'Address Form - Approach to PD location . ' . 'As Per PD Officer, the '.$address_type .'Address Form - Type of Address is situated in '.$comment_locality_master .'Address Form - Comment on locality Locality.';