diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index 5757df71..bb089022 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -86,14 +86,14 @@ class Data_Dump_Controller extends REST_Controller { public function googleSheet_post(){ // $logger = MYLOG::logFunction(null,"Gsheet"); - log_message("G-Sheet Fns Entered"); + log_message("info","G-Sheet Fns Entered"); $sheetData = $this->post(); if(count($sheetData) > 0){ $pd_id = $this->modificationGsheetData($sheetData); if($pd_id != null || $pd_id != '') { - log_message("G-Sheet For PD ID : ".$pd_id,array('ENV'=>ENVIRONMENT)); + log_message("info","G-Sheet For PD ID : ".$pd_id); // PDALERTS::pdnotification($pd_id); $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; @@ -103,14 +103,14 @@ class Data_Dump_Controller extends REST_Controller { } else { - log_message("G-Sheet SomeThing went Wrong mistake on Gsheet-data PDID not Founded"); + log_message("info","G-Sheet SomeThing went Wrong mistake on Gsheet-data PDID not Founded"); $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['msg'] = "Some thing went wrong"; $this->response($data,REST_Controller::HTTP_OK); } }else{ - log_message("G-Sheet Data Not Founded"); + log_message("info","G-Sheet Data Not Founded"); $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; $data['msg'] = "Some thing went wrong !"; @@ -133,9 +133,9 @@ class Data_Dump_Controller extends REST_Controller { } - public function modificationGsheetData($GSdata){ + public function modificationGsheetData($GSdata){ // $logger = MYLOG::logFunction(null,"Gsheet"); - log_message("G-Sheet For PD Step 1 (G-sheet Data)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata)); + log_message("info","G-Sheet For PD Step 1 (G-sheet Data)"); $modifiedData = array(); $pd_details = array(); $pd_applicant_details = array(); @@ -147,18 +147,18 @@ class Data_Dump_Controller extends REST_Controller { // addresses // [{"addressline1":"Third Floor Right Side Bal K 83-84 Udyan Road Uttam Nagar New Delhi","fk_city":"869","fk_state":"5","pincode":"27491","other_pincode":null}] for($i=0;$iENVIRONMENT,'MSG' => "INSIDE for Loop")); + log_message("G-Sheet For PD Step 2 (Processing data for-loop)"); if($i==1 && $GSdata[$i] != ""){ $modifiedData['lender'] = $GSdata[$i]; $fk_lender_id = $this->Data_Dump_Model->getId(1,$GSdata[$i]); $pd_details['fk_lender_id']=$fk_lender_id; $pd_details['sub_entity_id']=$fk_lender_id; - log_message("G-Sheet For PD Step 2.1 (First Cell lender/casebookedin)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['lender'],'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.1 (First Cell lender/casebookedin) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender']." PD :".$pd_details['fk_lender_id']." ".$pd_details['sub_entity_id']); } if($i==2 && $GSdata[$i] != ""){ $modifiedData['lender_applicant_id'] = str_replace(" ", "", $GSdata[$i]); $pd_details['lender_applicant_id'] =str_replace(" ", "", $GSdata[$i]); - log_message("G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.2 (Second Cell - loan applicantid)GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['lender_applicant_id']." PD :".$pd_details['lender_applicant_id']); } if($i==3 && $GSdata[$i] != ""){ $applicatantParts = explode(',',$GSdata[$i]); @@ -180,10 +180,12 @@ class Data_Dump_Controller extends REST_Controller { $modifiedData['pd_applicant_details'][0]['mobile_no'] = $GSdata[4] ? $GSdata[4] : null; $pd_applicant_details[0]['applicant_type'] = 1; $modifiedData['pd_applicant_details'][0]['applicant_type'] = 1; - log_message("G-Sheet For PD Step 2.3 (Third Cell applicantdetails)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'Applicants'=>$pd_applicant_details)); + log_message("G-Sheet For PD Step 2.3 (Third Cell applicantdetails) GSheet data : ".$GSdata[$i]); + //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==4 && $GSdata[$i] != ""){ $modifiedData['mobileNumber'] = $GSdata[$i]; - log_message("G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['mobileNumber']));} + log_message("G-Sheet For PD Step 2.4 (Fourth Cell mobilenumber) GSheet data : ".$GSdata[$i]); + //." Modify : ".$modifiedData." PD :".$pd_details);} if($i==5 && $GSdata[$i] != ""){//address section. $NormalParts = explode(',', $GSdata[$i]); $stateAndPincode = end($NormalParts); @@ -211,12 +213,14 @@ class Data_Dump_Controller extends REST_Controller { $pd_details['addressline1']=$addresses['addressline1']; // echo "Original Address : ".$GSdata[$i]; // echo "Modified Address : ".$address; - log_message("G-Sheet For PD Step 2.5 (Fifth Cell address)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['mobileNumber'],'PDDetails'=>$pd_details,'Address'=>$addresses)); + log_message("G-Sheet For PD Step 2.5 (Fifth Cell address) GSheet data : ".$GSdata[$i]); + //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==6 && $GSdata[$i] != ""){ $modifiedData['createdPerson'] = $GSdata[$i]; $pd_details['fk_createdby'] = $this->Data_Dump_Model->getId(8,$GSdata[$i]); - log_message("G-Sheet For PD Step 2.6 (Sixth Cell createdPerson)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['createdPerson'],'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.6 (Sixth Cell createdPerson) GSheet data : ".$GSdata[$i]); + // ." Modify : ".$modifiedData." PD :".$pd_details); } if($i==7 && ($GSdata[$i] != "" || $GSdata[$i] != 0)){ $amount = strtolower($GSdata[$i]); @@ -244,7 +248,7 @@ class Data_Dump_Controller extends REST_Controller { }} $modifiedData['loanAmount'] = implode("",$amount); $pd_details['loan_amount'] = implode("",$amount); - log_message("G-Sheet For PD Step 2.7 (Seventh Cell Amount)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['loanAmount'],'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.7 (Seventh Cell Amount) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['loanAmount']." PD :".$pd_details['loan_amount']); } if($i==8 && $GSdata[$i] != ""){ $product = explode('/', $GSdata[$i]); @@ -261,7 +265,8 @@ class Data_Dump_Controller extends REST_Controller { $fk_product_id = $this->Data_Dump_Model->getId(2,$product[0]); $pd_details['fk_product_id'] = $product[0] ? $fk_product_id : null ; } - log_message("G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.8 (eighth Cell Product/SubProduct) GSheet data : ".$GSdata[$i]); + //." Modify : ".$modifiedData." PD :".$pd_details); } if($i==9 && $GSdata[$i] != ""){ $type = explode('/', $GSdata[$i]); @@ -274,19 +279,19 @@ class Data_Dump_Controller extends REST_Controller { }else{ $pd_details['fk_pd_type'] = $modifiedData['type'] == "FULLPD" ? 1 : ($modifiedData['type'] == "SMARTPD" ? 2 :($modifiedData['type'] == "TELEPD" ? 3 : 0) ) ; } - log_message("G-Sheet For PD Step 2.9 (ninth Cell type/cs)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData,'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.9 (ninth Cell type/cs) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['type']." PD :".$pd_details['fk_pd_type']); } if($i==10 && $GSdata[$i] != ""){ // $modifiedData['date'] = $GSdata[$i]; $new_date_format = date('Y-m-d H:i:s', strtotime($GSdata[$i])); $modifiedData['date'] = $new_date_format; $pd_details['pd_date_of_initiation'] = $new_date_format; - log_message("G-Sheet For PD Step 2.10 (tenth Cell initiationdate)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$modifiedData['date'],'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.10 (tenth Cell initiationdate) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['date']." PD :".$pd_details['pd_date_of_initiation']); } if($i==11 && $GSdata[$i] != ""){ $modifiedData['remarks'] = $GSdata[$i]; $pd_details['remarks'] = $GSdata[$i]; - log_message("G-Sheet For PD Step 2.11 (eleventh Cell Remarks)",array('ENV'=>ENVIRONMENT,'DATA' => $GSdata[$i],'ModifiedData'=>$GSdata[$i],'PDDetails'=>$pd_details)); + log_message("G-Sheet For PD Step 2.11 (eleventh Cell Remarks) GSheet data : ".$GSdata[$i]." Modify : ".$modifiedData['remarks']." PD :".$pd_details['remarks']); } } @@ -331,15 +336,16 @@ class Data_Dump_Controller extends REST_Controller { } $pd_details['random_string'] = $randomString; $pd_details['is_notify_enabled'] = 1; - log_message("G-Sheet For PD Step 3 (Before Inserting Trigger)",array('ENV'=>ENVIRONMENT,'DATA' => $pd_details)); + log_message("G-Sheet For PD Step 3 (Before Inserting Trigger)"); + // PDdetails :".$pd_details); try { $pd_id = $this->Data_Dump_Model->saveRecords($pd_details,PDTRIGGER); - log_message("G-Sheet For PD Step 4 (PDID gotten)",array('ENV'=>ENVIRONMENT,'PDID' => $pd_id)); + log_message("G-Sheet For PD Step 4 (PDID gotten) PDID : ".$pd_id); if(empty($pd_id)) { throw new Exception('Error On Inserting TRIGGER details'); } } catch (Exception $e) { - log_message("G-Sheet For PD Step 4 (PDID gotten)",array('ENV'=>ENVIRONMENT,'ERR' => $e->getMessage())); + log_message("G-Sheet For PD Step 4 (PDID gotten) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } // $pd_id = 3073; @@ -349,7 +355,8 @@ class Data_Dump_Controller extends REST_Controller { { if($pd_applicant_details != "" || $pd_applicant_details != null) { - log_message("G-Sheet For PD Step 5 (applicant)",array('ENV'=>ENVIRONMENT,'Applicant' => $pd_applicant_details)); + log_message("G-Sheet For PD Step 5 (applicant)"); + // Applicant : ".$pd_applicant_details); foreach($pd_applicant_details as $pd_applicant_detail) { $pd_applicant_detail['fk_pd_id'] = $pd_id; @@ -357,13 +364,13 @@ class Data_Dump_Controller extends REST_Controller { if($pd_applicant_detail['company_name']){ $pd_applicant_detail['company_name'] = trim(MYUTIL::applicantNameCamelCaseConvertion($pd_applicant_detail['company_name'])); } try { $co_applicant_id = $this->Data_Dump_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS); - log_message("G-Sheet For PD Step 5.1 (applicant pkid)",array('ENV'=>ENVIRONMENT,'Applicant-ID' => $co_applicant_id)); + log_message("G-Sheet For PD Step 5.1 (applicant pkid) Applicant-ID : ".$co_applicant_id); if(empty($co_applicant_id)) { throw new Exception('Error On Inserting Applicant details'); } } catch (Exception $e) { //alert the user. - log_message("G-Sheet For PD Step 5.1 (applicant pkid)",array('ENV'=>ENVIRONMENT,'ERR' => $e->getMessage())); + log_message("G-Sheet For PD Step 5.1 (applicant pkid) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } @@ -379,29 +386,29 @@ class Data_Dump_Controller extends REST_Controller { $addresses['assigned_pd'] = $pd_id; try { $address_id = $this->Data_Dump_Model->saveRecords($addresses,PDADDRESS); - log_message("G-Sheet For PD Step 6 (Addresses)",array('ENV'=>ENVIRONMENT,'addresses' => $addresses,"addressId"=>$address_id)); + log_message("G-Sheet For PD Step 6 (Addresses) addressId : ".$address_id); if(empty($address_id)) { throw new Exception('Error On Inserting Adresses details'); } } catch (Exception $e) { - log_message("G-Sheet For PD Step 6 (Addresses)",array('ENV'=>ENVIRONMENT,'ERR'=>$e->getMessage())); + log_message("G-Sheet For PD Step 6 (Addresses) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } $triggertbl_records = array('fk_primary_address_id'=>$address_id,'fk_address_id'=>$address_id); try { $this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)); - log_message("G-Sheet For PD Step 7 (updateAddresses in trigger)",array('ENV'=>ENVIRONMENT)); + log_message("G-Sheet For PD Step 7 (updateAddresses in trigger)"); if(empty($this->Data_Dump_Model->updateRecords($triggertbl_records,PDTRIGGER,array('pd_id' => $pd_id)))) { throw new Exception('Error On updated Adresses Details in trigger table'); } } catch (Exception $e) { //alert the user. - log_message("G-Sheet For PD Step 7 (updateAddresses in trigger)",array('ENV'=>ENVIRONMENT,'ERR'=>$e->getMessage())); + log_message("G-Sheet For PD Step 7 (updateAddresses in trigger) ERR : ".$e->getMessage()); var_dump($e->getMessage()); } } - + } // print_r($pd_details); // print_r($modifiedData); // print_r($addresses); @@ -409,4 +416,4 @@ class Data_Dump_Controller extends REST_Controller { // die(); return $pd_id; } -} \ No newline at end of file + }