From 1f2576e4f53c106abe936402ccd60494da2511e0 Mon Sep 17 00:00:00 2001 From: velz Date: Fri, 14 Dec 2018 13:10:54 +0530 Subject: [PATCH] ENTITY BRANCH CHNAGED --- .gitignore | 1 + .../Entity_Management_Controller.php | 29 +++++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index dcc6cf87..5665749f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ api/application/syslogs/* !api/application/logs/.htaccess !api/application/syslogs/index.html !api/application/syslogs/.htaccess +!api/application/docs/* diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index d01af460..df47e886 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -565,15 +565,38 @@ class Entity_Management_Controller extends REST_Controller { { $entity_id = $this->get('entityid'); - $fields = array('entity_lender_branch_id', 'branch_name'); + //Get Mapped Cities + $fields = array('fk_city_id', 'branch_name','isactive','fk_createdby','fk_entity_id','fk_updatedby','fk_city_id'); $where_condition_array = array('fk_entity_id' => $entity_id,'isactive'=>1); $records = $this->Entity_Management_Model->selectCustomRecords($fields,$where_condition_array,ENTITYLENDERBRANCH); - if(count($records)) + $columns = array('ENTITYREGION.fk_city_id','CITY.name'); + $table = ENTITYREGION.' as ENTITYREGION'; + $joins = array(array('table' => CITY. ' as CITY', + 'condition' =>'ENTITYREGION.fk_city_id = CITY.city_id', + 'jointype' => 'INNER')); + $where_condition_array = array('ENTITYREGION.isactive' => 1,'ENTITYREGION.fk_entity_id' => $entity_id); + $entity_city_details = $this->Entity_Management_Model->getJoinRecords($columns,$table,$joins,$where_condition_array); + //print_r($entity_city_details); + + if(count($entity_city_details)) + { + foreach($entity_city_details as $key => $value) + { + $fields = array('entity_lender_branch_id', 'branch_name','isactive','fk_createdby','fk_entity_id','fk_updatedby','fk_city_id'); + $where_condition_array = array('fk_entity_id' => $entity_id,'isactive'=>1,'fk_city_id' => $value['fk_city_id']); + $records = $this->Entity_Management_Model->selectCustomRecords($fields,$where_condition_array,ENTITYLENDERBRANCH); + $entity_city_details[$key]['branch_details'] = $records; + } + } + + + + if(count($entity_city_details)) { $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = $records; + $data['records'] = $entity_city_details; $this->response($data,REST_Controller::HTTP_OK); } else