From d9964f977ad4f00ce7aee298d3c100a8de45ca07 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 4 Apr 2022 10:12:40 +0530 Subject: [PATCH 01/34] Google sheet 1 : ps --- api/application/config/routes.php | 4 +- .../controllers/Data_Dump_Controller.php | 259 ++++++++++++++++++ api/application/models/Data_Dump_Model.php | 33 +++ 3 files changed, 295 insertions(+), 1 deletion(-) diff --git a/api/application/config/routes.php b/api/application/config/routes.php index b2829701..fda37078 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -357,4 +357,6 @@ $route['verifyOTP'] = 'User_Management_Controller/verifyOTP'; $route['awsrek/(:any)'] = 'Test/testAwsrek'; $route['optimizeImages/(:num)'] = 'PD_Controller/optimizeImages'; $route['downloadSMCExcelFile/(:num)'] = 'PD_Controller/downloadSMCExcelFile'; -$route['compareFaces'] = 'Test/compareFaces'; \ No newline at end of file +$route['compareFaces'] = 'Test/compareFaces'; + +$route['googleSheet'] = 'Data_Dump_Controller/googleSheet'; \ No newline at end of file diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 1565e80d..3cea4004 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -81,4 +81,263 @@ class Data_Dump_Controller extends REST_Controller { } } + + //[true,"IIB","A50397621","Kamal Kumar Garg","9773522518","M/s Bhawani Matel,,,F-3, Kh. No. 105/72, New Mandoli Industrial Area, East Delhi New Delhi, Delhi-110093","Mukund","50 lacs","LAP PD","Tue Jul 06 16:18:00 GMT+05:30 2021","Fix for tomorrow morning 11-12 Pm...08 June",null,null,null,null] + + public function googleSheet_post(){ + $sheetData = $this->post(); + // $reponse = $this->Data_Dump_Model->GsheetData($sheetData); + $modified = $this->modificationGsheetData($sheetData); + $reponse = $this->Data_Dump_Model->GsheetData($modified); + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['sheetData'] = $sheetData; + $data['modifiedData'] = $modified; + $data['reponseData'] = $reponse; + $this->response($data,REST_Controller::HTTP_OK); + + } + + public function modificationGsheetData($GSdata){ + // echo count($GSdata); + $modifiedData = array(); + $pd_details = array(); + $pd_applicant_details = array(); + $addresses = array(); + // pd_details + // {"fk_lender_id":"42","sub_entity_id":"42","lender_applicant_id":"SR201819351","pd_branch_id":null,"lender_sales_person":"376","lender_credit_person":"350","imgc_fin_institute":null,"fk_product_id":"24","fk_subproduct_id":null,"fk_pd_type":"1","is_notify_enabled":null,"fk_customer_segment":"5","loan_amount":"3000000","addressline1":"Third Floor Right Side Bal K 83-84 Udyan Road Uttam Nagar New Delhi","fk_city":"869","fk_state":"5","pincode":"27491","other_pincode":null,"remarks":null,"pd_status":"TRIGGERED","fk_createdby":"397"} + // pd_applicant_details + // [{"applicant_name":"Ranjit Kumar Sharma","applicant_title_name":"5","company_name":"Kr Tourist Services Pvt Ltd","mobile_no":"9717361459","additional_mobile_no":null,"landline":null,"applicant_type":1,"relation":""}] + // addresses + // [{"addressline1":"Third Floor Right Side Bal K 83-84 Udyan Road Uttam Nagar New Delhi","fk_city":"869","fk_state":"5","pincode":"27491","other_pincode":null}] + for($i=0;$iData_Dump_Model->getId(1,$GSdata[$i]); + $pd_details['fk_lender_id']=$fk_lender_id; + // $pd_details['sub_entity_id'] ="42"; + } + if($i==2 && $GSdata[$i] != ""){ + $modifiedData['lender_applicant_id'] = str_replace(" ", "", $GSdata[$i]); + $pd_details['lender_applicant_id'] =str_replace(" ", "", $GSdata[$i]); + } + $mobile_no = ""; + if($i==4 && $GSdata[$i] != ""){ + $modifiedData['mobileNumber'] = $GSdata[$i]; + $mobile_no = $GSdata[$i]; + } + if($i==3 && $GSdata[$i] != ""){ + $flag = 0; + $companyParts = explode('/', $GSdata[$i]); + if(count($companyParts)>1){ + $applicatantParts = explode(',', $companyParts[0]); + if(count($applicatantParts)>1){ + for($j=0;$j 0){ + $pd_applicant_details[0]['applicant_name'] = $GSdata[$i]; + $modifiedData['pd_applicant_details'][0]['applicant'] = $GSdata[$i]; + } + } + + if($i==5 && $GSdata[$i] != ""){//address section. + $NormalParts = explode(',', $GSdata[$i]); + $stateAndPincode = end($NormalParts); + $splitStateAndPincode = explode('-',$stateAndPincode , 2); + $modifiedData['state'] = $splitStateAndPincode[0]; + $addresses['fk_state']=$this->Data_Dump_Model->getId(5,$splitStateAndPincode[0]); + $modifiedData['pincode'] = $splitStateAndPincode[1]; + $pin = $this->Data_Dump_Model->getId(6,$splitStateAndPincode[1]); + $addresses['pincode'] = ($pin != "" ? $pin : 1); + $addresses['other_pincode']=($pin == "" ? $splitStateAndPincode[1] : null); + $city = array_slice($NormalParts, -2, 1); + $modifiedData['city'] = $city[0]; + $addresses['fk_city']=$this->Data_Dump_Model->getId(7,$city[0]); + array_splice($NormalParts, -2);//removing city state and pincode. + // $reversedParts = explode('-', strrev($GSdata[$i]), 2); + // array_push($result_data["Pincode"],strrev($reversedParts[0])); + // print_r($NormalParts); + // print_r(array_filter($NormalParts));// removing Null values + $modifiedData['address'] = implode(",",array_filter($NormalParts)); + $addresses['addressline1'] = implode(",",array_filter($NormalParts)); + // echo "Original Address : ".$GSdata[$i]; + // echo "Modified Address : ".$address; + } + if($i==6 && $GSdata[$i] != ""){ + $modifiedData['createdPerson'] = $GSdata[$i]; + $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,$GSdata[$i]); + + } + if($i==7 && ($GSdata[$i] != "" || $GSdata[$i] != 0)){ + $amount = strtolower($GSdata[$i]); + $amount = explode(' ', $amount); + // 3 zeros in 1,000 - One Thousand + // 4 zeros in 10,000 - Ten Thousand + // 5 zeros in 100,000 - 1 Lakh / 100 Thousand + // 6 zeros in 1,000,000 - 10 Lakh / 1 Million + // 7 zeros in 10,000,000 - 1 Crore / 10 Million + // 8 zeros in 100,000,000 - 10 Crore / 100 Million + // 9 zeros in 1,000,000,000 - 100 Crore / 1 Billion + // 10 zeros in 10,000,000,000 - 1,000 Crore / 10 Billion + // 11 zeros in 100,000,000,000 - 10,000 Crore / 100 Billion + // 12 zeros in 1,000,000,000,000 - 1 Lakh Crore / 1 Trillion + // 13 zeros in 10,000,000,000,000 - 10 Lakh Crore / 10 Trillion + if(gettype($amount[1]) == 'string'){ + if($amount[1] == 'cr' || $amount[1] == 'crore'){ + $amount[1] = "0000000"; + } + if($amount[1] == 'lac' || $amount[1] == 'lacs' || $amount[1] == 'lakh'){ + $amount[1] = "000000"; + } + if($amount[1] =='k' ||$amount[1] == 'thousand'){ + $amount[1] = "000"; + }} + $modifiedData['loanAmount'] = implode("",$amount); + $pd_details['loan_amount'] = implode("",$amount); + } + if($i==8 && $GSdata[$i] != ""){ + $product = explode('/', $GSdata[$i]); + + if(count($product)>1){ + $modifiedData['product'] = $product[0] ? $product[0] : null; + $modifiedData['subproduct'] = $product[1] ? $product[1] : null ; + $fk_product_id = $this->Data_Dump_Model->getId(2,$product[0]); + $pd_details['fk_product_id'] = $fk_product_id; + $pd_details['fk_subproduct_id'] = $this->Data_Dump_Model->getId(3,$product[1]); + } + else{ + $modifiedData['product'] = $product[0] ? $product[0] : null ; + $fk_product_id = $this->Data_Dump_Model->getId(2,$product[0]); + $pd_details['fk_product_id'] = $product[0] ? $fk_product_id : null ; + } + } + if($i==9 && $GSdata[$i] != ""){ + $type = explode('/', $GSdata[$i]); + $modifiedData['type'] = ($type[0] != "") ? strtoupper(str_replace(' ', '', $type[0])) : "FULLPD"; + if(count($type)>1){ + $pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ; + $modifiedData['customerSegment'] = ($type[1] != "") ? $type[1] : null; + $fk_customer_segment = $this->Data_Dump_Model->getId(4,$modifiedData['customerSegment']); + $pd_details['fk_customer_segment'] = $fk_customer_segment; + }else{ + $pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ; + } + } + if($i==10 && $GSdata[$i] != ""){ + // $modifiedData['date'] = $GSdata[$i]; + $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata[$i])); + $modifiedData['date'] = $new_date_format; + $pd_details['pd_date_of_initiation'] = $new_date_format; + } + if($i==11 && $GSdata[$i] != ""){ + $modifiedData['remarks'] = $GSdata[$i]; + $pd_details['remarks'] = $GSdata[$i]; + } + + } + ## Default Status section; + $pd_details['pd_status'] = TRIGGERED; + + ## Template ID Section. + $fields = array('fk_template_id'); + $where_condition_array = array('fk_lender_id'=>$fk_lender_id ,'fk_product_id'=> $fk_product_id,'fk_customer_segment'=> $fk_customer_segment,'isactive' => 1); + $table = LENDERTEMPLATE; + $choosed_template_id = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,$table); + if(count($choosed_template_id))## CHOOSE FILTERED TEMPLATE + { + $pd_details['fk_pd_template_id'] = $choosed_template_id[0]['fk_template_id']; + } + else ## CHOOSE GENERIC TEMPLATE + { $customer_segment_abbr = $this->PD_Model->selectCustomRecords(array('*'),array('customer_segment_id' => $pd_details['fk_customer_segment'],'isactive' => 1),CUSTOMERSEGMENT); + $customer_segment_abbr = $customer_segment_abbr[0]['abbr']; + if( !strcasecmp($customer_segment_abbr,'SAL'))// || !strcasecmp($customer_segment_abbr,'SAL-CHQ')) + {$pd_details['fk_pd_template_id'] = 1;## SAL-(CASH/CHQ) + } + else if( !strcasecmp($customer_segment_abbr,'SE-DI') || !strcasecmp($customer_segment_abbr,'SEP-DI') || !strcasecmp($customer_segment_abbr,'SEP_INDV')) + {$pd_details['fk_pd_template_id'] = 2;## SENP/SEP-(DI) + } + else if( !strcasecmp($customer_segment_abbr,'SE-AI') || !strcasecmp($customer_segment_abbr,'SEP-AI') ) + {$pd_details['fk_pd_template_id'] = 3;## SENP/SEP-(DI) + } + else if( !strcasecmp($customer_segment_abbr,'SE-RI')) + {$pd_details['fk_pd_template_id'] = 4;## SENP/SEP-(RI) + } + } + + + ## Random URL Section. + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $charactersLength = strlen($characters); + $randomString = ''; + for ($i = 0; $i < 16; $i++) + { + $randomString .= $characters[rand(0, $charactersLength - 1)]; + } + $pd_details['random_string'] = $randomString; + $pd_details['is_notify_enabled'] = 1; + $pd_id = $this->PD_Model->saveRecords($pd_details,PDTRIGGER); + // $pd_id = 0; + if($pd_id != null || $pd_id != '') + { + if($pd_applicant_details != "" || $pd_applicant_details != null) + { + foreach($pd_applicant_details as $pd_applicant_detail) + { + $pd_applicant_detail['fk_pd_id'] = null; + $pd_applicant_detail['applicant_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['applicant_name'])); + $pd_applicant_detail['company_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['company_name'])); + + $co_applicant_id = $this->PD_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS); + if($co_applicant_id != null || $co_applicant_id != '') + { + $count = $count + 1; + } + } + } + } + + + ## Address Section. + // print_r($addresses); + if($pd_id != null || $pd_id != '') + { + if(count($addresses)) + { + foreach($addresses as $address_key => $address) + { + // $address->fk = 7 ; + $address['fk_pd_id'] = $pd_id; + $address['is_primary'] = count($addresses) == 1 ? 1 :0 ; + $address['assigned_pd'] = count($addresses) == 1 ? 0 :null ; + $address_id = $this->PD_Model->saveRecords($address,PDADDRESS); + // if($address_key == 0) + // { + // $temp_address_id = $address_id; + // } + } + }} + // print_r($pd_details); + // print_r($modifiedData); + // print_r($addresses); + // print_r($pd_applicant_details); + // print_r($address); + // die(); + return $pd_id; + } } \ No newline at end of file diff --git a/api/application/models/Data_Dump_Model.php b/api/application/models/Data_Dump_Model.php index beaaee5a..db539205 100755 --- a/api/application/models/Data_Dump_Model.php +++ b/api/application/models/Data_Dump_Model.php @@ -120,4 +120,37 @@ class Data_Dump_Model extends SPARQ_Model { $result['pdid'] = $this->db->select('PDTRIGGER.pd_sno,PDTRIGGER.pd_id')->from(PDTRIGGER.' as PDTRIGGER')->WHERE('PDTRIGGER.pd_status !=',"TRUNCATED")->GET()->result_array(); return $result; } + + public function getId($flag,$keyword){ + // echo "flag".$flag; + $keyword = str_replace(" ", "",$keyword); + if($flag == 1){ + // "entity_id": "16", + // "full_name": "Clix Capital Services Private Limited", + // "short_name": "CLIX", + $select = "entity_id";$table = "m_entity";$where = "short_name";} + if($flag == 2){$select = "product_id"; $table = "m_products"; $where = "abbr";} + if($flag == 3){$select = "subproduct_id"; $table = "m_subproducts"; $where = "abbr";} + if($flag == 4){$select = "customer_segment_id"; $table = "m_customer_segment"; $where = "abbr";} + if($flag ==5 ){$select = "state_id"; $table = "m_states"; $where = "name";} + if($flag ==6 ){$select = "pincode_id";$where = "pincode";$table = "m_pincode";} + if($flag ==7 ){$select = "city_id";$where = "name";$table = "m_city";} + if($flag ==8 ){$select = "userid";$where = "first_name";$table = "m_user_profile";} + + $this->db->select($select); + $this->db->from($table); + $this->db->where($where." LIKE '%$keyword%'"); + $this->db->where("isactive",1); + + $row = $this->db->get()->row(); + if (isset($row)) { + $id = $row->$select; + } else { + $id = ""; + } + return $id; + } + + // public function GsheetData($GSdata){ + // } } \ No newline at end of file From 442f59936febc7d10fe6b67f9e9d090b1923b19d Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 4 Apr 2022 16:11:14 +0530 Subject: [PATCH 02/34] Google sheet 2 : ps --- .../controllers/Data_Dump_Controller.php | 207 ++++++++++++------ api/application/models/Data_Dump_Model.php | 9 +- 2 files changed, 143 insertions(+), 73 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 3cea4004..5757df71 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -85,10 +85,44 @@ class Data_Dump_Controller extends REST_Controller { //[true,"IIB","A50397621","Kamal Kumar Garg","9773522518","M/s Bhawani Matel,,,F-3, Kh. No. 105/72, New Mandoli Industrial Area, East Delhi New Delhi, Delhi-110093","Mukund","50 lacs","LAP PD","Tue Jul 06 16:18:00 GMT+05:30 2021","Fix for tomorrow morning 11-12 Pm...08 June",null,null,null,null] public function googleSheet_post(){ + // $logger = MYLOG::logFunction(null,"Gsheet"); + log_message("G-Sheet Fns Entered"); $sheetData = $this->post(); - // $reponse = $this->Data_Dump_Model->GsheetData($sheetData); - $modified = $this->modificationGsheetData($sheetData); - $reponse = $this->Data_Dump_Model->GsheetData($modified); + if(count($sheetData) > 0){ + $pd_id = $this->modificationGsheetData($sheetData); + if($pd_id != null || $pd_id != '') + { + + log_message("G-Sheet For PD ID : ".$pd_id,array('ENV'=>ENVIRONMENT)); + // PDALERTS::pdnotification($pd_id); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['pdid'] = $pd_id; + $data['records'] = $pd_id; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + log_message("G-Sheet SomeThing went Wrong mistake on Gsheet-data PDID not Founded"); + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = "Some thing went wrong"; + $this->response($data,REST_Controller::HTTP_OK); + } + }else{ + log_message("G-Sheet Data Not Founded"); + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = "Some thing went wrong !"; + $this->response($data,REST_Controller::HTTP_OK); + } + // if($reponse){ + // $data['dataStatus'] = true; + // $data['status'] = REST_Controller::HTTP_OK; + // $data['pdid'] = $reponse; + // $data['sheetData'] = $sheetData; + // $data['modifiedData'] = $modified; + // } $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; @@ -100,7 +134,8 @@ class Data_Dump_Controller extends REST_Controller { } public function modificationGsheetData($GSdata){ - // echo count($GSdata); + // $logger = MYLOG::logFunction(null,"Gsheet"); + log_message("G-Sheet For PD Step 1 (G-sheet Data)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata)); $modifiedData = array(); $pd_details = array(); $pd_applicant_details = array(); @@ -112,63 +147,60 @@ class Data_Dump_Controller extends REST_Controller { // addresses // [{"addressline1":"Third Floor Right Side Bal K 83-84 Udyan Road Uttam Nagar New Delhi","fk_city":"869","fk_state":"5","pincode":"27491","other_pincode":null}] for($i=0;$iENVIRONMENT,'MSG' => "INSIDE for Loop")); if($i==1 && $GSdata[$i] != ""){ $modifiedData['lender'] = $GSdata[$i]; $fk_lender_id = $this->Data_Dump_Model->getId(1,$GSdata[$i]); $pd_details['fk_lender_id']=$fk_lender_id; - // $pd_details['sub_entity_id'] ="42"; + $pd_details['sub_entity_id']=$fk_lender_id; + log_message("G-Sheet For PD Step 2.1 (First Cell lender/casebookedin)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['lender'],'PDDetails'=>$pd_details)); } if($i==2 && $GSdata[$i] != ""){ $modifiedData['lender_applicant_id'] = str_replace(" ", "", $GSdata[$i]); $pd_details['lender_applicant_id'] =str_replace(" ", "", $GSdata[$i]); - } - $mobile_no = ""; - if($i==4 && $GSdata[$i] != ""){ - $modifiedData['mobileNumber'] = $GSdata[$i]; - $mobile_no = $GSdata[$i]; + log_message("G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'PDDetails'=>$pd_details)); } if($i==3 && $GSdata[$i] != ""){ - $flag = 0; - $companyParts = explode('/', $GSdata[$i]); - if(count($companyParts)>1){ - $applicatantParts = explode(',', $companyParts[0]); - if(count($applicatantParts)>1){ - for($j=0;$j1){ + for($j=0;$j 0){ - $pd_applicant_details[0]['applicant_name'] = $GSdata[$i]; - $modifiedData['pd_applicant_details'][0]['applicant'] = $GSdata[$i]; - } + $pd_applicant_details[0]['mobile_no'] = $GSdata[4] ? $GSdata[4] : null; + $modifiedData['pd_applicant_details'][0]['mobile_no'] = $GSdata[4] ? $GSdata[4] : null; + $pd_applicant_details[0]['applicant_type'] = 1; + $modifiedData['pd_applicant_details'][0]['applicant_type'] = 1; + log_message("G-Sheet For PD Step 2.3 (Third Cell applicantdetails)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'Applicants'=>$pd_applicant_details)); } - + if($i==4 && $GSdata[$i] != ""){ $modifiedData['mobileNumber'] = $GSdata[$i]; + log_message("G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['mobileNumber']));} if($i==5 && $GSdata[$i] != ""){//address section. $NormalParts = explode(',', $GSdata[$i]); $stateAndPincode = end($NormalParts); $splitStateAndPincode = explode('-',$stateAndPincode , 2); $modifiedData['state'] = $splitStateAndPincode[0]; $addresses['fk_state']=$this->Data_Dump_Model->getId(5,$splitStateAndPincode[0]); + $pd_details['fk_state'] =$addresses['fk_state']; $modifiedData['pincode'] = $splitStateAndPincode[1]; $pin = $this->Data_Dump_Model->getId(6,$splitStateAndPincode[1]); $addresses['pincode'] = ($pin != "" ? $pin : 1); + $pd_details['pincode'] = $addresses['pincode']; $addresses['other_pincode']=($pin == "" ? $splitStateAndPincode[1] : null); + $pd_details['other_pincode'] = $addresses['other_pincode']; $city = array_slice($NormalParts, -2, 1); $modifiedData['city'] = $city[0]; $addresses['fk_city']=$this->Data_Dump_Model->getId(7,$city[0]); + $pd_details['fk_city']=$addresses['fk_city']; array_splice($NormalParts, -2);//removing city state and pincode. // $reversedParts = explode('-', strrev($GSdata[$i]), 2); // array_push($result_data["Pincode"],strrev($reversedParts[0])); @@ -176,13 +208,15 @@ class Data_Dump_Controller extends REST_Controller { // print_r(array_filter($NormalParts));// removing Null values $modifiedData['address'] = implode(",",array_filter($NormalParts)); $addresses['addressline1'] = implode(",",array_filter($NormalParts)); + $pd_details['addressline1']=$addresses['addressline1']; // echo "Original Address : ".$GSdata[$i]; // echo "Modified Address : ".$address; + log_message("G-Sheet For PD Step 2.5 (Fifth Cell address)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['mobileNumber'],'PDDetails'=>$pd_details,'Address'=>$addresses)); } if($i==6 && $GSdata[$i] != ""){ $modifiedData['createdPerson'] = $GSdata[$i]; $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,$GSdata[$i]); - + log_message("G-Sheet For PD Step 2.6 (Sixth Cell createdPerson)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['createdPerson'],'PDDetails'=>$pd_details)); } if($i==7 && ($GSdata[$i] != "" || $GSdata[$i] != 0)){ $amount = strtolower($GSdata[$i]); @@ -210,6 +244,7 @@ class Data_Dump_Controller extends REST_Controller { }} $modifiedData['loanAmount'] = implode("",$amount); $pd_details['loan_amount'] = implode("",$amount); + log_message("G-Sheet For PD Step 2.7 (Seventh Cell Amount)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['loanAmount'],'PDDetails'=>$pd_details)); } if($i==8 && $GSdata[$i] != ""){ $product = explode('/', $GSdata[$i]); @@ -226,6 +261,7 @@ class Data_Dump_Controller extends REST_Controller { $fk_product_id = $this->Data_Dump_Model->getId(2,$product[0]); $pd_details['fk_product_id'] = $product[0] ? $fk_product_id : null ; } + log_message("G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'PDDetails'=>$pd_details)); } if($i==9 && $GSdata[$i] != ""){ $type = explode('/', $GSdata[$i]); @@ -238,19 +274,23 @@ class Data_Dump_Controller extends REST_Controller { }else{ $pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ; } + log_message("G-Sheet For PD Step 2.9 (ninth Cell type/cs)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'PDDetails'=>$pd_details)); } if($i==10 && $GSdata[$i] != ""){ // $modifiedData['date'] = $GSdata[$i]; $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata[$i])); $modifiedData['date'] = $new_date_format; $pd_details['pd_date_of_initiation'] = $new_date_format; + log_message("G-Sheet For PD Step 2.10 (tenth Cell initiationdate)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['date'],'PDDetails'=>$pd_details)); } if($i==11 && $GSdata[$i] != ""){ $modifiedData['remarks'] = $GSdata[$i]; $pd_details['remarks'] = $GSdata[$i]; + log_message("G-Sheet For PD Step 2.11 (eleventh Cell Remarks)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$GSdata[$i],'PDDetails'=>$pd_details)); } } + ## Default Status section; $pd_details['pd_status'] = TRIGGERED; @@ -258,13 +298,13 @@ class Data_Dump_Controller extends REST_Controller { $fields = array('fk_template_id'); $where_condition_array = array('fk_lender_id'=>$fk_lender_id ,'fk_product_id'=> $fk_product_id,'fk_customer_segment'=> $fk_customer_segment,'isactive' => 1); $table = LENDERTEMPLATE; - $choosed_template_id = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,$table); + $choosed_template_id = $this->Data_Dump_Model->selectCustomRecords($fields,$where_condition_array,$table); if(count($choosed_template_id))## CHOOSE FILTERED TEMPLATE { $pd_details['fk_pd_template_id'] = $choosed_template_id[0]['fk_template_id']; } else ## CHOOSE GENERIC TEMPLATE - { $customer_segment_abbr = $this->PD_Model->selectCustomRecords(array('*'),array('customer_segment_id' => $pd_details['fk_customer_segment'],'isactive' => 1),CUSTOMERSEGMENT); + { $customer_segment_abbr = $this->Data_Dump_Model->selectCustomRecords(array('*'),array('customer_segment_id' => $pd_details['fk_customer_segment'],'isactive' => 1),CUSTOMERSEGMENT); $customer_segment_abbr = $customer_segment_abbr[0]['abbr']; if( !strcasecmp($customer_segment_abbr,'SAL'))// || !strcasecmp($customer_segment_abbr,'SAL-CHQ')) {$pd_details['fk_pd_template_id'] = 1;## SAL-(CASH/CHQ) @@ -291,53 +331,82 @@ class Data_Dump_Controller extends REST_Controller { } $pd_details['random_string'] = $randomString; $pd_details['is_notify_enabled'] = 1; - $pd_id = $this->PD_Model->saveRecords($pd_details,PDTRIGGER); - // $pd_id = 0; + log_message("G-Sheet For PD Step 3 (Before Inserting Trigger)",array('ENV'=>ENVIRONMENT,'DATA' => $pd_details)); + try { + $pd_id = $this->Data_Dump_Model->saveRecords($pd_details,PDTRIGGER); + log_message("G-Sheet For PD Step 4 (PDID gotten)",array('ENV'=>ENVIRONMENT,'PDID' => $pd_id)); + if(empty($pd_id)) { + throw new Exception('Error On Inserting TRIGGER details'); + } + } catch (Exception $e) { + log_message("G-Sheet For PD Step 4 (PDID gotten)",array('ENV'=>ENVIRONMENT,'ERR' => $e->getMessage())); + var_dump($e->getMessage()); + } + // $pd_id = 3073; + + if($pd_id != null || $pd_id != '') { if($pd_applicant_details != "" || $pd_applicant_details != null) { + log_message("G-Sheet For PD Step 5 (applicant)",array('ENV'=>ENVIRONMENT,'Applicant' => $pd_applicant_details)); foreach($pd_applicant_details as $pd_applicant_detail) { - $pd_applicant_detail['fk_pd_id'] = null; + $pd_applicant_detail['fk_pd_id'] = $pd_id; $pd_applicant_detail['applicant_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['applicant_name'])); - $pd_applicant_detail['company_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['company_name'])); - - $co_applicant_id = $this->PD_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS); - if($co_applicant_id != null || $co_applicant_id != '') - { - $count = $count + 1; - } + if($pd_applicant_detail['company_name']){ $pd_applicant_detail['company_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['company_name'])); } + try { + $co_applicant_id = $this->Data_Dump_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS); + log_message("G-Sheet For PD Step 5.1 (applicant pkid)",array('ENV'=>ENVIRONMENT,'Applicant-ID' => $co_applicant_id)); + if(empty($co_applicant_id)) { + throw new Exception('Error On Inserting Applicant details'); + } + } catch (Exception $e) { + //alert the user. + log_message("G-Sheet For PD Step 5.1 (applicant pkid)",array('ENV'=>ENVIRONMENT,'ERR' => $e->getMessage())); + var_dump($e->getMessage()); + } + } + } } - ## Address Section. - // print_r($addresses); - if($pd_id != null || $pd_id != '') - { - if(count($addresses)) - { - foreach($addresses as $address_key => $address) - { - // $address->fk = 7 ; - $address['fk_pd_id'] = $pd_id; - $address['is_primary'] = count($addresses) == 1 ? 1 :0 ; - $address['assigned_pd'] = count($addresses) == 1 ? 0 :null ; - $address_id = $this->PD_Model->saveRecords($address,PDADDRESS); - // if($address_key == 0) - // { - // $temp_address_id = $address_id; - // } - } - }} + if($pd_id != ""){ + $addresses['fk_pd_id'] = $pd_id; + $addresses['is_primary'] = 1 ; + $addresses['assigned_pd'] = $pd_id; + try { + $address_id = $this->Data_Dump_Model->saveRecords($addresses,PDADDRESS); + log_message("G-Sheet For PD Step 6 (Addresses)",array('ENV'=>ENVIRONMENT,'addresses' => $addresses,"addressId"=>$address_id)); + if(empty($address_id)) { + throw new Exception('Error On Inserting Adresses details'); + } + } catch (Exception $e) { + log_message("G-Sheet For PD Step 6 (Addresses)",array('ENV'=>ENVIRONMENT,'ERR'=>$e->getMessage())); + var_dump($e->getMessage()); + } + $triggertbl_records = array('fk_primary_address_id'=>$address_id,'fk_address_id'=>$address_id); + + try { + $this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)); + log_message("G-Sheet For PD Step 7 (updateAddresses in trigger)",array('ENV'=>ENVIRONMENT)); + if(empty($this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)))) { + throw new Exception('Error On updated Adresses Details in trigger table'); + } + } catch (Exception $e) { + //alert the user. + log_message("G-Sheet For PD Step 7 (updateAddresses in trigger)",array('ENV'=>ENVIRONMENT,'ERR'=>$e->getMessage())); + var_dump($e->getMessage()); + } + } + // print_r($pd_details); // print_r($modifiedData); // print_r($addresses); // print_r($pd_applicant_details); - // print_r($address); - // die(); + // die(); return $pd_id; } } \ No newline at end of file diff --git a/api/application/models/Data_Dump_Model.php b/api/application/models/Data_Dump_Model.php index db539205..f492128d 100755 --- a/api/application/models/Data_Dump_Model.php +++ b/api/application/models/Data_Dump_Model.php @@ -123,14 +123,15 @@ class Data_Dump_Model extends SPARQ_Model { public function getId($flag,$keyword){ // echo "flag".$flag; - $keyword = str_replace(" ", "",$keyword); + $value = str_replace(" ", "",$keyword); if($flag == 1){ // "entity_id": "16", // "full_name": "Clix Capital Services Private Limited", // "short_name": "CLIX", $select = "entity_id";$table = "m_entity";$where = "short_name";} if($flag == 2){$select = "product_id"; $table = "m_products"; $where = "abbr";} - if($flag == 3){$select = "subproduct_id"; $table = "m_subproducts"; $where = "abbr";} + if($flag == 3){$value = $keyword; + $select = "subproduct_id"; $table = "m_subproducts"; $where = "abbr";} if($flag == 4){$select = "customer_segment_id"; $table = "m_customer_segment"; $where = "abbr";} if($flag ==5 ){$select = "state_id"; $table = "m_states"; $where = "name";} if($flag ==6 ){$select = "pincode_id";$where = "pincode";$table = "m_pincode";} @@ -139,9 +140,9 @@ class Data_Dump_Model extends SPARQ_Model { $this->db->select($select); $this->db->from($table); - $this->db->where($where." LIKE '%$keyword%'"); + $this->db->where($where." LIKE '%$value%'"); $this->db->where("isactive",1); - + // print_r($this->db->last_query());die(); $row = $this->db->get()->row(); if (isset($row)) { $id = $row->$select; From 265118f2c2d1e0334a8f6f844a4dca44ed97dc15 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 4 Apr 2022 16:53:59 +0530 Subject: [PATCH 03/34] Google sheet 3 : ps --- .../controllers/Data_Dump_Controller.php | 67 ++++++++++--------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 5757df71..bb089022 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -86,14 +86,14 @@ class Data_Dump_Controller extends REST_Controller { public function googleSheet_post(){ // $logger = MYLOG::logFunction(null,"Gsheet"); - log_message("G-Sheet Fns Entered"); + log_message("info","G-Sheet Fns Entered"); $sheetData = $this->post(); if(count($sheetData) > 0){ $pd_id = $this->modificationGsheetData($sheetData); if($pd_id != null || $pd_id != '') { - log_message("G-Sheet For PD ID : ".$pd_id,array('ENV'=>ENVIRONMENT)); + log_message("info","G-Sheet For PD ID : ".$pd_id); // PDALERTS::pdnotification($pd_id); $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; @@ -103,14 +103,14 @@ class Data_Dump_Controller extends REST_Controller { } else { - log_message("G-Sheet SomeThing went Wrong mistake on Gsheet-data PDID not Founded"); + log_message("info","G-Sheet SomeThing went Wrong mistake on Gsheet-data PDID not Founded"); $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['msg'] = "Some thing went wrong"; $this->response($data,REST_Controller::HTTP_OK); } }else{ - log_message("G-Sheet Data Not Founded"); + log_message("info","G-Sheet Data Not Founded"); $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['msg'] = "Some thing went wrong !"; @@ -133,9 +133,9 @@ class Data_Dump_Controller extends REST_Controller { } - public function modificationGsheetData($GSdata){ + public function modificationGsheetData($GSdata){ // $logger = MYLOG::logFunction(null,"Gsheet"); - log_message("G-Sheet For PD Step 1 (G-sheet Data)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata)); + log_message("info","G-Sheet For PD Step 1 (G-sheet Data)"); $modifiedData = array(); $pd_details = array(); $pd_applicant_details = array(); @@ -147,18 +147,18 @@ class Data_Dump_Controller extends REST_Controller { // addresses // [{"addressline1":"Third Floor Right Side Bal K 83-84 Udyan Road Uttam Nagar New Delhi","fk_city":"869","fk_state":"5","pincode":"27491","other_pincode":null}] for($i=0;$iENVIRONMENT,'MSG' => "INSIDE for Loop")); + log_message("G-Sheet For PD Step 2 (Processing data for-loop)"); if($i==1 && $GSdata[$i] != ""){ $modifiedData['lender'] = $GSdata[$i]; $fk_lender_id = $this->Data_Dump_Model->getId(1,$GSdata[$i]); $pd_details['fk_lender_id']=$fk_lender_id; $pd_details['sub_entity_id']=$fk_lender_id; - log_message("G-Sheet For PD Step 2.1 (First Cell lender/casebookedin)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['lender'],'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender']." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); } if($i==2 && $GSdata[$i] != ""){ $modifiedData['lender_applicant_id'] = str_replace(" ", "", $GSdata[$i]); $pd_details['lender_applicant_id'] =str_replace(" ", "", $GSdata[$i]); - log_message("G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender_applicant_id']." PD :".$pd_details['lender_applicant_id']); } if($i==3 && $GSdata[$i] != ""){ $applicatantParts = explode(',',$GSdata[$i]); @@ -180,10 +180,12 @@ class Data_Dump_Controller extends REST_Controller { $modifiedData['pd_applicant_details'][0]['mobile_no'] = $GSdata[4] ? $GSdata[4] : null; $pd_applicant_details[0]['applicant_type'] = 1; $modifiedData['pd_applicant_details'][0]['applicant_type'] = 1; - log_message("G-Sheet For PD Step 2.3 (Third Cell applicantdetails)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'Applicants'=>$pd_applicant_details)); + log_message("G-Sheet For PD Step 2.3 (Third Cell applicantdetails) GSheet data : ".$GSdata[$i]); + //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==4 && $GSdata[$i] != ""){ $modifiedData['mobileNumber'] = $GSdata[$i]; - log_message("G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['mobileNumber']));} + log_message("G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber) GSheet data : ".$GSdata[$i]); + //." Modify : ".$modifiedData." PD :".$pd_details);} if($i==5 && $GSdata[$i] != ""){//address section. $NormalParts = explode(',', $GSdata[$i]); $stateAndPincode = end($NormalParts); @@ -211,12 +213,14 @@ class Data_Dump_Controller extends REST_Controller { $pd_details['addressline1']=$addresses['addressline1']; // echo "Original Address : ".$GSdata[$i]; // echo "Modified Address : ".$address; - log_message("G-Sheet For PD Step 2.5 (Fifth Cell address)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['mobileNumber'],'PDDetails'=>$pd_details,'Address'=>$addresses)); + log_message("G-Sheet For PD Step 2.5 (Fifth Cell address) GSheet data : ".$GSdata[$i]); + //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==6 && $GSdata[$i] != ""){ $modifiedData['createdPerson'] = $GSdata[$i]; $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,$GSdata[$i]); - log_message("G-Sheet For PD Step 2.6 (Sixth Cell createdPerson)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['createdPerson'],'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata[$i]); + // ." Modify : ".$modifiedData." PD :".$pd_details); } if($i==7 && ($GSdata[$i] != "" || $GSdata[$i] != 0)){ $amount = strtolower($GSdata[$i]); @@ -244,7 +248,7 @@ class Data_Dump_Controller extends REST_Controller { }} $modifiedData['loanAmount'] = implode("",$amount); $pd_details['loan_amount'] = implode("",$amount); - log_message("G-Sheet For PD Step 2.7 (Seventh Cell Amount)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['loanAmount'],'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.7 (Seventh Cell Amount) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['loanAmount']." PD :".$pd_details['loan_amount']); } if($i==8 && $GSdata[$i] != ""){ $product = explode('/', $GSdata[$i]); @@ -261,7 +265,8 @@ class Data_Dump_Controller extends REST_Controller { $fk_product_id = $this->Data_Dump_Model->getId(2,$product[0]); $pd_details['fk_product_id'] = $product[0] ? $fk_product_id : null ; } - log_message("G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct) GSheet data : ".$GSdata[$i]); + //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==9 && $GSdata[$i] != ""){ $type = explode('/', $GSdata[$i]); @@ -274,19 +279,19 @@ class Data_Dump_Controller extends REST_Controller { }else{ $pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ; } - log_message("G-Sheet For PD Step 2.9 (ninth Cell type/cs)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.9 (ninth Cell type/cs) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['type']." PD :".$pd_details['fk_pd_type']); } if($i==10 && $GSdata[$i] != ""){ // $modifiedData['date'] = $GSdata[$i]; $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata[$i])); $modifiedData['date'] = $new_date_format; $pd_details['pd_date_of_initiation'] = $new_date_format; - log_message("G-Sheet For PD Step 2.10 (tenth Cell initiationdate)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['date'],'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['date']." PD :".$pd_details['pd_date_of_initiation']); } if($i==11 && $GSdata[$i] != ""){ $modifiedData['remarks'] = $GSdata[$i]; $pd_details['remarks'] = $GSdata[$i]; - log_message("G-Sheet For PD Step 2.11 (eleventh Cell Remarks)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$GSdata[$i],'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['remarks']." PD :".$pd_details['remarks']); } } @@ -331,15 +336,16 @@ class Data_Dump_Controller extends REST_Controller { } $pd_details['random_string'] = $randomString; $pd_details['is_notify_enabled'] = 1; - log_message("G-Sheet For PD Step 3 (Before Inserting Trigger)",array('ENV'=>ENVIRONMENT,'DATA' => $pd_details)); + log_message("G-Sheet For PD Step 3 (Before Inserting Trigger)"); + // PDdetails :".$pd_details); try { $pd_id = $this->Data_Dump_Model->saveRecords($pd_details,PDTRIGGER); - log_message("G-Sheet For PD Step 4 (PDID gotten)",array('ENV'=>ENVIRONMENT,'PDID' => $pd_id)); + log_message("G-Sheet For PD Step 4 (PDID gotten) PDID : ".$pd_id); if(empty($pd_id)) { throw new Exception('Error On Inserting TRIGGER details'); } } catch (Exception $e) { - log_message("G-Sheet For PD Step 4 (PDID gotten)",array('ENV'=>ENVIRONMENT,'ERR' => $e->getMessage())); + log_message("G-Sheet For PD Step 4 (PDID gotten) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } // $pd_id = 3073; @@ -349,7 +355,8 @@ class Data_Dump_Controller extends REST_Controller { { if($pd_applicant_details != "" || $pd_applicant_details != null) { - log_message("G-Sheet For PD Step 5 (applicant)",array('ENV'=>ENVIRONMENT,'Applicant' => $pd_applicant_details)); + log_message("G-Sheet For PD Step 5 (applicant)"); + // Applicant : ".$pd_applicant_details); foreach($pd_applicant_details as $pd_applicant_detail) { $pd_applicant_detail['fk_pd_id'] = $pd_id; @@ -357,13 +364,13 @@ class Data_Dump_Controller extends REST_Controller { if($pd_applicant_detail['company_name']){ $pd_applicant_detail['company_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['company_name'])); } try { $co_applicant_id = $this->Data_Dump_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS); - log_message("G-Sheet For PD Step 5.1 (applicant pkid)",array('ENV'=>ENVIRONMENT,'Applicant-ID' => $co_applicant_id)); + log_message("G-Sheet For PD Step 5.1 (applicant pkid) Applicant-ID : ".$co_applicant_id); if(empty($co_applicant_id)) { throw new Exception('Error On Inserting Applicant details'); } } catch (Exception $e) { //alert the user. - log_message("G-Sheet For PD Step 5.1 (applicant pkid)",array('ENV'=>ENVIRONMENT,'ERR' => $e->getMessage())); + log_message("G-Sheet For PD Step 5.1 (applicant pkid) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } @@ -379,29 +386,29 @@ class Data_Dump_Controller extends REST_Controller { $addresses['assigned_pd'] = $pd_id; try { $address_id = $this->Data_Dump_Model->saveRecords($addresses,PDADDRESS); - log_message("G-Sheet For PD Step 6 (Addresses)",array('ENV'=>ENVIRONMENT,'addresses' => $addresses,"addressId"=>$address_id)); + log_message("G-Sheet For PD Step 6 (Addresses) addressId : ".$address_id); if(empty($address_id)) { throw new Exception('Error On Inserting Adresses details'); } } catch (Exception $e) { - log_message("G-Sheet For PD Step 6 (Addresses)",array('ENV'=>ENVIRONMENT,'ERR'=>$e->getMessage())); + log_message("G-Sheet For PD Step 6 (Addresses) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } $triggertbl_records = array('fk_primary_address_id'=>$address_id,'fk_address_id'=>$address_id); try { $this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)); - log_message("G-Sheet For PD Step 7 (updateAddresses in trigger)",array('ENV'=>ENVIRONMENT)); + log_message("G-Sheet For PD Step 7 (updateAddresses in trigger)"); if(empty($this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)))) { throw new Exception('Error On updated Adresses Details in trigger table'); } } catch (Exception $e) { //alert the user. - log_message("G-Sheet For PD Step 7 (updateAddresses in trigger)",array('ENV'=>ENVIRONMENT,'ERR'=>$e->getMessage())); + log_message("G-Sheet For PD Step 7 (updateAddresses in trigger) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } } - + } // print_r($pd_details); // print_r($modifiedData); // print_r($addresses); @@ -409,4 +416,4 @@ class Data_Dump_Controller extends REST_Controller { // die(); return $pd_id; } -} \ No newline at end of file + } From ed251779009be9400a8a67e1138c88f62a964125 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 4 Apr 2022 17:27:34 +0530 Subject: [PATCH 04/34] Google sheet 4 : ps --- .../controllers/Data_Dump_Controller.php | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index bb089022..5143a3cf 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -185,7 +185,8 @@ class Data_Dump_Controller extends REST_Controller { } if($i==4 && $GSdata[$i] != ""){ $modifiedData['mobileNumber'] = $GSdata[$i]; log_message("G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber) GSheet data : ".$GSdata[$i]); - //." Modify : ".$modifiedData." PD :".$pd_details);} + //." Modify : ".$modifiedData." PD :".$pd_details); + } if($i==5 && $GSdata[$i] != ""){//address section. $NormalParts = explode(',', $GSdata[$i]); $stateAndPincode = end($NormalParts); @@ -344,10 +345,10 @@ class Data_Dump_Controller extends REST_Controller { if(empty($pd_id)) { throw new Exception('Error On Inserting TRIGGER details'); } - } catch (Exception $e) { + } catch (Exception $e) { log_message("G-Sheet For PD Step 4 (PDID gotten) ERR : ".$e->getMessage()); var_dump($e->getMessage()); - } + } // $pd_id = 3073; @@ -368,11 +369,11 @@ class Data_Dump_Controller extends REST_Controller { if(empty($co_applicant_id)) { throw new Exception('Error On Inserting Applicant details'); } - } catch (Exception $e) { + } catch (Exception $e) { //alert the user. log_message("G-Sheet For PD Step 5.1 (applicant pkid) ERR : ".$e->getMessage()); var_dump($e->getMessage()); - } + } } @@ -390,10 +391,10 @@ class Data_Dump_Controller extends REST_Controller { if(empty($address_id)) { throw new Exception('Error On Inserting Adresses details'); } - } catch (Exception $e) { + } catch (Exception $e) { log_message("G-Sheet For PD Step 6 (Addresses) ERR : ".$e->getMessage()); var_dump($e->getMessage()); - } + } $triggertbl_records = array('fk_primary_address_id'=>$address_id,'fk_address_id'=>$address_id); try { @@ -402,13 +403,12 @@ class Data_Dump_Controller extends REST_Controller { if(empty($this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)))) { throw new Exception('Error On updated Adresses Details in trigger table'); } - } catch (Exception $e) { + } catch (Exception $e) { //alert the user. log_message("G-Sheet For PD Step 7 (updateAddresses in trigger) ERR : ".$e->getMessage()); var_dump($e->getMessage()); - } - } - } + } + } // print_r($pd_details); // print_r($modifiedData); // print_r($addresses); @@ -416,4 +416,4 @@ class Data_Dump_Controller extends REST_Controller { // die(); return $pd_id; } - } +} \ No newline at end of file From 8ea2beb02acc4df01580dec770b21434f9327063 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 4 Apr 2022 17:33:20 +0530 Subject: [PATCH 05/34] log message mistake : ps --- .../controllers/Data_Dump_Controller.php | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 5143a3cf..6942ca69 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -147,18 +147,18 @@ class Data_Dump_Controller extends REST_Controller { // addresses // [{"addressline1":"Third Floor Right Side Bal K 83-84 Udyan Road Uttam Nagar New Delhi","fk_city":"869","fk_state":"5","pincode":"27491","other_pincode":null}] for($i=0;$iData_Dump_Model->getId(1,$GSdata[$i]); $pd_details['fk_lender_id']=$fk_lender_id; $pd_details['sub_entity_id']=$fk_lender_id; - log_message("G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender']." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); + log_message("info","G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender']." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); } if($i==2 && $GSdata[$i] != ""){ $modifiedData['lender_applicant_id'] = str_replace(" ", "", $GSdata[$i]); $pd_details['lender_applicant_id'] =str_replace(" ", "", $GSdata[$i]); - log_message("G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender_applicant_id']." PD :".$pd_details['lender_applicant_id']); + log_message("info","G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender_applicant_id']." PD :".$pd_details['lender_applicant_id']); } if($i==3 && $GSdata[$i] != ""){ $applicatantParts = explode(',',$GSdata[$i]); @@ -180,11 +180,11 @@ class Data_Dump_Controller extends REST_Controller { $modifiedData['pd_applicant_details'][0]['mobile_no'] = $GSdata[4] ? $GSdata[4] : null; $pd_applicant_details[0]['applicant_type'] = 1; $modifiedData['pd_applicant_details'][0]['applicant_type'] = 1; - log_message("G-Sheet For PD Step 2.3 (Third Cell applicantdetails) GSheet data : ".$GSdata[$i]); + log_message("info","G-Sheet For PD Step 2.3 (Third Cell applicantdetails) GSheet data : ".$GSdata[$i]); //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==4 && $GSdata[$i] != ""){ $modifiedData['mobileNumber'] = $GSdata[$i]; - log_message("G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber) GSheet data : ".$GSdata[$i]); + log_message("info","G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber) GSheet data : ".$GSdata[$i]); //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==5 && $GSdata[$i] != ""){//address section. @@ -214,13 +214,13 @@ class Data_Dump_Controller extends REST_Controller { $pd_details['addressline1']=$addresses['addressline1']; // echo "Original Address : ".$GSdata[$i]; // echo "Modified Address : ".$address; - log_message("G-Sheet For PD Step 2.5 (Fifth Cell address) GSheet data : ".$GSdata[$i]); + log_message("info","G-Sheet For PD Step 2.5 (Fifth Cell address) GSheet data : ".$GSdata[$i]); //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==6 && $GSdata[$i] != ""){ $modifiedData['createdPerson'] = $GSdata[$i]; $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,$GSdata[$i]); - log_message("G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata[$i]); + log_message("info","G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata[$i]); // ." Modify : ".$modifiedData." PD :".$pd_details); } if($i==7 && ($GSdata[$i] != "" || $GSdata[$i] != 0)){ @@ -249,7 +249,7 @@ class Data_Dump_Controller extends REST_Controller { }} $modifiedData['loanAmount'] = implode("",$amount); $pd_details['loan_amount'] = implode("",$amount); - log_message("G-Sheet For PD Step 2.7 (Seventh Cell Amount) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['loanAmount']." PD :".$pd_details['loan_amount']); + log_message("info","G-Sheet For PD Step 2.7 (Seventh Cell Amount) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['loanAmount']." PD :".$pd_details['loan_amount']); } if($i==8 && $GSdata[$i] != ""){ $product = explode('/', $GSdata[$i]); @@ -266,7 +266,7 @@ class Data_Dump_Controller extends REST_Controller { $fk_product_id = $this->Data_Dump_Model->getId(2,$product[0]); $pd_details['fk_product_id'] = $product[0] ? $fk_product_id : null ; } - log_message("G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct) GSheet data : ".$GSdata[$i]); + log_message("info","G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct) GSheet data : ".$GSdata[$i]); //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==9 && $GSdata[$i] != ""){ @@ -280,19 +280,19 @@ class Data_Dump_Controller extends REST_Controller { }else{ $pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ; } - log_message("G-Sheet For PD Step 2.9 (ninth Cell type/cs) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['type']." PD :".$pd_details['fk_pd_type']); + log_message("info","G-Sheet For PD Step 2.9 (ninth Cell type/cs) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['type']." PD :".$pd_details['fk_pd_type']); } if($i==10 && $GSdata[$i] != ""){ // $modifiedData['date'] = $GSdata[$i]; $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata[$i])); $modifiedData['date'] = $new_date_format; $pd_details['pd_date_of_initiation'] = $new_date_format; - log_message("G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['date']." PD :".$pd_details['pd_date_of_initiation']); + log_message("info","G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['date']." PD :".$pd_details['pd_date_of_initiation']); } if($i==11 && $GSdata[$i] != ""){ $modifiedData['remarks'] = $GSdata[$i]; $pd_details['remarks'] = $GSdata[$i]; - log_message("G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['remarks']." PD :".$pd_details['remarks']); + log_message("info","G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['remarks']." PD :".$pd_details['remarks']); } } @@ -337,16 +337,16 @@ class Data_Dump_Controller extends REST_Controller { } $pd_details['random_string'] = $randomString; $pd_details['is_notify_enabled'] = 1; - log_message("G-Sheet For PD Step 3 (Before Inserting Trigger)"); + log_message("info","G-Sheet For PD Step 3 (Before Inserting Trigger)"); // PDdetails :".$pd_details); try { $pd_id = $this->Data_Dump_Model->saveRecords($pd_details,PDTRIGGER); - log_message("G-Sheet For PD Step 4 (PDID gotten) PDID : ".$pd_id); + log_message("info","G-Sheet For PD Step 4 (PDID gotten) PDID : ".$pd_id); if(empty($pd_id)) { throw new Exception('Error On Inserting TRIGGER details'); } } catch (Exception $e) { - log_message("G-Sheet For PD Step 4 (PDID gotten) ERR : ".$e->getMessage()); + log_message("info","G-Sheet For PD Step 4 (PDID gotten) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } // $pd_id = 3073; @@ -356,7 +356,7 @@ class Data_Dump_Controller extends REST_Controller { { if($pd_applicant_details != "" || $pd_applicant_details != null) { - log_message("G-Sheet For PD Step 5 (applicant)"); + log_message("info","G-Sheet For PD Step 5 (applicant)"); // Applicant : ".$pd_applicant_details); foreach($pd_applicant_details as $pd_applicant_detail) { @@ -365,13 +365,13 @@ class Data_Dump_Controller extends REST_Controller { if($pd_applicant_detail['company_name']){ $pd_applicant_detail['company_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['company_name'])); } try { $co_applicant_id = $this->Data_Dump_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS); - log_message("G-Sheet For PD Step 5.1 (applicant pkid) Applicant-ID : ".$co_applicant_id); + log_message("info","G-Sheet For PD Step 5.1 (applicant pkid) Applicant-ID : ".$co_applicant_id); if(empty($co_applicant_id)) { throw new Exception('Error On Inserting Applicant details'); } } catch (Exception $e) { //alert the user. - log_message("G-Sheet For PD Step 5.1 (applicant pkid) ERR : ".$e->getMessage()); + log_message("info","G-Sheet For PD Step 5.1 (applicant pkid) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } @@ -387,25 +387,25 @@ class Data_Dump_Controller extends REST_Controller { $addresses['assigned_pd'] = $pd_id; try { $address_id = $this->Data_Dump_Model->saveRecords($addresses,PDADDRESS); - log_message("G-Sheet For PD Step 6 (Addresses) addressId : ".$address_id); + log_message("info","G-Sheet For PD Step 6 (Addresses) addressId : ".$address_id); if(empty($address_id)) { throw new Exception('Error On Inserting Adresses details'); } } catch (Exception $e) { - log_message("G-Sheet For PD Step 6 (Addresses) ERR : ".$e->getMessage()); + log_message("info","G-Sheet For PD Step 6 (Addresses) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } $triggertbl_records = array('fk_primary_address_id'=>$address_id,'fk_address_id'=>$address_id); try { $this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)); - log_message("G-Sheet For PD Step 7 (updateAddresses in trigger)"); + log_message("info","G-Sheet For PD Step 7 (updateAddresses in trigger)"); if(empty($this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)))) { throw new Exception('Error On updated Adresses Details in trigger table'); } } catch (Exception $e) { //alert the user. - log_message("G-Sheet For PD Step 7 (updateAddresses in trigger) ERR : ".$e->getMessage()); + log_message("info","G-Sheet For PD Step 7 (updateAddresses in trigger) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } } From da2db735b5e712dc00160aef84bcfb1c3e57a641 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 6 Apr 2022 11:49:47 +0530 Subject: [PATCH 06/34] smartpd-report enqueued check removed : ps --- api/application/controllers/PD_Controller.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index e469958b..d163c127 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4919,14 +4919,14 @@ public function getPDFormDetailsJSON_post() $data['msg'] = isset($data['msg']) ? ($data['msg'] . 'Image ZIP'.', ') : 'Image ZIP, '; } - if($pd_master_details[0]['fk_pd_type'] == 2) - { - $video_status = $this->PD_Model->selectCustomRecords(array('count(*) as count'),array('isactive' => 1,'twilo_status' => 'enqueued','fk_pd_id' => $pdid),VIDEO_ROOM_INFO); - if($video_status[0]['count'] != 0) - { - $data['msg'] = isset($data['msg']) ? ($data['msg'] . 'Some videos'.', ') : 'Some videos, '; - } - } + // if($pd_master_details[0]['fk_pd_type'] == 2) + // { + // $video_status = $this->PD_Model->selectCustomRecords(array('count(*) as count'),array('isactive' => 1,'twilo_status' => 'enqueued','fk_pd_id' => $pdid),VIDEO_ROOM_INFO); + // if($video_status[0]['count'] != 0) + // { + // $data['msg'] = isset($data['msg']) ? ($data['msg'] . 'Some videos'.', ') : 'Some videos, '; + // } + // } // print_r($data); // echo strrpos($data['msg'], ','); if(isset($data['msg']) && $data['msg'] != '') From b479e7f99a1e35cbf93c89cdf63998dd6b5aca43 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 6 Apr 2022 23:05:20 +0530 Subject: [PATCH 07/34] templatev2 form displayed issues fixes : ps --- .../Template_Management_Controller.php | 29 +++++++++++++++---- .../models/Template_Management_Model.php | 20 ++++++++++++- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index 2cdfbacc..3422b7ff 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -939,6 +939,7 @@ class Template_Management_Controller extends REST_Controller { $records['customer_segment_id'] = $this->get("customer_segment_id");} $result_array = $this->Template_Management_Model->getTemplateMappingDetailsV2($records); + // print_r($result_array);die(); if(!empty($result_array)) foreach($result_array as $inx => $arr) { @@ -1045,6 +1046,7 @@ class Template_Management_Controller extends REST_Controller { $this->response($data,REST_Controller::HTTP_OK); }else{ $fields = array('id'); + $flag=0; $where_condition_array = $records; $where_condition_array['isactive'] = 1; $map_table = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATE_MAP_V2); @@ -1052,19 +1054,34 @@ class Template_Management_Controller extends REST_Controller { // $this->db->where('id',$map_table[0]['id']); // $this->db->set('isactive',0); // $this->db->update(TEMPLATE_MAP_V2); - $map_pk_id = (int)$map_table[0]['id']; - $msg = "Data Already Available For Given Params"; + // $map_pk_id = (int)$map_table[0]['id']; + $msg = "Data Already Available For Given Params / MAPID => ".(int)$map_table[0]['id']; + $STScode = REST_Controller::HTTP_ACCEPTED; + $flag++; }else{ + // form Template is declare as gobally in m_pd_forms table @form_template column using CustomerSegmentID. + $form_template = $this->Template_Management_Model->GetFormTemplate($records['customer_segment_id']); $map_pk_id = $this->Template_Management_Model->saveTemplateMapping($records,TEMPLATE_MAP_V2); + $c = "JSON ID Are =>"; //concate; + for($i=0; $i $form_template[$i]['form_id'],'json' => $template,'map_id'=>$map_pk_id,'is_form_status'=>"DRAFT"); + $json_pk_id = $this->Template_Management_Model->saveTemplateMapping($fields,TEMPLATE_JSON_V2); + $c = $c." ".$json_pk_id; + } + } $msg = "Sucessfully Inserted"; + $flag++; + $STScode = REST_Controller::HTTP_CREATED; } - - if($map_pk_id) + if($flag>0) { $data['dataStatus'] = true; - $data['status'] = REST_Controller::HTTP_OK; - $data['map_id'] = $map_pk_id; + $data['status'] = $STScode; + if(isset($map_pk_id)){$data['map_id'] = $map_pk_id;} + if(isset($c)){$data['json_id'] = $c;} $data['msg'] = $msg; $this->response($data,REST_Controller::HTTP_OK); } diff --git a/api/application/models/Template_Management_Model.php b/api/application/models/Template_Management_Model.php index 571e5cd6..d9f40e61 100644 --- a/api/application/models/Template_Management_Model.php +++ b/api/application/models/Template_Management_Model.php @@ -310,6 +310,7 @@ class Template_Management_Model extends SPARQ_Model { } } $result = $this->db->GET()->result_array(); + // print_r($this->db->last_query());die(); return $result; } @@ -332,7 +333,7 @@ class Template_Management_Model extends SPARQ_Model { FROM `m_template_json_v2` as `TEMPLATE_JSON_V2` LEFT JOIN `m_pd_forms` as `PDFORMS` ON `TEMPLATE_JSON_V2`.`form_id` = `PDFORMS`.`pd_form_id` WHERE `TEMPLATE_JSON_V2`.`isactive` = 1 - AND `TEMPLATE_JSON_V2`.`map_id` = ".$value." + AND `TEMPLATE_JSON_V2`.`id` = ".$value." AND `PDFORMS`.`is_business_form` = 0 AND `TEMPLATE_JSON_V2`.`is_form_status` = 'COMPLETED' @@ -341,6 +342,7 @@ class Template_Management_Model extends SPARQ_Model { or `TEMPLATE_JSON_V2`.`is_form_status` = 'DRAFT' ORDER BY `PDFORMS`.`pd_form_order`"; + // print_r($sql_query);die(); return $this->db->query($sql_query)->result_array(); } @@ -407,4 +409,20 @@ class Template_Management_Model extends SPARQ_Model { } + public function getFormTemplate($csID){ + // $sql_query = "'DRAFT'"; + $sql_query = "SELECT m_template_forms.form_id,m_pd_forms.form_template + FROM m_template_forms + JOIN m_template + on m_template_forms.fk_template_id = m_template.template_id and m_template_forms.isactive = 1 + JOIN m_pd_forms + on m_pd_forms.pd_form_id = m_template_forms.form_id and m_pd_forms.isactive = 1 + WHERE fk_customer_segment like '%`".$csID."`%' and m_template.isactive = 1 "; + // and form_template != ''"; + $result = $this->db->query($sql_query)->result_array(); + // print_r($result); + // print_r($sql_query);die(); + return $result; + } + } \ No newline at end of file From 8198485db671de6da099c817d97ac537f54fc144 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Thu, 7 Apr 2022 13:30:05 +0530 Subject: [PATCH 08/34] Template Form Status fixes : ps --- .../controllers/Template_Management_Controller.php | 5 +++-- api/application/models/Template_Management_Model.php | 9 ++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index 3422b7ff..c6939e76 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -1067,13 +1067,14 @@ class Template_Management_Controller extends REST_Controller { $template = $form_template[$i]['form_template']; if($template != null || $template != ""){ $fields = array('form_id' => $form_template[$i]['form_id'],'json' => $template,'map_id'=>$map_pk_id,'is_form_status'=>"DRAFT"); + if($form_template[$i]['form_id'] != 13 || $form_template[$i]['form_id'] != 18 ||$form_template[$i]['form_id'] != 26){ $json_pk_id = $this->Template_Management_Model->saveTemplateMapping($fields,TEMPLATE_JSON_V2); - $c = $c." ".$json_pk_id; + $c = $c." ".$json_pk_id;} } } $msg = "Sucessfully Inserted"; $flag++; - $STScode = REST_Controller::HTTP_CREATED; + $STScode = REST_Controller::HTTP_OK; } if($flag>0) diff --git a/api/application/models/Template_Management_Model.php b/api/application/models/Template_Management_Model.php index d9f40e61..b40e7ec8 100644 --- a/api/application/models/Template_Management_Model.php +++ b/api/application/models/Template_Management_Model.php @@ -327,22 +327,21 @@ class Template_Management_Model extends SPARQ_Model { // $this->db->ORDER_BY('PDFORMS.pd_form_order'); // $result = $this->db->GET()->result_array(); // return $result; - $sql_query = "SELECT `TEMPLATE_JSON_V2`.`id` as `template_id`, `TEMPLATE_JSON_V2`.`form_id`, `PDFORMS`.`pd_form_name` as `form_name`, + $sql_query = "SELECT `TEMPLATE_JSON_V2`.`map_id`,`TEMPLATE_JSON_V2`.`id` as `template_id`, `TEMPLATE_JSON_V2`.`form_id`, `PDFORMS`.`pd_form_name` as `form_name`, `TEMPLATE_JSON_V2`.`json`, `TEMPLATE_JSON_V2`.`is_form_disabled`, `PDFORMS`.`is_business_form`, `TEMPLATE_JSON_V2`.`is_group_form`, `PDFORMS`.`pd_form_order`, `TEMPLATE_JSON_V2`.`is_form_status` FROM `m_template_json_v2` as `TEMPLATE_JSON_V2` LEFT JOIN `m_pd_forms` as `PDFORMS` ON `TEMPLATE_JSON_V2`.`form_id` = `PDFORMS`.`pd_form_id` WHERE `TEMPLATE_JSON_V2`.`isactive` = 1 - AND `TEMPLATE_JSON_V2`.`id` = ".$value." + AND `TEMPLATE_JSON_V2`.`map_id` = ".$value." AND `PDFORMS`.`is_business_form` = 0 - AND + AND ( `TEMPLATE_JSON_V2`.`is_form_status` = 'COMPLETED' or `TEMPLATE_JSON_V2`.`is_form_status` = 'APPROVED' or - `TEMPLATE_JSON_V2`.`is_form_status` = 'DRAFT' + `TEMPLATE_JSON_V2`.`is_form_status` = 'DRAFT' ) ORDER BY `PDFORMS`.`pd_form_order`"; - // print_r($sql_query);die(); return $this->db->query($sql_query)->result_array(); } From d25f1cdc0685f9fe7149feb30026070256d863ae Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Thu, 7 Apr 2022 08:20:06 +0000 Subject: [PATCH 09/34] Template_Management_Controller.php edited online with Bitbucket --- api/application/controllers/Template_Management_Controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index c6939e76..8e605ddd 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -1067,7 +1067,7 @@ class Template_Management_Controller extends REST_Controller { $template = $form_template[$i]['form_template']; if($template != null || $template != ""){ $fields = array('form_id' => $form_template[$i]['form_id'],'json' => $template,'map_id'=>$map_pk_id,'is_form_status'=>"DRAFT"); - if($form_template[$i]['form_id'] != 13 || $form_template[$i]['form_id'] != 18 ||$form_template[$i]['form_id'] != 26){ + if($form_template[$i]['form_id'] != 18 ||$form_template[$i]['form_id'] != 26){ $json_pk_id = $this->Template_Management_Model->saveTemplateMapping($fields,TEMPLATE_JSON_V2); $c = $c." ".$json_pk_id;} } From 7fab15e45f3012df0e2ecfac7f5d8142ea1cd1d1 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Fri, 8 Apr 2022 10:45:47 +0530 Subject: [PATCH 10/34] GS-logmessages added : ps --- .../controllers/Data_Dump_Controller.php | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 6942ca69..2567fc8b 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -86,14 +86,14 @@ class Data_Dump_Controller extends REST_Controller { public function googleSheet_post(){ // $logger = MYLOG::logFunction(null,"Gsheet"); - log_message("info","G-Sheet Fns Entered"); + log_message('ERROR','#/# G-Sheet Fns Entered - '.date('Y-m-d H:i:s A')); $sheetData = $this->post(); + log_message('ERROR','#/# Params Are - '.$this->post()); if(count($sheetData) > 0){ $pd_id = $this->modificationGsheetData($sheetData); if($pd_id != null || $pd_id != '') - { - - log_message("info","G-Sheet For PD ID : ".$pd_id); + { + log_message('ERROR',"#/# G-Sheet For PD ID : ".$pd_id); // PDALERTS::pdnotification($pd_id); $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; @@ -135,7 +135,7 @@ class Data_Dump_Controller extends REST_Controller { public function modificationGsheetData($GSdata){ // $logger = MYLOG::logFunction(null,"Gsheet"); - log_message("info","G-Sheet For PD Step 1 (G-sheet Data)"); + log_message('ERROR',"G-Sheet For PD Step 1 (G-sheet Data)"); $modifiedData = array(); $pd_details = array(); $pd_applicant_details = array(); @@ -147,18 +147,18 @@ class Data_Dump_Controller extends REST_Controller { // addresses // [{"addressline1":"Third Floor Right Side Bal K 83-84 Udyan Road Uttam Nagar New Delhi","fk_city":"869","fk_state":"5","pincode":"27491","other_pincode":null}] for($i=0;$iData_Dump_Model->getId(1,$GSdata[$i]); $pd_details['fk_lender_id']=$fk_lender_id; $pd_details['sub_entity_id']=$fk_lender_id; - log_message("info","G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender']." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); + log_message('ERROR',"G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender']." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); } if($i==2 && $GSdata[$i] != ""){ $modifiedData['lender_applicant_id'] = str_replace(" ", "", $GSdata[$i]); $pd_details['lender_applicant_id'] =str_replace(" ", "", $GSdata[$i]); - log_message("info","G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender_applicant_id']." PD :".$pd_details['lender_applicant_id']); + log_message('ERROR',"G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender_applicant_id']." PD :".$pd_details['lender_applicant_id']); } if($i==3 && $GSdata[$i] != ""){ $applicatantParts = explode(',',$GSdata[$i]); @@ -180,11 +180,11 @@ class Data_Dump_Controller extends REST_Controller { $modifiedData['pd_applicant_details'][0]['mobile_no'] = $GSdata[4] ? $GSdata[4] : null; $pd_applicant_details[0]['applicant_type'] = 1; $modifiedData['pd_applicant_details'][0]['applicant_type'] = 1; - log_message("info","G-Sheet For PD Step 2.3 (Third Cell applicantdetails) GSheet data : ".$GSdata[$i]); + log_message('ERROR',"G-Sheet For PD Step 2.3 (Third Cell applicantdetails) GSheet data : ".$GSdata[$i]); //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==4 && $GSdata[$i] != ""){ $modifiedData['mobileNumber'] = $GSdata[$i]; - log_message("info","G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber) GSheet data : ".$GSdata[$i]); + log_message('ERROR',"G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber) GSheet data : ".$GSdata[$i]); //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==5 && $GSdata[$i] != ""){//address section. @@ -214,13 +214,13 @@ class Data_Dump_Controller extends REST_Controller { $pd_details['addressline1']=$addresses['addressline1']; // echo "Original Address : ".$GSdata[$i]; // echo "Modified Address : ".$address; - log_message("info","G-Sheet For PD Step 2.5 (Fifth Cell address) GSheet data : ".$GSdata[$i]); + log_message('ERROR',"G-Sheet For PD Step 2.5 (Fifth Cell address) GSheet data : ".$GSdata[$i]); //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==6 && $GSdata[$i] != ""){ $modifiedData['createdPerson'] = $GSdata[$i]; $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,$GSdata[$i]); - log_message("info","G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata[$i]); + log_message('ERROR',"G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata[$i]); // ." Modify : ".$modifiedData." PD :".$pd_details); } if($i==7 && ($GSdata[$i] != "" || $GSdata[$i] != 0)){ @@ -249,7 +249,7 @@ class Data_Dump_Controller extends REST_Controller { }} $modifiedData['loanAmount'] = implode("",$amount); $pd_details['loan_amount'] = implode("",$amount); - log_message("info","G-Sheet For PD Step 2.7 (Seventh Cell Amount) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['loanAmount']." PD :".$pd_details['loan_amount']); + log_message('ERROR',"G-Sheet For PD Step 2.7 (Seventh Cell Amount) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['loanAmount']." PD :".$pd_details['loan_amount']); } if($i==8 && $GSdata[$i] != ""){ $product = explode('/', $GSdata[$i]); @@ -266,7 +266,7 @@ class Data_Dump_Controller extends REST_Controller { $fk_product_id = $this->Data_Dump_Model->getId(2,$product[0]); $pd_details['fk_product_id'] = $product[0] ? $fk_product_id : null ; } - log_message("info","G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct) GSheet data : ".$GSdata[$i]); + log_message('ERROR',"G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct) GSheet data : ".$GSdata[$i]); //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==9 && $GSdata[$i] != ""){ @@ -280,19 +280,19 @@ class Data_Dump_Controller extends REST_Controller { }else{ $pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ; } - log_message("info","G-Sheet For PD Step 2.9 (ninth Cell type/cs) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['type']." PD :".$pd_details['fk_pd_type']); + log_message('ERROR',"G-Sheet For PD Step 2.9 (ninth Cell type/cs) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['type']." PD :".$pd_details['fk_pd_type']); } if($i==10 && $GSdata[$i] != ""){ // $modifiedData['date'] = $GSdata[$i]; $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata[$i])); $modifiedData['date'] = $new_date_format; $pd_details['pd_date_of_initiation'] = $new_date_format; - log_message("info","G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['date']." PD :".$pd_details['pd_date_of_initiation']); + log_message('ERROR',"G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['date']." PD :".$pd_details['pd_date_of_initiation']); } if($i==11 && $GSdata[$i] != ""){ $modifiedData['remarks'] = $GSdata[$i]; $pd_details['remarks'] = $GSdata[$i]; - log_message("info","G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['remarks']." PD :".$pd_details['remarks']); + log_message('ERROR',"G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['remarks']." PD :".$pd_details['remarks']); } } @@ -337,16 +337,16 @@ class Data_Dump_Controller extends REST_Controller { } $pd_details['random_string'] = $randomString; $pd_details['is_notify_enabled'] = 1; - log_message("info","G-Sheet For PD Step 3 (Before Inserting Trigger)"); + log_message('ERROR',"G-Sheet For PD Step 3 (Before Inserting Trigger)"); // PDdetails :".$pd_details); try { $pd_id = $this->Data_Dump_Model->saveRecords($pd_details,PDTRIGGER); - log_message("info","G-Sheet For PD Step 4 (PDID gotten) PDID : ".$pd_id); + log_message('ERROR',"G-Sheet For PD Step 4 (PDID gotten) PDID : ".$pd_id); if(empty($pd_id)) { throw new Exception('Error On Inserting TRIGGER details'); } } catch (Exception $e) { - log_message("info","G-Sheet For PD Step 4 (PDID gotten) ERR : ".$e->getMessage()); + log_message('ERROR',"G-Sheet For PD Step 4 (PDID gotten) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } // $pd_id = 3073; @@ -356,7 +356,7 @@ class Data_Dump_Controller extends REST_Controller { { if($pd_applicant_details != "" || $pd_applicant_details != null) { - log_message("info","G-Sheet For PD Step 5 (applicant)"); + log_message('ERROR',"G-Sheet For PD Step 5 (applicant)"); // Applicant : ".$pd_applicant_details); foreach($pd_applicant_details as $pd_applicant_detail) { @@ -365,13 +365,13 @@ class Data_Dump_Controller extends REST_Controller { if($pd_applicant_detail['company_name']){ $pd_applicant_detail['company_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['company_name'])); } try { $co_applicant_id = $this->Data_Dump_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS); - log_message("info","G-Sheet For PD Step 5.1 (applicant pkid) Applicant-ID : ".$co_applicant_id); + log_message('ERROR',"G-Sheet For PD Step 5.1 (applicant pkid) Applicant-ID : ".$co_applicant_id); if(empty($co_applicant_id)) { throw new Exception('Error On Inserting Applicant details'); } } catch (Exception $e) { //alert the user. - log_message("info","G-Sheet For PD Step 5.1 (applicant pkid) ERR : ".$e->getMessage()); + log_message('ERROR',"G-Sheet For PD Step 5.1 (applicant pkid) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } @@ -387,25 +387,25 @@ class Data_Dump_Controller extends REST_Controller { $addresses['assigned_pd'] = $pd_id; try { $address_id = $this->Data_Dump_Model->saveRecords($addresses,PDADDRESS); - log_message("info","G-Sheet For PD Step 6 (Addresses) addressId : ".$address_id); + log_message('ERROR',"G-Sheet For PD Step 6 (Addresses) addressId : ".$address_id); if(empty($address_id)) { throw new Exception('Error On Inserting Adresses details'); } } catch (Exception $e) { - log_message("info","G-Sheet For PD Step 6 (Addresses) ERR : ".$e->getMessage()); + log_message('ERROR',"G-Sheet For PD Step 6 (Addresses) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } $triggertbl_records = array('fk_primary_address_id'=>$address_id,'fk_address_id'=>$address_id); try { $this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)); - log_message("info","G-Sheet For PD Step 7 (updateAddresses in trigger)"); + log_message('ERROR',"G-Sheet For PD Step 7 (updateAddresses in trigger)"); if(empty($this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)))) { throw new Exception('Error On updated Adresses Details in trigger table'); } } catch (Exception $e) { //alert the user. - log_message("info","G-Sheet For PD Step 7 (updateAddresses in trigger) ERR : ".$e->getMessage()); + log_message('ERROR',"G-Sheet For PD Step 7 (updateAddresses in trigger) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } } @@ -414,6 +414,7 @@ class Data_Dump_Controller extends REST_Controller { // print_r($addresses); // print_r($pd_applicant_details); // die(); + log_message('ERROR',"#/# G-Sheet Final PDID : ".$pd_id); return $pd_id; } } \ No newline at end of file From a0c2f60726da10f0e4ddc057e63d49bd975936f6 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Fri, 8 Apr 2022 12:06:46 +0530 Subject: [PATCH 11/34] buiness form available check : ps --- .../controllers/Data_Dump_Controller.php | 2 +- .../Template_Management_Controller.php | 3 +- .../models/Template_Management_Model.php | 30 +++++++++++++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 2567fc8b..bb1e3a0b 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -88,7 +88,7 @@ class Data_Dump_Controller extends REST_Controller { // $logger = MYLOG::logFunction(null,"Gsheet"); log_message('ERROR','#/# G-Sheet Fns Entered - '.date('Y-m-d H:i:s A')); $sheetData = $this->post(); - log_message('ERROR','#/# Params Are - '.$this->post()); + // log_message('ERROR','#/# Params Are - '.$sheetData); if(count($sheetData) > 0){ $pd_id = $this->modificationGsheetData($sheetData); if($pd_id != null || $pd_id != '') diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index 8e605ddd..de7aff24 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -952,7 +952,8 @@ class Template_Management_Controller extends REST_Controller { }else{ $result_array[$inx]["forms"] = array(); } - array_push($result_array[$inx]["forms"],array("form_id"=> "13","form_name"=> "Business Information","json"=> "","is_form_disabled"=> "0","is_business_form"=> "1","is_group_form"=> "1","pd_form_order"=>"5","is_form_status"=>null,"template_id"=>null)); + $buinessFormAvailable =$this->Template_Management_Model->checkBuinessFormsAvailablity($records); + if($buinessFormAvailable){array_push($result_array[$inx]["forms"],array("form_id"=> "13","form_name"=> "Business Information","json"=> "","is_form_disabled"=> "0","is_business_form"=> "1","is_group_form"=> "1","pd_form_order"=>"5","is_form_status"=>null,"template_id"=>null));} array_push($result_array[$inx]["forms"],array("form_id"=> "18","form_name"=> "General Information","json"=> "","is_form_disabled"=> "0","is_business_form"=> "0","is_group_form"=> "0","pd_form_order"=>"2","is_form_status"=>null,"template_id"=>null)); array_push($result_array[$inx]["forms"],array("form_id"=> "26","form_name"=> "Photograph","json"=> "","is_form_disabled"=> "0","is_business_form"=> "0","is_group_form"=> "0","pd_form_order"=>"24","is_form_status"=>null,"template_id"=>null)); // $buiness_arr = array("form_id"=> "13","form_name"=> "Business Information","json"=> "","is_form_disabled"=> "0","is_business_form"=> "1","is_group_form"=> "1"); diff --git a/api/application/models/Template_Management_Model.php b/api/application/models/Template_Management_Model.php index b40e7ec8..8d1afde5 100644 --- a/api/application/models/Template_Management_Model.php +++ b/api/application/models/Template_Management_Model.php @@ -344,6 +344,32 @@ class Template_Management_Model extends SPARQ_Model { ORDER BY `PDFORMS`.`pd_form_order`"; return $this->db->query($sql_query)->result_array(); } + + public function checkBuinessFormsAvailablity($records){ + $Availablity = false; + if(!empty($records['customer_segment_id'])){ + $cs_id = $cs_id; + }else{ + $this->db->select('customer_segment_id'); + $this->db->from(TEMPLATE_MAP_V2); + $this->db->where('id',$records['map_id']); + $this->db->where('isactive',1); + $query = $this->db->get(); + if ($query->num_rows() > 0) { + $cs_id = $query->row()->customer_segment_id; + } + } + if($cs_id){ + $arr = $this->getFormTemplate($cs_id); + for($i=0; $idb->insert($table, $records); @@ -391,9 +417,9 @@ class Template_Management_Model extends SPARQ_Model { WHERE `TEMPLATE_JSON_V2`.`map_id` = ".$map_id." AND `PDFORMS`.`is_business_form` = 1 AND `TEMPLATE_JSON_V2`.`isactive` = 1 - AND `TEMPLATE_JSON_V2`.`is_form_status` = 'COMPLETED' + AND (`TEMPLATE_JSON_V2`.`is_form_status` = 'COMPLETED' OR `TEMPLATE_JSON_V2`.`is_form_status` = 'APPROVED' - OR `TEMPLATE_JSON_V2`.`is_form_status` = 'DRAFT'"; + OR `TEMPLATE_JSON_V2`.`is_form_status` = 'DRAFT')"; $result = $this->db->query($sql_query)->result_array(); }else{ $this->db->SELECT('TEMPLATE_JSON_V2.id as template_id,TEMPLATE_JSON_V2.form_id,PDFORMS.pd_form_order,PDFORMS.pd_form_level_order,PDFORMS.pd_form_name as form_name,TEMPLATE_JSON_V2.is_form_disabled,PDFORMS.is_business_form,TEMPLATE_JSON_V2.is_group_form,TEMPLATE_JSON_V2.is_form_status'); From f5750782ce907c5fb2ac7c45b328fe3ba72cab96 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 8 Apr 2022 06:55:04 +0000 Subject: [PATCH 12/34] buiness check : ps --- api/application/controllers/Template_Management_Controller.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index de7aff24..e9f7d810 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -1068,7 +1068,8 @@ class Template_Management_Controller extends REST_Controller { $template = $form_template[$i]['form_template']; if($template != null || $template != ""){ $fields = array('form_id' => $form_template[$i]['form_id'],'json' => $template,'map_id'=>$map_pk_id,'is_form_status'=>"DRAFT"); - if($form_template[$i]['form_id'] != 18 ||$form_template[$i]['form_id'] != 26){ + // if($form_template[$i]['form_id'] != 18 ||$form_template[$i]['form_id'] != 26){ + if($form_template[$i]['form_id'] != 18 ||$form_template[$i]['form_id'] != 26 ||$form_template[$i]['form_id'] != 13){ $json_pk_id = $this->Template_Management_Model->saveTemplateMapping($fields,TEMPLATE_JSON_V2); $c = $c." ".$json_pk_id;} } From b5e74123db678f38d2a0f709a7b66d22d7b23086 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Fri, 8 Apr 2022 14:45:19 +0530 Subject: [PATCH 13/34] Google sheet 5: ps --- .../controllers/Data_Dump_Controller.php | 40 ++++++++++--------- api/application/models/Data_Dump_Model.php | 8 ++++ 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index bb1e3a0b..108369c3 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -88,29 +88,31 @@ class Data_Dump_Controller extends REST_Controller { // $logger = MYLOG::logFunction(null,"Gsheet"); log_message('ERROR','#/# G-Sheet Fns Entered - '.date('Y-m-d H:i:s A')); $sheetData = $this->post(); - // log_message('ERROR','#/# Params Are - '.$sheetData); + // $sheetData = json_decode($this->post(),true); + log_message('ERROR','#/# Params Count - '.count($sheetData)); if(count($sheetData) > 0){ $pd_id = $this->modificationGsheetData($sheetData); if($pd_id != null || $pd_id != '') { + $pd_serial_no = $this->Data_Dump_Model->getPDSerialNO($pd_id); log_message('ERROR',"#/# G-Sheet For PD ID : ".$pd_id); // PDALERTS::pdnotification($pd_id); $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['pdid'] = $pd_id; - $data['records'] = $pd_id; + $data['pdid'] = $pd_serial_no." / ".$pd_id; + $data['msg'] = "Successfully Inserted PD.NO/ID : ".$pd_serial_no." / ".$pd_id; $this->response($data,REST_Controller::HTTP_OK); } else { - log_message("info","G-Sheet SomeThing went Wrong mistake on Gsheet-data PDID not Founded"); + log_message("ERROR","#/# G-Sheet SomeThing went Wrong mistake on Gsheet-data PDID not Founded"); $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['msg'] = "Some thing went wrong"; $this->response($data,REST_Controller::HTTP_OK); } }else{ - log_message("info","G-Sheet Data Not Founded"); + log_message("ERROR","#/# G-Sheet Data Not Founded"); $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['msg'] = "Some thing went wrong !"; @@ -150,14 +152,14 @@ class Data_Dump_Controller extends REST_Controller { log_message('ERROR',"G-Sheet For PD Step 2 (Processing data for-loop)"); if($i==1 && $GSdata[$i] != ""){ $modifiedData['lender'] = $GSdata[$i]; - $fk_lender_id = $this->Data_Dump_Model->getId(1,$GSdata[$i]); + $fk_lender_id = $this->Data_Dump_Model->getId(1,trim($GSdata[$i])); $pd_details['fk_lender_id']=$fk_lender_id; $pd_details['sub_entity_id']=$fk_lender_id; log_message('ERROR',"G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender']." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); } if($i==2 && $GSdata[$i] != ""){ - $modifiedData['lender_applicant_id'] = str_replace(" ", "", $GSdata[$i]); - $pd_details['lender_applicant_id'] =str_replace(" ", "", $GSdata[$i]); + $modifiedData['lender_applicant_id'] = trim(str_replace(" ", "", $GSdata[$i])); + $pd_details['lender_applicant_id'] =trim(str_replace(" ", "", $GSdata[$i])); log_message('ERROR',"G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender_applicant_id']." PD :".$pd_details['lender_applicant_id']); } if($i==3 && $GSdata[$i] != ""){ @@ -192,17 +194,17 @@ class Data_Dump_Controller extends REST_Controller { $stateAndPincode = end($NormalParts); $splitStateAndPincode = explode('-',$stateAndPincode , 2); $modifiedData['state'] = $splitStateAndPincode[0]; - $addresses['fk_state']=$this->Data_Dump_Model->getId(5,$splitStateAndPincode[0]); - $pd_details['fk_state'] =$addresses['fk_state']; - $modifiedData['pincode'] = $splitStateAndPincode[1]; - $pin = $this->Data_Dump_Model->getId(6,$splitStateAndPincode[1]); + $addresses['fk_state']=$this->Data_Dump_Model->getId(5,trim($splitStateAndPincode[0])); + $pd_details['fk_state'] =trim($addresses['fk_state']); + $modifiedData['pincode'] = trim($splitStateAndPincode[1]); + $pin = $this->Data_Dump_Model->getId(6,trim($splitStateAndPincode[1])); $addresses['pincode'] = ($pin != "" ? $pin : 1); $pd_details['pincode'] = $addresses['pincode']; - $addresses['other_pincode']=($pin == "" ? $splitStateAndPincode[1] : null); + $addresses['other_pincode']=($pin == "" ? trim($splitStateAndPincode[1]) : null); $pd_details['other_pincode'] = $addresses['other_pincode']; $city = array_slice($NormalParts, -2, 1); $modifiedData['city'] = $city[0]; - $addresses['fk_city']=$this->Data_Dump_Model->getId(7,$city[0]); + $addresses['fk_city']=$this->Data_Dump_Model->getId(7,trim($city[0])); $pd_details['fk_city']=$addresses['fk_city']; array_splice($NormalParts, -2);//removing city state and pincode. // $reversedParts = explode('-', strrev($GSdata[$i]), 2); @@ -219,7 +221,7 @@ class Data_Dump_Controller extends REST_Controller { } if($i==6 && $GSdata[$i] != ""){ $modifiedData['createdPerson'] = $GSdata[$i]; - $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,$GSdata[$i]); + $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,trim($GSdata[$i])); log_message('ERROR',"G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata[$i]); // ." Modify : ".$modifiedData." PD :".$pd_details); } @@ -257,13 +259,13 @@ class Data_Dump_Controller extends REST_Controller { if(count($product)>1){ $modifiedData['product'] = $product[0] ? $product[0] : null; $modifiedData['subproduct'] = $product[1] ? $product[1] : null ; - $fk_product_id = $this->Data_Dump_Model->getId(2,$product[0]); + $fk_product_id = $this->Data_Dump_Model->getId(2,trim($product[0])); $pd_details['fk_product_id'] = $fk_product_id; - $pd_details['fk_subproduct_id'] = $this->Data_Dump_Model->getId(3,$product[1]); + $pd_details['fk_subproduct_id'] = $this->Data_Dump_Model->getId(3,trim($product[1])); } else{ $modifiedData['product'] = $product[0] ? $product[0] : null ; - $fk_product_id = $this->Data_Dump_Model->getId(2,$product[0]); + $fk_product_id = $this->Data_Dump_Model->getId(2,trim($product[0])); $pd_details['fk_product_id'] = $product[0] ? $fk_product_id : null ; } log_message('ERROR',"G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct) GSheet data : ".$GSdata[$i]); @@ -275,7 +277,7 @@ class Data_Dump_Controller extends REST_Controller { if(count($type)>1){ $pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ; $modifiedData['customerSegment'] = ($type[1] != "") ? $type[1] : null; - $fk_customer_segment = $this->Data_Dump_Model->getId(4,$modifiedData['customerSegment']); + $fk_customer_segment = $this->Data_Dump_Model->getId(4,trim($modifiedData['customerSegment'])); $pd_details['fk_customer_segment'] = $fk_customer_segment; }else{ $pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ; diff --git a/api/application/models/Data_Dump_Model.php b/api/application/models/Data_Dump_Model.php index f492128d..9f30ce68 100755 --- a/api/application/models/Data_Dump_Model.php +++ b/api/application/models/Data_Dump_Model.php @@ -152,6 +152,14 @@ class Data_Dump_Model extends SPARQ_Model { return $id; } + public function getPDSerialNO($pd_id){ + $this->db->select('pd_sno'); + $this->db->from(PDTRIGGER); + $this->db->where('pd_id',$pd_id); + $row = $this->db->get()->row(); + $sno = (isset($row)) ? $row->pd_sno : ""; + return $sno; + } // public function GsheetData($GSdata){ // } } \ No newline at end of file From f2760ca07ce24cd5599c135d3a49dd0241ab8e38 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Fri, 8 Apr 2022 10:41:38 +0000 Subject: [PATCH 14/34] Data_Dump_Controller.php edited online with Bitbucket --- api/application/controllers/Data_Dump_Controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 108369c3..7b9b80db 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -87,8 +87,8 @@ class Data_Dump_Controller extends REST_Controller { public function googleSheet_post(){ // $logger = MYLOG::logFunction(null,"Gsheet"); log_message('ERROR','#/# G-Sheet Fns Entered - '.date('Y-m-d H:i:s A')); - $sheetData = $this->post(); - // $sheetData = json_decode($this->post(),true); + // $sheetData = $this->post(); + $sheetData = json_decode($this->post(),true); log_message('ERROR','#/# Params Count - '.count($sheetData)); if(count($sheetData) > 0){ $pd_id = $this->modificationGsheetData($sheetData); From fbe7aedacf3156c97a665f10f44b686969599b81 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Fri, 8 Apr 2022 23:13:00 +0530 Subject: [PATCH 15/34] Google sheet 6 : ps --- api/application/controllers/Data_Dump_Controller.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 7b9b80db..bf5d5330 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -88,7 +88,8 @@ class Data_Dump_Controller extends REST_Controller { // $logger = MYLOG::logFunction(null,"Gsheet"); log_message('ERROR','#/# G-Sheet Fns Entered - '.date('Y-m-d H:i:s A')); // $sheetData = $this->post(); - $sheetData = json_decode($this->post(),true); + // $sheetData = json_decode($this->post(),true); + $sheetData = json_decode($_POST['data']); log_message('ERROR','#/# Params Count - '.count($sheetData)); if(count($sheetData) > 0){ $pd_id = $this->modificationGsheetData($sheetData); From 19fb47ca2c4dc89bd66fc05fa6d60c976b0e179d Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Sat, 9 Apr 2022 13:23:48 +0530 Subject: [PATCH 16/34] Google sheet 7: ps --- .../controllers/Data_Dump_Controller.php | 170 ++++++++---------- 1 file changed, 73 insertions(+), 97 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index bf5d5330..c42a2786 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -89,7 +89,7 @@ class Data_Dump_Controller extends REST_Controller { log_message('ERROR','#/# G-Sheet Fns Entered - '.date('Y-m-d H:i:s A')); // $sheetData = $this->post(); // $sheetData = json_decode($this->post(),true); - $sheetData = json_decode($_POST['data']); + $sheetData = $this->post(); log_message('ERROR','#/# Params Count - '.count($sheetData)); if(count($sheetData) > 0){ $pd_id = $this->modificationGsheetData($sheetData); @@ -126,20 +126,12 @@ class Data_Dump_Controller extends REST_Controller { // $data['sheetData'] = $sheetData; // $data['modifiedData'] = $modified; // } - - $data['dataStatus'] = true; - $data['status'] = REST_Controller::HTTP_OK; - $data['sheetData'] = $sheetData; - $data['modifiedData'] = $modified; - $data['reponseData'] = $reponse; - $this->response($data,REST_Controller::HTTP_OK); - } public function modificationGsheetData($GSdata){ // $logger = MYLOG::logFunction(null,"Gsheet"); log_message('ERROR',"G-Sheet For PD Step 1 (G-sheet Data)"); - $modifiedData = array(); + $pd_details = array(); $pd_applicant_details = array(); $addresses = array(); @@ -149,85 +141,77 @@ class Data_Dump_Controller extends REST_Controller { // [{"applicant_name":"Ranjit Kumar Sharma","applicant_title_name":"5","company_name":"Kr Tourist Services Pvt Ltd","mobile_no":"9717361459","additional_mobile_no":null,"landline":null,"applicant_type":1,"relation":""}] // addresses // [{"addressline1":"Third Floor Right Side Bal K 83-84 Udyan Road Uttam Nagar New Delhi","fk_city":"869","fk_state":"5","pincode":"27491","other_pincode":null}] - for($i=0;$iData_Dump_Model->getId(1,trim($GSdata[$i])); + if(isset($GSdata["LenderName"]) && $GSdata["LenderName"] != ""){ + $fk_lender_id = $this->Data_Dump_Model->getId(1,trim($GSdata["LenderName"])); $pd_details['fk_lender_id']=$fk_lender_id; $pd_details['sub_entity_id']=$fk_lender_id; - log_message('ERROR',"G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender']." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); + log_message('ERROR',"G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata["LenderName"]." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); } - if($i==2 && $GSdata[$i] != ""){ - $modifiedData['lender_applicant_id'] = trim(str_replace(" ", "", $GSdata[$i])); - $pd_details['lender_applicant_id'] =trim(str_replace(" ", "", $GSdata[$i])); - log_message('ERROR',"G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender_applicant_id']." PD :".$pd_details['lender_applicant_id']); + if(isset($GSdata["LAN"]) && $GSdata["LAN"] != ""){ + $LAN = trim(str_replace(" ", "", $GSdata["LAN"])); + $pd_details['lender_applicant_id'] =$LAN; + log_message('ERROR',"G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)GSheet data : ".$LAN." PD :".$pd_details['lender_applicant_id']); } - if($i==3 && $GSdata[$i] != ""){ - $applicatantParts = explode(',',$GSdata[$i]); + $applicatantParts =""; + if(isset($GSdata["ApplicantName_CompanyName"]) && $GSdata["ApplicantName_CompanyName"] != ""){ + $applicatantParts = explode(',',$GSdata["ApplicantName_CompanyName"]); if(count($applicatantParts)>1){ for($j=0;$j1){ + $pd_applicant_details[$j]['applicant_name'] = $splitCompanyandApplicant[0]; + $pd_applicant_details[$j]['company_name'] = isset($splitCompanyandApplicant[1]) ? $splitCompanyandApplicant[1] : null; + } + else{ + $pd_applicant_details[0]['applicant_name'] = $splitCompanyandApplicant[0]; $pd_applicant_details[0]['company_name'] = null; - $modifiedData['pd_applicant_details'][0]['applicant'] = $applicatantParts[0]; - $modifiedData['pd_applicant_details'][0]['company_name'] = null; + } } - $pd_applicant_details[0]['mobile_no'] = $GSdata[4] ? $GSdata[4] : null; - $modifiedData['pd_applicant_details'][0]['mobile_no'] = $GSdata[4] ? $GSdata[4] : null; + $pd_applicant_details[0]['mobile_no'] = isset($GSdata['ContactNumber']) ? $GSdata['ContactNumber'] : null; $pd_applicant_details[0]['applicant_type'] = 1; - $modifiedData['pd_applicant_details'][0]['applicant_type'] = 1; - log_message('ERROR',"G-Sheet For PD Step 2.3 (Third Cell applicantdetails) GSheet data : ".$GSdata[$i]); - //." Modify : ".$modifiedData." PD :".$pd_details); + log_message('ERROR',"G-Sheet For PD Step 2.3 (Third Cell applicantdetails) GSheet data : ".$GSdata['ContactNumber']); + log_message('ERROR',"G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber) GSheet data : ".$GSdata['ContactNumber']); } - if($i==4 && $GSdata[$i] != ""){ $modifiedData['mobileNumber'] = $GSdata[$i]; - log_message('ERROR',"G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber) GSheet data : ".$GSdata[$i]); - //." Modify : ".$modifiedData." PD :".$pd_details); - } - if($i==5 && $GSdata[$i] != ""){//address section. - $NormalParts = explode(',', $GSdata[$i]); + //address section. + if(isset($GSdata["PDLocation"]) && $GSdata["PDLocation"] != ""){ + $NormalParts = explode(',', $GSdata["PDLocation"]); $stateAndPincode = end($NormalParts); $splitStateAndPincode = explode('-',$stateAndPincode , 2); - $modifiedData['state'] = $splitStateAndPincode[0]; $addresses['fk_state']=$this->Data_Dump_Model->getId(5,trim($splitStateAndPincode[0])); - $pd_details['fk_state'] =trim($addresses['fk_state']); - $modifiedData['pincode'] = trim($splitStateAndPincode[1]); + $pd_details['fk_state'] =$addresses['fk_state']; $pin = $this->Data_Dump_Model->getId(6,trim($splitStateAndPincode[1])); $addresses['pincode'] = ($pin != "" ? $pin : 1); $pd_details['pincode'] = $addresses['pincode']; $addresses['other_pincode']=($pin == "" ? trim($splitStateAndPincode[1]) : null); $pd_details['other_pincode'] = $addresses['other_pincode']; $city = array_slice($NormalParts, -2, 1); - $modifiedData['city'] = $city[0]; $addresses['fk_city']=$this->Data_Dump_Model->getId(7,trim($city[0])); $pd_details['fk_city']=$addresses['fk_city']; array_splice($NormalParts, -2);//removing city state and pincode. - // $reversedParts = explode('-', strrev($GSdata[$i]), 2); + // $reversedParts = explode('-', strrev($GSdataata[$i]), 2); // array_push($result_data["Pincode"],strrev($reversedParts[0])); // print_r($NormalParts); // print_r(array_filter($NormalParts));// removing Null values - $modifiedData['address'] = implode(",",array_filter($NormalParts)); + $modifyaddress = implode(",",array_filter($NormalParts)); $addresses['addressline1'] = implode(",",array_filter($NormalParts)); $pd_details['addressline1']=$addresses['addressline1']; - // echo "Original Address : ".$GSdata[$i]; + // echo "Original Address : ".$GSdataata[$i]; // echo "Modified Address : ".$address; - log_message('ERROR',"G-Sheet For PD Step 2.5 (Fifth Cell address) GSheet data : ".$GSdata[$i]); - //." Modify : ".$modifiedData." PD :".$pd_details); + log_message('ERROR',"G-Sheet For PD Step 2.5 (Fifth Cell address) GSheet data : ".$GSdata["PDLocation"]); } - if($i==6 && $GSdata[$i] != ""){ - $modifiedData['createdPerson'] = $GSdata[$i]; - $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,trim($GSdata[$i])); - log_message('ERROR',"G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata[$i]); - // ." Modify : ".$modifiedData." PD :".$pd_details); + if(isset($GSdata["PersonDoing"]) && $GSdata["PersonDoing"] != ""){ + $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,trim($GSdata["PersonDoing"])); + log_message('ERROR',"G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata["PersonDoing"]); } - if($i==7 && ($GSdata[$i] != "" || $GSdata[$i] != 0)){ - $amount = strtolower($GSdata[$i]); + if(isset($GSdata["LoanAmount"]) && ($GSdata["LoanAmount"] != "" || $GSdata["LoanAmount"] != 0)){ + $amount = strtolower($GSdata["LoanAmount"]); $amount = explode(' ', $amount); // 3 zeros in 1,000 - One Thousand // 4 zeros in 10,000 - Ten Thousand @@ -250,59 +234,57 @@ class Data_Dump_Controller extends REST_Controller { if($amount[1] =='k' ||$amount[1] == 'thousand'){ $amount[1] = "000"; }} - $modifiedData['loanAmount'] = implode("",$amount); $pd_details['loan_amount'] = implode("",$amount); - log_message('ERROR',"G-Sheet For PD Step 2.7 (Seventh Cell Amount) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['loanAmount']." PD :".$pd_details['loan_amount']); + log_message('ERROR',"G-Sheet For PD Step 2.7 (Seventh Cell Amount) GSheet data : ".$GSdata["LoanAmount"]." PD :".$pd_details['loan_amount']); } - if($i==8 && $GSdata[$i] != ""){ - $product = explode('/', $GSdata[$i]); - + $fk_product_id =""; + if(isset($GSdata["Product_SubProduct"]) && $GSdata["Product_SubProduct"] != ""){ + $product = explode('/', $GSdata["Product_SubProduct"]); if(count($product)>1){ - $modifiedData['product'] = $product[0] ? $product[0] : null; - $modifiedData['subproduct'] = $product[1] ? $product[1] : null ; $fk_product_id = $this->Data_Dump_Model->getId(2,trim($product[0])); $pd_details['fk_product_id'] = $fk_product_id; - $pd_details['fk_subproduct_id'] = $this->Data_Dump_Model->getId(3,trim($product[1])); + $pd_details['fk_subproduct_id'] = $this->Data_Dump_Model->getId(3,$product[1]); } else{ - $modifiedData['product'] = $product[0] ? $product[0] : null ; $fk_product_id = $this->Data_Dump_Model->getId(2,trim($product[0])); $pd_details['fk_product_id'] = $product[0] ? $fk_product_id : null ; } - log_message('ERROR',"G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct) GSheet data : ".$GSdata[$i]); - //." Modify : ".$modifiedData." PD :".$pd_details); + log_message('ERROR',"G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct) GSheet data : ".$GSdata["Product_SubProduct"]); } - if($i==9 && $GSdata[$i] != ""){ - $type = explode('/', $GSdata[$i]); - $modifiedData['type'] = ($type[0] != "") ? strtoupper(str_replace(' ', '', $type[0])) : "FULLPD"; + $fk_customer_segment = ""; + if(isset($GSdata["Type_CustomerSegment"]) && $GSdata["Type_CustomerSegment"] != ""){ + $type = explode('/', $GSdata["Type_CustomerSegment"]); + $modifytype = ($type[0] != "") ? strtoupper(str_replace(' ', '', $type[0])) : "FULLPD"; if(count($type)>1){ - $pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ; - $modifiedData['customerSegment'] = ($type[1] != "") ? $type[1] : null; - $fk_customer_segment = $this->Data_Dump_Model->getId(4,trim($modifiedData['customerSegment'])); + $pd_details['fk_pd_type'] = $modifytype == "FULLPD" ? 1 : ($modifytype == "SMARTPD" ? 2 :($modifytype == "TELEPD" ? 3 : 0) ) ; + $modifycustomerSegment = ($type[1] != "") ? $type[1] : null; + $fk_customer_segment = $this->Data_Dump_Model->getId(4,trim($modifycustomerSegment)); $pd_details['fk_customer_segment'] = $fk_customer_segment; }else{ - $pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ; + $pd_details['fk_pd_type'] = $modifytype == "FULLPD" ? 1 : ($modifytype == "SMARTPD" ? 2 :($modifytype == "TELEPD" ? 3 : 0) ) ; } - log_message('ERROR',"G-Sheet For PD Step 2.9 (ninth Cell type/cs) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['type']." PD :".$pd_details['fk_pd_type']); - } - if($i==10 && $GSdata[$i] != ""){ - // $modifiedData['date'] = $GSdata[$i]; - $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata[$i])); - $modifiedData['date'] = $new_date_format; - $pd_details['pd_date_of_initiation'] = $new_date_format; - log_message('ERROR',"G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['date']." PD :".$pd_details['pd_date_of_initiation']); - } - if($i==11 && $GSdata[$i] != ""){ - $modifiedData['remarks'] = $GSdata[$i]; - $pd_details['remarks'] = $GSdata[$i]; - log_message('ERROR',"G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['remarks']." PD :".$pd_details['remarks']); + log_message('ERROR',"G-Sheet For PD Step 2.9 (ninth Cell type/cs) GSheet data : ".$GSdata["Type_CustomerSegment"]." Modify : ".$modifytype." PD :".$pd_details['fk_pd_type']); } - } + if(isset($GSdata["DateofReceivingPDRequest"]) && $GSdata["DateofReceivingPDRequest"] != ""){ + $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata["DateofReceivingPDRequest"])); + $pd_details['pd_date_of_initiation'] = $new_date_format; + log_message('ERROR',"G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata["DateofReceivingPDRequest"]." PD :".$pd_details['pd_date_of_initiation']); + } + + if(isset($GSdata["RemarksonCurrentStatus"]) && $GSdata["RemarksonCurrentStatus"] != ""){ + $pd_details['remarks'] = "`Remarks on Current Status` : ".$GSdata["RemarksonCurrentStatus"]; + log_message('ERROR',"G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata["RemarksonCurrentStatus"]." PD :".$pd_details['remarks']); + } + if(isset($GSdata["PreviousRemarks"]) && $GSdata["PreviousRemarks"] != ""){ + $pd_details['remarks'] = $pd_details['remarks']."\r\n `Previous Remarks` : ".$GSdata["PreviousRemarks"]; + log_message('ERROR',"G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata["RemarksonCurrentStatus"]." PD :".$pd_details['remarks']); + } + + ## Default Status section; $pd_details['pd_status'] = TRIGGERED; - ## Template ID Section. $fields = array('fk_template_id'); $where_condition_array = array('fk_lender_id'=>$fk_lender_id ,'fk_product_id'=> $fk_product_id,'fk_customer_segment'=> $fk_customer_segment,'isactive' => 1); @@ -341,7 +323,6 @@ class Data_Dump_Controller extends REST_Controller { $pd_details['random_string'] = $randomString; $pd_details['is_notify_enabled'] = 1; log_message('ERROR',"G-Sheet For PD Step 3 (Before Inserting Trigger)"); - // PDdetails :".$pd_details); try { $pd_id = $this->Data_Dump_Model->saveRecords($pd_details,PDTRIGGER); log_message('ERROR',"G-Sheet For PD Step 4 (PDID gotten) PDID : ".$pd_id); @@ -350,7 +331,7 @@ class Data_Dump_Controller extends REST_Controller { } } catch (Exception $e) { log_message('ERROR',"G-Sheet For PD Step 4 (PDID gotten) ERR : ".$e->getMessage()); - var_dump($e->getMessage()); + // var_dump($e->getMessage()); } // $pd_id = 3073; @@ -375,7 +356,7 @@ class Data_Dump_Controller extends REST_Controller { } catch (Exception $e) { //alert the user. log_message('ERROR',"G-Sheet For PD Step 5.1 (applicant pkid) ERR : ".$e->getMessage()); - var_dump($e->getMessage()); + // var_dump($e->getMessage()); } } @@ -396,7 +377,7 @@ class Data_Dump_Controller extends REST_Controller { } } catch (Exception $e) { log_message('ERROR',"G-Sheet For PD Step 6 (Addresses) ERR : ".$e->getMessage()); - var_dump($e->getMessage()); + // var_dump($e->getMessage()); } $triggertbl_records = array('fk_primary_address_id'=>$address_id,'fk_address_id'=>$address_id); @@ -407,16 +388,11 @@ class Data_Dump_Controller extends REST_Controller { throw new Exception('Error On updated Adresses Details in trigger table'); } } catch (Exception $e) { - //alert the user. log_message('ERROR',"G-Sheet For PD Step 7 (updateAddresses in trigger) ERR : ".$e->getMessage()); - var_dump($e->getMessage()); + // var_dump($e->getMessage()); } } - // print_r($pd_details); - // print_r($modifiedData); - // print_r($addresses); - // print_r($pd_applicant_details); - // die(); + log_message('ERROR',"#/# G-Sheet Final PDID : ".$pd_id); return $pd_id; } From e6edf865bcb5af84aa49baef48c652c87021df19 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Sat, 9 Apr 2022 15:04:20 +0530 Subject: [PATCH 17/34] Google sheet 8: ps --- .../controllers/Data_Dump_Controller.php | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index c42a2786..739406a2 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -166,8 +166,8 @@ class Data_Dump_Controller extends REST_Controller { }else{ $splitCompanyandApplicant = explode('/',$applicatantParts[0]); if(count($splitCompanyandApplicant)>1){ - $pd_applicant_details[$j]['applicant_name'] = $splitCompanyandApplicant[0]; - $pd_applicant_details[$j]['company_name'] = isset($splitCompanyandApplicant[1]) ? $splitCompanyandApplicant[1] : null; + $pd_applicant_details[0]['applicant_name'] = $splitCompanyandApplicant[0]; + $pd_applicant_details[0]['company_name'] = isset($splitCompanyandApplicant[1]) ? $splitCompanyandApplicant[1] : null; } else{ $pd_applicant_details[0]['applicant_name'] = $splitCompanyandApplicant[0]; @@ -211,8 +211,8 @@ class Data_Dump_Controller extends REST_Controller { log_message('ERROR',"G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata["PersonDoing"]); } if(isset($GSdata["LoanAmount"]) && ($GSdata["LoanAmount"] != "" || $GSdata["LoanAmount"] != 0)){ - $amount = strtolower($GSdata["LoanAmount"]); - $amount = explode(' ', $amount); + // $amount = strtolower($GSdata["LoanAmount"]); + // $amount = explode(' ', $amount); // 3 zeros in 1,000 - One Thousand // 4 zeros in 10,000 - Ten Thousand // 5 zeros in 100,000 - 1 Lakh / 100 Thousand @@ -224,17 +224,18 @@ class Data_Dump_Controller extends REST_Controller { // 11 zeros in 100,000,000,000 - 10,000 Crore / 100 Billion // 12 zeros in 1,000,000,000,000 - 1 Lakh Crore / 1 Trillion // 13 zeros in 10,000,000,000,000 - 10 Lakh Crore / 10 Trillion - if(gettype($amount[1]) == 'string'){ - if($amount[1] == 'cr' || $amount[1] == 'crore'){ - $amount[1] = "0000000"; - } - if($amount[1] == 'lac' || $amount[1] == 'lacs' || $amount[1] == 'lakh'){ - $amount[1] = "000000"; - } - if($amount[1] =='k' ||$amount[1] == 'thousand'){ - $amount[1] = "000"; - }} - $pd_details['loan_amount'] = implode("",$amount); + // if(gettype($amount[1]) == 'string'){ + // if($amount[1] == 'cr' || $amount[1] == 'crore'){ + // $amount[1] = "0000000"; + // } + // if($amount[1] == 'lac' || $amount[1] == 'lacs' || $amount[1] == 'lakh'){ + // $amount[1] = "000000"; + // } + // if($amount[1] =='k' ||$amount[1] == 'thousand'){ + // $amount[1] = "000"; + // }} + // $pd_details['loan_amount'] = implode("",$amount); + $pd_details['loan_amount'] = (int)$GSdata["LoanAmount"]; log_message('ERROR',"G-Sheet For PD Step 2.7 (Seventh Cell Amount) GSheet data : ".$GSdata["LoanAmount"]." PD :".$pd_details['loan_amount']); } $fk_product_id =""; @@ -267,9 +268,10 @@ class Data_Dump_Controller extends REST_Controller { } if(isset($GSdata["DateofReceivingPDRequest"]) && $GSdata["DateofReceivingPDRequest"] != ""){ - $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata["DateofReceivingPDRequest"])); - $pd_details['pd_date_of_initiation'] = $new_date_format; - log_message('ERROR',"G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata["DateofReceivingPDRequest"]." PD :".$pd_details['pd_date_of_initiation']); + // $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata["DateofReceivingPDRequest"])); + // $pd_details['pd_date_of_initiation'] = $new_date_format; + // log_message('ERROR',"G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata["DateofReceivingPDRequest"]." PD :".$pd_details['pd_date_of_initiation']); + $pd_details['pd_date_of_initiation'] = date('Y-m-d H-i-s'); } if(isset($GSdata["RemarksonCurrentStatus"]) && $GSdata["RemarksonCurrentStatus"] != ""){ @@ -281,8 +283,8 @@ class Data_Dump_Controller extends REST_Controller { log_message('ERROR',"G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata["RemarksonCurrentStatus"]." PD :".$pd_details['remarks']); } - - + // print_r($pd_applicant_details); + // die(); ## Default Status section; $pd_details['pd_status'] = TRIGGERED; ## Template ID Section. @@ -321,6 +323,8 @@ class Data_Dump_Controller extends REST_Controller { $randomString .= $characters[rand(0, $charactersLength - 1)]; } $pd_details['random_string'] = $randomString; + $url = OFFICER_TRACKING_URL.$randomString; + $pd_details['encrypted_url'] = $url; $pd_details['is_notify_enabled'] = 1; log_message('ERROR',"G-Sheet For PD Step 3 (Before Inserting Trigger)"); try { From 6abc238836509d8f81f6a3b06a74ba86c55ac43a Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 11 Apr 2022 16:38:01 +0530 Subject: [PATCH 18/34] Gsheet and templated : ps --- .../controllers/Data_Dump_Controller.php | 17 ++++--- .../Template_Management_Controller.php | 46 +++++++++++++++++-- api/application/models/Data_Dump_Model.php | 6 ++- .../models/Template_Management_Model.php | 42 +++++++++++++++++ 4 files changed, 98 insertions(+), 13 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 739406a2..0095beb9 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -148,6 +148,11 @@ class Data_Dump_Controller extends REST_Controller { $pd_details['fk_lender_id']=$fk_lender_id; $pd_details['sub_entity_id']=$fk_lender_id; log_message('ERROR',"G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata["LenderName"]." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); + $lender_contact_persons = $this->PD_Model->getLenderContactPersons($fk_lender_id,null); + if(!empty($lender_contact_persons)){ + $pd_details['lender_credit_person'] = $lender_contact_persons[0]['role_type'] == "CREDIT" ? $lender_contact_persons[0]['userid'] : null; + $pd_details['lender_sales_person'] = $lender_contact_persons[0]['role_type'] == "SALES" ? $lender_contact_persons[0]['userid'] : null; + } } if(isset($GSdata["LAN"]) && $GSdata["LAN"] != ""){ $LAN = trim(str_replace(" ", "", $GSdata["LAN"])); @@ -184,7 +189,7 @@ class Data_Dump_Controller extends REST_Controller { $NormalParts = explode(',', $GSdata["PDLocation"]); $stateAndPincode = end($NormalParts); $splitStateAndPincode = explode('-',$stateAndPincode , 2); - $addresses['fk_state']=$this->Data_Dump_Model->getId(5,trim($splitStateAndPincode[0])); + $addresses['fk_state']=$this->Data_Dump_Model->getId(5,$splitStateAndPincode[0]); $pd_details['fk_state'] =$addresses['fk_state']; $pin = $this->Data_Dump_Model->getId(6,trim($splitStateAndPincode[1])); $addresses['pincode'] = ($pin != "" ? $pin : 1); @@ -192,7 +197,7 @@ class Data_Dump_Controller extends REST_Controller { $addresses['other_pincode']=($pin == "" ? trim($splitStateAndPincode[1]) : null); $pd_details['other_pincode'] = $addresses['other_pincode']; $city = array_slice($NormalParts, -2, 1); - $addresses['fk_city']=$this->Data_Dump_Model->getId(7,trim($city[0])); + $addresses['fk_city']=$this->Data_Dump_Model->getId(7,$city[0]); $pd_details['fk_city']=$addresses['fk_city']; array_splice($NormalParts, -2);//removing city state and pincode. // $reversedParts = explode('-', strrev($GSdataata[$i]), 2); @@ -207,7 +212,7 @@ class Data_Dump_Controller extends REST_Controller { log_message('ERROR',"G-Sheet For PD Step 2.5 (Fifth Cell address) GSheet data : ".$GSdata["PDLocation"]); } if(isset($GSdata["PersonDoing"]) && $GSdata["PersonDoing"] != ""){ - $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,trim($GSdata["PersonDoing"])); + $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,$GSdata["PersonDoing"]); log_message('ERROR',"G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata["PersonDoing"]); } if(isset($GSdata["LoanAmount"]) && ($GSdata["LoanAmount"] != "" || $GSdata["LoanAmount"] != 0)){ @@ -267,12 +272,11 @@ class Data_Dump_Controller extends REST_Controller { log_message('ERROR',"G-Sheet For PD Step 2.9 (ninth Cell type/cs) GSheet data : ".$GSdata["Type_CustomerSegment"]." Modify : ".$modifytype." PD :".$pd_details['fk_pd_type']); } - if(isset($GSdata["DateofReceivingPDRequest"]) && $GSdata["DateofReceivingPDRequest"] != ""){ + // if(isset($GSdata["DateofReceivingPDRequest"]) && $GSdata["DateofReceivingPDRequest"] != ""){ // $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata["DateofReceivingPDRequest"])); // $pd_details['pd_date_of_initiation'] = $new_date_format; // log_message('ERROR',"G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata["DateofReceivingPDRequest"]." PD :".$pd_details['pd_date_of_initiation']); - $pd_details['pd_date_of_initiation'] = date('Y-m-d H-i-s'); - } + // } if(isset($GSdata["RemarksonCurrentStatus"]) && $GSdata["RemarksonCurrentStatus"] != ""){ $pd_details['remarks'] = "`Remarks on Current Status` : ".$GSdata["RemarksonCurrentStatus"]; @@ -287,6 +291,7 @@ class Data_Dump_Controller extends REST_Controller { // die(); ## Default Status section; $pd_details['pd_status'] = TRIGGERED; + $pd_details['pd_date_of_initiation'] = date('Y-m-d H-i-s'); ## Template ID Section. $fields = array('fk_template_id'); $where_condition_array = array('fk_lender_id'=>$fk_lender_id ,'fk_product_id'=> $fk_product_id,'fk_customer_segment'=> $fk_customer_segment,'isactive' => 1); diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index e9f7d810..58b33dd4 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -1051,6 +1051,7 @@ class Template_Management_Controller extends REST_Controller { $where_condition_array = $records; $where_condition_array['isactive'] = 1; $map_table = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATE_MAP_V2); + // $map_table = array(); if(count($map_table)>0){ // $this->db->where('id',$map_table[0]['id']); // $this->db->set('isactive',0); @@ -1061,15 +1062,24 @@ class Template_Management_Controller extends REST_Controller { $flag++; }else{ // form Template is declare as gobally in m_pd_forms table @form_template column using CustomerSegmentID. - $form_template = $this->Template_Management_Model->GetFormTemplate($records['customer_segment_id']); + // $form_template = array(); + $regular_form_template = $this->Template_Management_Model->getFormTemplate($records['customer_segment_id']); + $buiness_form_template = $this->getBuinessFormTemplate($records); + $key = array_search('13', array_column($regular_form_template, 'form_id')); + if (!empty($key)) { + unset($regular_form_template[$key]);//here 13th form is buiness unset here.id have both regular and buiness. + $form_template = array_merge($regular_form_template,$buiness_form_template); + }else{ + $form_template = $regular_form_template; + } $map_pk_id = $this->Template_Management_Model->saveTemplateMapping($records,TEMPLATE_MAP_V2); $c = "JSON ID Are =>"; //concate; for($i=0; $i $form_template[$i]['form_id'],'json' => $template,'map_id'=>$map_pk_id,'is_form_status'=>"DRAFT"); - // if($form_template[$i]['form_id'] != 18 ||$form_template[$i]['form_id'] != 26){ - if($form_template[$i]['form_id'] != 18 ||$form_template[$i]['form_id'] != 26 ||$form_template[$i]['form_id'] != 13){ + if($form_template[$i]['form_id'] != 18 ||$form_template[$i]['form_id'] != 26){ + // if($form_template[$i]['form_id'] != 18 ||$form_template[$i]['form_id'] != 26 ||$form_template[$i]['form_id'] != 13){ $json_pk_id = $this->Template_Management_Model->saveTemplateMapping($fields,TEMPLATE_JSON_V2); $c = $c." ".$json_pk_id;} } @@ -1330,6 +1340,7 @@ class Template_Management_Controller extends REST_Controller { } // analysing public function getBuinessGroupFormsV2_get(){ + // echo $_GET['map_id'];die; // if((!isset($_GET['map_id']))) // { // $data['dataStatus'] = false; @@ -1351,6 +1362,7 @@ class Template_Management_Controller extends REST_Controller { { $records['customer_segment_id'] = $this->get("customer_segment_id");} $result_array = $this->Template_Management_Model->getTemplateMappingDetailsV2($records); + // echo "no problem";print_r($result_array);die; if(!empty($result_array)) foreach($result_array as $inx => $arr) { @@ -1415,7 +1427,7 @@ class Template_Management_Controller extends REST_Controller { if(!empty($filter_arr)){ $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['available_question'] = $filter_arr; + // $data['available_question'] = $filter_arr; // $data['json'] = $quest; $this->response($data,REST_Controller::HTTP_OK); }else{ @@ -1572,5 +1584,29 @@ class Template_Management_Controller extends REST_Controller { // $return_arr = array(); // $i = 0 ; // } + // http://localhost/AWSEC2/sparqapi/api/Template_Management_Controller/check + // public function check_get(){ + // $form_template = $this->Template_Management_Model->getFormTemplate(4); + // // print_r($form_template);die(); + // $this->response($form_template,REST_Controller::HTTP_OK); + // } + public function getBuinessFormTemplate($records){ + $fields = array('short_name'); + $where_condition_array = array('entity_id'=>$records['entity_id'],"isactive"=>1); + $lender_table = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,'m_entity'); + $lender_short_name = $lender_table[0]['short_name']; + $fields = array(' abbr'); + $where_condition_array = array('customer_segment_id'=>$records['customer_segment_id'],"isactive"=>1); + $segment_table = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,'m_customer_segment'); + $str = substr($segment_table[0]['abbr'],-2); + + $form_id = array(13,22,1,2,11); + //here 14 removed because finacial form calculation are there. + if(strcmp($str,'AI')) { array_push($form_id,16); } + if(!strcasecmp($lender_short_name, 'CLIX')){ array_push($form_id,21); } + if(!strcasecmp($lender_short_name, 'CLIX') || (!strcasecmp($lender_short_name, 'MWISE'))) { array_push($form_id,23);} + $form_template = $this->Template_Management_Model->getBuinessFormTemplate($form_id); + return $form_template; + } } \ No newline at end of file diff --git a/api/application/models/Data_Dump_Model.php b/api/application/models/Data_Dump_Model.php index 9f30ce68..2a7b3961 100755 --- a/api/application/models/Data_Dump_Model.php +++ b/api/application/models/Data_Dump_Model.php @@ -133,9 +133,11 @@ class Data_Dump_Model extends SPARQ_Model { if($flag == 3){$value = $keyword; $select = "subproduct_id"; $table = "m_subproducts"; $where = "abbr";} if($flag == 4){$select = "customer_segment_id"; $table = "m_customer_segment"; $where = "abbr";} - if($flag ==5 ){$select = "state_id"; $table = "m_states"; $where = "name";} + if($flag ==5 ){$value = $keyword; + $select = "state_id"; $table = "m_states"; $where = "name";} if($flag ==6 ){$select = "pincode_id";$where = "pincode";$table = "m_pincode";} - if($flag ==7 ){$select = "city_id";$where = "name";$table = "m_city";} + if($flag ==7 ){$value = $keyword; + $select = "city_id";$where = "name";$table = "m_city";} if($flag ==8 ){$select = "userid";$where = "first_name";$table = "m_user_profile";} $this->db->select($select); diff --git a/api/application/models/Template_Management_Model.php b/api/application/models/Template_Management_Model.php index 8d1afde5..255602c2 100644 --- a/api/application/models/Template_Management_Model.php +++ b/api/application/models/Template_Management_Model.php @@ -450,4 +450,46 @@ class Template_Management_Model extends SPARQ_Model { return $result; } +// public function getFormTemplate($csID){ +// // $sql_query = "'DRAFT'"; +// $sql_query_old = "SELECT m_template_forms.form_id,m_pd_forms.form_template +// FROM m_template_forms +// JOIN m_template +// on m_template_forms.fk_template_id = m_template.template_id and m_template_forms.isactive = 1 +// JOIN m_pd_forms +// on m_pd_forms.pd_form_id = m_template_forms.form_id and m_pd_forms.isactive = 1 +// WHERE fk_customer_segment like '%`".$csID."`%' and m_template.isactive = 1 "; +// // and form_template != ''"; +// // $result = $this->db->query($sql_query)->result_array(); +// // print_r($result); +// // print_r($sql_query);die(); +// // return $result; + +// $get_template_id = "SELECT m_template.template_id +// FROM m_template +// WHERE m_template.isactive = 1 and fk_customer_segment like '%`".$csID."`%' "; +// $row = $this->db->query($get_template_id)->row(); +// // print_r($this->db->last_query());die(); +// // print_r($row);die(); +// if(isset($row->template_id)){ +// $template_id = $row->template_id; +// $sql_query = "SELECT m_pd_forms.pd_form_id as form_id,m_pd_forms.form_template +// FROM m_pd_forms +// LEFT JOIN m_template_forms +// ON m_template_forms.form_id = m_pd_forms.form_id AND m_template_forms.isactive = 1 +// WHERE m_template_forms.fk_template_id = ".$template_id; +// $result = $this->db->query($sql_query)->result_array(); +// // print_r($this->db->last_query());die(); +// return $result; +// }else{ +// return array(); +// } +// } + public function getBuinessFormTemplate($form_id){ + $this->db->select('m_pd_forms.pd_form_id as form_id,m_pd_forms.form_template'); + $this->db->from(PDFORMS.' as m_pd_forms'); + $this->db->where_in('m_pd_forms.pd_form_id',$form_id); // Must be id + $this->db->where('m_pd_forms.is_business_form',1); + return $this->db->get()->result_array();; + } } \ No newline at end of file From f7bd0734948aab1c255a40ed2156d2830c2a105b Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 11 Apr 2022 17:54:01 +0530 Subject: [PATCH 19/34] buinessform check in template module :ps --- api/application/models/Template_Management_Model.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/api/application/models/Template_Management_Model.php b/api/application/models/Template_Management_Model.php index 255602c2..6062cf92 100644 --- a/api/application/models/Template_Management_Model.php +++ b/api/application/models/Template_Management_Model.php @@ -361,12 +361,8 @@ class Template_Management_Model extends SPARQ_Model { } if($cs_id){ $arr = $this->getFormTemplate($cs_id); - for($i=0; $i Date: Tue, 12 Apr 2022 07:26:09 +0000 Subject: [PATCH 20/34] trim() added : ps --- api/application/models/Data_Dump_Model.php | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/api/application/models/Data_Dump_Model.php b/api/application/models/Data_Dump_Model.php index 2a7b3961..5db37a84 100755 --- a/api/application/models/Data_Dump_Model.php +++ b/api/application/models/Data_Dump_Model.php @@ -123,22 +123,22 @@ class Data_Dump_Model extends SPARQ_Model { public function getId($flag,$keyword){ // echo "flag".$flag; - $value = str_replace(" ", "",$keyword); - if($flag == 1){ - // "entity_id": "16", - // "full_name": "Clix Capital Services Private Limited", - // "short_name": "CLIX", - $select = "entity_id";$table = "m_entity";$where = "short_name";} - if($flag == 2){$select = "product_id"; $table = "m_products"; $where = "abbr";} - if($flag == 3){$value = $keyword; - $select = "subproduct_id"; $table = "m_subproducts"; $where = "abbr";} - if($flag == 4){$select = "customer_segment_id"; $table = "m_customer_segment"; $where = "abbr";} - if($flag ==5 ){$value = $keyword; - $select = "state_id"; $table = "m_states"; $where = "name";} - if($flag ==6 ){$select = "pincode_id";$where = "pincode";$table = "m_pincode";} - if($flag ==7 ){$value = $keyword; - $select = "city_id";$where = "name";$table = "m_city";} - if($flag ==8 ){$select = "userid";$where = "first_name";$table = "m_user_profile";} + if($flag == 1){ $value = trim($keyword); $value = strtolower($value); + $select = "entity_id";$table = "m_entity";$where = "short_name";} + if($flag == 2){ $value = rtrim($keyword," ");$value = ltrim($value," "); $value = strtolower($value); + $select = "product_id"; $table = "m_products"; $where = "abbr";} + if($flag == 3){ $value = rtrim($keyword," ");$value = ltrim($value," "); $value = strtolower($value); + $select = "subproduct_id"; $table = "m_subproducts"; $where = "abbr";} + if($flag == 4){ $value = trim($keyword);$value = strtolower($value); + $select = "customer_segment_id"; $table = "m_customer_segment"; $where = "abbr";} + if($flag == 5){ $value = rtrim($keyword," ");$value = ltrim($value," "); $value = strtolower($value); + $select = "state_id"; $table = "m_states"; $where = "name";} + if($flag == 6){ $value = trim($keyword); $value = strtolower($value); + $select = "pincode_id";$where = "pincode";$table = "m_pincode";} + if($flag == 7){ $value = rtrim($keyword," ");$value = ltrim($value," "); $value = strtolower($value); + $select = "city_id";$where = "name";$table = "m_city";} + if($flag == 8){ $value = trim($keyword);$value = strtolower($value); + $select = "userid";$where = "first_name";$table = "m_user_profile";} $this->db->select($select); $this->db->from($table); From 7d50b289cb84a4539a3fa28489284d811246c94e Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Wed, 13 Apr 2022 07:05:32 +0000 Subject: [PATCH 21/34] gsheet partent pdid : ps --- api/application/controllers/Data_Dump_Controller.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 0095beb9..03044fb2 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -388,7 +388,8 @@ class Data_Dump_Controller extends REST_Controller { log_message('ERROR',"G-Sheet For PD Step 6 (Addresses) ERR : ".$e->getMessage()); // var_dump($e->getMessage()); } - $triggertbl_records = array('fk_primary_address_id'=>$address_id,'fk_address_id'=>$address_id); + // $triggertbl_records = array('fk_primary_address_id'=>$address_id,'fk_address_id'=>$address_id); + $triggertbl_records = array('fk_primary_address_id'=>$address_id,'fk_address_id'=>$address_id,'parent_pd_id'=>$pd_id); try { $this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)); From b5b3c294186560e5bef9c8f84b60e267666e5536 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 13 Apr 2022 19:52:44 +0530 Subject: [PATCH 22/34] OTP template : ps --- api/application/controllers/User_Management_Controller.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/application/controllers/User_Management_Controller.php b/api/application/controllers/User_Management_Controller.php index 65717bef..e38c5dbc 100644 --- a/api/application/controllers/User_Management_Controller.php +++ b/api/application/controllers/User_Management_Controller.php @@ -567,8 +567,9 @@ else { // SMS_GUPSHUP::sendSMS($msg,$mobile); // $msg = "OTP for starting your personal discussions with the verification officer is ".$OTP.".Pls share this only when the officer has reached your place"; // $msg = "PD for Loan Applicant ".$OTP." ID - ".$OTP." has been triggered."; - $msg = "PDGenie OTP is : ".$OTP; - SMS_GUPSHUP::sendSMS($msg,$mobile,array('id'=>$userid,'msg'=>"Your OTP is ".$OTP." from User Management Controller")); + //$msg = "PDGenie OTP is : ".$OTP; + $msg = "PDGenie Authentication Code is ".$OTP; + SMS_GUPSHUP::sendSMS($msg,$mobile,array('id'=>$userid,'msg'=>"PDGenie Authentication Code is ".$OTP." from User Management Controller")); $this->User_Management_Model->updateRecords(array('OTP'=>$OTP),USERPROFILE,array('userid'=>$userid)); $data['dataStatus'] = true; From ecccc69767856eab4717d2dafc3c5ad696fd2b56 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Apr 2022 06:01:10 +0000 Subject: [PATCH 23/34] completed - is_form_status removed in disableformv2 api : ps --- api/application/controllers/Template_Management_Controller.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index 58b33dd4..ee4f389a 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -1304,7 +1304,8 @@ class Template_Management_Controller extends REST_Controller { $form_id = $record['form_id']; $is_form_disabled = $record['is_form_disabled']; $fields = array('id'); - $where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"isactive"=>1,"is_form_status"=>"COMPLETED"); + // $where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"isactive"=>1,"is_form_status"=>"COMPLETED"); + $where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"isactive"=>1); $json_table = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATE_JSON_V2); if(count($json_table)>0){ // $data['dataStatus'] = true; From 1c7f3c50c942c5eb221714270453ecaafeeb6d61 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 18 Apr 2022 13:06:20 +0000 Subject: [PATCH 24/34] Dynamic Template ( loadFullTemplateV2 - mapid empty means) : ps --- api/application/models/PD_Model.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 066e71cb..db98174c 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -2362,6 +2362,8 @@ class PD_Model extends SPARQ_Model { $map_id = $row->id; } else { $map_id = ""; + return []; + // msg = 'There is no Template Registered With Us Please check With TemplateV2 Screen'; } } $this->db->SELECT('TEMPLATE_JSON_V2.id as template_id,TEMPLATE_JSON_V2.map_id,TEMPLATE_JSON_V2.form_id,PDFORMS.pd_form_order,PDFORMS.pd_form_level_order,PDFORMS.pd_form_name as form_name,TEMPLATE_JSON_V2.is_form_disabled,PDFORMS.is_business_form,TEMPLATE_JSON_V2.is_group_form'); From d2e13a6443cacab94dde70078143edd44909a890 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 19 Apr 2022 11:16:00 +0000 Subject: [PATCH 25/34] Dynamic Template : form_status Removed : ps --- .../controllers/Template_Management_Controller.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/application/controllers/Template_Management_Controller.php b/api/application/controllers/Template_Management_Controller.php index ee4f389a..dc14adbb 100644 --- a/api/application/controllers/Template_Management_Controller.php +++ b/api/application/controllers/Template_Management_Controller.php @@ -1271,8 +1271,10 @@ class Template_Management_Controller extends REST_Controller { $form_id = $_GET['form_id']; $template_id = isset($_GET['template_id'])?$_GET['template_id']:null; $fields = array('id','json'); - if($template_id){$where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"is_form_status"=>"COMPLETED","id"=>$template_id);} - else{$where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"is_form_status"=>"COMPLETED","isactive"=>1);$data['note'] = "Existing JSON..";} + // if($template_id){$where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"is_form_status"=>"COMPLETED","id"=>$template_id);} + // else{$where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"is_form_status"=>"COMPLETED","isactive"=>1);$data['note'] = "Existing JSON..";} + if($template_id){$where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"id"=>$template_id);} + else{$where_condition_array = array('map_id'=>$map_id,"form_id"=>$form_id,"isactive"=>1);} $json_table = $this->Template_Management_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATE_JSON_V2); if(count($json_table)>0){ $data['dataStatus'] = true; From f431d0571fc4277bd20761c1c0723bc9b1c9ec36 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 20 Apr 2022 17:06:50 +0530 Subject: [PATCH 26/34] PD officer List for notification : ps --- api/application/config/routes.php | 5 +- api/application/controllers/PD_Controller.php | 97 ++++++++++++++++++- api/application/helpers/pdalerts_helper.php | 30 ++++++ .../helpers/push_notification_helper.php | 2 +- 4 files changed, 127 insertions(+), 7 deletions(-) diff --git a/api/application/config/routes.php b/api/application/config/routes.php index fda37078..a77fd306 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -359,4 +359,7 @@ $route['optimizeImages/(:num)'] = 'PD_Controller/optimizeImages'; $route['downloadSMCExcelFile/(:num)'] = 'PD_Controller/downloadSMCExcelFile'; $route['compareFaces'] = 'Test/compareFaces'; -$route['googleSheet'] = 'Data_Dump_Controller/googleSheet'; \ No newline at end of file +$route['googleSheet'] = 'Data_Dump_Controller/googleSheet'; + +$route['getListPDOfficersForNotification'] = 'PD_Controller/getListPDOfficersForNotification'; +$route['sendNotificationToOfficers'] = 'PD_Controller/sendNotificationToOfficers'; \ No newline at end of file diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index d163c127..ead4e1ed 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -1826,7 +1826,7 @@ public function assignPDTempalate($data) *GET List of PD officers for PD edit/view page for manual allocation *@param pd */ - public function getListPDOfficers_post() + public function getListPDOfficers_post() { $pdid = $this->post('pdid'); @@ -11761,9 +11761,96 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() $this->response($data,REST_Controller::HTTP_OK); } } - + + public function getListPDOfficersForNotification_get(){ + + $fields = array('fk_user_id'); + $where_condition_array = array('isactive' => 1); + $list_of_pd_officers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS); + if(!empty($list_of_pd_officers)){ + foreach($list_of_pd_officers as $key => $pdofficer) + { + $this->db->SELECT('USERPROFILE.first_name,USERPROFILE.last_name,USERPROFILE.profilepic,USERPROFILE.mobile_no,USERPROFILEROLES.user_role,ROLES.role_name'); + $this->db->FROM(USERPROFILE.' as USERPROFILE'); + $this->db->JOIN(USERPROFILEROLES.' as USERPROFILEROLES','USERPROFILE.userid = USERPROFILEROLES.fk_userid'); + $this->db->JOIN(ROLES.' as ROLES','USERPROFILEROLES.user_role = ROLES.role_id'); + $this->db->WHERE('USERPROFILE.userid',$pdofficer['fk_user_id']); + $names = $this->db->GET()->result_array(); + if(count($names)){ + $list_of_pd_officers[$key]['first_name'] = $names[0]['first_name']; + $list_of_pd_officers[$key]['last_name'] = $names[0]['last_name']; + $list_of_pd_officers[$key]['mobile_no'] = $names[0]['mobile_no']; + $list_of_pd_officers[$key]['user_role'] = $names[0]['user_role']; + $list_of_pd_officers[$key]['role_name'] = $names[0]['role_name']; + } + } + } + // Get Central PD Officers List + $central_pd_officers = array(); + + $this->db->SELECT('USERPROFILE.userid as fk_user_id,USERPROFILE.first_name,USERPROFILE.last_name,USERPROFILE.mobile_no,USERPROFILEROLES.user_role,ROLES.role_name'); + $this->db->FROM(USERPROFILE.' as USERPROFILE'); + $this->db->JOIN(USERPROFILEROLES.' as USERPROFILEROLES','USERPROFILE.userid = USERPROFILEROLES.fk_userid'); + $this->db->JOIN(ROLES.' as ROLES','USERPROFILEROLES.user_role = ROLES.role_id'); + $this->db->WHERE('ROLES.role_id',2); + $central_pd_officers = $this->db->GET()->result_array(); + + + if(!empty($list_of_pd_officers) && !empty($central_pd_officers)){ + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['msg'] = 'PD-Officer and Central PD-Officer Records Available!'; + $data['records'] = array('pdofficers' => $list_of_pd_officers,'centralpdofficers' => $central_pd_officers); + + }else if(empty($list_of_pd_officers) && !empty($central_pd_officers)){ + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['msg'] = 'PD-Officer Records Not Found!'; + $data['records'] = array('pdofficers' => array(),'centralpdofficers' => $central_pd_officers); + }else if(empty($central_pd_officers) && !empty($list_of_pd_officers)){ + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['msg'] = 'Central PD-Officer Records Not Found!'; + $data['records'] = array('pdofficers' => $list_of_pd_officers,'centralpdofficers' => array()); + }else{ + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'Officers Records Not Found!'; + } + $this->response($data,REST_Controller::HTTP_OK); + } + public function sendNotificationToOfficers_post(){ + $records = $this->post('records'); + $users = $records['user_id']; // alluser,multiuser,particularuser + $msg = $records['msg']; // alluser,multiuser,particularuser + // print_r($this->post());die(); + + if(!empty($msg) && !empty($users)){ + // $fields = array('notification_token_id','mob_token'); + // $where_condition_array = array(); + // $tokens = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,USERNOTIFICATIONTOKENS); + // pd offier's mobile token get form notification table + PDALERTS::sendNotificationToOfficers($records); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['msg'] = 'Notification Sended'; + }else{ + if(empty($msg)){ + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'Message Data Not Found!'; + }else if(empty($users)){ + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'Users Not Found!'; + }else{ + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'Records Not Found!'; + } + } + $this->response($data,REST_Controller::HTTP_OK); + } -} - - +} \ No newline at end of file diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index 5cb0eef7..adb5d3cc 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -842,6 +842,36 @@ class PDALERTS } $mail->SmtpClose(); } + + public static function sendNotificationToOfficers($records) + { + $users = $records['user_id']; // alluser,multiuser,particularuser + $msg = $records['msg']; // msg + $CI =&get_instance(); + $CI->load->helper('push_notification'); + // notification_token_id, fk_user_id, web_token, mob_token, createdon, updatedon + $CI->db->SELECT("USERNOTIFICATIONTOKENS.notification_token_id,USERNOTIFICATIONTOKENS.fk_user_id,USERNOTIFICATIONTOKENS.mob_token"); + $CI->db->FROM(USERNOTIFICATIONTOKENS." as USERNOTIFICATIONTOKENS"); + $CI->db->JOIN(USERPROFILEROLES.' as USERPROFILEROLES','USERPROFILEROLES.fk_userid = USERNOTIFICATIONTOKENS.fk_user_id'); + // $CI->db->WHERE('ROLES.role_id',2); + if(is_array($users) && count($users)){ + if($users[0] != 0){ + $CI->db->WHERE_IN('USERNOTIFICATIONTOKENS.fk_user_id ',$users); + }else{ + $CI->db->WHERE_IN("USERPROFILEROLES.user_role",[2,22]);//pd officer roles only + // $CI->db->WHERE_IN("USERPROFILEROLES.user_role",[2,5,22]); + } + } + $CI->db->WHERE('USERNOTIFICATIONTOKENS.mob_token != ""'); + $notification_details = $CI->db->GET()->result_array(); + + $additional_data_for_logs['to_whom'] = 'PDOFFICERS'; + $web_token = ""; + for($i=0;$iinfo("PUSH NOTIFICATION ",array('firebase_result' => $result,'additional_data' => $additional_data,'token_type' => ($type == 1? 'WEB' : 'MOB'),'token' => $token)); + MYLOG::logFunction(null,(isset($additional_data['pd_id'])?$additional_data['pd_id']:""))->info("PUSH NOTIFICATION ",array('firebase_result' => $result,'additional_data' => $additional_data,'token_type' => ($type == 1? 'WEB' : 'MOB'),'token' => $token)); } } From 69da7583b1fdc2339f578c028722e8586c855b71 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 20 Apr 2022 21:37:25 +0530 Subject: [PATCH 27/34] Gsheet client queries 1 : ps --- .../controllers/Data_Dump_Controller.php | 142 +++++++++++------- 1 file changed, 91 insertions(+), 51 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 03044fb2..16584395 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -147,7 +147,7 @@ class Data_Dump_Controller extends REST_Controller { $fk_lender_id = $this->Data_Dump_Model->getId(1,trim($GSdata["LenderName"])); $pd_details['fk_lender_id']=$fk_lender_id; $pd_details['sub_entity_id']=$fk_lender_id; - log_message('ERROR',"G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata["LenderName"]." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); + log_message('ERROR',"G-Sheet For PD Step 2.1 (lender/casebookedin) GSheet data : ".$GSdata["LenderName"]." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); $lender_contact_persons = $this->PD_Model->getLenderContactPersons($fk_lender_id,null); if(!empty($lender_contact_persons)){ $pd_details['lender_credit_person'] = $lender_contact_persons[0]['role_type'] == "CREDIT" ? $lender_contact_persons[0]['userid'] : null; @@ -157,33 +157,52 @@ class Data_Dump_Controller extends REST_Controller { if(isset($GSdata["LAN"]) && $GSdata["LAN"] != ""){ $LAN = trim(str_replace(" ", "", $GSdata["LAN"])); $pd_details['lender_applicant_id'] =$LAN; - log_message('ERROR',"G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)GSheet data : ".$LAN." PD :".$pd_details['lender_applicant_id']); + log_message('ERROR',"G-Sheet For PD Step 2.2 (loan applicantid) GSheet data : ".$LAN." PD :".$pd_details['lender_applicant_id']); } + // $applicatantParts =""; + // if(isset($GSdata["ApplicantName_CompanyName"]) && $GSdata["ApplicantName_CompanyName"] != ""){ + // $applicatantParts = explode(',',$GSdata["ApplicantName_CompanyName"]); + // if(count($applicatantParts)>1){ + // for($j=0;$j1){ + // $pd_applicant_details[0]['applicant_name'] = $splitCompanyandApplicant[0]; + // $pd_applicant_details[0]['company_name'] = isset($splitCompanyandApplicant[1]) ? $splitCompanyandApplicant[1] : null; + // } + // else{ + // $pd_applicant_details[0]['applicant_name'] = $splitCompanyandApplicant[0]; + // $pd_applicant_details[0]['company_name'] = null; + // } + // } + // $pd_applicant_details[0]['mobile_no'] = isset($GSdata['ContactNumber']) ? $GSdata['ContactNumber'] : null; + // $pd_applicant_details[0]['applicant_type'] = 1; + // log_message('ERROR',"G-Sheet For PD Step 2.3 (Third Cell applicantdetails) GSheet data : ".$GSdata['ContactNumber']); + // log_message('ERROR',"G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber) GSheet data : ".$GSdata['ContactNumber']); + // } $applicatantParts =""; - if(isset($GSdata["ApplicantName_CompanyName"]) && $GSdata["ApplicantName_CompanyName"] != ""){ - $applicatantParts = explode(',',$GSdata["ApplicantName_CompanyName"]); + if(isset($GSdata["ApplicantName"]) && $GSdata["ApplicantName"] != ""){ + $applicatantParts = explode(',',$GSdata["ApplicantName"]); if(count($applicatantParts)>1){ for($j=0;$j1){ - $pd_applicant_details[0]['applicant_name'] = $splitCompanyandApplicant[0]; - $pd_applicant_details[0]['company_name'] = isset($splitCompanyandApplicant[1]) ? $splitCompanyandApplicant[1] : null; - } - else{ - $pd_applicant_details[0]['applicant_name'] = $splitCompanyandApplicant[0]; - $pd_applicant_details[0]['company_name'] = null; - } + $pd_applicant_details[0]['applicant_name'] = $applicatantParts[0]; + } + $pd_applicant_details[0]['company_name'] = isset($GSdata["CompanyName"]) ? $GSdata["CompanyName"] : null ; $pd_applicant_details[0]['mobile_no'] = isset($GSdata['ContactNumber']) ? $GSdata['ContactNumber'] : null; $pd_applicant_details[0]['applicant_type'] = 1; - log_message('ERROR',"G-Sheet For PD Step 2.3 (Third Cell applicantdetails) GSheet data : ".$GSdata['ContactNumber']); - log_message('ERROR',"G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber) GSheet data : ".$GSdata['ContactNumber']); + log_message('ERROR',"G-Sheet For PD Step 2.3 (applicant details) GSheet data : ".json_encode($pd_applicant_details)); + log_message('ERROR',"G-Sheet For PD Step 2.4 (mobile number) GSheet data : ".$GSdata['ContactNumber']); + log_message('ERROR',"G-Sheet For PD Step 2.5 (company) GSheet data : ".$GSdata["CompanyName"]); } + //address section. if(isset($GSdata["PDLocation"]) && $GSdata["PDLocation"] != ""){ $NormalParts = explode(',', $GSdata["PDLocation"]); @@ -209,11 +228,11 @@ class Data_Dump_Controller extends REST_Controller { $pd_details['addressline1']=$addresses['addressline1']; // echo "Original Address : ".$GSdataata[$i]; // echo "Modified Address : ".$address; - log_message('ERROR',"G-Sheet For PD Step 2.5 (Fifth Cell address) GSheet data : ".$GSdata["PDLocation"]); + log_message('ERROR',"G-Sheet For PD Step 2.6 (address) GSheet data : ".$GSdata["PDLocation"]); } if(isset($GSdata["PersonDoing"]) && $GSdata["PersonDoing"] != ""){ $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,$GSdata["PersonDoing"]); - log_message('ERROR',"G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata["PersonDoing"]); + log_message('ERROR',"G-Sheet For PD Step 2.7 (Allocated Person) GSheet data : ".$GSdata["PersonDoing"]); } if(isset($GSdata["LoanAmount"]) && ($GSdata["LoanAmount"] != "" || $GSdata["LoanAmount"] != 0)){ // $amount = strtolower($GSdata["LoanAmount"]); @@ -241,50 +260,50 @@ class Data_Dump_Controller extends REST_Controller { // }} // $pd_details['loan_amount'] = implode("",$amount); $pd_details['loan_amount'] = (int)$GSdata["LoanAmount"]; - log_message('ERROR',"G-Sheet For PD Step 2.7 (Seventh Cell Amount) GSheet data : ".$GSdata["LoanAmount"]." PD :".$pd_details['loan_amount']); + log_message('ERROR',"G-Sheet For PD Step 2.8 (Amount) GSheet data : ".$GSdata["LoanAmount"]." PD details :".$pd_details['loan_amount']); } $fk_product_id =""; - if(isset($GSdata["Product_SubProduct"]) && $GSdata["Product_SubProduct"] != ""){ - $product = explode('/', $GSdata["Product_SubProduct"]); - if(count($product)>1){ - $fk_product_id = $this->Data_Dump_Model->getId(2,trim($product[0])); - $pd_details['fk_product_id'] = $fk_product_id; - $pd_details['fk_subproduct_id'] = $this->Data_Dump_Model->getId(3,$product[1]); - } - else{ - $fk_product_id = $this->Data_Dump_Model->getId(2,trim($product[0])); - $pd_details['fk_product_id'] = $product[0] ? $fk_product_id : null ; - } - log_message('ERROR',"G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct) GSheet data : ".$GSdata["Product_SubProduct"]); + if(isset($GSdata["Product"]) && $GSdata["Product"] != ""){ + $fk_product_id = $this->Data_Dump_Model->getId(2,trim($GSdata["Product"])); + $pd_details['fk_product_id'] = $GSdata["Product"] ? $fk_product_id : null ; + log_message('ERROR',"G-Sheet For PD Step 2.9 (Product) GSheet data : ".$GSdata["Product"]." pd details : ".$fk_product_id); + } + if(isset($GSdata["SubProduct"]) && $GSdata["SubProduct"] != ""){ + $pd_details['fk_subproduct_id'] = $this->Data_Dump_Model->getId(3,$GSdata["SubProduct"]); + log_message('ERROR',"G-Sheet For PD Step 2.10 (SubProduct) GSheet data : ".$GSdata["SubProduct"]." pd details : ".$pd_details['fk_subproduct_id']); + } + if(isset($GSdata["Type"]) && $GSdata["Type"] != ""){ + $type = $GSdata["Type"]; + $modifytype = ($type != "") ? strtoupper(str_replace(' ', '', $type)) : "FULLPD"; + $pd_details['fk_pd_type'] = $modifytype == "FULLPD" ? 1 : ($modifytype == "SMARTPD" ? 2 :($modifytype == "TELEPD" ? 3 : 0) ) ; + log_message('ERROR',"G-Sheet For PD Step 2.11 (pd-type) GSheet data : ".$GSdata["Type"]." PD details :".$pd_details['fk_pd_type']); } $fk_customer_segment = ""; - if(isset($GSdata["Type_CustomerSegment"]) && $GSdata["Type_CustomerSegment"] != ""){ - $type = explode('/', $GSdata["Type_CustomerSegment"]); - $modifytype = ($type[0] != "") ? strtoupper(str_replace(' ', '', $type[0])) : "FULLPD"; - if(count($type)>1){ - $pd_details['fk_pd_type'] = $modifytype == "FULLPD" ? 1 : ($modifytype == "SMARTPD" ? 2 :($modifytype == "TELEPD" ? 3 : 0) ) ; - $modifycustomerSegment = ($type[1] != "") ? $type[1] : null; + if(isset($GSdata["CustomerSegment"]) && $GSdata["CustomerSegment"] != ""){ + $modifycustomerSegment = ($GSdata["CustomerSegment"] != "") ? $GSdata["CustomerSegment"] : null; $fk_customer_segment = $this->Data_Dump_Model->getId(4,trim($modifycustomerSegment)); $pd_details['fk_customer_segment'] = $fk_customer_segment; - }else{ - $pd_details['fk_pd_type'] = $modifytype == "FULLPD" ? 1 : ($modifytype == "SMARTPD" ? 2 :($modifytype == "TELEPD" ? 3 : 0) ) ; - } - log_message('ERROR',"G-Sheet For PD Step 2.9 (ninth Cell type/cs) GSheet data : ".$GSdata["Type_CustomerSegment"]." Modify : ".$modifytype." PD :".$pd_details['fk_pd_type']); + log_message('ERROR',"G-Sheet For PD Step 2.12 (customer segment) GSheet data : ".$GSdata["CustomerSegment"]." PD details :".$fk_customer_segment); } - // if(isset($GSdata["DateofReceivingPDRequest"]) && $GSdata["DateofReceivingPDRequest"] != ""){ // $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata["DateofReceivingPDRequest"])); // $pd_details['pd_date_of_initiation'] = $new_date_format; // log_message('ERROR',"G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata["DateofReceivingPDRequest"]." PD :".$pd_details['pd_date_of_initiation']); // } - if(isset($GSdata["RemarksonCurrentStatus"]) && $GSdata["RemarksonCurrentStatus"] != ""){ - $pd_details['remarks'] = "`Remarks on Current Status` : ".$GSdata["RemarksonCurrentStatus"]; - log_message('ERROR',"G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata["RemarksonCurrentStatus"]." PD :".$pd_details['remarks']); + if(isset($GSdata["AdditionalRequirements"]) && $GSdata["AdditionalRequirements"] != ""){ + // $pd_details['remarks'] = "`Remarks on Current Status` : ".$GSdata["RemarksonCurrentStatus"]; + $pd_addtional_requirements = explode(',',$GSdata["AdditionalRequirements"]); + log_message('ERROR',"G-Sheet For PD Step 2.13 ( additional requirements) GSheet data : ".$GSdata["AdditionalRequirements"]." PD details :".json_encode($pd_addtional_requirements)); } - if(isset($GSdata["PreviousRemarks"]) && $GSdata["PreviousRemarks"] != ""){ - $pd_details['remarks'] = $pd_details['remarks']."\r\n `Previous Remarks` : ".$GSdata["PreviousRemarks"]; - log_message('ERROR',"G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata["RemarksonCurrentStatus"]." PD :".$pd_details['remarks']); + if(isset($GSdata["Remarks"]) && $GSdata["Remarks"] != ""){ + // $pd_details['remarks'] = $pd_details['remarks']."\r\n `Previous Remarks` : ".$GSdata["PreviousRemarks"]; + $pd_details['remarks'] = $GSdata["Remarks"]; + log_message('ERROR',"G-Sheet For PD Step 2.14 (Remarks) : ".$pd_details['remarks']); + } + if(isset($GSdata["LenderCreditName"]) && $GSdata["LenderCreditName"] != ""){ + $pd_details['lender_credit_person'] = $this->Data_Dump_Model->getId(8,$GSdata["LenderCreditName"]); + log_message('ERROR',"G-Sheet For PD Step 2.15 (Lender Credit Person) GSheet data : ".$GSdata["LenderCreditName"]); } // print_r($pd_applicant_details); @@ -372,7 +391,28 @@ class Data_Dump_Controller extends REST_Controller { } } - + ## Credit Manager’s Specific Queries + if($pd_id != ""){ + if($pd_addtional_requirements != "" || $pd_addtional_requirements != null) + { + log_message('ERROR',"G-Sheet For PD Step 6 (credit manager queries)"); + foreach($pd_addtional_requirements as $pd_addtional_requirement) + { + try { + $pd_addtional_requirement['fk_pd_id'] = $pd_id; + $requirement_id = $this->Data_Dump_Model->saveRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS); + log_message('ERROR',"G-Sheet For PD Step 6.1 (credit manager queries/additional requirements pkid) REQUIREMENTS-ID : ".$requirement_id); + if(empty($requirement_id)) { + throw new Exception('Error On Inserting Additional Requirements'); + } + } catch (Exception $e) { + //alert the user. + log_message('ERROR',"G-Sheet For PD Step 6.1 (credit manager queries/additional requirements pkid) ERR : ".$e->getMessage()); + // var_dump($e->getMessage()); + } + } + } + } ## Address Section. if($pd_id != ""){ $addresses['fk_pd_id'] = $pd_id; From eec23ec2b3a4555da17d2955be1bd135d779349b Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Thu, 21 Apr 2022 13:02:39 +0530 Subject: [PATCH 28/34] role id added in notification api : ps --- api/application/controllers/PD_Controller.php | 1 + api/application/helpers/pdalerts_helper.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index ead4e1ed..2df46f86 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -11775,6 +11775,7 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() $this->db->JOIN(USERPROFILEROLES.' as USERPROFILEROLES','USERPROFILE.userid = USERPROFILEROLES.fk_userid'); $this->db->JOIN(ROLES.' as ROLES','USERPROFILEROLES.user_role = ROLES.role_id'); $this->db->WHERE('USERPROFILE.userid',$pdofficer['fk_user_id']); + $this->db->WHERE_IN("USERPROFILEROLES.user_role",[5]);//pd officer role only $names = $this->db->GET()->result_array(); if(count($names)){ $list_of_pd_officers[$key]['first_name'] = $names[0]['first_name']; diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index adb5d3cc..4da86494 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -852,18 +852,20 @@ class PDALERTS // notification_token_id, fk_user_id, web_token, mob_token, createdon, updatedon $CI->db->SELECT("USERNOTIFICATIONTOKENS.notification_token_id,USERNOTIFICATIONTOKENS.fk_user_id,USERNOTIFICATIONTOKENS.mob_token"); $CI->db->FROM(USERNOTIFICATIONTOKENS." as USERNOTIFICATIONTOKENS"); - $CI->db->JOIN(USERPROFILEROLES.' as USERPROFILEROLES','USERPROFILEROLES.fk_userid = USERNOTIFICATIONTOKENS.fk_user_id'); + $CI->db->JOIN(USERPROFILEROLES.' as USERPROFILEROLES','USERPROFILEROLES.fk_userid = USERNOTIFICATIONTOKENS.fk_user_id and USERPROFILEROLES.isactive = 1'); // $CI->db->WHERE('ROLES.role_id',2); if(is_array($users) && count($users)){ if($users[0] != 0){ $CI->db->WHERE_IN('USERNOTIFICATIONTOKENS.fk_user_id ',$users); }else{ - $CI->db->WHERE_IN("USERPROFILEROLES.user_role",[2,22]);//pd officer roles only + $CI->db->WHERE_IN("USERPROFILEROLES.user_role",[5]);//pd officer roles only // $CI->db->WHERE_IN("USERPROFILEROLES.user_role",[2,5,22]); } } $CI->db->WHERE('USERNOTIFICATIONTOKENS.mob_token != ""'); $notification_details = $CI->db->GET()->result_array(); + // print_r($CI->db->last_query());die(); + // print_r($notification_details);die(); $additional_data_for_logs['to_whom'] = 'PDOFFICERS'; $web_token = ""; From d2217ee01917324e5bb13b9340472d60c882704c Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Thu, 21 Apr 2022 13:28:02 +0530 Subject: [PATCH 29/34] log message added : ps --- api/application/controllers/PD_Controller.php | 13 ++++++++++--- api/application/helpers/pdalerts_helper.php | 12 +++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 2df46f86..64f54350 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -11763,7 +11763,7 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() } public function getListPDOfficersForNotification_get(){ - + log_message('ERROR',"getListPDOfficers Function"); $fields = array('fk_user_id'); $where_condition_array = array('isactive' => 1); $list_of_pd_officers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS); @@ -11786,6 +11786,7 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() } } } + log_message('ERROR',"getListPDOfficers PDofficer list : ".json_encode($list_of_pd_officers)); // Get Central PD Officers List $central_pd_officers = array(); @@ -11795,7 +11796,7 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() $this->db->JOIN(ROLES.' as ROLES','USERPROFILEROLES.user_role = ROLES.role_id'); $this->db->WHERE('ROLES.role_id',2); $central_pd_officers = $this->db->GET()->result_array(); - + log_message('ERROR',"getListPDOfficers CentralPDofficer list : ".json_encode($central_pd_officers)); if(!empty($list_of_pd_officers) && !empty($central_pd_officers)){ $data['dataStatus'] = true; @@ -11821,6 +11822,7 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() $this->response($data,REST_Controller::HTTP_OK); } public function sendNotificationToOfficers_post(){ + log_message('ERROR',"send Notification To Officers "); $records = $this->post('records'); $users = $records['user_id']; // alluser,multiuser,particularuser $msg = $records['msg']; // alluser,multiuser,particularuser @@ -11831,20 +11833,25 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() // $where_condition_array = array(); // $tokens = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,USERNOTIFICATIONTOKENS); // pd offier's mobile token get form notification table - PDALERTS::sendNotificationToOfficers($records); + $resp = PDALERTS::sendNotificationToOfficers($records); + log_message('ERROR',"send Notification To Officers : ".json_encode($resp)); $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; $data['msg'] = 'Notification Sended'; + $data['details'] = $resp; }else{ if(empty($msg)){ + log_message('ERROR',"send Notification To Officers : Message Not Found "); $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['msg'] = 'Message Data Not Found!'; }else if(empty($users)){ + log_message('ERROR',"send Notification To Officers : Officer List Not Found "); $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['msg'] = 'Users Not Found!'; }else{ + log_message('ERROR',"send Notification To Officers : No Content "); $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['msg'] = 'Records Not Found!'; diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index 4da86494..b00905fd 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -845,14 +845,16 @@ class PDALERTS public static function sendNotificationToOfficers($records) { + log_message('ERROR','send Notification To Officers in pd alert'); $users = $records['user_id']; // alluser,multiuser,particularuser $msg = $records['msg']; // msg $CI =&get_instance(); $CI->load->helper('push_notification'); // notification_token_id, fk_user_id, web_token, mob_token, createdon, updatedon - $CI->db->SELECT("USERNOTIFICATIONTOKENS.notification_token_id,USERNOTIFICATIONTOKENS.fk_user_id,USERNOTIFICATIONTOKENS.mob_token"); + $CI->db->SELECT("USERNOTIFICATIONTOKENS.notification_token_id,USERNOTIFICATIONTOKENS.fk_user_id,USERNOTIFICATIONTOKENS.mob_token,concat(USERPROFILE.first_name,' ',USERPROFILE.last_name) as pdofficer_name"); $CI->db->FROM(USERNOTIFICATIONTOKENS." as USERNOTIFICATIONTOKENS"); $CI->db->JOIN(USERPROFILEROLES.' as USERPROFILEROLES','USERPROFILEROLES.fk_userid = USERNOTIFICATIONTOKENS.fk_user_id and USERPROFILEROLES.isactive = 1'); + $CI->db->JOIN(USERPROFILE." as USERPROFILE","USERNOTIFICATIONTOKENS.fk_user_id = USERPROFILE.userid",'LEFT'); // $CI->db->WHERE('ROLES.role_id',2); if(is_array($users) && count($users)){ if($users[0] != 0){ @@ -864,15 +866,23 @@ class PDALERTS } $CI->db->WHERE('USERNOTIFICATIONTOKENS.mob_token != ""'); $notification_details = $CI->db->GET()->result_array(); + log_message('ERROR',"send Notification To Officers Records : ".json_encode($notification_details)); // print_r($CI->db->last_query());die(); // print_r($notification_details);die(); $additional_data_for_logs['to_whom'] = 'PDOFFICERS'; $web_token = ""; + + // $officers_name = array(); + $officers_name['total_count'] = count($notification_details); + $officers_name['officers'] = array(); for($i=0;$i Date: Thu, 21 Apr 2022 23:11:12 +0530 Subject: [PATCH 30/34] Google Sheet Rview Completed : ps --- .../controllers/Data_Dump_Controller.php | 53 +++++++++++++------ 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 16584395..d28f4aab 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -148,11 +148,11 @@ class Data_Dump_Controller extends REST_Controller { $pd_details['fk_lender_id']=$fk_lender_id; $pd_details['sub_entity_id']=$fk_lender_id; log_message('ERROR',"G-Sheet For PD Step 2.1 (lender/casebookedin) GSheet data : ".$GSdata["LenderName"]." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); - $lender_contact_persons = $this->PD_Model->getLenderContactPersons($fk_lender_id,null); - if(!empty($lender_contact_persons)){ - $pd_details['lender_credit_person'] = $lender_contact_persons[0]['role_type'] == "CREDIT" ? $lender_contact_persons[0]['userid'] : null; - $pd_details['lender_sales_person'] = $lender_contact_persons[0]['role_type'] == "SALES" ? $lender_contact_persons[0]['userid'] : null; - } + // $lender_contact_persons = $this->PD_Model->getLenderContactPersons($fk_lender_id,null); + // if(!empty($lender_contact_persons)){ + // $pd_details['lender_credit_person'] = $lender_contact_persons[0]['role_type'] == "CREDIT" ? $lender_contact_persons[0]['userid'] : null; + // $pd_details['lender_sales_person'] = $lender_contact_persons[0]['role_type'] == "SALES" ? $lender_contact_persons[0]['userid'] : null; + // } } if(isset($GSdata["LAN"]) && $GSdata["LAN"] != ""){ $LAN = trim(str_replace(" ", "", $GSdata["LAN"])); @@ -195,12 +195,22 @@ class Data_Dump_Controller extends REST_Controller { $pd_applicant_details[0]['applicant_name'] = $applicatantParts[0]; } - $pd_applicant_details[0]['company_name'] = isset($GSdata["CompanyName"]) ? $GSdata["CompanyName"] : null ; - $pd_applicant_details[0]['mobile_no'] = isset($GSdata['ContactNumber']) ? $GSdata['ContactNumber'] : null; + $pd_applicant_details[0]['company_name'] = (isset($GSdata["CompanyName"]) && $GSdata["CompanyName"] != "") ? $GSdata["CompanyName"] : null ; $pd_applicant_details[0]['applicant_type'] = 1; log_message('ERROR',"G-Sheet For PD Step 2.3 (applicant details) GSheet data : ".json_encode($pd_applicant_details)); - log_message('ERROR',"G-Sheet For PD Step 2.4 (mobile number) GSheet data : ".$GSdata['ContactNumber']); - log_message('ERROR',"G-Sheet For PD Step 2.5 (company) GSheet data : ".$GSdata["CompanyName"]); + log_message('ERROR',"G-Sheet For PD Step 2.4 (company) GSheet data : ".$GSdata["CompanyName"]); + } + if(isset($GSdata["ContactNumber"]) && $GSdata["ContactNumber"] != ""){ + $ContactNumber = explode(',',$GSdata["ContactNumber"]); + if(count($ContactNumber)>1){ + for($j=0;$jData_Dump_Model->getId(8,$GSdata["PersonDoing"]); + // $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,$GSdata["PersonDoing"]); log_message('ERROR',"G-Sheet For PD Step 2.7 (Allocated Person) GSheet data : ".$GSdata["PersonDoing"]); } if(isset($GSdata["LoanAmount"]) && ($GSdata["LoanAmount"] != "" || $GSdata["LoanAmount"] != 0)){ @@ -292,9 +302,16 @@ class Data_Dump_Controller extends REST_Controller { // } if(isset($GSdata["AdditionalRequirements"]) && $GSdata["AdditionalRequirements"] != ""){ - // $pd_details['remarks'] = "`Remarks on Current Status` : ".$GSdata["RemarksonCurrentStatus"]; - $pd_addtional_requirements = explode(',',$GSdata["AdditionalRequirements"]); - log_message('ERROR',"G-Sheet For PD Step 2.13 ( additional requirements) GSheet data : ".$GSdata["AdditionalRequirements"]." PD details :".json_encode($pd_addtional_requirements)); + $requirements = explode(',',$GSdata["AdditionalRequirements"]); + if(count($requirements)>1){ + for($j=0;$j$fk_lender_id ,'fk_product_id'=> $fk_product_id,'fk_customer_segment'=> $fk_customer_segment,'isactive' => 1); @@ -361,7 +379,7 @@ class Data_Dump_Controller extends REST_Controller { log_message('ERROR',"G-Sheet For PD Step 4 (PDID gotten) ERR : ".$e->getMessage()); // var_dump($e->getMessage()); } - // $pd_id = 3073; + // $pd_id = 3149; if($pd_id != null || $pd_id != '') @@ -374,7 +392,7 @@ class Data_Dump_Controller extends REST_Controller { { $pd_applicant_detail['fk_pd_id'] = $pd_id; $pd_applicant_detail['applicant_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['applicant_name'])); - if($pd_applicant_detail['company_name']){ $pd_applicant_detail['company_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['company_name'])); } + if(isset($pd_applicant_detail['company_name'])){ $pd_applicant_detail['company_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['company_name'])); } try { $co_applicant_id = $this->Data_Dump_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS); log_message('ERROR',"G-Sheet For PD Step 5.1 (applicant pkid) Applicant-ID : ".$co_applicant_id); @@ -393,12 +411,13 @@ class Data_Dump_Controller extends REST_Controller { } ## Credit Manager’s Specific Queries if($pd_id != ""){ - if($pd_addtional_requirements != "" || $pd_addtional_requirements != null) + if($addi_requirements != "" || $addi_requirements != null) { log_message('ERROR',"G-Sheet For PD Step 6 (credit manager queries)"); - foreach($pd_addtional_requirements as $pd_addtional_requirement) + foreach($addi_requirements as $pd_addtional_requirement) { try { + $pd_addtional_requirement['isactive'] = 1; $pd_addtional_requirement['fk_pd_id'] = $pd_id; $requirement_id = $this->Data_Dump_Model->saveRecords($pd_addtional_requirement,PDADDTIONALREQUIREMENTS); log_message('ERROR',"G-Sheet For PD Step 6.1 (credit manager queries/additional requirements pkid) REQUIREMENTS-ID : ".$requirement_id); From 292d8afa363aacfa200f525ad975f3d7c96ed69a Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Sat, 23 Apr 2022 08:11:35 +0000 Subject: [PATCH 31/34] google sheet lender credit person : ps --- api/application/models/Data_Dump_Model.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/application/models/Data_Dump_Model.php b/api/application/models/Data_Dump_Model.php index 5db37a84..c7fffaa7 100755 --- a/api/application/models/Data_Dump_Model.php +++ b/api/application/models/Data_Dump_Model.php @@ -137,7 +137,9 @@ class Data_Dump_Model extends SPARQ_Model { $select = "pincode_id";$where = "pincode";$table = "m_pincode";} if($flag == 7){ $value = rtrim($keyword," ");$value = ltrim($value," "); $value = strtolower($value); $select = "city_id";$where = "name";$table = "m_city";} - if($flag == 8){ $value = trim($keyword);$value = strtolower($value); + if($flag == 8){ $value = rtrim($keyword," ");$value = ltrim($value," ");$value = strtolower($value); + $select = "userid";$where = "concat(m_user_profile.first_name, ' ', m_user_profile.last_name)";$table = "m_user_profile";} + if($flag == 9){ $value = trim($keyword);$value = strtolower($value); $select = "userid";$where = "first_name";$table = "m_user_profile";} $this->db->select($select); From 0770e89ac1fc357073d3f23344b6ec31a7190ff9 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 26 Apr 2022 04:24:23 +0000 Subject: [PATCH 32/34] PD_Controller.php edited online with Bitbucket --- api/application/controllers/PD_Controller.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 64f54350..a5b2db96 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -11783,6 +11783,8 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() $list_of_pd_officers[$key]['mobile_no'] = $names[0]['mobile_no']; $list_of_pd_officers[$key]['user_role'] = $names[0]['user_role']; $list_of_pd_officers[$key]['role_name'] = $names[0]['role_name']; + }else{ + unset($list_of_pd_officers[$key]); } } } From a7f8cdb19a86dfb0e9df3088afc09036bfc0c03a Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Thu, 28 Apr 2022 11:36:52 +0530 Subject: [PATCH 33/34] Data Dump (New) : ps --- api/application/config/autoload.php | 2 +- api/application/config/routes.php | 9 +- .../Request_DataDump_Controller.php | 229 ++----- .../helpers/requestdatadump_helper.php | 594 ++++++++++++++++++ 4 files changed, 653 insertions(+), 181 deletions(-) create mode 100644 api/application/helpers/requestdatadump_helper.php diff --git a/api/application/config/autoload.php b/api/application/config/autoload.php index 24025f75..8e50e9ea 100644 --- a/api/application/config/autoload.php +++ b/api/application/config/autoload.php @@ -89,7 +89,7 @@ $autoload['drivers'] = array(); | | $autoload['helper'] = array('url', 'file'); */ -$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myutil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform','sms_gupshup','assessedincome','rentalform','external_dir_check','applicantname_grabber','vendor_form','custom_encryption','readexceldata','loanform'); +$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myutil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform','sms_gupshup','assessedincome','rentalform','external_dir_check','applicantname_grabber','vendor_form','custom_encryption','readexceldata','loanform','requestdatadump'); /* | ------------------------------------------------------------------- diff --git a/api/application/config/routes.php b/api/application/config/routes.php index a77fd306..57a70717 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -324,10 +324,6 @@ $route['getCMUsers'] = 'SMC_Credit_PD_Controller/getCMUsers'; $route['smcCreditPDMisReport'] = 'SMC_Credit_PD_Controller/smcCreditPDMisReport'; $route['getCompanyListForSMCList'] = 'SMC_Credit_PD_Controller/getCompanyListForSMCList'; -$route['getRequestForDataDump'] = 'Request_DataDump_Controller/getRequestForDataDump'; -$route['getMasterForDataDump'] = 'Request_DataDump_Controller/getMasterForDataDump'; -$route['downloadDataDump'] = 'Request_DataDump_Controller/downloadDataDump2'; - $route['getSMCVendorList'] = 'SMC_Credit_PD_Controller/getStateWiseAgency'; $route['getSMCVendorPDOfficersList'] = 'SMC_Credit_PD_Controller/getSMCVendorPDOfficersList'; @@ -362,4 +358,7 @@ $route['compareFaces'] = 'Test/compareFaces'; $route['googleSheet'] = 'Data_Dump_Controller/googleSheet'; $route['getListPDOfficersForNotification'] = 'PD_Controller/getListPDOfficersForNotification'; -$route['sendNotificationToOfficers'] = 'PD_Controller/sendNotificationToOfficers'; \ No newline at end of file +$route['sendNotificationToOfficers'] = 'PD_Controller/sendNotificationToOfficers'; + +$route['getMasterForDataDump'] = 'Request_DataDump_Controller/getMasterForDataDump'; +$route['getRequestForDataDump'] = 'Request_DataDump_Controller/getRequestForDataDump'; \ No newline at end of file diff --git a/api/application/controllers/Request_DataDump_Controller.php b/api/application/controllers/Request_DataDump_Controller.php index 10e6ad15..e2abc8e0 100755 --- a/api/application/controllers/Request_DataDump_Controller.php +++ b/api/application/controllers/Request_DataDump_Controller.php @@ -12,6 +12,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); /** @noinspection PhpIncludeInspection */ require_once APPPATH . '/libraries/REST_Controller.php'; include_once APPPATH.'/vendor/autoload.php'; +require APPPATH.'/vendor/autoload.php'; /** * This is an example of a few basic user interaction methods you could use @@ -31,33 +32,61 @@ class Request_DataDump_Controller extends REST_Controller { parent::__construct(); $this->load->model('Data_Dump_Model','Data_Dump_Model'); - //$this->load->library('AWS_S3'); - $this->load->library('excel'); - $this->load->helper('download'); + $this->load->library('pdfgenerator'); + // $this->load->library('AWS_S3'); } - + + ### XL-Data-Dump master Details Filter + # PD-TYPE,PRODUCT,CUSTOMER-SEGMENT AND PD-SNO. + public function getMasterForDataDump_get(){ + log_message('ERROR','## XL-datadump Master Details inside Fns - '.date('Y-m-d H:i:s A')); + $result = $this->Data_Dump_Model->filtermasterfordatadumprequest(); + if(count($result) > 0) + { log_message('ERROR',"## XL-datadump Master Details : ".json_encode($result)); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $result; + } + else + { log_message('ERROR',"## XL-datadump Master Details Error "); + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + } + $this->response($data,REST_Controller::HTTP_OK); + }//getMasterForDataDump closed here. + + ### Request the Details For XL-Data-Dump. public function getRequestForDataDump_post(){ - // {"type":null,"fd":null,"td":null,"pdid":[]} - // {"type":null,"fd":"2021-07-08","td":null,"pdid":[]} - // {"type":null,"fd":"2021-07-08","td":"2021-07-20","pdid":[]} - // {"product_id":null,"customer_segment_id":null,"pd_type_id":null,"from_date":null,"to_date":null,"pd_id":["2583"]} - // {"type":null,"fd":null,"td":null,"pdid":["6691"]} - // {"type":null,"fd":null,"td":null,"pdid":["6692","6691","6688"]} - // {"product":null"customer_segment":null,"type":null,"fd":null,"td":null,"pdid":["6692","6691","6688"]} + // echo XLPATH;die(); + log_message('ERROR','## Request For XL-datadump inside Fns - '.date('Y-m-d H:i:s A')); + ## Sample Params : {"product_id":1,"customer_segment_id":null,"pd_type_id":null,"from_date":null,"to_date":null,"pd_id":["2583","2606"]} $postarr = $this->post(); - // ### Requested Details - $requested_details = $this->Data_Dump_Model->getRequestForDataDump($postarr); - // echo "i am in controller"; print_r($requested_details); count($requested_details); - $file = APPPATH.'docs/RequestDataDump.xls'; - if (file_exists($file)){ - if (file_exists(APPPATH."docs/DataDump.xls")) { - unlink(APPPATH.'docs/DataDump.xls'); - } + log_message('ERROR','## Request For XL-datadump Parmas - '.json_encode($postarr)); + ## Gathering Data based on params. + $requested_details = $this->Data_Dump_Model->getRequestForDataDump($postarr); + log_message('ERROR','## Request For XL-datadump Requested-data count - '.count($requested_details)); + if (!empty($requested_details)){ + requestdatadump::Fns4($requested_details); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['message'] = "Success"; + }// if closed 68; + else { + log_message('ERROR','## Request For XL-datadump file template Not Founded'); + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['message'] = "Fails"; + }//else closed + $this->response($data,REST_Controller::HTTP_OK); + // switch($role_id){} + } + public function getRequestForDataDump2_post(){ + + + // echo "\n The file $file exists"; // $pathinfo = pathinfo($file); print_r($pathinfo); - require_once APPPATH .'third_party/PHPExcel/Classes/PHPExcel/IOFactory.php'; - $reader= PHPExcel_IOFactory::createReaderForFile($file); - $XL = $reader->load($file); + // '3', 'Personal Details', // '15', 'Lender Representative', // '16', 'Assessed Income', @@ -1840,156 +1869,6 @@ class Request_DataDump_Controller extends REST_Controller { // Display the output // echo $encode; // $objWriter->save('php://output'); - $data['dataStatus'] = true; - $data['status'] = REST_Controller::HTTP_OK; - // $data['message'] = "Success ( The file $file exists )"; - $this->response($data,REST_Controller::HTTP_OK); - } - else - { - $data['dataStatus'] = false; - $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $data['message'] = "Fails ( The file $file does not exists )"; - $this->response($data,REST_Controller::HTTP_OK); - } - } - - public function check($ths_var){ - if (isset($the_var)) { - if (empty($the_var)) { - return "-"; - } else { return $the_var; } - } else { return "-"; } - - - } - public function getMasterForDataDump_get(){ - - $result = $this->Data_Dump_Model->filtermasterfordatadumprequest(); - - if(count($result) > 0) - { - $data['dataStatus'] = true; - $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = $result; - $this->response($data,REST_Controller::HTTP_OK); - } - else - { - $data['dataStatus'] = false; - $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $this->response($data,REST_Controller::HTTP_OK); - } - - - } - - public function downloadDataDump_get() - { - - - - - $fp = fopen (APPPATH.'docs/DataDump.xls', 'w+');//This is the file where we save the information - $headers = array('Content-type: application/json'); - $fp = fopen (dirname(__FILE__) . '/localfile.tmp', 'w+');//This is the file where we save the information - $curl = curl_init(DONWLOAD_REPORT); - curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_USERPWD, $api_key); - $file = curl_exec($curl); - - if ($file === false) - { - $info = curl_getinfo($curl); - curl_close($curl); - die('error occured during curl exec. Additioanl info: ' . var_export($info)); - } - - curl_close($curl); - - header('Content-type: ' . 'application/octet-stream'); - header('Content-Disposition: ' . 'attachment; filename=DataDump.xls'); - echo $file; - - } - - public function downloadDataDump1_get() - { - $content = trim(file_get_contents(APPPATH.'docs/DataDump.xls')); - return $content; - } - public function downloadDataDump2_post(){ - // $pth = file_get_contents(APPPATH."docs/DataDump.xls"); - // $nme = "sample_file.xls"; - // force_download($nme, $pth); - if (file_exists(APPPATH."docs/DataDump.xls")) { - header("Content-Type: application/x-binary"); - header("Content-Transfer-Encoding: Binary"); - header("Content-Length:".filesize($file)); - header("Content-Disposition: attachment; filename=".$name); - $file = read_file(APPPATH."docs/DataDump.xls"); // Use file helper to read the file's - $name = "DataDump".date('Y-m-d-H-i-s').'.xls'; - force_download($name, $file); - } else { - $data['dataStatus'] = false; - $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $data['message'] = "The file does not exist"; - $this->response($data,REST_Controller::HTTP_OK); - } - // exit; - } - // public function getXL_get(){ - // $data = read_file(APPPATH."docs/DataDump.xls"); // Use file helper to read the file's - // $name = "DataDump".date('Y-m-d-H-i-s').'.xls'; - // force_download($name, $data); - // } - public function downloadDataDump5_get(){ - $temp_base64_string = "DataDump.xls"; - $title = "Request Data Dump"; - $output_file = APPPATH."docs/DataDump.xls"; - $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - $charactersLength = strlen($characters); - $randomString = ''; - for ($i = 0; $i < 5; $i++) { - $randomString .= $characters[rand(0, $charactersLength - 1)]; - } - $temp_file_name = $randomString.date('Y-m-d-H-i-s').'.xls'; - $ifp = fopen( $output_file, 'wb' ); - $temp_data = explode( ',', $temp_base64_string ); - print_r($temp_data); - // fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) ); - // fclose( $ifp ); - // $tempdoc = $output_file; - // prit_r($tempdoc); - } - public function downloadDataDump3_get(){ - $temp_base64_string = "DataDump.xls"; - $title = "Request Data Dump"; - $output_file = APPPATH."docs/DataDump.xls"; - $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - $charactersLength = strlen($characters); - $randomString = ''; - for ($i = 0; $i < 5; $i++) { - $randomString .= $characters[rand(0, $charactersLength - 1)]; - } - $temp_file_name = $randomString.date('Y-m-d-H-i-s').'.xls'; - $ifp = fopen( $output_file, 'wb' ); - $temp_data = explode( ',', $temp_base64_string ); - fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) ); - fclose( $ifp ); - $tempdoc = $output_file; - $tempdocname = $temp_file_name; - $bucketname = LENDER_BUCKET_NAME_PREFIX; - $key = 'docs/'.$tempdocname ; - $sourcefile = $tempdoc; - - $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile); - $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); - - print_r($s3result); - - } - -} \ No newline at end of file + }//closed + +}// Class Closed Here. \ No newline at end of file diff --git a/api/application/helpers/requestdatadump_helper.php b/api/application/helpers/requestdatadump_helper.php new file mode 100644 index 00000000..4f7b48ee --- /dev/null +++ b/api/application/helpers/requestdatadump_helper.php @@ -0,0 +1,594 @@ +load->library('myspreadsheet'); + $spreadsheet = $CI->myspreadsheet->getMySpreadSheet(); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->setCellValue('A1', 'Second Hello World !'); + $sheet->setTitle('Address Form datas'); + $myWorkSheet = new \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet($spreadsheet, 'My Data'); + // Attach the "My Data" worksheet as the first worksheet in the Spreadsheet object + $spreadsheet->addSheet($myWorkSheet, 0); + + $writer = $CI->myspreadsheet->getXlsx($spreadsheet); + $writer->save(XLPATH.'/tmp/SecondTest.xls'); + } + + public static function Fns2($requested_details) + { + log_message('ERROR','####RequestDataDump Helper FNS1'); + log_message('ERROR','####Creating Test Excel'); + $CI =&get_instance(); + $CI->load->library('myspreadsheet'); + SELF::$current_spreadsheet = $CI->myspreadsheet->getMySpreadSheet(); + $sheet = SELF::$current_spreadsheet->getActiveSheet(); + $sheet->setCellValue('A1', 'Second Hello World !'); + $sheet->setTitle('Address Form datas'); + SELF::$current_spreadsheet->setActiveSheetIndex(0)->setTitle('My Data'); + // Attach the "My Data" worksheet as the first worksheet in the Spreadsheet object + SELF::$current_spreadsheet->addSheet($myWorkSheet, 0); + $writer = $CI->myspreadsheet->getXlsx(SELF::$current_spreadsheet); + $writer->save(XLPATH.'/tmp/ThridTest.xls'); + } + + public static function multiple_spreadsheet($r) + { + $CI =&get_instance(); + $CI->load->library('myspreadsheet'); + + // header('Content-Type: application/vnd.ms-excel'); + // header('Content-Disposition: attachment;filename=myexcel.xlsx'); + + $spreadsheet = $CI->myspreadsheet->getMySpreadSheet(); + $spreadsheet->setActiveSheetIndex(0)->setCellValue('A1','service worksheet'); + $spreadsheet->getActiveSheet()->setTitle('Service'); + + $spreadsheet->createSheet(); + $spreadsheet->setActiveSheetIndex(1)->setCellValue('A1','New Worksheet'); + $spreadsheet->getActiveSheet()->setTitle('Product1'); + + $spreadsheet->createSheet(); + $spreadsheet->setActiveSheetIndex(2)->setCellValue('A1','New Worksheeet'); + $spreadsheet->getActiveSheet()->setTitle('Product2'); + + $spreadsheet->createSheet(); + $spreadsheet->setActiveSheetIndex(3)->setCellValue('A1','New Workshet'); + $spreadsheet->getActiveSheet()->setTitle('Product3'); + + $spreadsheet->createSheet(); + $spreadsheet->setActiveSheetIndex(4)->setCellValue('A1','New Workshheet'); + $spreadsheet->getActiveSheet()->setTitle('Product4'); + // $spreadsheet->setActiveSheetIndex(0); + + $writer = $CI->myspreadsheet->getXlsx($spreadsheet); + $writer->save(XLPATH.'/tmp/PDExportXL_f.xls'); + } + + public static function Fns4($requested_details) + { + log_message('ERROR','####RequestDataDump Helper FNS2'); + log_message('ERROR','####Creating Test Excel'); + $CI =&get_instance(); + $CI->load->library('myspreadsheet'); + SELF::$current_spreadsheet = $CI->myspreadsheet->getMySpreadSheet(); + $formid_arr = array(); + for($i=0;$i < count($requested_details);$i++){ + $processedJson = json_decode($requested_details[$i]['processed_json'],TRUE); + $formid = $processedJson['formid']; + // echo " ".$formid." "; + if (!in_array($formid, $formid_arr)){ + array_push($formid_arr,(int)$formid); + } + } + sort($formid_arr); + SELF::formHeadlines($formid_arr); + $writer = $CI->myspreadsheet->getXlsx(SELF::$current_spreadsheet); + $filename = "PDExportXL_".date('Y-m-d H:i:s A').".xls"; + $writer->save(XLPATH.'/tmp/'.$filename); + // $numbers = array(4, 6, 2, 22, 11);sort($numbers); + // print_r($numbers); + // print_r($formid_arr);die(); + + for($i=0;$i < count($requested_details);$i++){ + $processedJson = json_decode($requested_details[$i]['processed_json'],TRUE); + // print_r($processedJson);die(); + // echo "Don't Worry Be happy because i have JSON"; + $formid = $processedJson['formid']; + switch($formid) + { + // case 1: ## '1', 'Supplier Details' + // $details = SELF::gatheringSupplierForm($processedJson); + // // $sheet->setTitle('Supplier Details'); + // $sheet->setActiveSheetIndex(0)->setCellValue('A1','Supplier Details'); + // $sheet->getActiveSheet()->setTitle('Supplier Details'); + + // break; + // case 2: ## '2', 'Client Details' + // $details = SELF::gatheringClientForm($processedJson); + // $sheet->createSheet(); + // $sheet->setActiveSheetIndex(1)->setCellValue('A1', 'Client Details !'); + // $sheet->getActiveSheet()->setTitle('Client Details'); + + // break; + // case 3: ## '3', 'Personal Details' + // $details = SELF::gatheringPersonalForm($processedJson); + // $sheet->createSheet(); + // $sheet->setActiveSheetIndex(2)->setCellValue('A1', 'Personal Details !'); + // $sheet->getActiveSheet()->setTitle('Personal Details'); + // break; + // case 4: ## '4', 'Other Assets' + // $details = SELF::gatheringOtherAssetForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Other Assets'); + + // break; + // case 5: ## '5', 'Address Details' + // $details = SELF::gatheringAddressForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Address Details'); + + // break; + // case 6: ## '6', 'Family Details' + // $details = SELF::gatheringOtherFamilyDetailsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Family Details'); + + // break; + // case 7: ## '7', 'Banking Details' + // $details = SELF::gatheringBankingInfoForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Banking Details'); + + // break; + // case 8: ## '8', 'Existing Loan Obligations' + // $details = SELF::gatheringExistingLoanDetailsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Existing Loan Obligations'); + + // break; + // case 9: ## '9', 'Other Income Details' + // $details = SELF::gatheringOtherIncomeDetailsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Other Income Details'); + + // break; + // case 10: ## '10', 'Loan Details' + // $details = SELF::gatheringLoanDetailsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Loan Details'); + + // break; + // case 11: ## '11', 'Stock Details' + // $details = SELF::gatheringStockDetailsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Stock Details'); + + // break; + // case 12: ## '12', 'Employment Information' + // $details = SELF::gatheringEmploymetForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Employment Information'); + + // break; + // case 13: ## '13', 'Business Information' + // $details = SELF::gatheringBusinessForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Business Information'); + + // break; + // case 14: ## '14', 'Financial Information' + // $details = SELF::gatheringFinancialInfoForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Financial Information'); + + // break; + // case 15: ## '15', 'Lender Representative' + // $details = SELF::gatheringLenderRepresentativeForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Lender Representative'); + + // break; + // case 16: ## '16', 'Assessed Income' + // $details = SELF::gatheringAssessedIncomeForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Assessed Income'); + + // break; + // case 17: ## '17', 'Rental Verification' + // $details = SELF::gatheringRentalIncomeForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Rental Verification'); + + // break; + // case 18: ## '18', 'General Information' + // $details = SELF::gatheringGeneralInfoForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('General Information'); + + // break; + // case 19: ## '19', 'Neighbourhood / Reference Check' + // $details = SELF::gatheringNeighbourForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Neighbourhood and Ref Check'); + + // break; + // case 20: ## '20', 'Final Remarks Form' + // $details = SELF::gatheringFinalRemarksForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Final Remarks Form'); + + // break; + // case 21: ## '21', 'Business Banking' + // $details = SELF::gatheringBusinessBankingFormForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Business Banking'); + + // break; + // case 22: ## '22', 'Business Assets' + // $details = SELF::gatheringBusinessAssetsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Business Assets'); + + // break; + // case 23: ## '23', 'Future Plan and Business Environment' + // $details = SELF::gatheringFuturePlanandBusinessEnvironmentForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Future Plan'); + + // break; + // case 24: ## '24', 'Credit Manager Queries' + // $details = SELF::gatheringCreditManagerQueriesForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Credit Manager Queries'); + + // break; + // case 25: ## '25', 'Vendor PD Form' + // $details = SELF::gatheringVendorPDForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Vendor PD Form'); + + // break; + // case 26: ## '26', 'Photograph' + // $details = SELF::gatheringPhotographForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Photograph'); + + // break; + // default: ## + // echo "Final - No Form ID";break; + }// Switch ends here + }// for loop ends here + $writer = $CI->myspreadsheet->getXlsx(SELF::$current_spreadsheet); + $filename = "PDExportXL_".date('Y-m-d H:i:s A').".xls"; + $writer->save(XLPATH.'/tmp/'.$filename); + }// fns2 ends here + public static function formHeadlines($formid_arr){ + $i=0; + $arr = sort($formid_arr); + $sheet = SELF::$current_spreadsheet; + foreach($formid_arr as $data) + { + switch($data){ + case 1: ## '1', 'Supplier Details' + $sheet->setActiveSheetIndex($i)->setCellValue('A1','Supplier Details'); + $sheet->getActiveSheet()->setTitle('Supplier Details'); + break; + case 2: ## '2', 'Client Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Client Details'); + break; + case 3: ## '3', 'Personal Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Personal Details !'); + $sheet->getActiveSheet()->setTitle('Personal Details'); + break; + case 4: ## '4', 'Other Assets' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Other Assets'); + + break; + case 5: ## '5', 'Address Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i) + ->setCellValue('A1', 'PDID') + ->setCellValue('B1', 'Address at which PD was initiated') + ->setCellValue('C1', 'City') + ->setCellValue('D1', 'State') + ->setCellValue('E1', 'Pincode') + ->setCellValue('F1', 'Specify other pincode') + ->setCellValue('G1', 'Is this the address where PD is done') + ->setCellValue('H1', 'Enter actual PD address') + ->setCellValue('I1', 'City') + ->setCellValue('J1', 'State') + ->setCellValue('K1', 'Pincode') + ->setCellValue('L1', 'Specify Other Pincode') + ->setCellValue('M1', 'Reason for change in PD visit address') + ->setCellValue('N1', 'Address Type') + ->setCellValue('O1', 'Specify Other Address Type') + ->setCellValue('P1', 'Locality') + ->setCellValue('Q1', 'Specify Other Locality') + ->setCellValue('R1', 'Approach to PD Location') + ->setCellValue('S1', 'Comment on locality') + ->setCellValue('T1', 'Estimated Area') + ->setCellValue('U1', 'Unit Of Measurement') + ->setCellValue('V1', 'Specify Other UOM') + ->setCellValue('W1', 'Remarks'); + $sheet->getActiveSheet()->setTitle('Address Details'); + + break; + case 6: ## '6', 'Family Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Family Details'); + + break; + case 7: ## '7', 'Banking Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Banking Details'); + + break; + case 8: ## '8', 'Existing Loan Obligations' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Existing Loan Obligations'); + + break; + case 9: ## '9', 'Other Income Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Other Income Details'); + + break; + case 10: ## '10', 'Loan Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i) + ->mergeCells('A1:A2')->setCellValue('A1', 'PDID') + ->mergeCells('B1:B2')->setCellValue('B1', 'Loan Amount Applied for ?') + ->mergeCells('C1:C2')->setCellValue('C1', 'Loan Tenure applied for ?') + ->mergeCells('D1:D2')->setCellValue('D1', 'Sub-Product') + ->mergeCells('E1:E2')->setCellValue('E1', 'What is the End Use') + ->mergeCells('F1:F2')->setCellValue('F1', 'Specify End Use') + ->mergeCells('G1:G2')->setCellValue('G1', 'Is there a balance transfer ?') + ->mergeCells('H1:H2')->setCellValue('H1', 'Amount of Own Contribution') + ->mergeCells('I1:I2')->setCellValue('I1', 'Source of Own Contribution') + ->mergeCells('J1:J2')->setCellValue('J1', 'Specify Other Sources') + ->mergeCells('K1:K2')->setCellValue('K1', 'What is the amount for Balance Transfer ?') + ->mergeCells('L1:L2')->setCellValue('L1', 'Lender from where balance transfer done') + ->mergeCells('M1:M2')->setCellValue('M1', 'Specify other Lender') + ->mergeCells('N1:N2')->setCellValue('N1', 'Topup Amount ') + ->mergeCells('O1:O2')->setCellValue('O1', 'What is the End Use of the Top Up ?') + ->mergeCells('P1:P2')->setCellValue('P1', 'Specify End Use Of TopUP') + ->mergeCells('Q1:Q2')->setCellValue('Q1', 'EMI Amount Comfortable Paying') + ->mergeCells('R1:AB1')->setCellValue('R1', 'Details of Property being Mortgaged') + ->setCellValue('R2', 'Type of property') + ->setCellValue('S2', 'Specify type of property') + ->setCellValue('T2', 'Name of the proposed owner') + ->setCellValue('U2', 'Status of Construction') + ->setCellValue('V2', 'Estimate Market Value as Per Customer') + ->setCellValue('W2', 'Name of current owner(s)/ Seller(s) of the property') + ->setCellValue('X2', 'Address of the proposed property') + ->setCellValue('Y2', 'State') + ->setCellValue('Z2', 'City') + ->setCellValue('AA2', 'Pincode') + ->setCellValue('AB2', 'Specify Other pincode') + ->mergeCells('AC1:AC2')->setCellValue('AC1', 'Remarks') + ->mergeCells('AD1:AD2')->setCellValue('AD1', 'Facility Amount Applied For ?') + ->mergeCells('AE1:AE2')->setCellValue('AE1', 'Name of the Anchor') + ->mergeCells('AF1:AI1')->setCellValue('AF1', 'applicant`s association vintage with the Anchor') + ->mergeCells('AJ1:AU1')->setCellValue('AJ1', 'Credit period with the Anchor (Days)') + ->setCellValue('AF2', 'Year') + ->setCellValue('AG2', 'Month') + ->setCellValue('AH2', 'Monthly business (sale/purchase) with the Anchor') + ->setCellValue('AI2', 'Business concentration with Anchor %') + ->setCellValue('AJ2', 'Number of days') + ->setCellValue('AK2', 'Payment Mechanism') + ->setCellValue('AL2', 'Average Invoice Value') + ->setCellValue('AM2', 'Are there peak seasons for the business with Anchor') + ->setCellValue('AN2', 'Months in which sales/service is low?') + ->setCellValue('AO2', 'Comments') + ->setCellValue('AP2', 'Are there debit/credit notes being issued to/by Anchor') + ->setCellValue('AQ2', 'Reason for such debit/credit notes') + ->setCellValue('AR2', 'Value of stock related to Anchor') + ->setCellValue('AS2', 'Observations on Sample Invoices') + ->setCellValue('AT2', 'reason for no sample invoices') + ->setCellValue('AU2', 'Details of invoice and lorry recipts like date, amount, Quantity, Vehicle number, Client and supplier name'); + + + + + + + + $sheet->getActiveSheet()->setTitle('Loan Details'); + + break; + case 11: ## '11', 'Stock Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Stock Details'); + + break; + case 12: ## '12', 'Employment Information' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Employment Information'); + + break; + case 13: ## '13', 'Business Information' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Business Information'); + + break; + case 14: ## '14', 'Financial Information' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Financial Information'); + + break; + case 15: ## '15', 'Lender Representative' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Lender Representative'); + + break; + case 16: ## '16', 'Assessed Income' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Assessed Income'); + + break; + case 17: ## '17', 'Rental Verification' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Rental Verification'); + + break; + case 18: ## '18', 'General Information' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i) + ->mergeCells('A1:A2')->setCellValue('A1', 'PDID') + ->mergeCells('B1:G1')->setCellValue('B1', 'Name of Person(s) Met and Individual Loan Applicant(s)') + ->mergeCells('H1:H2')->setCellValue('H1', 'Is the applicant name same as per KYC') + ->mergeCells('I1:I2')->setCellValue('I1', 'Capture the correct name as per the KYC?') + ->mergeCells('J1:O1')->setCellValue('J1', 'Company') + ->mergeCells('P1:R1')->setCellValue('P1', 'Relationship Between Individuals') + ->mergeCells('S1:U1')->setCellValue('S1', 'Relationship of Individuals to Company / Firm') + ->mergeCells('V1:V2')->setCellValue('V1', 'Remarks') + ->setCellValue('B2', 'Name')->setCellValue('C2', 'Person Contacted')->setCellValue('D2', 'Is Loan applicant') + ->setCellValue('E2', 'Age')->setCellValue('F2', 'Qualification')->setCellValue('G2', 'Specify Qualification') + ->setCellValue('J2', 'Company/Firm')->setCellValue('K2', 'Is applicant')->setCellValue('L2', 'Company/Firm Entity Type') + ->setCellValue('M2', 'Month (Number of Years For Which The Company/Firm Has Been Running)') + ->setCellValue('N2', 'Year (Number of Years For Which The Company/Firm Has Been Running)') + ->setCellValue('O2', 'Date of Formation (Number of Years For Which The Company/Firm Has Been Running)') + ->setCellValue('P2', 'Name')->setCellValue('Q2', 'Relation')->setCellValue('R2', 'Relationship To') + ->setCellValue('S2', 'Applicant')->setCellValue('T2', 'Relation')->setCellValue('U2', 'Company') + ->setTitle('General Information'); + // $conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); + // $conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); + // $conditional1->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN); + // $conditional1->addCondition('0'); + // $conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED); + // $conditional1->getStyle()->getFont()->setBold(true); + + // $conditional2 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); + // $conditional2->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); + // $conditional2->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL); + // $conditional2->addCondition('0'); + // $conditional2->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN); + // $conditional2->getStyle()->getFont()->setBold(true); + + // $conditionalStyles = $sheet->getActiveSheet()->getStyle('B2')->getConditionalStyles(); + // $conditionalStyles[] = $conditional1; + // $conditionalStyles[] = $conditional2; + + // $sheet->getActiveSheet()->getStyle('B2')->setConditionalStyles($conditionalStyles); + + + break; + case 19: ## '19', 'Neighbourhood / Reference Check' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Neighbourhood and Ref Check'); + + break; + case 20: ## '20', 'Final Remarks Form' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Final Remarks Form'); + + break; + case 21: ## '21', 'Business Banking' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Business Banking'); + + break; + case 22: ## '22', 'Business Assets' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Business Assets'); + + break; + case 23: ## '23', 'Future Plan and Business Environment' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Future Plan'); + + break; + case 24: ## '24', 'Credit Manager Queries' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Credit Manager Queries'); + + break; + case 25: ## '25', 'Vendor PD Form' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Vendor PD Form'); + + break; + case 26: ## '26', 'Photograph' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Photograph'); + + break; + default: ## + echo "Final - No Form ID";break; + }// Switch ends here + // $spreadsheet->setActiveSheetIndex(0) + // ->setCellValue('A'.$i, ) + // ->setCellValue('B'.$i, ) + // ->setCellValue('C'.$i, ) + // ->setCellValue('D'.$i, ); + $i++; + } + return $sheet; + + } + ## '1', 'Supplier Details' + static function gatheringSupplierForm($processedJson){ + + }// supplier ends here + ## '2', 'Client Details' + static function gatheringClientForm($processedJson){ } //client ends here + ## '3', 'Personal Details' + static function gatheringPersonalForm($processedJson){ }//personal ends here + ## '4', 'Other Assets' + static function gatheringOtherAssetForm($processedJson){ }// other asset ends here + ## '5', 'Address Details' + static function gatheringAddressForm($processedJson){ }//address ends here + ## '6', 'Family Details' + static function gatheringOtherFamilyDetailsForm($processedJson){ }// family ends here + ## '7', 'Banking Details' + static function gatheringBankingInfoForm($processedJson){}// banking ends here + ## '8', 'Existing Loan Obligations' + static function gatheringExistingLoanDetailsForm($processedJson){} //exist loan ends here + ## '9', 'Other Income Details' + static function gatheringOtherIncomeDetailsForm($processedJson){}// other Income ends here + ## '10', 'Loan Details' + static function gatheringLoanDetailsForm($processedJson){}// loan ends here + ## '11', 'Stock Details' + static function gatheringStockDetailsForm($processedJson){}// stock ends here + ## '12', 'Employment Information' + static function gatheringEmploymetForm($processedJson){}// employment INfoo ends here + ## '13', 'Business Information' + static function gatheringBusinessForm($processedJson){ }// buiness ends here + ## '14', 'Financial Information' + static function gatheringFinancialInfoForm($processedJson){ }//financial ends here + ## '15', 'Lender Representative' + static function gatheringLenderRepresentativeForm($processedJson){}//lender rep ends here + ## '16', 'Assessed Income' + static function gatheringAssessedIncomeForm($processedJson){ }// assess info ends here + ## '17', 'Rental Verification' + static function gatheringRentalIncomeForm($processedJson){ } //rental info ends here + ## '18', 'General Information' + static function gatheringGeneralInfoForm($processedJson){ }//general ends here + ## '19', 'Neighbourhood / Reference Check' + static function gatheringNeighbourForm($processedJson){ }// refer ends here + ## '20', 'Final Remarks Form' + static function gatheringFinalRemarksForm($processedJson){ }// final remarks ends here + ## '21', 'Business Banking' + static function gatheringBusinessBankingForm($processedJson){ }// buiness bank ends here + ## '22', 'Business Assets' + static function gatheringBusinessAssetsForm($processedJson){} //buiness asset ends here + ## '23', 'Future Plan and Business Environment' + static function gatheringFuturePlanandBusinessEnvironmentForm($processedJson){}//future plan ends here + ## '24', 'Credit Manager Queries' + static function gatheringCreditManagerQueriesForm($processedJson){}// CM quries ends here + ## '25', 'Vendor PD Form' + static function gatheringVendorPDForm($processedJson){} // pd vendor info ends here + ## '26', 'Photograph' + static function gatheringPhotographForm($processedJson){} //photograph ends here +} +?> \ No newline at end of file From 070ba1e0c9e359f2ac77e46e027e82138d2ca03c Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Thu, 28 Apr 2022 12:05:35 +0000 Subject: [PATCH 34/34] getListPDOfficersForNotification 3rd index missing fixed : ps --- api/application/controllers/PD_Controller.php | 1 + 1 file changed, 1 insertion(+) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index a5b2db96..1c9ca3d5 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -11788,6 +11788,7 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() } } } + Sort($list_of_pd_officers); log_message('ERROR',"getListPDOfficers PDofficer list : ".json_encode($list_of_pd_officers)); // Get Central PD Officers List $central_pd_officers = array();