ENTITY BRANCH CHNAGED

This commit is contained in:
velz 2018-12-14 13:10:54 +05:30
parent 1b4632f991
commit 1f2576e4f5
2 changed files with 27 additions and 3 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ api/application/syslogs/*
!api/application/logs/.htaccess
!api/application/syslogs/index.html
!api/application/syslogs/.htaccess
!api/application/docs/*

View File

@ -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