fixes : ps

This commit is contained in:
VE10-Sanjeev 2022-08-25 22:54:50 +05:30
parent d5c70ab5b8
commit 5a68f8a3c4

View File

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Created by PhpStorm. * Created by PhpStorm.
* User: kms * User: kms
@ -6,7 +7,7 @@
* Time: 7:40 PM * Time: 7:40 PM
*/ */
defined('BASEPATH') OR exit('No direct script access allowed'); defined('BASEPATH') or exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions // This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */ /** @noinspection PhpIncludeInspection */
@ -24,7 +25,8 @@ include_once APPPATH.'/vendor/autoload.php';
* @license MIT * @license MIT
* @link * @link
*/ */
class Data_Dump_Controller extends REST_Controller { class Data_Dump_Controller extends REST_Controller
{
function __construct() function __construct()
{ {
@ -47,8 +49,7 @@ class Data_Dump_Controller extends REST_Controller {
{ {
$this->load->helper('data_dump'); $this->load->helper('data_dump');
for($i = 1;$i<=30;$i++) for ($i = 1; $i <= 30; $i++) {
{
$fields = array('processed_json'); $fields = array('processed_json');
$where_condition_array = array('isactive' => 1, 'fk_pd_id' => $pdid, 'fk_form_id' => $i); $where_condition_array = array('isactive' => 1, 'fk_pd_id' => $pdid, 'fk_form_id' => $i);
@ -59,18 +60,15 @@ class Data_Dump_Controller extends REST_Controller {
//get General form dump //get General form dump
$gen_data_dump = array(); $gen_data_dump = array();
if(isset($pd_processed_forms[18])) if (isset($pd_processed_forms[18])) {
{
$gen_data = (json_decode($pd_processed_forms[18][0]['processed_json'], TRUE)); $gen_data = (json_decode($pd_processed_forms[18][0]['processed_json'], TRUE));
//print_r($gen_data);die(); //print_r($gen_data);die();
$gen_data_dump = DATA_DUMP::convertGeneralDetailsForm($gen_data, $master); $gen_data_dump = DATA_DUMP::convertGeneralDetailsForm($gen_data, $master);
print_r($gen_data_dump); print_r($gen_data_dump);
$this->Data_Dump_Model->saveGenDumpData($gen_data_dump); $this->Data_Dump_Model->saveGenDumpData($gen_data_dump);
} }
if(isset($pd_processed_forms[13])) if (isset($pd_processed_forms[13])) {
{ if (array_key_exists('company_data', $gen_data_dump) && count($gen_data_dump)) {
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)); $business_data = (json_decode($pd_processed_forms[13][0]['processed_json'], TRUE));
//print_r($business_data);die(); //print_r($business_data);die();
$business_data_dump = DATA_DUMP::convertBusinessDetailsForm($business_data, $master, $gen_data_dump['company_data']); $business_data_dump = DATA_DUMP::convertBusinessDetailsForm($business_data, $master, $gen_data_dump['company_data']);
@ -79,12 +77,12 @@ 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] //[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(){ public function googleSheet_post()
{
// $logger = MYLOG::logFunction(null,"Gsheet"); // $logger = MYLOG::logFunction(null,"Gsheet");
log_message('ERROR', '#/# G-Sheet Fns Entered - ' . date('Y-m-d H:i:s A')); log_message('ERROR', '#/# G-Sheet Fns Entered - ' . date('Y-m-d H:i:s A'));
// $sheetData = $this->post(); // $sheetData = $this->post();
@ -93,8 +91,7 @@ class Data_Dump_Controller extends REST_Controller {
log_message('ERROR', '#/# Params Count - ' . count($sheetData)); log_message('ERROR', '#/# Params Count - ' . count($sheetData));
if (count($sheetData) > 0) { if (count($sheetData) > 0) {
$pd_id = $this->modificationGsheetData($sheetData); $pd_id = $this->modificationGsheetData($sheetData);
if($pd_id != null || $pd_id != '') if ($pd_id != null || $pd_id != '') {
{
$pd_serial_no = $this->Data_Dump_Model->getPDSerialNO($pd_id); $pd_serial_no = $this->Data_Dump_Model->getPDSerialNO($pd_id);
log_message('ERROR', "#/# G-Sheet For PD ID : " . $pd_id); log_message('ERROR', "#/# G-Sheet For PD ID : " . $pd_id);
// PDALERTS::pdnotification($pd_id); // PDALERTS::pdnotification($pd_id);
@ -103,9 +100,7 @@ class Data_Dump_Controller extends REST_Controller {
$data['pdid'] = $pd_serial_no . " / " . $pd_id; $data['pdid'] = $pd_serial_no . " / " . $pd_id;
$data['msg'] = "Successfully Inserted PD.NO/ID : " . $pd_serial_no . " / " . $pd_id; $data['msg'] = "Successfully Inserted PD.NO/ID : " . $pd_serial_no . " / " . $pd_id;
$this->response($data, REST_Controller::HTTP_OK); $this->response($data, REST_Controller::HTTP_OK);
} } else {
else
{
log_message("ERROR", "#/# 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['dataStatus'] = false;
$data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['status'] = REST_Controller::HTTP_NO_CONTENT;
@ -128,7 +123,8 @@ class Data_Dump_Controller extends REST_Controller {
// } // }
} }
public function modificationGsheetData($GSdata){ public function modificationGsheetData($GSdata)
{
// $logger = MYLOG::logFunction(null,"Gsheet"); // $logger = MYLOG::logFunction(null,"Gsheet");
log_message('ERROR', "G-Sheet For PD Step 1 (G-sheet Data)"); log_message('ERROR', "G-Sheet For PD Step 1 (G-sheet Data)");
@ -196,7 +192,6 @@ class Data_Dump_Controller extends REST_Controller {
$pd_applicant_details[$j]['applicant_name'] = $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]); $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"]); $this->Data_Dump_Model->getId(10, $GSdata["LenderCreditName"]);
} else { } else {
$pd_applicant_details[$j]['applicant_name'] = $applicatantParts[$j]; $pd_applicant_details[$j]['applicant_name'] = $applicatantParts[$j];
} }
@ -206,11 +201,9 @@ class Data_Dump_Controller extends REST_Controller {
if (count($applicant_title_name) > 1) { if (count($applicant_title_name) > 1) {
$pd_applicant_details[0]['applicant_name'] = $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]); $pd_applicant_details[0]['applicant_title_name'] = $this->Data_Dump_Model->getId(10, $applicant_title_name[0]);
} else { } else {
$pd_applicant_details[0]['applicant_name'] = $applicatantParts[0]; $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]['company_name'] = (isset($GSdata["CompanyName"]) && $GSdata["CompanyName"] != "") ? $GSdata["CompanyName"] : null;
$pd_applicant_details[0]['applicant_type'] = 1; $pd_applicant_details[0]['applicant_type'] = 1;
@ -240,7 +233,6 @@ class Data_Dump_Controller extends REST_Controller {
} }
} else { } else {
$pd_applicant_details[0]['mobile_no'] = $ContactNumber[0]; $pd_applicant_details[0]['mobile_no'] = $ContactNumber[0];
} }
log_message('ERROR', "G-Sheet For PD Step 2.5 (mobile number) GSheet data : " . $GSdata['ContactNumber']); log_message('ERROR', "G-Sheet For PD Step 2.5 (mobile number) GSheet data : " . $GSdata['ContactNumber']);
} }
@ -341,7 +333,6 @@ class Data_Dump_Controller extends REST_Controller {
} }
} else { } else {
$addi_requirements[0]['add_requirement'] = $requirements[0]; $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)); log_message('ERROR', "G-Sheet For PD Step 2.13 ( additional requirements) GSheet data : " . $GSdata["AdditionalRequirements"] . " PD details :" . json_encode($addi_requirements));
} }
@ -367,21 +358,19 @@ class Data_Dump_Controller extends REST_Controller {
if (count($choosed_template_id)) ## CHOOSE FILTERED TEMPLATE if (count($choosed_template_id)) ## CHOOSE FILTERED TEMPLATE
{ {
$pd_details['fk_pd_template_id'] = $choosed_template_id[0]['fk_template_id']; $pd_details['fk_pd_template_id'] = $choosed_template_id[0]['fk_template_id'];
} } else ## CHOOSE GENERIC TEMPLATE
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 = $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']; $customer_segment_abbr = $customer_segment_abbr[0]['abbr'];
if (!strcasecmp($customer_segment_abbr, 'SAL')) // || !strcasecmp($customer_segment_abbr,'SAL-CHQ')) if (!strcasecmp($customer_segment_abbr, 'SAL')) // || !strcasecmp($customer_segment_abbr,'SAL-CHQ'))
{$pd_details['fk_pd_template_id'] = 1;## SAL-(CASH/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')) } 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) $pd_details['fk_pd_template_id'] = 2; ## SENP/SEP-(DI)
} } else if (!strcasecmp($customer_segment_abbr, 'SE-AI') || !strcasecmp($customer_segment_abbr, 'SEP-AI')) {
else if( !strcasecmp($customer_segment_abbr,'SE-AI') || !strcasecmp($customer_segment_abbr,'SEP-AI') ) $pd_details['fk_pd_template_id'] = 3; ## SENP/SEP-(DI)
{$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)
else if( !strcasecmp($customer_segment_abbr,'SE-RI'))
{$pd_details['fk_pd_template_id'] = 4;## SENP/SEP-(RI)
} }
} }
@ -390,8 +379,7 @@ class Data_Dump_Controller extends REST_Controller {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters); $charactersLength = strlen($characters);
$randomString = ''; $randomString = '';
for ($i = 0; $i < 16; $i++) for ($i = 0; $i < 16; $i++) {
{
$randomString .= $characters[rand(0, $charactersLength - 1)]; $randomString .= $characters[rand(0, $charactersLength - 1)];
} }
$pd_details['random_string'] = $randomString; $pd_details['random_string'] = $randomString;
@ -412,17 +400,16 @@ class Data_Dump_Controller extends REST_Controller {
// $pd_id = 3149; // $pd_id = 3149;
if($pd_id != null || $pd_id != '') if ($pd_id != null || $pd_id != '') {
{ if ($pd_applicant_details != "" || $pd_applicant_details != null) {
if($pd_applicant_details != "" || $pd_applicant_details != null)
{
log_message('ERROR', "G-Sheet For PD Step 5 (applicant)"); log_message('ERROR', "G-Sheet For PD Step 5 (applicant)");
// Applicant : ".$pd_applicant_details); // Applicant : ".$pd_applicant_details);
foreach($pd_applicant_details as $pd_applicant_detail) foreach ($pd_applicant_details as $pd_applicant_detail) {
{
$pd_applicant_detail['fk_pd_id'] = $pd_id; $pd_applicant_detail['fk_pd_id'] = $pd_id;
$pd_applicant_detail['applicant_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['applicant_name'])); $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'])); } if (isset($pd_applicant_detail['company_name'])) {
$pd_applicant_detail['company_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['company_name']));
}
try { try {
$co_applicant_id = $this->Data_Dump_Model->saveRecords($pd_applicant_detail, PDAPPLICANTSDETAILS); $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); log_message('ERROR', "G-Sheet For PD Step 5.1 (applicant pkid) Applicant-ID : " . $co_applicant_id);
@ -434,18 +421,14 @@ class Data_Dump_Controller extends REST_Controller {
log_message('ERROR', "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()); // var_dump($e->getMessage());
} }
}
} }
} }
## Credit Managers Specific Queries }
## Credit Manager<65>s Specific Queries
if ($pd_id != "") { if ($pd_id != "") {
if($addi_requirements != "" || $addi_requirements != null) if ($addi_requirements != "" || $addi_requirements != null) {
{
log_message('ERROR', "G-Sheet For PD Step 6 (credit manager queries)"); log_message('ERROR', "G-Sheet For PD Step 6 (credit manager queries)");
foreach($addi_requirements as $pd_addtional_requirement) foreach ($addi_requirements as $pd_addtional_requirement) {
{
try { try {
$pd_addtional_requirement['isactive'] = 1; $pd_addtional_requirement['isactive'] = 1;
$pd_addtional_requirement['fk_pd_id'] = $pd_id; $pd_addtional_requirement['fk_pd_id'] = $pd_id;
@ -503,14 +486,17 @@ class Data_Dump_Controller extends REST_Controller {
// step 4 : processjson inactive data deleted.. // step 4 : processjson inactive data deleted..
//working fine on tables. //working fine on tables.
public function deleteOldPDbk_up_get(){ public function deleteOldPDbk_up_get()
{
$_90th_date = date("Y/m/d", strtotime('-90 days')); $_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'); $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'; $table = PDTRIGGER . ' as PDTRIGGER';
$joins = array(array('table' => PDAPPLICANTSDETAILS. ' as PDAPPLICANTSDETAILS', $joins = array(array(
'table' => PDAPPLICANTSDETAILS . ' as PDAPPLICANTSDETAILS',
'condition' => 'PDAPPLICANTSDETAILS.fk_pd_id = PDTRIGGER.pd_id AND PDAPPLICANTSDETAILS.isactive = 1 AND PDAPPLICANTSDETAILS.applicant_type = 1', 'condition' => 'PDAPPLICANTSDETAILS.fk_pd_id = PDTRIGGER.pd_id AND PDAPPLICANTSDETAILS.isactive = 1 AND PDAPPLICANTSDETAILS.applicant_type = 1',
'jointype' => 'LEFT')); 'jointype' => 'LEFT'
));
$tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'DATE_FORMAT(PDTRIGGER.createdon, "%d/%m/%Y") <=' => $_90th_date); $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); $tgr_dtls = $this->PD_Model->getJoinRecords($columns, $table, $joins, $tgr_cond_arr);
$i = 0; // testing Purpose only $i = 0; // testing Purpose only
@ -580,7 +566,8 @@ class Data_Dump_Controller extends REST_Controller {
$this->response($data, REST_Controller::HTTP_OK); $this->response($data, REST_Controller::HTTP_OK);
} }
public function renamingExistingPDinfo_get(){ public function renamingExistingPDinfo_get()
{
log_message('ERROR', "renamingExistingPDinfo Fns Called"); log_message('ERROR', "renamingExistingPDinfo Fns Called");
$_90th_date = date("Y/m/d", strtotime('-90 days')); $_90th_date = date("Y/m/d", strtotime('-90 days'));
$pdsno = $this->get('pdsno'); $pdsno = $this->get('pdsno');
@ -588,9 +575,11 @@ class Data_Dump_Controller extends REST_Controller {
$pdid_arr = array(); // testing purpose $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', 'PDAPPLICANTSDETAILS.pd_co_applicant_id', 'PDTRIGGER.pd_contact_person_mail', 'PDTRIGGER.fk_lender_id'); $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', 'PDTRIGGER.fk_lender_id');
$table = PDTRIGGER . ' as PDTRIGGER'; $table = PDTRIGGER . ' as PDTRIGGER';
$joins = array(array('table' => PDAPPLICANTSDETAILS. ' as PDAPPLICANTSDETAILS', $joins = array(array(
'table' => PDAPPLICANTSDETAILS . ' as PDAPPLICANTSDETAILS',
'condition' => 'PDAPPLICANTSDETAILS.fk_pd_id = PDTRIGGER.pd_id AND PDAPPLICANTSDETAILS.isactive = 1 AND PDAPPLICANTSDETAILS.applicant_type = 1', 'condition' => 'PDAPPLICANTSDETAILS.fk_pd_id = PDTRIGGER.pd_id AND PDAPPLICANTSDETAILS.isactive = 1 AND PDAPPLICANTSDETAILS.applicant_type = 1',
'jointype' => 'LEFT')); 'jointype' => 'LEFT'
));
if (!empty($pdsno)) { if (!empty($pdsno)) {
log_message('ERROR', "PD Serial No => " . $pdsno); log_message('ERROR', "PD Serial No => " . $pdsno);
$tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'PDTRIGGER.pd_sno' => $pdsno); $tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'PDTRIGGER.pd_sno' => $pdsno);
@ -649,8 +638,6 @@ class Data_Dump_Controller extends REST_Controller {
if (!empty($docs_dtls)) { if (!empty($docs_dtls)) {
$earliest['docs_details'] = $docs_dtls; $earliest['docs_details'] = $docs_dtls;
} }
} }
$return = $this->renamingProcess($earliest); $return = $this->renamingProcess($earliest);
@ -667,7 +654,8 @@ class Data_Dump_Controller extends REST_Controller {
$this->response($data, REST_Controller::HTTP_OK); $this->response($data, REST_Controller::HTTP_OK);
} }
public function renamingProcess($details){ public function renamingProcess($details)
{
log_message('ERROR', "renamingProcess Fns Called"); log_message('ERROR', "renamingProcess Fns Called");
$have_to_replace = array(); $have_to_replace = array();
@ -690,27 +678,39 @@ class Data_Dump_Controller extends REST_Controller {
if ($tgr_dtls['addressline1']) { if ($tgr_dtls['addressline1']) {
$updt_on_tgr['addressline1'] = $general_format . '-addressline1'; $updt_on_tgr['addressline1'] = $general_format . '-addressline1';
$have_to_replace[$tgr_dtls['addressline1']] = $general_format . '-addressline1'; $have_to_replace[$tgr_dtls['addressline1']] = $general_format . '-addressline1';
}else{ $updt_on_tgr['addressline1'] = null; } } else {
$updt_on_tgr['addressline1'] = null;
}
if ($tgr_dtls['addressline2']) { if ($tgr_dtls['addressline2']) {
$updt_on_tgr['addressline2'] = $general_format . ' - addressline2'; $updt_on_tgr['addressline2'] = $general_format . ' - addressline2';
$have_to_replace[$tgr_dtls['addressline2']] = $general_format . '-addressline2'; $have_to_replace[$tgr_dtls['addressline2']] = $general_format . '-addressline2';
}else{ $updt_on_tgr['addressline1'] = null; } } else {
$updt_on_tgr['addressline1'] = null;
}
if ($tgr_dtls['addressline3']) { if ($tgr_dtls['addressline3']) {
$updt_on_tgr['addressline3'] = $general_format . '-addressline3'; $updt_on_tgr['addressline3'] = $general_format . '-addressline3';
$have_to_replace[$tgr_dtls['addressline3']] = $general_format . '-addressline3'; $have_to_replace[$tgr_dtls['addressline3']] = $general_format . '-addressline3';
}else{ $updt_on_tgr['addressline1'] = null; } } else {
$updt_on_tgr['addressline1'] = null;
}
if ($tgr_dtls['pd_contact_mobileno']) { if ($tgr_dtls['pd_contact_mobileno']) {
$updt_on_tgr['pd_contact_mobileno'] = $general_format . '-mobileno'; $updt_on_tgr['pd_contact_mobileno'] = $general_format . '-mobileno';
$have_to_replace[$tgr_dtls['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; } } else {
$updt_on_tgr['pd_contact_mobileno'] = null;
}
if ($tgr_dtls['pd_contact_landline']) { if ($tgr_dtls['pd_contact_landline']) {
$updt_on_tgr['pd_contact_landline'] = $general_format . '-landline'; $updt_on_tgr['pd_contact_landline'] = $general_format . '-landline';
$have_to_replace[$tgr_dtls['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; } } else {
$updt_on_tgr['pd_contact_landline'] = null;
}
if ($tgr_dtls['pd_contact_person_mail']) { if ($tgr_dtls['pd_contact_person_mail']) {
$updt_on_tgr['pd_contact_person_mail'] = $general_format . '-mail'; $updt_on_tgr['pd_contact_person_mail'] = $general_format . '-mail';
$have_to_replace[$tgr_dtls['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 ; } } else {
$updt_on_tgr['pd_contact_person_mail'] = null;
}
} }
if (!empty($apcnt_dtls)) { if (!empty($apcnt_dtls)) {
@ -726,46 +726,65 @@ class Data_Dump_Controller extends REST_Controller {
if ($apcnt_dtls[$j]['mobile_no']) { if ($apcnt_dtls[$j]['mobile_no']) {
$updt_apcnt_dtls['mobile_no'] = $appcnt_id . '-mobile_no'; $updt_apcnt_dtls['mobile_no'] = $appcnt_id . '-mobile_no';
$have_to_replace[$apcnt_dtls[$j]['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 ; } } else {
$updt_apcnt_dtls['mobile_no'] = null;
}
if ($apcnt_dtls[$j]['additional_mobile_no']) { if ($apcnt_dtls[$j]['additional_mobile_no']) {
$updt_apcnt_dtls['additional_mobile_no'] = $appcnt_id . '-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'; $have_to_replace[$apcnt_dtls[$j]['additional_mobile_no']] = $appcnt_id . '-additional_mobile_no';
}else{ $updt_apcnt_dtls['additional_mobile_no'] = null ; } } else {
$updt_apcnt_dtls['additional_mobile_no'] = null;
}
if ($apcnt_dtls[$j]['landline']) { if ($apcnt_dtls[$j]['landline']) {
$updt_apcnt_dtls['landline'] = $appcnt_id . '-landline'; $updt_apcnt_dtls['landline'] = $appcnt_id . '-landline';
$have_to_replace[$apcnt_dtls[$j]['landline']] = $appcnt_id . '-landline'; $have_to_replace[$apcnt_dtls[$j]['landline']] = $appcnt_id . '-landline';
}else{ $updt_apcnt_dtls['landline'] = null ; } } else {
$updt_apcnt_dtls['landline'] = null;
}
if ($apcnt_dtls[$j]['email']) { if ($apcnt_dtls[$j]['email']) {
$updt_apcnt_dtls['email'] = $appcnt_id . '-email'; $updt_apcnt_dtls['email'] = $appcnt_id . '-email';
$have_to_replace[$apcnt_dtls[$j]['email']] = $appcnt_id . '-email'; $have_to_replace[$apcnt_dtls[$j]['email']] = $appcnt_id . '-email';
}else{ $updt_apcnt_dtls['email'] = null ; } } else {
$updt_apcnt_dtls['email'] = null;
}
if ($apcnt_dtls[$j]['addressline1']) { if ($apcnt_dtls[$j]['addressline1']) {
$updt_apcnt_dtls['addressline1'] = $appcnt_id . '-addressline1'; $updt_apcnt_dtls['addressline1'] = $appcnt_id . '-addressline1';
$have_to_replace[$apcnt_dtls[$j]['addressline1']] = $appcnt_id . '-addressline1'; $have_to_replace[$apcnt_dtls[$j]['addressline1']] = $appcnt_id . '-addressline1';
}else{ $updt_apcnt_dtls['addressline1'] = null ; } } else {
$updt_apcnt_dtls['addressline1'] = null;
}
if ($apcnt_dtls[$j]['addressline2']) { if ($apcnt_dtls[$j]['addressline2']) {
$updt_apcnt_dtls['addressline2'] = $appcnt_id . '-addressline2'; $updt_apcnt_dtls['addressline2'] = $appcnt_id . '-addressline2';
$have_to_replace[$apcnt_dtls[$j]['addressline2']] = $appcnt_id . '-addressline2'; $have_to_replace[$apcnt_dtls[$j]['addressline2']] = $appcnt_id . '-addressline2';
}else{ $updt_apcnt_dtls['addressline2'] = null ; } } else {
$updt_apcnt_dtls['addressline2'] = null;
}
if ($apcnt_dtls[$j]['addressline3']) { if ($apcnt_dtls[$j]['addressline3']) {
$updt_apcnt_dtls['addressline3'] = $appcnt_id . '-addressline3'; $updt_apcnt_dtls['addressline3'] = $appcnt_id . '-addressline3';
$have_to_replace[$apcnt_dtls[$j]['addressline3']] = $appcnt_id . '-addressline3'; $have_to_replace[$apcnt_dtls[$j]['addressline3']] = $appcnt_id . '-addressline3';
}else{ $updt_apcnt_dtls['addressline3'] = null ; } } else {
$updt_apcnt_dtls['addressline3'] = null;
}
if ($apcnt_dtls[$j]['company_name']) { if ($apcnt_dtls[$j]['company_name']) {
$updt_apcnt_dtls['company_name'] = $appcnt_id . '-company_name'; $updt_apcnt_dtls['company_name'] = $appcnt_id . '-company_name';
$have_to_replace[$apcnt_dtls[$j]['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 ; } } 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'])); $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)." )");} if ($apcnt_result) {
else{ log_message('ERROR',"Check here Applicant Not updated ( ".($j+1)." ) pkid = ".$apcnt_dtls[$j]['pd_co_applicant_id']); } 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']);
}
} }
} }
@ -779,8 +798,11 @@ class Data_Dump_Controller extends REST_Controller {
$updt_addr_dtls['addressline1'] = null; $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'])); $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)." )");} if ($addr_result) {
else{ log_message('ERROR',"Check here Adress table Not updated ( ".($k+1)." ) pkid = ".$addr_dtls[$k]['pd_address_id']); } 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']);
}
} }
} }
@ -802,8 +824,7 @@ class Data_Dump_Controller extends REST_Controller {
$replaced_j_arr = $this->replace_in_array($key, $value, $original_j_arr); $replaced_j_arr = $this->replace_in_array($key, $value, $original_j_arr);
} }
// $fid=18; // $fid=18;
switch($fid) switch ($fid) {
{
case 1: case 1:
// 1 trade_product_contact_person_name , person_landline ,person_stdcode // 1 trade_product_contact_person_name , person_landline ,person_stdcode
$arr1 = array('trade_product_contact_person_name', 'person_landline', 'person_stdcode'); $arr1 = array('trade_product_contact_person_name', 'person_landline', 'person_stdcode');
@ -816,6 +837,12 @@ class Data_Dump_Controller extends REST_Controller {
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr2, $general_format); $replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr2, $general_format);
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr2, $general_format); $replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr2, $general_format);
break; break;
case 4:
// 4 other asset
$arr4 = array('address_of_the_property');
$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: case 5:
// 5 alternative_address // 5 alternative_address
$arr5 = array('alternative_address', 'address'); $arr5 = array('alternative_address', 'address');
@ -866,7 +893,6 @@ class Data_Dump_Controller extends REST_Controller {
$arr18 = array('is_person_met_pic', 'is_person_met_id_proof'); $arr18 = array('is_person_met_pic', 'is_person_met_id_proof');
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr18, $general_format); $replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr18, $general_format);
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr18, $general_format); $replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr18, $general_format);
break; break;
case 19: case 19:
// 19 neighbourhood_name // 19 neighbourhood_name
@ -880,14 +906,16 @@ class Data_Dump_Controller extends REST_Controller {
$replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr22, $general_format); $replaced_pj_arr = $this->traverseArray($replaced_pj_arr, $arr22, $general_format);
$replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr22, $general_format); $replaced_j_arr = $this->traverseArray($replaced_j_arr, $arr22, $general_format);
break; break;
} }
// traverseArray(&$array, $keys) // traverseArray(&$array, $keys)
$update_json_arr['json'] = json_encode($replaced_j_arr); $update_json_arr['json'] = json_encode($replaced_j_arr);
$update_json_arr['processed_json'] = json_encode($replaced_pj_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'])); $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']);} if ($json_result) {
else{ log_message('ERROR',"Check here JSON Not updated ".$form_name." ( ".($l+1)." ) json table id = ".$json_dtls[$l]['pd_form_detail_json_id']); } 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['have_to_replace_this'] = $have_to_replace;
// $data['replaced_pj_array'] = $replaced_pj_arr; // $data['replaced_pj_array'] = $replaced_pj_arr;
// $data['original_pj_array'] = $original_pj_arr; // $data['original_pj_array'] = $original_pj_arr;
@ -896,35 +924,40 @@ class Data_Dump_Controller extends REST_Controller {
} }
} }
// $earliest['docs_details'] = $docs_dtls; // $earliest['docs_details'] = $docs_dtls;
if(!empty($doc_dtls)){ if (!empty($docs_dtls)) {
for($m = 0 ;$m < count($doc_dtls);$m++){ for ($m = 0; $m < count($docs_dtls); $m++) {
log_message('ERROR',"Document ".$doc_dtls[$m]['pd_document_name'] ); log_message('ERROR', "Document " . $docs_dtls[$m]['pd_document_name']);
$docname = $doc_dtls[$m]['pd_document_name']; $docname = $docs_dtls[$m]['pd_document_name'];
$destination_path = $this->external_path . "/pd_reports/" . $pdid . "/" . $docname; $destination_path = $this->external_path . "/pd_reports/" . $pdid . "/" . $docname;
if (file_exists($destination_path)) {
unlink($destination_path); unlink($destination_path);
}
$bucketname = LENDER_BUCKET_NAME_PREFIX . $pdlenid; $bucketname = LENDER_BUCKET_NAME_PREFIX . $pdlenid;
$key = 'pd' . $pdid . '/' . $docname; $key = 'pd' . $pdid . '/' . $docname;
$s3result = $this->aws_s3->deleteSingleObjFromBucket($bucketname, $key); $s3result = $this->aws_s3->deleteSingleObjFromBucket($bucketname, $key);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) if (is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) {
{
log_message('ERROR', "s3result " . $s3result['@metadata']['statusCode']); log_message('ERROR', "s3result " . $s3result['@metadata']['statusCode']);
} else {
log_message('ERROR', "Check here Not updated on S3 result " . $s3result['@metadata']['statusCode']);
} }
else{ log_message('ERROR',"Check here Not updated on S3 result ".$s3result['@metadata']['statusCode'] ); }
} }
} }
$updt_on_tgr['pd_status'] = ARCHIVED; $updt_on_tgr['pd_status'] = ARCHIVED;
$updt_tgr_where = array('pd_id' => $pdid, 'pd_status' => QC_COMPLETED); $updt_tgr_where = array('pd_id' => $pdid, 'pd_status' => QC_COMPLETED);
$trg_result = $this->PD_Model->updateRecords($updt_on_tgr, PDTRIGGER, $updt_tgr_where); $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 ");} if ($trg_result) {
else{ log_message('ERROR',"Check here Trigger table Not updated pdid = ".$pdid); } log_message('ERROR', "Trigger table updated pdid => " . $pdid . " Updated successfully ");
} else {
log_message('ERROR', "Check here Trigger table Not updated pdid = " . $pdid);
}
return $pdid; return $pdid;
// $data['pdid'] = $pdid ; // $data['pdid'] = $pdid ;
// $this->response($data,REST_Controller::HTTP_OK); // $this->response($data,REST_Controller::HTTP_OK);
} }
function replace_in_array($find, $replace, &$array) { function replace_in_array($find, $replace, &$array)
{
array_walk_recursive($array, function (&$array) use ($find, $replace) { array_walk_recursive($array, function (&$array) use ($find, $replace) {
if ($array === $find) { if ($array === $find) {
$array = $replace; $array = $replace;
@ -935,7 +968,8 @@ class Data_Dump_Controller extends REST_Controller {
function traverseArray(&$array, $keys,$format) { function traverseArray(&$array, $keys, $format)
{
foreach ($array as $key => &$value) { foreach ($array as $key => &$value) {
if (is_array($value)) { if (is_array($value)) {
$this->traverseArray($value, $keys, $format); $this->traverseArray($value, $keys, $format);
@ -949,7 +983,8 @@ class Data_Dump_Controller extends REST_Controller {
return $array; return $array;
} }
function delete_file_destination($file,$pdid) { function delete_file_destination($file, $pdid)
{
// foreach ($files as $file) { // foreach ($files as $file) {
// if (file_exists($file)) { // if (file_exists($file)) {
@ -961,5 +996,4 @@ class Data_Dump_Controller extends REST_Controller {
// } // }
// } // }
} }
} }