Google sheet 5: ps
This commit is contained in:
parent
a0c2f60726
commit
b5e74123db
@ -88,29 +88,31 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
// $logger = MYLOG::logFunction(null,"Gsheet");
|
||||
log_message('ERROR','#/# G-Sheet Fns Entered - '.date('Y-m-d H:i:s A'));
|
||||
$sheetData = $this->post();
|
||||
// log_message('ERROR','#/# Params Are - '.$sheetData);
|
||||
// $sheetData = json_decode($this->post(),true);
|
||||
log_message('ERROR','#/# Params Count - '.count($sheetData));
|
||||
if(count($sheetData) > 0){
|
||||
$pd_id = $this->modificationGsheetData($sheetData);
|
||||
if($pd_id != null || $pd_id != '')
|
||||
{
|
||||
$pd_serial_no = $this->Data_Dump_Model->getPDSerialNO($pd_id);
|
||||
log_message('ERROR',"#/# G-Sheet For PD ID : ".$pd_id);
|
||||
// PDALERTS::pdnotification($pd_id);
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['pdid'] = $pd_id;
|
||||
$data['records'] = $pd_id;
|
||||
$data['pdid'] = $pd_serial_no." / ".$pd_id;
|
||||
$data['msg'] = "Successfully Inserted PD.NO/ID : ".$pd_serial_no." / ".$pd_id;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message("info","G-Sheet SomeThing went Wrong mistake on Gsheet-data PDID not Founded");
|
||||
log_message("ERROR","#/# G-Sheet SomeThing went Wrong mistake on Gsheet-data PDID not Founded");
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$data['msg'] = "Some thing went wrong";
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
}else{
|
||||
log_message("info","G-Sheet Data Not Founded");
|
||||
log_message("ERROR","#/# G-Sheet Data Not Founded");
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$data['msg'] = "Some thing went wrong !";
|
||||
@ -150,14 +152,14 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
log_message('ERROR',"G-Sheet For PD Step 2 (Processing data for-loop)");
|
||||
if($i==1 && $GSdata[$i] != ""){
|
||||
$modifiedData['lender'] = $GSdata[$i];
|
||||
$fk_lender_id = $this->Data_Dump_Model->getId(1,$GSdata[$i]);
|
||||
$fk_lender_id = $this->Data_Dump_Model->getId(1,trim($GSdata[$i]));
|
||||
$pd_details['fk_lender_id']=$fk_lender_id;
|
||||
$pd_details['sub_entity_id']=$fk_lender_id;
|
||||
log_message('ERROR',"G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender']." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']);
|
||||
}
|
||||
if($i==2 && $GSdata[$i] != ""){
|
||||
$modifiedData['lender_applicant_id'] = str_replace(" ", "", $GSdata[$i]);
|
||||
$pd_details['lender_applicant_id'] =str_replace(" ", "", $GSdata[$i]);
|
||||
$modifiedData['lender_applicant_id'] = trim(str_replace(" ", "", $GSdata[$i]));
|
||||
$pd_details['lender_applicant_id'] =trim(str_replace(" ", "", $GSdata[$i]));
|
||||
log_message('ERROR',"G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender_applicant_id']." PD :".$pd_details['lender_applicant_id']);
|
||||
}
|
||||
if($i==3 && $GSdata[$i] != ""){
|
||||
@ -192,17 +194,17 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
$stateAndPincode = end($NormalParts);
|
||||
$splitStateAndPincode = explode('-',$stateAndPincode , 2);
|
||||
$modifiedData['state'] = $splitStateAndPincode[0];
|
||||
$addresses['fk_state']=$this->Data_Dump_Model->getId(5,$splitStateAndPincode[0]);
|
||||
$pd_details['fk_state'] =$addresses['fk_state'];
|
||||
$modifiedData['pincode'] = $splitStateAndPincode[1];
|
||||
$pin = $this->Data_Dump_Model->getId(6,$splitStateAndPincode[1]);
|
||||
$addresses['fk_state']=$this->Data_Dump_Model->getId(5,trim($splitStateAndPincode[0]));
|
||||
$pd_details['fk_state'] =trim($addresses['fk_state']);
|
||||
$modifiedData['pincode'] = trim($splitStateAndPincode[1]);
|
||||
$pin = $this->Data_Dump_Model->getId(6,trim($splitStateAndPincode[1]));
|
||||
$addresses['pincode'] = ($pin != "" ? $pin : 1);
|
||||
$pd_details['pincode'] = $addresses['pincode'];
|
||||
$addresses['other_pincode']=($pin == "" ? $splitStateAndPincode[1] : null);
|
||||
$addresses['other_pincode']=($pin == "" ? trim($splitStateAndPincode[1]) : null);
|
||||
$pd_details['other_pincode'] = $addresses['other_pincode'];
|
||||
$city = array_slice($NormalParts, -2, 1);
|
||||
$modifiedData['city'] = $city[0];
|
||||
$addresses['fk_city']=$this->Data_Dump_Model->getId(7,$city[0]);
|
||||
$addresses['fk_city']=$this->Data_Dump_Model->getId(7,trim($city[0]));
|
||||
$pd_details['fk_city']=$addresses['fk_city'];
|
||||
array_splice($NormalParts, -2);//removing city state and pincode.
|
||||
// $reversedParts = explode('-', strrev($GSdata[$i]), 2);
|
||||
@ -219,7 +221,7 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
}
|
||||
if($i==6 && $GSdata[$i] != ""){
|
||||
$modifiedData['createdPerson'] = $GSdata[$i];
|
||||
$pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,$GSdata[$i]);
|
||||
$pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,trim($GSdata[$i]));
|
||||
log_message('ERROR',"G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata[$i]);
|
||||
// ." Modify : ".$modifiedData." PD :".$pd_details);
|
||||
}
|
||||
@ -257,13 +259,13 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
if(count($product)>1){
|
||||
$modifiedData['product'] = $product[0] ? $product[0] : null;
|
||||
$modifiedData['subproduct'] = $product[1] ? $product[1] : null ;
|
||||
$fk_product_id = $this->Data_Dump_Model->getId(2,$product[0]);
|
||||
$fk_product_id = $this->Data_Dump_Model->getId(2,trim($product[0]));
|
||||
$pd_details['fk_product_id'] = $fk_product_id;
|
||||
$pd_details['fk_subproduct_id'] = $this->Data_Dump_Model->getId(3,$product[1]);
|
||||
$pd_details['fk_subproduct_id'] = $this->Data_Dump_Model->getId(3,trim($product[1]));
|
||||
}
|
||||
else{
|
||||
$modifiedData['product'] = $product[0] ? $product[0] : null ;
|
||||
$fk_product_id = $this->Data_Dump_Model->getId(2,$product[0]);
|
||||
$fk_product_id = $this->Data_Dump_Model->getId(2,trim($product[0]));
|
||||
$pd_details['fk_product_id'] = $product[0] ? $fk_product_id : null ;
|
||||
}
|
||||
log_message('ERROR',"G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct) GSheet data : ".$GSdata[$i]);
|
||||
@ -275,7 +277,7 @@ class Data_Dump_Controller extends REST_Controller {
|
||||
if(count($type)>1){
|
||||
$pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ;
|
||||
$modifiedData['customerSegment'] = ($type[1] != "") ? $type[1] : null;
|
||||
$fk_customer_segment = $this->Data_Dump_Model->getId(4,$modifiedData['customerSegment']);
|
||||
$fk_customer_segment = $this->Data_Dump_Model->getId(4,trim($modifiedData['customerSegment']));
|
||||
$pd_details['fk_customer_segment'] = $fk_customer_segment;
|
||||
}else{
|
||||
$pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ;
|
||||
|
||||
@ -152,6 +152,14 @@ class Data_Dump_Model extends SPARQ_Model {
|
||||
return $id;
|
||||
}
|
||||
|
||||
public function getPDSerialNO($pd_id){
|
||||
$this->db->select('pd_sno');
|
||||
$this->db->from(PDTRIGGER);
|
||||
$this->db->where('pd_id',$pd_id);
|
||||
$row = $this->db->get()->row();
|
||||
$sno = (isset($row)) ? $row->pd_sno : "";
|
||||
return $sno;
|
||||
}
|
||||
// public function GsheetData($GSdata){
|
||||
// }
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user