diff --git a/api/application/config/routes.php b/api/application/config/routes.php index a47cf8af..ecb4c445 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -197,6 +197,7 @@ $route['savePDPhotos'] = 'PD_Controller/savePDPhotos'; $route['getPDAddress'] = 'PD_Controller/getPDAddress'; $route['updatePDAddress'] = 'PD_Controller/updatePDAddress'; $route['getPDCompleteDetails'] = 'PD_Controller/getPDCompleteDetails'; +$route['getStateCityNamesAndPincode'] = 'PD_Controller/getStateCityNamesAndPincode'; // $route['savePDFormDetailsJSON'] = 'PD_Controller/savePDFormDetailsJSON'; // $route['getPDFormDetailsJSON'] = 'PD_Controller/getPDFormDetailsJSON'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index e763b455..59dd123b 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -239,6 +239,31 @@ class PD_Controller extends REST_Controller { } + //For RI form list display + public function getStateCityNamesAndPincode_post() + { + $records = $this->post('records'); + + //get state name + $fields = array('name as state_name'); + $where_condition_array = array('isactive' => 1,'state_id' => $records['state_id']); + $state = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,STATE); + + //get city name + $fields = array('name as city_name'); + $where_condition_array = array('isactive' => 1,'city_id' => $records['city_id']); + $city = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,CITY); + + //get pincode + $fields = array('pincode'); + $where_condition_array = array('isactive' => 1,'pincode_id' => $records['pincode_id']); + $pincode = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PINCODE); + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = array('state_name' => $state[0]['state_name'],'city_name' => $city[0]['city_name'],'pincode' => $pincode[0]['pincode']); + $this->response($data,REST_Controller::HTTP_OK); + } /********************Get get List Of States and Cities Name only for Business form *********/ public function getListOfStatesCities_post() @@ -545,9 +570,11 @@ class PD_Controller extends REST_Controller { } } + + $temp_address_id = null; if(count($addresses)) { - $temp_address_id = 0; + foreach($addresses as $address_key => $address) { $address['fk_pd_id'] = $pd_id; @@ -559,8 +586,13 @@ class PD_Controller extends REST_Controller { $temp_address_id = $address_id; } } - - $temp = array('parent_pd_id' => $pd_id); + + } + + + + //update parent pd id for same pd itself after PK generated + $temp = array('parent_pd_id' => $pd_id); if(count($addresses) == 1) { $temp['fk_primary_address_id'] = $temp_address_id; @@ -568,9 +600,6 @@ class PD_Controller extends REST_Controller { } $where_condition_array = array('pd_id' => $pd_id); $this->PD_Model->updateRecords($temp,PDTRIGGER,$where_condition_array); - - - } if(count($company)) { @@ -695,6 +724,7 @@ class PD_Controller extends REST_Controller { } if(isset($pd_details['pd_status']) && $pd_details['pd_status'] == STARTED) { + $pd_details['start_location'] = $pd_details['link']; unset($pd_details['link']); $string2 = str_shuffle('1234567890'); @@ -714,7 +744,7 @@ class PD_Controller extends REST_Controller { if(isset($pd_details['pd_status']) && $pd_details['pd_status'] == COMPLETED) { - //echo "completed"; + if(array_key_exists('link',$pd_details)) { $pd_details['complete_location'] = $pd_details['link']; @@ -752,6 +782,7 @@ class PD_Controller extends REST_Controller { if(isset($pd_details['pd_status']) && ($pd_details['pd_status'] == TRIGGERED || $pd_details['pd_status'] == INITIATED)) { + /***********************CHOOSE PD TEMPALATE*********************/ $pd_details['fk_pd_template_id'] = $this->assignPDTempalate($pd_details['pd_id']); @@ -780,9 +811,12 @@ class PD_Controller extends REST_Controller { // { // $pd_details['parent_pd_id'] = isset($pd_details['parent_pd_id']) ? $pd_details['parent_pd_id'] : null; // } - if( $exist_pd_details[0]['is_child'] == 0 && ($exist_pd_details[0]['parent_pd_id'] == null || $exist_pd_details[0]['parent_pd_id'] == 0)) + if( $exist_pd_details[0]['is_child'] == 0) { - $pd_details['parent_pd_id'] = $pd_details['pd_id']; + if(($pd_details['parent_pd_id'] == null || $pd_details['parent_pd_id'] == "")) + { + $pd_details['parent_pd_id'] = $exist_pd_details[0]['pd_id'] != "" || $exist_pd_details[0]['pd_id'] != null ? $exist_pd_details[0]['pd_id'] : $pd_details['pd_id']; + } } @@ -828,11 +862,11 @@ class PD_Controller extends REST_Controller { { //GET PArent PD Details $parent_pd_details = $this->PD_Model->getPDMasterDetails($pd_details['parent_pd_id']); - //echo date_format(date_create($parent_pd_details[0]['pd_date_of_initiation']),'Y-m-d');die(); + if(count($parent_pd_details)) { $newpd['fk_lender_id'] = $parent_pd_details[0]['fk_lender_id']; - $newpd['pd_date_of_initiation'] = date_format(date_create($parent_pd_details[0]['pd_date_of_initiation']),'Y-d-m'); + $newpd['pd_date_of_initiation'] = $parent_pd_details[0]['pd_date_of_initiation_sqlformat']; $newpd['fk_entity_billing_id'] = $parent_pd_details[0]['fk_entity_billing_id']; $newpd['lender_applicant_id'] = $parent_pd_details[0]['lender_applicant_id']; $newpd['fk_product_id'] = $parent_pd_details[0]['fk_product_id']; @@ -850,7 +884,7 @@ class PD_Controller extends REST_Controller { //$newpd['scheduled_on'] = $pd_details['scheduled_on'] ? $pd_details['scheduled_on'] : null; $newpd['fk_pd_template_id'] = $this->assignPDTempalate(array('lender' => $newpd['fk_lender_id'],'product' => $newpd['fk_product_id'],'customer_segment' => $newpd['fk_customer_segment'])); - + //print_r($newpd);die(); $pd_id = $this->PD_Model->saveRecords($newpd,PDTRIGGER); if($pd_id != "" || $pd_id != null) @@ -2178,6 +2212,7 @@ class PD_Controller extends REST_Controller { $createdby = $records['fk_createdby']; $company_id = null; $processed_json = null; + $rental_count_id = isset($records['rental_count_id']) ? $records['rental_count_id'] : null; //print_r($records);die(); $parent_pdid = $records['parent_pdid'];; $parent_form_index = null; @@ -2226,6 +2261,12 @@ class PD_Controller extends REST_Controller { { $where_condition_array = array('fk_form_id'=>$formid,'fk_pd_id'=>$pdid,'company_id' => $company_id); } + + if($rental_count_id != null) + { + $where_condition_array['rental_count_id'] = $rental_count_id; + } + $id = $this->PD_Model->updateRecords($fields,PDFORMDETAILSJSON,$where_condition_array); @@ -2318,6 +2359,7 @@ class PD_Controller extends REST_Controller { unset($records['fk_createdby']); unset($records['company_id']); unset($records['parent_pdid']); + unset($records['rental_count_id']); $records = json_encode($records); if($processed_json != null) { @@ -2325,9 +2367,8 @@ class PD_Controller extends REST_Controller { } - $temp_array = array('fk_form_id'=>$formid,'company_id' => $company_id,'fk_pd_id'=>$pdid,'fk_createdby'=>$createdby,'json'=>$records,'processed_json' => $processed_json); - //print_r($temp_array); - // die(); + $temp_array = array('fk_form_id'=>$formid,'company_id' => $company_id,'fk_pd_id'=>$pdid,'fk_createdby'=>$createdby,'json'=>$records,'processed_json' => $processed_json,'rental_count_id' => $rental_count_id); + $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILSJSON); if($id != "" || $id != null) { @@ -2358,9 +2399,9 @@ class PD_Controller extends REST_Controller { if($pd_id != $parent_pd_id) { - $parent_form_index = array_search($pd_form_id,$parent_forms); $pd_id = $parent_form_index != null ? $parent_pd_id : $pd_id; + } //echo $pd_id; if($pd_form_id == 18) @@ -2369,8 +2410,10 @@ class PD_Controller extends REST_Controller { $fields = array('*'); $where_condition_array = array('fk_pd_id' => $pd_id,'fk_form_id' =>$pd_form_id , 'isactive' => 1); $form_count = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON); - if(!count($form_count)) + //print_r($form_count); + if(count($form_count)) { + //echo "dsjsbsdj"; $fields = array('json','processed_json'); $where_condition_array = array('isactive' => 1,'fk_form_id'=>$pd_form_id,'fk_pd_id'=>$parent_pd_id); $rec = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON); @@ -2387,13 +2430,16 @@ class PD_Controller extends REST_Controller { } } - if($pd_form_id == 5)//address form + if($pd_form_id == 5 )//address form && ($parent_pd_id != $pd_id) { + $fields = array('*'); $where_condition_array = array('fk_pd_id' => $pd_id,'fk_form_id' =>$pd_form_id , 'isactive' => 1); $form_count = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON); + if(count($form_count)) { + $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; $data['records'] = json_decode($form_count[0]['json']); @@ -2401,7 +2447,7 @@ class PD_Controller extends REST_Controller { } else { - //get address details from address form + //echo "get address details from address form"; $fields = array('*'); $where_condition_array = array('assigned_pd' => $pd_id); $assigned_address = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDADDRESS); @@ -2411,9 +2457,9 @@ class PD_Controller extends REST_Controller { //print_r($temp_address); //construct address form jsn format here $address = array(); - $address[] = array('address' => $temp_address['addressline1'],'address_type' => '','address_type_others' => '','state'=>$temp_address['fk_state'],'city'=>$temp_address['fk_city'],'citySearch' =>'','stateSearch'=>'','citySearch'=>'','pinSearch' => '','pincode'=>$temp_address['pincode'],'pincode_others' => '','locality' => '','locality_others'=>'','pd_location' => '','comment_locality' => '','estimated_area' => '','uom' => '','uom_others'=>''); + $address[] = array('address' => $temp_address['addressline1'],'address_type' => 1,'address_type_others' => '','state'=>$temp_address['fk_state'],'city'=>$temp_address['fk_city'],'citySearch' =>'','stateSearch'=>'','citySearch'=>'','pinSearch' => '','pincode'=>$temp_address['pincode'],'pincode_others' => '','locality' => '','locality_others'=>'','pd_location' => '','comment_locality' => '','estimated_area' => '','uom' => '','uom_others'=>''); - $records['addressess'] = $address; + $records['addresses'] = $address; $records['address_form_remark'] = 'From COnd'; $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; @@ -2436,10 +2482,21 @@ class PD_Controller extends REST_Controller { if(count($rec)) { + $json = null; + if($pd_form_id == 17) + { + foreach($rec as $r) + { + $json[] = json_decode($r['json'],true); + } + } + else + { + $json = json_decode($rec[0]['json']); + } $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = json_decode($rec[0]['json']); - //$data['records'] = json_decode($rec[0]['processed_json']); + $data['records'] = $json; $this->response($data,REST_Controller::HTTP_OK); } else @@ -4818,7 +4875,7 @@ class PD_Controller extends REST_Controller { else { $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid); - + if($pd_master_details[0]['fk_subproduct_id'] != "" || $pd_master_details[0]['fk_subproduct_id'] != null) { diff --git a/api/application/helpers/jwt_helper.php b/api/application/helpers/jwt_helper.php index a954c30f..846794ca 100644 --- a/api/application/helpers/jwt_helper.php +++ b/api/application/helpers/jwt_helper.php @@ -79,6 +79,10 @@ class JWT throw new UnexpectedValueException('Signature verification failed'); } } + + // echo "jwt token"; + // print_r($bodyb64); + // die(); return $payload; } diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 6a1aa184..77c67f8e 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -217,7 +217,7 @@ class PD_Model extends SPARQ_Model { /* *Get All PD Related Documents as signed and expired URL's from S3 Buckets */ - public function getSignedPDDocsURL($pdid,$form_id = null,$company_id) + public function getSignedPDDocsURL($pdid,$form_id = null,$company_id = null) { //echo $pdid,$form_id,$company_id;die(); $document_lists = array(); @@ -276,6 +276,7 @@ class PD_Model extends SPARQ_Model { //Get all AddtionalPD's ID $addtional_pd_ids = $this->getAddtionalPDIDs($parent_pd_id); + print_r($addtional_pd_ids); $addtional_pd_ids_string = array(); if(count($addtional_pd_ids)) { @@ -741,7 +742,7 @@ class PD_Model extends SPARQ_Model { */ public function getPDMasterDetails($pdid) { - $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id'); + $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation,PDTRIGGER.pd_date_of_initiation as pd_date_of_initiation_sqlformat, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done,PDTRIGGER.encrypted_url,PDTRIGGER.is_child,PDTRIGGER.parent_pd_id,PDTRIGGER.fk_primary_address_id,PDTRIGGER.fk_address_id'); $this->db->FROM(PDTRIGGER.' as PDTRIGGER'); $this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id ','LEFT'); $this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT'); diff --git a/api/index.php b/api/index.php index c9e55e88..e0af6393 100644 --- a/api/index.php +++ b/api/index.php @@ -77,7 +77,7 @@ switch (ENVIRONMENT) case 'testing': error_reporting(-1); - ini_set('display_errors', 1); + ini_set('display_errors', 0); break; case 'production': ini_set('display_errors', 0);