From 9295bd6d5ad55d250f5a8f5a30cb94f1fb87906a Mon Sep 17 00:00:00 2001 From: velz Date: Thu, 4 Apr 2019 19:59:21 +0530 Subject: [PATCH] ADDTIONAL PD GENERAL FORM HANDLED --- api/application/config/customconfig_one.php | 2 +- api/application/controllers/PD_Controller.php | 101 ++++++++++++++---- 2 files changed, 80 insertions(+), 23 deletions(-) diff --git a/api/application/config/customconfig_one.php b/api/application/config/customconfig_one.php index ced548a0..75cd14fd 100644 --- a/api/application/config/customconfig_one.php +++ b/api/application/config/customconfig_one.php @@ -59,5 +59,5 @@ $config['master_tables_field_names'] = array('INDUSTRYCLASSIFICATION' => 'name', $config['master_tables_pkid'] = array('INDUSTRYCLASSIFICATION' => 'industry_classification_id','UOM' => 'uom_id','OCCUPATIONMEMBERS' => 'occupation_non_earning_member_id','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'type_of_activity_id','RELATIONSHIPS' => 'relationship_id','FREQUENCY' => 'frequency_id', 'CUSTOMERBEHAVIOUR' => 'customer_behaviour_id', 'CUSTOMERSEGMENT' => 'customer_segment_id','DESIGNATION' => 'designation_id', 'EARNINGMEMBERSSTATUS' => 'earning_member_status_id','EDUQUALIFICATION' => 'qualification_id','ADDRESSTYPE' => 'address_type_id','LOCALITY' => 'locality_id','ASSETTYPE' => 'id','PROPERTIES' => 'id','INVESTMENTTYPE' => 'id','INSURANCETYPE' => 'id','PERSONSMET' => 'person_met_id','RESIDENCEOWNERSHIP' => 'id','PAYMENTMODE' => 'id','ACCOUNTTYPE' => 'id','SOURCEOFOTHERINCOME' => 'id','MORTAGEPROPERTYTYPE' => 'id','ENDUSEOFLOAN' => 'enduse_of_loan_id','SOURCEOFBALANCETRANSFER' => 'id', 'STATUSOFCONSTRUCTION' => 'id','MORTAGEPROPERTIES' => 'mortage_property_id','BTLENDERLIST'=>'bt_lender_list_id','EXISTINGLOANTYPES'=>'existing_loan_type_id','PDAPPLICANTSDETAILS'=>'pd_co_applicant_id','RELATIONWITHBUSINESS'=>'relation_with_business_id','BUSINESSENTITYTYPE'=>'business_entity_type_id','COMPANYRELATIONSHIPS'=>'company_relationship_id','STATE'=>'state_id','CITY'=>'city_id','COUNTRY'=>'country_id','BOUNCEMASTER'=>'bounce_id','BUSINESSEXPENSES'=>'expense_item_id','BUSINESSINCOME'=>'business_income_id','COMMENTSONLOCALITY'=>'comments_on_locality_id','COMPANY'=>'name','LOCALITY'=>'locality_id','NONINDIVIDUALENTITIES'=>'non_individual_entity_id','PDFORMS'=>'form_id','PDLOCATIONAPPROACH'=>'pd_location_approach_id','PDTYPE'=>'pd_type_id','PDNOTIFICATION'=>'pdnotification_id','QUESTIONCATEGORY'=>'question_category_id','ROLES'=>'role_id','SUBPRODUCTS'=>'subproduct_id','TITLES'=>'title_id','PINCODE'=>'pincode_id','PRODUCTS'=>'product_id','ENTITYTYPE'=>'entity_type_id','PDTEAM'=>'pdteam_id','ENTITY'=>'entity_id','PDSTATUS'=>'pd_status_id','LISTOFMASTERS'=>'master_id','OTPREJECTION'=>'otp_rejection_id','ENDUSEOFTOPUP'=>'end_use_of_topup_id','VEHICLETYPE'=>'vehicle_type_id','PDOFFICERRECOMMENDATIONS'=>'pdofficer_recommendation_id','REGIONS'=>'region_id','PRICINGINFO'=>'pricing_info_id'); -$config['parent_forms'] = array(0,18,10,7,4,6,8,9,20,5);// 0 added for dummy +$config['parent_forms'] = array(0,10,7,4,6,8,9,20,5);// 0 added for dummy ?> \ No newline at end of file diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 579b9544..42821c68 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -2312,33 +2312,90 @@ class PD_Controller extends REST_Controller { $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) + { + + $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)) + { + $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); + + if(count($rec)) + { + $temp_json = $this->renewGeneralFormForAddtionalPD($rec[0]['json']); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $temp_json; + $this->response($data,REST_Controller::HTTP_OK); + } + + } + } - $fields = array('json','processed_json'); - $where_condition_array = array('isactive' => 1,'fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id); - if($company_id != null) - { - $where_condition_array = array('fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id,'company_id' => $company_id,'isactive' => 1); - } - $rec = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON); + $fields = array('json','processed_json'); + $where_condition_array = array('isactive' => 1,'fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id); + + if($company_id != null) + { + $where_condition_array = array('fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id,'company_id' => $company_id,'isactive' => 1); + } + $rec = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON); + + if(count($rec)) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = json_decode($rec[0]['json']); + //$data['records'] = json_decode($rec[0]['processed_json']); + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'No Data Available'; + $this->response($data,REST_Controller::HTTP_OK); + } - if(count($rec)) - { - $data['dataStatus'] = true; - $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = json_decode($rec[0]['json']); - //$data['records'] = json_decode($rec[0]['processed_json']); - $this->response($data,REST_Controller::HTTP_OK); - } - else - { - $data['dataStatus'] = false; - $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $data['msg'] = 'No Data Available'; - $this->response($data,REST_Controller::HTTP_OK); - } } + + public function renewGeneralFormForAddtionalPD($json) + { + //echo 'renewGeneralFormForAddtionalPD'; + $json = json_decode($json,true); + if(array_key_exists('individuals',$json)) + { + foreach($json['individuals'] as $individual_key => $individual) + { + $json['individuals'][$individual_key]['is_person_met'] = false; + } + } + + if(array_key_exists('companies',$json)) + { + foreach($json['companies'] as $company_key => $compnay) + { + $json['companies'][$company_key]['is_company_applicant'] = false; + $json['companies'][$company_key]['business_entity_type'] = null; + $json['companies'][$company_key]['business_years'] = ""; + $json['companies'][$company_key]['business_month'] = ""; + $json['companies'][$company_key]['business_date_object'] = ""; + $json['companies'][$company_key]['business_date_object'] = ""; + } + } + unset($json['company_with_relationships']); + $json['general_remark'] = ""; + + return (($json)); + + } public function downloadExcel_get() {