From 6cc57869e75dea7641cdae31dc868bdc8bee9eda Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Thu, 12 Sep 2019 17:41:00 +0530 Subject: [PATCH] CLIX RE CHANGE AND GEN FORM BASE64 SEPERATE --- api/application/config/routes.php | 2 +- api/application/controllers/PD_Controller.php | 160 +++++++++++++++--- api/application/models/PD_Model.php | 1 + .../report_templates/JSONTOREPORT_CLIX.php | 8 +- 4 files changed, 139 insertions(+), 32 deletions(-) diff --git a/api/application/config/routes.php b/api/application/config/routes.php index f53cee9c..b2ad6b7d 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -219,7 +219,7 @@ $route['getPDScore'] = 'PD_Controller/getPDScoreForDisplay'; $route['savePDRemark'] = 'PD_Controller/savePDRemark'; $route['savePDDocsToBeCollected'] = 'PD_Controller/savePDDocsToBeCollected'; $route['getLenderContactPersons'] = 'PD_Controller/getLenderContactPersons'; -// $route['savePDFormDetailsJSON'] = 'PD_Controller/savePDFormDetailsJSON'; +$route['saveApplicantFromGeneralForm'] = 'PD_Controller/saveApplicantFromGeneralForm'; // $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 5ef38649..a0be9f58 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -2359,7 +2359,7 @@ public function assignPDTempalate($data) public function savePDFormDetailsJSON_post() { //ini_set('max_execution_time', 60); - $this->load->helper('INLINEPHOTOTRANSFORM'); + //$this->load->helper('INLINEPHOTOTRANSFORM'); $records = $this->post('records'); $pdid = $records['pdid']; $formid = $records['formid']; @@ -2368,7 +2368,7 @@ public function assignPDTempalate($data) $processed_json = null; $rental_count_id = isset($records['rental_count_id']) ? $records['rental_count_id'] : null; //print_r($records);die(); - $parent_pdid = $records['parent_pdid'];; + $parent_pdid = $records['parent_pdid']; $parent_form_index = null; $parent_forms = $this->config->item('parent_forms'); $additional_pd_id = $pdid; @@ -2376,9 +2376,10 @@ public function assignPDTempalate($data) $logger = MYLOG::logFunction(null,$pdid); $log_info_array['pdid'] = $pdid; $log_info_array['formid'] = $formid; + $log_info_array['payload_size'] = (int) $_SERVER['CONTENT_LENGTH']; $logger->info("SAVE FORM JSON FUNCTION CALLED - ENV (".ENVIRONMENT.")",$log_info_array); - - $inline_forms_photo_status_check = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pdid),T_PD_INLINE_PHOTO_FORM_STATUS); + ///die(); + //$inline_forms_photo_status_check = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pdid),T_PD_INLINE_PHOTO_FORM_STATUS); // print_r($inline_forms_photo_status_check); // echo count($inline_forms_photo_status_check); @@ -2397,22 +2398,17 @@ public function assignPDTempalate($data) } //Save Any New Applicants Details From General Form - if($formid == 18) - { - $records = $this->saveCoApplicantsFromGeneralInfoForm($records); - if(!count($inline_forms_photo_status_check)) - { - $records = INLINEPHOTOTRANSFORM::retransformGeneralFormInlinePhotos($records); - //update general form photos saved once - $this->PD_Model->saveRecords(array('fk_pd_id' => $pdid,'is_general_photo_saved' => 1),T_PD_INLINE_PHOTO_FORM_STATUS); + // if($formid == 18) + // { + // $records = $this->saveCoApplicantsFromGeneralInfoForm($records); + // if(!count($inline_forms_photo_status_check)) + // { + // $records = INLINEPHOTOTRANSFORM::retransformGeneralFormInlinePhotos($records); + // //update general form photos saved once + // $this->PD_Model->saveRecords(array('fk_pd_id' => $pdid,'is_general_photo_saved' => 1),T_PD_INLINE_PHOTO_FORM_STATUS); + // } - - } - - - - - } + // } if($formid == 10) { @@ -2424,11 +2420,11 @@ public function assignPDTempalate($data) { $this->saveEmpSalaryAsBusinessExpensesFromBusinessForm($records); - if(count($inline_forms_photo_status_check) && $inline_forms_photo_status_check[0]['is_business_photo_saved'] != 1) - { - $records = INLINEPHOTOTRANSFORM::retransformBusinessFormInlinePhotos($records); - $this->PD_Model->updateRecords(array('is_business_photo_saved' => 1),T_PD_INLINE_PHOTO_FORM_STATUS,array('fk_pd_id' => $pdid)); - } + // if(count($inline_forms_photo_status_check) && $inline_forms_photo_status_check[0]['is_business_photo_saved'] != 1) + // { + // $records = INLINEPHOTOTRANSFORM::retransformBusinessFormInlinePhotos($records); + // $this->PD_Model->updateRecords(array('is_business_photo_saved' => 1),T_PD_INLINE_PHOTO_FORM_STATUS,array('fk_pd_id' => $pdid)); + // } } if($formid == 22) @@ -2593,6 +2589,7 @@ public function assignPDTempalate($data) public function getPDFormDetailsJSON_post() { + //echo (memory_get_usage()/1024) /1024;die(); $pd_id = $this->post('pd_id'); $pd_form_id = $this->post('pd_form_id'); $parent_pd_id = $this->post('parent_pdid');// ? $this->post('parent_pd_id') : null; @@ -4681,10 +4678,10 @@ public function getPDFormDetailsJSON_post() //Get Common Images $data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid,null,null,'common',null,'report'); - + $temp = 'DEFAULT DATA'; if($data['pd_master_details'][0]['lender_short_name'] == 'CLIX') { - $t = $this->load->view('report_templates/JSONTOREPORT_CLIX',$data,true); + $temp = $this->load->view('report_templates/JSONTOREPORT_CLIX',$data,true); } else if($data['pd_master_details'][0]['customer_segment_abbr'] == 'SE-RI') { @@ -7892,7 +7889,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $person_met_is_applicant_count = 0; $person_met_selfie_count = 0; $person_met_id_proof_count = 0; - + //print_r( $general_form['individuals'] );die(); foreach($general_form['individuals'] as $person) { @@ -8822,4 +8819,113 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() // die(); } + + public function saveApplicantFromGeneralForm_post() + { + $records = $this->post(); + $current_operation = null; + $applicant_id = null; + //print_r($records); + + $applicant_type = $records['is_applicant'] ? 0 : ($records['is_person_met'] ? 3 : ''); + $applicant_details = array('fk_pd_id' => $records['fk_pd_id'],'applicant_name' => $records['applicant_name'],'applicant_title_name' => $records['applicant_title_name'],'applicant_type' => $applicant_type ); + //print_r($applicant_details); + if($records['pd_co_applicant_id'] == " " || $records['pd_co_applicant_id'] == null) + { + $applicant_id = $this->PD_Model->saveRecords($applicant_details,PDAPPLICANTSDETAILS); + $current_operation = 1;// 1 means INSERT + } + else + { + unset($applicant_details['applicant_type']); + $applicant_id = $this->PD_Model->updateRecords($applicant_details,PDAPPLICANTSDETAILS,array('pd_co_applicant_id' => $records['pd_co_applicant_id'])); + $current_operation = 2;// 2 means UPDATE + } + //echo $current_operation.$applicant_id;die(); + if($records['is_person_met']) + { + $img_data = array(); + if($current_operation == 1) + { + + if($records['is_person_met_pic'] != "") + { + $img_data[] = array('Name' => $records['applicant_name'], 'image' => $records['is_person_met_pic'], 'link' => $records['link']); + } + if($records['is_person_met_id_proof'] != "") + { + $img_data[] = array('Name' => ($records['applicant_name'].'-id_proof'), 'image' => $records['is_person_met_id_proof'], 'link' => $records['link']); + } + } + //print_r( $img_data ); + if($current_operation == 2) // Make inactive old entries with same data + { + $sql = 'UPDATE '. PDDOCUMENTS.' SET isactive = 0 where fk_pd_id = '.$records['fk_pd_id']; + $where1 = ''; + $where2 = ''; + if($records['is_person_met_pic'] != "" && !substr_count($records['is_person_met_pic'],'https')) + { + $img_data[] = array('Name' => $records['applicant_name'], 'image' => $records['is_person_met_pic'], 'link' => $records['link']); + $where1 = $records['applicant_name']; + } + if($records['is_person_met_id_proof'] != "" && !substr_count($records['is_person_met_id_proof'],'https')) + { + $img_data[] = array('Name' => ($records['applicant_name'].'-id_proof'), 'image' => $records['is_person_met_id_proof'], 'link' => $records['link']); + $where1 = ($records['applicant_name'].'-id_proof'); + } + + if($where1 != '' || $where2 != '') + { + $sql .= ' and (pd_document_title = ? or pd_document_title = ?)'; + $this->db->query($sql, array($where1, $where2)); + } + } + + + if(count($img_data)) + { + $this->saveBase64Images($records['fk_pd_id'],18,null,null,$img_data); + } + } + + $is_person_met_id_proof = ''; + $is_person_met_pic = ''; + $lender_id = $this->PD_Model->selectCustomRecords(array('fk_lender_id'),array('pd_id' => $records['fk_pd_id']),PDTRIGGER); + $bucket_name = LENDER_BUCKET_NAME_PREFIX.$lender_id[0]['fk_lender_id']; + + $applicant_name = $this->PD_Model->selectCustomRecords(array('pd_document_name'),array('fk_pd_id' => $records['fk_pd_id'],'pd_document_title' => ($records['applicant_name'])),PDDOCUMENTS); + if(count($applicant_name)) + { + $profilepics3path = 'pd'.$records['fk_pd_id'].'/'.($applicant_name[0]['pd_document_name']); + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,'30 minutes'); + $is_person_met_pic = $singed_uri; + } + $applicant_name_id = $this->PD_Model->selectCustomRecords(array('pd_document_name'),array('fk_pd_id' => $records['fk_pd_id'],'pd_document_title' => ($records['applicant_name'].'-id_proof')),PDDOCUMENTS); + if(count($applicant_name_id)) + { + $profilepics3path = 'pd'.$records['fk_pd_id'].'/'.($applicant_name_id[0]['pd_document_name']); + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,'30 minutes'); + $is_person_met_id_proof = $singed_uri; + } + + + if($applicant_id != null) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = array("pd_co_applicant_id" => $applicant_id,"is_person_met_pic" => $is_person_met_pic, "is_person_met_id_proof" => $is_person_met_id_proof); + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + $data['msg'] = 'Data Not Updated, Try one more!'; + $this->response($data,REST_Controller::HTTP_OK); + } + + + //pd_co_applicant_id, fk_pd_id, , applicant_type, mobile_no, landline, email, isactive, addressline1, addressline2, addressline3, fk_city, fk_state, pincode, relation, company_name, applicant_title_name, additional_pd_id + } } \ No newline at end of file diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index ec334f32..019fa81e 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -298,6 +298,7 @@ class PD_Model extends SPARQ_Model { $time = '+5 day'; } //print_r($where_condition_array);die(); + $where_condition_array['isactive'] = 1; $document_lists = $this->selectRecords(PDDOCUMENTS,$where_condition_array); if(count($document_lists)) diff --git a/api/application/views/report_templates/JSONTOREPORT_CLIX.php b/api/application/views/report_templates/JSONTOREPORT_CLIX.php index b5857b80..b451ab9a 100644 --- a/api/application/views/report_templates/JSONTOREPORT_CLIX.php +++ b/api/application/views/report_templates/JSONTOREPORT_CLIX.php @@ -2355,7 +2355,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); // $getService=array(); //$getTotalPaymentsPercentonCredit=array(); $client_first_row = '1Product / Service '; - $client_second_row = '2Contact Person '; + $client_second_row = '2Client Name '; $client_third_row = '3Mobile Number '; $client_fourth_row = '4Landline No'; $client_fifth_row = '5Payment Terms'; @@ -2636,7 +2636,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); } $temp['supplier_first_row'] = '1Item Purchased '.''.$raw['manufacturing_raw_material_name'].''; - $supplier_second_row = '2Contact Person '; + $supplier_second_row = '2Supplier Name '; $supplier_second_row .= isset($raw['person_title_name_master']) ? '' . $raw['person_title_name_master'].' ': '' . ''; $supplier_second_row .= $raw['manufacturing_contact_person_name'] ; @@ -3630,7 +3630,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); ?> -

Personal Banking:

+ @@ -3759,7 +3759,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $residence_text .= (!strcasecmp($fmValue['residence_ownership'],'rented')) ? ' The rent paid '.$rupee_symbol.' '.$fmValue['rent'].' per month.' : ''; $clix_dependency_text = 'There are totally '.$fmValue['no_family_members_clix'].' family members'; - $clix_dependency_text .= isset($fmValue['no_dependents_clix']) && $fmValue['no_dependents_clix'] != 0 ? (' and ' . $fmValue['no_dependents_clix']. ' of them have dependencies on applicant.'): ' and no dependencies.'; + $clix_dependency_text .= isset($fmValue['no_dependents_clix']) && $fmValue['no_dependents_clix'] != 0 ? (' and ' . $fmValue['no_dependents_clix']. ' of them have dependencies on applicant.'): ' and no dependencies on applicant.'; echo $intro_text;echo "

";echo $residence_text;echo "

";echo $clix_dependency_text;