1134 lines
55 KiB
PHP
1134 lines
55 KiB
PHP
<?php
|
||
|
||
/**
|
||
* Created by PhpStorm.
|
||
* User: kms
|
||
* Date: 11/13/17
|
||
* Time: 7:40 PM
|
||
*/
|
||
|
||
defined('BASEPATH') or exit('No direct script access allowed');
|
||
|
||
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
|
||
/** @noinspection PhpIncludeInspection */
|
||
require_once APPPATH . '/libraries/REST_Controller.php';
|
||
include_once APPPATH . '/vendor/autoload.php';
|
||
|
||
/**
|
||
* This is an example of a few basic user interaction methods you could use
|
||
* all done with a hardcoded array
|
||
*
|
||
* @package CodeIgniter
|
||
* @subpackage Rest Server
|
||
* @category Controller
|
||
* @author
|
||
* @license MIT
|
||
* @link
|
||
*/
|
||
class Data_Dump_Controller extends REST_Controller
|
||
{
|
||
|
||
function __construct()
|
||
{
|
||
|
||
parent::__construct();
|
||
$this->load->model('PD_Model', 'PD_Model');
|
||
$this->load->model('Data_Dump_Model', 'Data_Dump_Model');
|
||
$this->external_path = $this->config->item('external_data_path');
|
||
//$this->load->library('AWS_S3');
|
||
}
|
||
|
||
public function getRawData_get()
|
||
{
|
||
|
||
$pdid = $this->get('pdid');
|
||
$rs = $this->get('rs');
|
||
$pd_processed_forms = array();
|
||
$master = $this->PD_Model->getPDMasterDetails($pdid);
|
||
|
||
if ($pdid != '') // && $rs != '')
|
||
{
|
||
$this->load->helper('data_dump');
|
||
|
||
for ($i = 1; $i <= 30; $i++) {
|
||
$fields = array('processed_json');
|
||
$where_condition_array = array('isactive' => 1, 'fk_pd_id' => $pdid, 'fk_form_id' => $i);
|
||
|
||
$pd_processed_forms[$i] = $this->PD_Model->selectCustomRecords($fields, $where_condition_array, PDFORMDETAILSJSON, array(), '', 'company_id', 'ASC');
|
||
// $fields2 = array('*');
|
||
// $data['pd_images'][$i] = $this->PD_Model->getSignedPDDocsURL($pdid,$i,null,null,null,'report');
|
||
}
|
||
|
||
//get General form dump
|
||
$gen_data_dump = array();
|
||
if (isset($pd_processed_forms[18])) {
|
||
$gen_data = (json_decode($pd_processed_forms[18][0]['processed_json'], TRUE));
|
||
//print_r($gen_data);die();
|
||
$gen_data_dump = DATA_DUMP::convertGeneralDetailsForm($gen_data, $master);
|
||
print_r($gen_data_dump);
|
||
$this->Data_Dump_Model->saveGenDumpData($gen_data_dump);
|
||
}
|
||
if (isset($pd_processed_forms[13])) {
|
||
if (array_key_exists('company_data', $gen_data_dump) && count($gen_data_dump)) {
|
||
$business_data = (json_decode($pd_processed_forms[13][0]['processed_json'], TRUE));
|
||
//print_r($business_data);die();
|
||
$business_data_dump = DATA_DUMP::convertBusinessDetailsForm($business_data, $master, $gen_data_dump['company_data']);
|
||
print_r($business_data_dump);
|
||
$this->Data_Dump_Model->saveBusinessDUmpData($business_data_dump);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
//[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('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();
|
||
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_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("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("ERROR", "#/# 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;
|
||
// }
|
||
}
|
||
|
||
public function modificationGsheetData($GSdata)
|
||
{
|
||
// $logger = MYLOG::logFunction(null,"Gsheet");
|
||
log_message('ERROR', "G-Sheet For PD Step 1 (G-sheet Data)");
|
||
|
||
$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}]
|
||
|
||
log_message('ERROR', "G-Sheet For PD Step 2 (Processing data for-loop)");
|
||
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 (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"]));
|
||
$pd_details['lender_applicant_id'] = $LAN;
|
||
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;$j<count($applicatantParts);$j++){
|
||
// $splitCompanyandApplicant = explode('/',$applicatantParts[$j]);
|
||
// $pd_applicant_details[$j]['applicant_name'] = $splitCompanyandApplicant[0];
|
||
// $pd_applicant_details[$j]['company_name'] = isset($splitCompanyandApplicant[1]) ? $splitCompanyandApplicant[1] : null;
|
||
// }
|
||
// }else{
|
||
// $splitCompanyandApplicant = explode('/',$applicatantParts[0]);
|
||
// if(count($splitCompanyandApplicant)>1){
|
||
// $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 = "";
|
||
$Totalapplicatantcount = 0;
|
||
if (isset($GSdata["ApplicantName"]) && $GSdata["ApplicantName"] != "") {
|
||
$applicatantParts = explode(',', $GSdata["ApplicantName"]);
|
||
if (count($applicatantParts) > 1) {
|
||
$Totalapplicatantcount = count($applicatantParts);
|
||
for ($j = 0; $j < count($applicatantParts); $j++) {
|
||
$applicant_title_name = explode('.', $applicatantParts[$j]);
|
||
if (count($applicant_title_name) > 1) {
|
||
$pd_applicant_details[$j]['applicant_name'] = $applicant_title_name[1];
|
||
$pd_applicant_details[$j]['applicant_title_name'] = $this->Data_Dump_Model->getId(10, $applicant_title_name[0]);
|
||
// $this->Data_Dump_Model->getId(10, $GSdata["LenderCreditName"]);
|
||
} else {
|
||
$pd_applicant_details[$j]['applicant_name'] = $applicatantParts[$j];
|
||
}
|
||
}
|
||
} else {
|
||
$applicant_title_name = explode('.', $applicatantParts[0]);
|
||
if (count($applicant_title_name) > 1) {
|
||
$pd_applicant_details[0]['applicant_name'] = $applicant_title_name[1];
|
||
$pd_applicant_details[0]['applicant_title_name'] = $this->Data_Dump_Model->getId(10, $applicant_title_name[0]);
|
||
} else {
|
||
$pd_applicant_details[0]['applicant_name'] = $applicatantParts[0];
|
||
}
|
||
}
|
||
$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 (company) GSheet data : " . $GSdata["CompanyName"]);
|
||
}
|
||
if (isset($GSdata["ContactNumber"]) && $GSdata["ContactNumber"] != "") {
|
||
$ContactNumber = explode(',', trim($GSdata["ContactNumber"]));
|
||
// Contact number as below Format
|
||
// mentioned (9999999999, 8888888888, 7777777777) in Gsheet, then:
|
||
// 1st number mentioned as primary number in PD genie,
|
||
// 2nd number as additional number, (if applicant has no additional number they mentioned as Single 0 only)
|
||
// 3rd number as co-applicant number.
|
||
if (count($ContactNumber) > 1) {
|
||
for ($j = 0; $j < count($ContactNumber); $j++) {
|
||
if ($j == 0 || $j == 1) {
|
||
if ($j == 0 && !empty($ContactNumber[$j]) && $ContactNumber[$j] != 0) {
|
||
$pd_applicant_details[0]['mobile_no'] = $ContactNumber[$j];
|
||
}
|
||
if ($j == 1 && !empty($ContactNumber[$j]) && $ContactNumber[$j] != 0) {
|
||
$pd_applicant_details[0]['additional_mobile_no'] = $ContactNumber[$j];
|
||
}
|
||
} else if ($j > 1 && $Totalapplicatantcount > ($j - 1)) {
|
||
// here if condition $J inx should greater than 1 and total applicant count is also greater then index .
|
||
$pd_applicant_details[$j - 1]['mobile_no'] = $ContactNumber[$j];
|
||
}
|
||
}
|
||
} else {
|
||
$pd_applicant_details[0]['mobile_no'] = $ContactNumber[0];
|
||
}
|
||
log_message('ERROR', "G-Sheet For PD Step 2.5 (mobile number) GSheet data : " . $GSdata['ContactNumber']);
|
||
}
|
||
|
||
//address section.
|
||
if (isset($GSdata["PDLocation"]) && $GSdata["PDLocation"] != "") {
|
||
$NormalParts = explode(',', $GSdata["PDLocation"]);
|
||
$stateAndPincode = end($NormalParts);
|
||
$splitStateAndPincode = explode('-', $stateAndPincode, 2);
|
||
$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);
|
||
$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);
|
||
$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);
|
||
// array_push($result_data["Pincode"],strrev($reversedParts[0]));
|
||
// print_r($NormalParts);
|
||
// print_r(array_filter($NormalParts));// removing Null values
|
||
$modifyaddress = implode(",", array_filter($NormalParts));
|
||
$addresses['addressline1'] = implode(",", array_filter($NormalParts));
|
||
$pd_details['addressline1'] = $addresses['addressline1'];
|
||
// echo "Original Address : ".$GSdataata[$i];
|
||
// echo "Modified Address : ".$address;
|
||
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.7 (Allocated Person) GSheet data : " . $GSdata["PersonDoing"]);
|
||
}
|
||
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
|
||
// 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";
|
||
// }}
|
||
// $pd_details['loan_amount'] = implode("",$amount);
|
||
$pd_details['loan_amount'] = (int)$GSdata["LoanAmount"];
|
||
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"]) && $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["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;
|
||
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["AdditionalRequirements"]) && $GSdata["AdditionalRequirements"] != "") {
|
||
$requirements = explode(',', $GSdata["AdditionalRequirements"]);
|
||
if (count($requirements) > 1) {
|
||
for ($j = 0; $j < count($requirements); $j++) {
|
||
$addi_requirements[$j]['add_requirement'] = $requirements[$j];
|
||
}
|
||
} else {
|
||
$addi_requirements[0]['add_requirement'] = $requirements[0];
|
||
}
|
||
log_message('ERROR', "G-Sheet For PD Step 2.13 ( additional requirements) GSheet data : " . $GSdata["AdditionalRequirements"] . " PD details :" . json_encode($addi_requirements));
|
||
}
|
||
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"]);
|
||
// }
|
||
|
||
## Default Status section;
|
||
$pd_details['pd_status'] = TRIGGERED;
|
||
$pd_details['pd_date_of_initiation'] = date('Y-m-d H-i-s');
|
||
$pd_details['fk_createdby'] = 318; // default user created for admin.
|
||
## 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->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->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)
|
||
} 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;
|
||
$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 {
|
||
$pd_id = $this->Data_Dump_Model->saveRecords($pd_details, PDTRIGGER);
|
||
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('ERROR', "G-Sheet For PD Step 4 (PDID gotten) ERR : " . $e->getMessage());
|
||
// var_dump($e->getMessage());
|
||
}
|
||
// $pd_id = 3149;
|
||
|
||
|
||
if ($pd_id != null || $pd_id != '') {
|
||
if ($pd_applicant_details != "" || $pd_applicant_details != null) {
|
||
log_message('ERROR', "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;
|
||
$pd_applicant_detail['applicant_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['applicant_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);
|
||
if (empty($co_applicant_id)) {
|
||
throw new Exception('Error On Inserting Applicant details');
|
||
}
|
||
} 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());
|
||
}
|
||
}
|
||
}
|
||
}
|
||
## Credit Manager<65>s Specific Queries
|
||
if ($pd_id != "") {
|
||
if ($addi_requirements != "" || $addi_requirements != null) {
|
||
log_message('ERROR', "G-Sheet For PD Step 6 (credit manager queries)");
|
||
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);
|
||
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;
|
||
$addresses['is_primary'] = 1;
|
||
$addresses['assigned_pd'] = $pd_id;
|
||
try {
|
||
$address_id = $this->Data_Dump_Model->saveRecords($addresses, PDADDRESS);
|
||
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('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, 'parent_pd_id' => $pd_id);
|
||
|
||
try {
|
||
$this->Data_Dump_Model->updateRecords($triggertbl_records, PDTRIGGER, array('pd_id' => $pd_id));
|
||
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) {
|
||
log_message('ERROR', "G-Sheet For PD Step 7 (updateAddresses in trigger) ERR : " . $e->getMessage());
|
||
// var_dump($e->getMessage());
|
||
}
|
||
}
|
||
|
||
log_message('ERROR', "#/# G-Sheet Final PDID : " . $pd_id);
|
||
return $pd_id;
|
||
}
|
||
|
||
// delete Old PD.
|
||
// step 1 : DB-tables update
|
||
// step 2 : json and processed_json
|
||
// step 3 : rar images docs.....
|
||
// step 4 : processjson inactive data deleted..
|
||
|
||
//working fine on tables.
|
||
public function deleteOldPDbk_up_get()
|
||
{
|
||
$_90th_date = date("Y/m/d", strtotime('-90 days'));
|
||
|
||
$columns = array('PDTRIGGER.pd_id', 'PDTRIGGER.addressline1', 'PDTRIGGER.addressline2', 'PDTRIGGER.addressline3', 'PDTRIGGER.pd_contact_mobileno', 'PDTRIGGER.pd_contact_landline', 'PDTRIGGER.pd_sno', 'DATE_FORMAT(PDTRIGGER.createdon, "%d/%m/%Y") as createdon', 'PDAPPLICANTSDETAILS.pd_co_applicant_id', 'PDTRIGGER.pd_contact_person_mail');
|
||
$table = PDTRIGGER . ' as PDTRIGGER';
|
||
$joins = array(array(
|
||
'table' => PDAPPLICANTSDETAILS . ' as PDAPPLICANTSDETAILS',
|
||
'condition' => 'PDAPPLICANTSDETAILS.fk_pd_id = PDTRIGGER.pd_id AND PDAPPLICANTSDETAILS.isactive = 1 AND PDAPPLICANTSDETAILS.applicant_type = 1',
|
||
'jointype' => 'LEFT'
|
||
));
|
||
$tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'DATE_FORMAT(PDTRIGGER.createdon, "%d/%m/%Y") <=' => $_90th_date);
|
||
$tgr_dtls = $this->PD_Model->getJoinRecords($columns, $table, $joins, $tgr_cond_arr);
|
||
$i = 0; // testing Purpose only
|
||
// for($i = 0 ;$i < count($tgr_dtls);$i++){
|
||
$pdid = $tgr_dtls[$i]['pd_id'];
|
||
$pdsno = $tgr_dtls[$i]['pd_sno'];
|
||
$pdappcntid = $tgr_dtls[$i]['pd_co_applicant_id'];
|
||
$general_format = $pdsno . "-" . $pdid . "-" . $pdappcntid;
|
||
|
||
$updt_on_tgr['addressline1'] = $tgr_dtls[$i]['addressline1'] ? $general_format . ' - addressline1' : null;
|
||
$updt_on_tgr['addressline2'] = $tgr_dtls[$i]['addressline2'] ? $general_format . ' - addressline2' : null;
|
||
$updt_on_tgr['addressline3'] = $tgr_dtls[$i]['addressline3'] ? $general_format . ' - addressline3' : null;
|
||
$updt_on_tgr['pd_contact_mobileno'] = $tgr_dtls[$i]['pd_contact_mobileno'] ? $general_format . ' - mobileno' : null;
|
||
$updt_on_tgr['pd_contact_landline'] = $tgr_dtls[$i]['pd_contact_landline'] ? $general_format . ' - landline' : null;
|
||
$updt_on_tgr['pd_contact_person_mail'] = $tgr_dtls[$i]['pd_contact_person_mail'] ? $general_format . ' - person_mail' : null;
|
||
$updt_tgr_where = array('pd_id' => $pdid, 'pd_status' => QC_COMPLETED);
|
||
|
||
$this->PD_Model->updateRecords($updt_on_tgr, PDTRIGGER, $updt_tgr_where);
|
||
|
||
if (!empty($pdid)) {
|
||
$apcnt_fields = array('pd_co_applicant_id', 'mobile_no', 'additional_mobile_no', 'landline', 'email', 'addressline1', 'addressline2', 'addressline3', 'company_name');
|
||
$apcnt_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||
$apcnt_dtls = $this->PD_Model->selectCustomRecords($apcnt_fields, $apcnt_cond_arr, PDAPPLICANTSDETAILS);
|
||
if (!empty($apcnt_dtls)) {
|
||
for ($j = 0; $j < count($apcnt_dtls); $j++) {
|
||
$appcnt_id = $pdsno . "-" . $pdid . "-" . $apcnt_dtls[$j]['pd_co_applicant_id'];
|
||
$updt_apcnt_dtls['applicant_name'] = $appcnt_id;
|
||
$updt_apcnt_dtls['mobile_no'] = $apcnt_dtls[$j]['mobile_no'] ? $appcnt_id . ' - mobile_no' : null;
|
||
$updt_apcnt_dtls['additional_mobile_no'] = $apcnt_dtls[$j]['additional_mobile_no'] ? $appcnt_id . ' - additional_mobile_no' : null;
|
||
$updt_apcnt_dtls['landline'] = $apcnt_dtls[$j]['landline'] ? $appcnt_id . ' - landline' : null;
|
||
$updt_apcnt_dtls['email'] = $apcnt_dtls[$j]['email'] ? $appcnt_id . ' - email' : null;
|
||
$updt_apcnt_dtls['addressline1'] = $apcnt_dtls[$j]['addressline1'] ? $appcnt_id . ' - addressline1' : null;
|
||
$updt_apcnt_dtls['addressline2'] = $apcnt_dtls[$j]['addressline2'] ? $appcnt_id . ' - addressline2' : null;
|
||
$updt_apcnt_dtls['addressline3'] = $apcnt_dtls[$j]['addressline3'] ? $appcnt_id . ' - addressline3' : null;
|
||
$updt_apcnt_dtls['company_name'] = $apcnt_dtls[$j]['company_name'] ? $appcnt_id . ' - company_name' : null;
|
||
|
||
$this->PD_Model->updateRecords($updt_apcnt_dtls, PDAPPLICANTSDETAILS, array('pd_co_applicant_id' => $apcnt_dtls[$j]['pd_co_applicant_id']));
|
||
}
|
||
}
|
||
|
||
$addr_fields = array('pd_address_id', 'addressline1');
|
||
$addr_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||
$addr_dtls = $this->PD_Model->selectCustomRecords($addr_fields, $addr_cond_arr, PDADDRESS);
|
||
if (!empty($addr_dtls)) {
|
||
for ($k = 0; $k < count($addr_dtls); $k++) {
|
||
$updt_addr_dtls['addressline1'] = $addr_dtls[$k]['addressline1'] ? $general_format . ' - addressline1' : null;
|
||
$this->PD_Model->updateRecords($updt_addr_dtls, PDADDRESS, array('pd_address_id' => $addr_dtls[$k]['pd_address_id']));
|
||
}
|
||
}
|
||
$json_fields = array('json', 'processed_json');
|
||
$json_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||
$json_dtls = $this->PD_Model->selectCustomRecords($json_fields, $json_cond_arr, PDFORMDETAILSJSON);
|
||
|
||
|
||
|
||
// -- replace(COL,Wrong Value,New Value)
|
||
// UPDATE sineedgeprod.t_salespd_section_data
|
||
// SET section_data = replace(CONVERT(section_data USING utf8), '[answer_value] =>"SAVED"','"answer_value":""')
|
||
// where sales_pd_id = 5620 and section_id = 9 and isactive = 1;
|
||
}
|
||
// } // undo the command
|
||
$data['dataStatus'] = true;
|
||
$data['status'] = REST_Controller::HTTP_OK;
|
||
// $data['query'] = $this->db->last_query();
|
||
// $data['total data'] =count($tgr_dtls);
|
||
// $data['before 90 days data'] = $tgr_dtls;
|
||
$this->response($data, REST_Controller::HTTP_OK);
|
||
}
|
||
|
||
public function renamingExistingPDinfo_get()
|
||
{
|
||
log_message('ERROR', "renamingExistingPDinfo Fns Called");
|
||
$day_limit = "";
|
||
$pdsno = $this->get('pdsno');
|
||
$from_date = $this->get('from_date');
|
||
$to_date = $this->get('to_date');
|
||
$entity = $this->get('lender_id');
|
||
$pdid_arr = array(); // testing purpose
|
||
|
||
$columns = array('PDTRIGGER.pd_id', 'PDTRIGGER.addressline1', 'PDTRIGGER.addressline2', 'PDTRIGGER.addressline3', 'PDTRIGGER.pd_contact_mobileno', 'PDTRIGGER.pd_contact_landline', 'PDTRIGGER.pd_sno', 'DATE_FORMAT(PDTRIGGER.createdon, "%d/%m/%Y") as createdon','DATE_FORMAT(PDTRIGGER.completed_on, "%d/%m/%Y") as completedon','PDAPPLICANTSDETAILS.pd_co_applicant_id', 'PDTRIGGER.pd_contact_person_mail', 'PDTRIGGER.fk_lender_id');
|
||
$table = PDTRIGGER . ' as PDTRIGGER';
|
||
$joins = array(array(
|
||
'table' => PDAPPLICANTSDETAILS . ' as PDAPPLICANTSDETAILS',
|
||
'condition' => 'PDAPPLICANTSDETAILS.fk_pd_id = PDTRIGGER.pd_id AND PDAPPLICANTSDETAILS.isactive = 1 AND PDAPPLICANTSDETAILS.applicant_type = 1',
|
||
'jointype' => 'LEFT'
|
||
));
|
||
|
||
if(empty($pdsno) && empty($from_date) && empty($to_date) && empty($entity)){
|
||
$msg = "";
|
||
$to_get_entity_id = $this->PD_Model->selectCustomRecords(array('fk_lender_id'), array('pd_status' => QC_COMPLETED),PDTRIGGER, array(), '', '', '', 'fk_lender_id');
|
||
for ($i = 0; $i < count($to_get_entity_id); $i++) {
|
||
$entity = $to_get_entity_id[$i]['fk_lender_id'];
|
||
$select = array('data_purge_days','short_name');
|
||
$condit = array('isactive' => 1,'fk_entity_type_id'=> 2,'entity_id'=>$entity);
|
||
$value = $this->PD_Model->selectCustomRecords($select, $condit, ENTITY);
|
||
// print_r($value);
|
||
if(!empty($value)){
|
||
$days = $value[0]['data_purge_days'];
|
||
$len_short_name = $value[0]['short_name'];
|
||
}
|
||
$where_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'PDTRIGGER.fk_lender_id' => $entity, '(SELECT
|
||
MAX(DATE_FORMAT(logmaster.createdon, "%d/%m/%Y"))
|
||
FROM h_common_masters as logmaster
|
||
WHERE logmaster.new_value = "QC_COMPLETED" AND PDTRIGGER.pd_id = logmaster.primary_key) <=' => date("d/m/Y", strtotime("-".$days." days")));
|
||
// 'PDTRIGGER.fk_customer_segment'=> 11 // 1 4 5 8 9 10 11
|
||
|
||
$result[] = $this->PD_Model->getJoinRecords($columns, $table, $joins, $where_arr);
|
||
// echo "---------------------------";
|
||
// print_r($this->db->last_query());
|
||
// print_r($result);
|
||
$msg = $msg."( PD QC-Completed Given Entity =>". $len_short_name." [".$entity ."] ". $days." days and Lastdate = ".$day_limit." )";
|
||
}
|
||
// print_r($result);
|
||
$tgr_dtls = array_merge(...$result);
|
||
|
||
|
||
log_message('ERROR', "Trigger Details Total Records => " . count($tgr_dtls));
|
||
|
||
}
|
||
else{
|
||
if (!empty($pdsno)) {
|
||
$msg = "PD Serial No => " . $pdsno;
|
||
log_message('ERROR', $msg);
|
||
$where_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'PDTRIGGER.pd_sno' => $pdsno);
|
||
}else if(($from_date != "" || $from_date != null) && ($to_date != "" || $to_date != null)){
|
||
$newDate1 = date("Y-m-d", strtotime($from_date));
|
||
$newDate2 = date("Y-m-d", strtotime($to_date));
|
||
$msg = "PD QC-Completed Date Given Format => " . $from_date ." to ".$to_date;
|
||
log_message('ERROR', $msg." Changed ".$newDate1." to ".$newDate2);
|
||
// $where = 'DATE(PDTRIGGER.completed_on) BETWEEN ' ."'$newDate1'". ' AND ' ."'$newDate2'";
|
||
$where = '(SELECT
|
||
MAX(DATE(logmaster.createdon))
|
||
FROM h_common_masters as logmaster
|
||
WHERE logmaster.new_value = "QC_COMPLETED" AND PDTRIGGER.pd_id = logmaster.primary_key)
|
||
BETWEEN ' ."'$newDate1'". ' AND ' ."'$newDate2'";
|
||
$where_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, $where => null);
|
||
}
|
||
else if(!empty($entity)){
|
||
$condit = array('isactive' => 1,'fk_entity_type_id'=> 2,'entity_id'=>$entity);
|
||
$value = $this->PD_Model->selectCustomRecords($select, $condit, ENTITY);
|
||
if(!empty($value)){
|
||
$days = $value[0]['data_purge_days'];
|
||
$day_limit = date("d/m/Y", strtotime("-".$days." days"));
|
||
$where_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'PDTRIGGER.fk_lender_id' => $entity, '(SELECT
|
||
MAX(DATE_FORMAT(logmaster.createdon, "%d/%m/%Y"))
|
||
FROM h_common_masters as logmaster
|
||
WHERE logmaster.new_value = "QC_COMPLETED" AND PDTRIGGER.pd_id = logmaster.primary_key) <=' => $day_limit);
|
||
|
||
$msg = "PD QC-Completed Given Entity =>". $entity ." ". $days." days and lastdate ".$day_limit;
|
||
}
|
||
|
||
}
|
||
// 'PDTRIGGER.fk_customer_segment'=> 11 // 1 4 5 8 9 10 11
|
||
$tgr_dtls = $this->PD_Model->getJoinRecords($columns, $table, $joins, $where_arr);
|
||
log_message('ERROR', "Trigger Details Total Records => " . count($tgr_dtls));
|
||
}
|
||
|
||
// print_r($tgr_dtls);die();
|
||
|
||
if(!empty($tgr_dtls)){
|
||
for ($i = 0; $i < count($tgr_dtls); $i++) {
|
||
$pdid = $tgr_dtls[$i]['pd_id'];
|
||
log_message('ERROR', "trigger details for Loop inx = " . $i . " PDID = " . $pdid);
|
||
$earliest['trigger_details'] = $tgr_dtls[$i];
|
||
if (!empty($pdid)) {
|
||
$apcnt_fields = array('pd_co_applicant_id', 'mobile_no', 'additional_mobile_no', 'landline', 'email', 'addressline1', 'addressline2', 'addressline3', 'company_name', 'applicant_name');
|
||
$apcnt_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||
$apcnt_dtls = $this->PD_Model->selectCustomRecords($apcnt_fields, $apcnt_cond_arr, PDAPPLICANTSDETAILS);
|
||
log_message('ERROR', "Total Applicant Details for " . $pdid . " = " . count($apcnt_dtls));
|
||
if (!empty($apcnt_dtls)) {
|
||
$earliest['applicant_details'] = $apcnt_dtls;
|
||
}
|
||
$addr_fields = array('pd_address_id', 'addressline1');
|
||
$addr_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||
$addr_dtls = $this->PD_Model->selectCustomRecords($addr_fields, $addr_cond_arr, PDADDRESS);
|
||
log_message('ERROR', "Total Address Details for " . $pdid . " = " . count($addr_dtls));
|
||
if (!empty($addr_dtls)) {
|
||
$earliest['address_details'] = $addr_dtls;
|
||
}
|
||
$json_fields = array('pd_form_detail_json_id', 'json', 'processed_json', 'fk_pd_id', 'fk_form_id');
|
||
$json_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||
$json_dtls = $this->PD_Model->selectCustomRecords($json_fields, $json_cond_arr, PDFORMDETAILSJSON);
|
||
log_message('ERROR', "Total JSON Details for " . $pdid . " = " . count($json_dtls));
|
||
if (!empty($json_dtls)) {
|
||
$earliest['json_details'] = $json_dtls;
|
||
}
|
||
$previous_json_fields = array('pd_form_detail_json_id');
|
||
$previous_json_cond_arr = array('isactive' => 0, 'fk_pd_id' => $pdid);
|
||
$previous_json_dtls = $this->PD_Model->selectCustomRecords($previous_json_fields, $previous_json_cond_arr, PDFORMDETAILSJSON);
|
||
$simple_array = array();
|
||
if (!empty($previous_json_dtls)) {
|
||
for ($i = 0; $i < count($previous_json_dtls); $i++) {
|
||
if(gettype($previous_json_dtls[$i]) == 'array'){
|
||
foreach($previous_json_dtls as $d){
|
||
// $simple_array[]=$d['pd_form_detail_json_id'];
|
||
array_push($simple_array,$d['pd_form_detail_json_id']);
|
||
}
|
||
}else{
|
||
array_push($simple_array,$previous_json_dtls[$i]);
|
||
}}
|
||
log_message('ERROR', "Total IN-Active JSON Details for " . $pdid . " = " . count($simple_array));
|
||
$this->db->where_in('pd_form_detail_json_id', $simple_array);
|
||
$this->db->delete(PDFORMDETAILSJSON);
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
$docs_fields = array('pd_document_id', 'pd_document_title', 'pd_document_name');
|
||
$docs_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||
$docs_dtls = $this->PD_Model->selectCustomRecords($docs_fields, $docs_cond_arr, PDDOCUMENTS);
|
||
log_message('ERROR', "Total Document Details for " . $pdid . " = " . count($docs_dtls));
|
||
if (!empty($docs_dtls)) {
|
||
$earliest['docs_details'] = $docs_dtls;
|
||
}
|
||
}
|
||
|
||
$return = $this->renamingProcess($earliest);
|
||
|
||
// if(!empty($return)){
|
||
// array_push($pdid_arr['updated pdid'],$return);
|
||
// array_push($pdid_arr['data'],$earliest);}
|
||
array_push($pdid_arr,$pdid);
|
||
}
|
||
|
||
// array_push($img_response, $pdid);
|
||
$data['dataStatus'] = true;
|
||
$data['records'] = $pdid_arr;
|
||
$data['message'] = $msg;
|
||
// $data['earliest'] = $earliest;
|
||
$data['totalDetailsInCount'] =count($tgr_dtls);
|
||
// $data['before 90 days data'] = $tgr_dtls;
|
||
}else{
|
||
$data['dataStatus'] = false;
|
||
$data['message'] = 'There is no data in QC-Completed '.$msg;
|
||
$data['totalDetailsInCount'] = count($tgr_dtls);
|
||
}
|
||
$this->response($data, REST_Controller::HTTP_OK);
|
||
}
|
||
|
||
public function renamingProcess($details)
|
||
{
|
||
log_message('ERROR', "renamingProcess Fns Called");
|
||
$have_to_replace = array();
|
||
|
||
$tgr_dtls = isset($details['trigger_details']) ? $details['trigger_details'] : array();;
|
||
$apcnt_dtls = isset($details['applicant_details']) ? $details['applicant_details'] : array();
|
||
//print_r($apcnt_dtls);die();
|
||
$addr_dtls = isset($details['address_details']) ? $details['address_details'] : array();
|
||
$json_dtls = isset($details['json_details']) ? $details['json_details'] : array();
|
||
$docs_dtls = isset($details['docs_details']) ? $details['docs_details'] : array();
|
||
|
||
$pdid = $tgr_dtls['pd_id'];
|
||
$pdsno = $tgr_dtls['pd_sno'];
|
||
$pdlenid = $tgr_dtls['fk_lender_id'];
|
||
|
||
$pdappcntid = $tgr_dtls['pd_co_applicant_id'];
|
||
$general_format = $pdsno . "-" . $pdid . "-" . $pdappcntid;
|
||
log_message('ERROR', "Format generated => " . $general_format);
|
||
|
||
if (!empty($tgr_dtls)) {
|
||
if ($tgr_dtls['addressline1']) {
|
||
$updt_on_tgr['addressline1'] = $general_format . '-addressline1';
|
||
$have_to_replace[$tgr_dtls['addressline1']] = $general_format . '-addressline1';
|
||
} else {
|
||
$updt_on_tgr['addressline1'] = null;
|
||
}
|
||
if ($tgr_dtls['addressline2']) {
|
||
$updt_on_tgr['addressline2'] = $general_format . ' - addressline2';
|
||
$have_to_replace[$tgr_dtls['addressline2']] = $general_format . '-addressline2';
|
||
} else {
|
||
$updt_on_tgr['addressline1'] = null;
|
||
}
|
||
if ($tgr_dtls['addressline3']) {
|
||
$updt_on_tgr['addressline3'] = $general_format . '-addressline3';
|
||
$have_to_replace[$tgr_dtls['addressline3']] = $general_format . '-addressline3';
|
||
} else {
|
||
$updt_on_tgr['addressline1'] = null;
|
||
}
|
||
if ($tgr_dtls['pd_contact_mobileno']) {
|
||
$updt_on_tgr['pd_contact_mobileno'] = $general_format . '-mobileno';
|
||
$have_to_replace[$tgr_dtls['pd_contact_mobileno']] = $general_format . '-mobileno';
|
||
} else {
|
||
$updt_on_tgr['pd_contact_mobileno'] = null;
|
||
}
|
||
if ($tgr_dtls['pd_contact_landline']) {
|
||
$updt_on_tgr['pd_contact_landline'] = $general_format . '-landline';
|
||
$have_to_replace[$tgr_dtls['pd_contact_landline']] = $general_format . '-landline';
|
||
} else {
|
||
$updt_on_tgr['pd_contact_landline'] = null;
|
||
}
|
||
if ($tgr_dtls['pd_contact_person_mail']) {
|
||
$updt_on_tgr['pd_contact_person_mail'] = $general_format . '-mail';
|
||
$have_to_replace[$tgr_dtls['pd_contact_person_mail']] = $general_format . '-mail';
|
||
} else {
|
||
$updt_on_tgr['pd_contact_person_mail'] = null;
|
||
}
|
||
}
|
||
|
||
if (!empty($apcnt_dtls)) {
|
||
for ($j = 0; $j < count($apcnt_dtls); $j++) {
|
||
$appcnt_id = $pdsno . "-" . $pdid . "-" . $apcnt_dtls[$j]['pd_co_applicant_id'];
|
||
|
||
if ($apcnt_dtls[$j]['applicant_name']) {
|
||
// $have_to_replace[str_replace(' ','',$apcnt_dtls[$j]['applicant_name'])] = $appcnt_id;
|
||
$have_to_replace[$apcnt_dtls[$j]['applicant_name']] = $appcnt_id;
|
||
$updt_apcnt_dtls['applicant_name'] = $appcnt_id;
|
||
}
|
||
|
||
if ($apcnt_dtls[$j]['mobile_no']) {
|
||
$updt_apcnt_dtls['mobile_no'] = $appcnt_id . '-mobile_no';
|
||
$have_to_replace[$apcnt_dtls[$j]['mobile_no']] = $appcnt_id . '-mobile_no';
|
||
} else {
|
||
$updt_apcnt_dtls['mobile_no'] = null;
|
||
}
|
||
|
||
if ($apcnt_dtls[$j]['additional_mobile_no']) {
|
||
$updt_apcnt_dtls['additional_mobile_no'] = $appcnt_id . '-additional_mobile_no';
|
||
$have_to_replace[$apcnt_dtls[$j]['additional_mobile_no']] = $appcnt_id . '-additional_mobile_no';
|
||
} else {
|
||
$updt_apcnt_dtls['additional_mobile_no'] = null;
|
||
}
|
||
|
||
if ($apcnt_dtls[$j]['landline']) {
|
||
$updt_apcnt_dtls['landline'] = $appcnt_id . '-landline';
|
||
$have_to_replace[$apcnt_dtls[$j]['landline']] = $appcnt_id . '-landline';
|
||
} else {
|
||
$updt_apcnt_dtls['landline'] = null;
|
||
}
|
||
|
||
if ($apcnt_dtls[$j]['email']) {
|
||
$updt_apcnt_dtls['email'] = $appcnt_id . '-email';
|
||
$have_to_replace[$apcnt_dtls[$j]['email']] = $appcnt_id . '-email';
|
||
} else {
|
||
$updt_apcnt_dtls['email'] = null;
|
||
}
|
||
|
||
if ($apcnt_dtls[$j]['addressline1']) {
|
||
$updt_apcnt_dtls['addressline1'] = $appcnt_id . '-addressline1';
|
||
$have_to_replace[$apcnt_dtls[$j]['addressline1']] = $appcnt_id . '-addressline1';
|
||
} else {
|
||
$updt_apcnt_dtls['addressline1'] = null;
|
||
}
|
||
|
||
if ($apcnt_dtls[$j]['addressline2']) {
|
||
$updt_apcnt_dtls['addressline2'] = $appcnt_id . '-addressline2';
|
||
$have_to_replace[$apcnt_dtls[$j]['addressline2']] = $appcnt_id . '-addressline2';
|
||
} else {
|
||
$updt_apcnt_dtls['addressline2'] = null;
|
||
}
|
||
|
||
if ($apcnt_dtls[$j]['addressline3']) {
|
||
$updt_apcnt_dtls['addressline3'] = $appcnt_id . '-addressline3';
|
||
$have_to_replace[$apcnt_dtls[$j]['addressline3']] = $appcnt_id . '-addressline3';
|
||
} else {
|
||
$updt_apcnt_dtls['addressline3'] = null;
|
||
}
|
||
|
||
if ($apcnt_dtls[$j]['company_name']) {
|
||
$updt_apcnt_dtls['company_name'] = $appcnt_id . '-company_name';
|
||
$have_to_replace[$apcnt_dtls[$j]['company_name']] = $appcnt_id . '-company_name';
|
||
} else {
|
||
$updt_apcnt_dtls['company_name'] = null;
|
||
}
|
||
|
||
$apcnt_result = $this->PD_Model->updateRecords($updt_apcnt_dtls, PDAPPLICANTSDETAILS, array('pd_co_applicant_id' => $apcnt_dtls[$j]['pd_co_applicant_id']));
|
||
if ($apcnt_result) {
|
||
log_message('ERROR', "applicant updated => " . $apcnt_dtls[$j]['pd_co_applicant_id'] . " Updated successfully ( " . ($j + 1) . " )");
|
||
} else {
|
||
log_message('ERROR', "Check here Applicant Not updated ( " . ($j + 1) . " ) pkid = " . $apcnt_dtls[$j]['pd_co_applicant_id']);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
if (!empty($addr_dtls)) {
|
||
for ($k = 0; $k < count($addr_dtls); $k++) {
|
||
if ($addr_dtls[$k]['addressline1']) {
|
||
$updt_addr_dtls['addressline1'] = $general_format . '-addressline1';
|
||
$have_to_replace[$addr_dtls[$k]['addressline1']] = $general_format . '-addressline1';
|
||
} else {
|
||
$updt_addr_dtls['addressline1'] = null;
|
||
}
|
||
$addr_result = $this->PD_Model->updateRecords($updt_addr_dtls, PDADDRESS, array('pd_address_id' => $addr_dtls[$k]['pd_address_id']));
|
||
if ($addr_result) {
|
||
log_message('ERROR', "address updated => " . $addr_dtls[$k]['pd_address_id'] . " Updated successfully ( " . ($k + 1) . " )");
|
||
} else {
|
||
log_message('ERROR', "Check here Adress table Not updated ( " . ($k + 1) . " ) pkid = " . $addr_dtls[$k]['pd_address_id']);
|
||
}
|
||
}
|
||
}
|
||
|
||
if (!empty($json_dtls)) {
|
||
|
||
for ($l = 0; $l < count($json_dtls); $l++) {
|
||
$fid = $json_dtls[$l]['fk_form_id'];
|
||
$fields = array('pd_form_name');
|
||
$where_condition_array = array("pd_form_id" => $fid);
|
||
$form_table = $this->PD_Model->selectCustomRecords($fields, $where_condition_array, PDFORMS);
|
||
$form_name = count($form_table) > 0 ? $form_table[0]['pd_form_name'] : '';
|
||
// echo count($json_dtls);
|
||
// pd_form_detail_json_id, fk_pd_id, fk_form_id, company_id, isactive, json, processed_json,
|
||
$original_j_arr = json_decode($json_dtls[$l]['json'], true);
|
||
$original_pj_arr = json_decode($json_dtls[$l]['processed_json'], true);
|
||
// $have_to_replace["is_person_met_pic"] = "";
|
||
foreach ($have_to_replace as $key => $value) {
|
||
$replaced_pj_arr = $this->replace_in_array($key, $value, $original_pj_arr);
|
||
$replaced_j_arr = $this->replace_in_array($key, $value, $original_j_arr);
|
||
}
|
||
// $fid=18;
|
||
switch ($fid) {
|
||
case 1:
|
||
// 1 trade_product_contact_person_name , person_landline ,person_stdcode
|
||
$arr1 = array('trade_product_contact_person_name','trade_product_contact_person_mobile_number','person_stdcode','person_landline','manufacturing_contact_person_name','manufacturing_contact_person_mobile_number','service_provider_contact_person_name','service_provider_contact_person_mobile_number');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr1, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr1, $general_format);
|
||
break;
|
||
case 2:
|
||
// 2 trade_product_contact_person_name , person_landline
|
||
$arr2 = array('manufacturing_contact_person_name','manufacturing_contact_person_mobile_number','trade_product_contact_person_name','trade_product_contact_person_mobile_number','service_provider_product_contact_person_name','service_provider_product_contact_person_mobile_number','person_stdcode','person_landline');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr2, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr2, $general_format);
|
||
break;
|
||
case 4:
|
||
// 4 other asset
|
||
$arr4 = array('address_of_the_property','other_owner','business_name_of_the_other_owner');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr4, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr4, $general_format);
|
||
break;
|
||
case 5:
|
||
// 5 alternative_address
|
||
$arr5 = array('alternative_address', 'address');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr5, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr5, $general_format);
|
||
break;
|
||
case 6:
|
||
// 6 residence_place
|
||
$arr6 = array('residence_place', 'earning_name_of_the_employer_or_business', 'family_member_name','ownershipOther');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr6, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr6, $general_format);
|
||
break;
|
||
case 7:
|
||
// 7 banking Details
|
||
$arr6 = array('other_applicant','other_applicant_business');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr6, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr6, $general_format);
|
||
break;
|
||
case 8:
|
||
// 8 label
|
||
$arr8 = array('label','others_loan_taken');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr8, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr8, $general_format);
|
||
break;
|
||
case 9:
|
||
// 9 address
|
||
$arr9 = array('address');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr9, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr9, $general_format);
|
||
break;
|
||
case 10:
|
||
$arr10 = array('address', 'property_seller','anchor_name');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr10, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr10, $general_format);
|
||
break;
|
||
case 12:
|
||
$arr12 = array("employer_name", "designation_person_met");
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr12, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr12, $general_format);
|
||
break;
|
||
case 13:
|
||
// 13 partner_name_master . gst_Regn_cert_pic , shop_eat_act_cert_pic,family_member_name
|
||
$arr13 = array("partner_name_master", "gst_Regn_cert_pic", "shop_eat_act_cert_pic", "export_import_cert_pic", "factory_cert_pic", "pf_regn_pic", "esic_regn_pic", "eb_bill_pic","family_member_name","partner_other_name");
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr13, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr13, $general_format);
|
||
break;
|
||
case 17:
|
||
$arr17 = array('address_property','other_person_met','property_owner_other','name_tenant_lessees','name_tenant_lessees_per_met','property_owner_other_per_met','other_person_met','whom_third_party_check_done','agreement_property_owner_other');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr17, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr17, $general_format);
|
||
break;
|
||
case 18:
|
||
// 18 is_person_met_pic , is_person_met_id_proof
|
||
$arr18 = array('is_person_met_pic', 'is_person_met_id_proof','applicant_name');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr18, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr18, $general_format);
|
||
break;
|
||
case 19:
|
||
// 19 neighbourhood_name
|
||
$arr19 = array('neighbourhood_name','mobile','reference_name','std_code','landline');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr19, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr19, $general_format);
|
||
break;
|
||
case 22:
|
||
// 22 address_label,address_label
|
||
$arr22 = array('address_label', 'address_label');
|
||
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr22, $general_format);
|
||
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr22, $general_format);
|
||
break;
|
||
}
|
||
// traverseArray(&$array, $keys)
|
||
$update_json_arr['json'] = json_encode($replaced_j_arr);
|
||
$update_json_arr['processed_json'] = json_encode($replaced_pj_arr);
|
||
$json_result = $this->PD_Model->updateRecords($update_json_arr, PDFORMDETAILSJSON, array('pd_form_detail_json_id' => $json_dtls[$l]['pd_form_detail_json_id']));
|
||
if ($json_result) {
|
||
log_message('ERROR', "JSON updated => " . $form_name . " Updated successfully ( " . ($l + 1) . " ) json table id = " . $json_dtls[$l]['pd_form_detail_json_id']);
|
||
} else {
|
||
log_message('ERROR', "Check here JSON Not updated " . $form_name . " ( " . ($l + 1) . " ) json table id = " . $json_dtls[$l]['pd_form_detail_json_id']);
|
||
}
|
||
// $data['have_to_replace_this'] = $have_to_replace;
|
||
// $data['replaced_pj_array'] = $replaced_pj_arr;
|
||
// $data['original_pj_array'] = $original_pj_arr;
|
||
// $data['original_j_array'] = $original_j_arr;
|
||
// $data['replaced_j_array'] = $replaced_j_arr;
|
||
}
|
||
}
|
||
// $earliest['docs_details'] = $docs_dtls;
|
||
if (!empty($docs_dtls)) {
|
||
for ($m = 0; $m < count($docs_dtls); $m++) {
|
||
log_message('ERROR', "Document " . $docs_dtls[$m]['pd_document_name']);
|
||
$docname = $docs_dtls[$m]['pd_document_name'];
|
||
$destination_path = $this->external_path . "/pd_reports/" . $pdid;
|
||
$files = glob($destination_path.'/*');
|
||
|
||
foreach($files as $file) {
|
||
if(is_file($file))
|
||
// Delete the given file
|
||
unlink($file);
|
||
}
|
||
}
|
||
$this->deleteS3Images($pdlenid,$pdid);
|
||
}
|
||
$updt_on_tgr['pd_status'] = ARCHIVED;
|
||
$updt_tgr_where = array('pd_id' => $pdid, 'pd_status' => QC_COMPLETED);
|
||
$trg_result = $this->PD_Model->updateRecords($updt_on_tgr, PDTRIGGER, $updt_tgr_where);
|
||
if ($trg_result) {
|
||
log_message('ERROR', "Trigger table updated pdid => " . $pdid . " Updated successfully ");
|
||
} else {
|
||
log_message('ERROR', "Check here Trigger table Not updated pdid = " . $pdid);
|
||
}
|
||
return $pdid;
|
||
// $data['pdid'] = $pdid ;
|
||
// $this->response($data,REST_Controller::HTTP_OK);
|
||
}
|
||
|
||
function replace_in_array($find, $replace, &$array)
|
||
{
|
||
array_walk_recursive($array, function (&$array) use ($find, $replace) {
|
||
if ($array === $find) {
|
||
$array = $replace;
|
||
}
|
||
});
|
||
return $array;
|
||
}
|
||
|
||
|
||
|
||
function traverseArray(&$array, $keys, $format)
|
||
{
|
||
foreach ($array as $key => &$value) {
|
||
if (is_array($value)) {
|
||
$this->traverseArray($value, $keys, $format);
|
||
} else {
|
||
if (in_array($key, $keys)) {
|
||
// unset($array[$key]);
|
||
$array[$key] = $format . "-" . $key;
|
||
}
|
||
}
|
||
}
|
||
return $array;
|
||
}
|
||
|
||
function delete_file_destination($file, $pdid)
|
||
{
|
||
|
||
// foreach ($files as $file) {
|
||
// if (file_exists($file)) {
|
||
// unlink($file);
|
||
$destination_path = $this->external_path . "/pd_reports/" . $pdid . "/" . $file;
|
||
unlink($destination_path);
|
||
// } else {
|
||
// // File not found.
|
||
// }
|
||
// }
|
||
}
|
||
|
||
public function checkjsonPD_post()
|
||
{
|
||
$records = $this->post('records');
|
||
$pdid = $records['pd_id'];
|
||
$fromid = $records['form_id'];
|
||
$fields = array('json', 'company_id','processed_json');
|
||
$where_condition_array = array('isactive' => 1, 'fk_form_id' => $fromid, 'fk_pd_id' => $pdid);
|
||
$data = $this->PD_Model->selectCustomRecords($fields, $where_condition_array, PDFORMDETAILSJSON);
|
||
$dat['j'] = (json_decode($data[0]['json'],true));
|
||
$dat['pj'] =(json_decode($data[0]['processed_json'],true));
|
||
$this->response($dat, REST_Controller::HTTP_OK);
|
||
}
|
||
|
||
public function deleteS3Images($pdLenId,$pdid){
|
||
// public function deleteS3Images_get(){
|
||
// $pdid = $this->get('pdid');$rs = $this->get('rs');
|
||
// $master = $this->PD_Model->getPDMasterDetails($pdid,$rs);
|
||
// $pdLenId = $master[0]['fk_lender_id'];
|
||
$bucketName = LENDER_BUCKET_NAME_PREFIX . $pdLenId;
|
||
$key = 'pd' . $pdid;
|
||
$allFiles = $this->aws_s3->getAllObjectsInaBucket($bucketName, $key);
|
||
if(!empty($allFiles)){
|
||
foreach ($allFiles as $files) {
|
||
log_message('ERROR', "Lender File Name " . $files['Key']);
|
||
$s3result = $this->aws_s3->deleteSingleObjFromBucket($bucketName, $files['Key']);
|
||
if (is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) {
|
||
log_message('ERROR', "s3result " . $s3result['@metadata']['statusCode']);
|
||
} else {
|
||
log_message('ERROR', "Check here Not updated on S3 result " . $s3result['@metadata']['statusCode']);
|
||
}
|
||
}
|
||
}
|
||
$allOptimizedFiles = $this->aws_s3->getAllObjectsInaBucket(OPTIMIZED_IMAGE_BUCKET_NAME, $key);
|
||
if(!empty($allOptimizedFiles)){
|
||
// print_r($allOptimizedFiles);
|
||
foreach ($allOptimizedFiles as $files) {
|
||
log_message('ERROR', "Optimized File Name " . $files['Key']);
|
||
$optimizeds3result = $this->aws_s3->deleteSingleObjFromBucket(OPTIMIZED_IMAGE_BUCKET_NAME, $files['Key']);
|
||
if (is_object($optimizeds3result) && $optimizeds3result['ObjectURL'] != '' && $optimizeds3result['@metadata']['statusCode'] == 200) {
|
||
log_message('ERROR', "optimizeds3result " . $optimizeds3result['@metadata']['statusCode']);
|
||
} else {
|
||
log_message('ERROR', "Check here Not updated on Optimized s3 result " . $optimizeds3result['@metadata']['statusCode']);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
} |