user management changes

This commit is contained in:
venbaSriram 2018-09-20 11:03:35 +05:30
parent 89b120f3af
commit b176c040b9
2 changed files with 12 additions and 28 deletions

View File

@ -53,15 +53,15 @@ class User_Management_Controller extends REST_Controller {
//print_r($this->post('roles'));die; //print_r($this->post('roles'));die;
if($this->post('roles')){ $roles = $this->post('roles'); } if($this->post('roles')){ $roles = $this->post('roles'); }
if($this->post('lender_hierarchy')){ $lender_hierarchy = $this->post('lender_hierarchy'); } if($this->post('lender_hierarchy')){ $lender_hierarchy = json_decode($this->post('lender_hierarchy'),true); }
$records = json_decode($this->post('records'),true); $records = json_decode($this->post('records'),true);
//print_r($records);die; //print_r($records);die;
$roles = json_decode($this->post('roles'),true); $roles = json_decode($this->post('roles'),true);
//print_r(json_decode($this->post('lender_hierarchy'),true));die;
$lender_hierarchy = json_decode($this->post('lender_hierarchy'),true); //$lender_hierarchy = json_decode($this->post('lender_hierarchy'),true);
//echo $_FILES['profilepic']['name'];die; //echo $_FILES['profilepic']['name'];die;
if(!empty($_FILES['profilepic']['tmp_name'])) if(!empty($_FILES['profilepic']['tmp_name']))
{ {
@ -121,12 +121,14 @@ class User_Management_Controller extends REST_Controller {
$this->User_Management_Model->saveRecords($role_array,USERPROFILEROLES); $this->User_Management_Model->saveRecords($role_array,USERPROFILEROLES);
} }
} }
//$user_id = 52;
if($lender_hierarchy != "") if($lender_hierarchy != "")
{ {
//print_r($lender_hierarchy);die;
foreach($lender_hierarchy as $hierarchy) foreach($lender_hierarchy as $hierarchy)
{ { //echo $hierarchy['lender_hierarchy_id'];die;
$hierarchy = array('fk_hierarchy_id'=>$hierarchy['fk_hierarchy_id'],'fk_user_id'=>$user_id,'fk_createdby'=>$records['fk_createdby'],'createdon'=>$records['createdon']);//insert hierarchy againest lender type users $hierarchy = array('fk_hierarchy_id'=>$hierarchy['lender_hierarchy_id'],'fk_user_id'=>$user_id);//insert hierarchy againest lender type users
$this->User_Management_Model->saveRecords($hierarchy,USERPROFILEHIERARCHY); $this->User_Management_Model->saveRecords($hierarchy,USERPROFILEHIERARCHY);
} }
} }
@ -145,15 +147,6 @@ class User_Management_Controller extends REST_Controller {
$this->response($data,REST_Controller::HTTP_NOT_MODIFIED); $this->response($data,REST_Controller::HTTP_NOT_MODIFIED);
} }
} }
@ -164,13 +157,13 @@ class User_Management_Controller extends REST_Controller {
if($this->post('roles')){ $roles = $this->post('roles'); } if($this->post('roles')){ $roles = $this->post('roles'); }
if($this->post('lender_hierarchy')){ $lender_hierarchy = $this->post('lender_hierarchy'); } if($this->post('lender_hierarchy')){ $lender_hierarchy = json_decode($this->post('lender_hierarchy'),true); }
$records = json_decode($this->post('records'),true); $records = json_decode($this->post('records'),true);
$roles = json_decode($this->post('roles'),true); $roles = json_decode($this->post('roles'),true);
$lender_hierarchy = json_decode($this->post('lender_hierarchy'),true); // $lender_hierarchy = json_decode($this->post('lender_hierarchy'),true);
if(!empty($_FILES['profilepic']['tmp_name'])) if(!empty($_FILES['profilepic']['tmp_name']))
{ {
@ -238,8 +231,8 @@ class User_Management_Controller extends REST_Controller {
foreach($lender_hierarchy as $hierarchy) foreach($lender_hierarchy as $hierarchy)
{ {
$this->User_Management_Model->updateRecords(array('isactive'=>0),USERPROFILEHIERARCHY,array('userid'=>$records['userid'])); $this->User_Management_Model->updateRecords(array('isactive'=>0),USERPROFILEHIERARCHY,array('fk_user_id'=>$records['userid']));
$hierarchy = array('fk_hierarchy_id'=>$hierarchy['fk_hierarchy_id'],'fk_user_id'=>$user_id);//insert hierarchy againest lender type users $hierarchy = array('fk_hierarchy_id'=>$hierarchy['lender_hierarchy_id'],'fk_user_id'=>$records['userid']);//insert hierarchy againest lender type users
$this->User_Management_Model->saveRecords($hierarchy,USERPROFILEHIERARCHY); $this->User_Management_Model->saveRecords($hierarchy,USERPROFILEHIERARCHY);
} }
} }
@ -258,15 +251,6 @@ class User_Management_Controller extends REST_Controller {
$this->response($data,REST_Controller::HTTP_NOT_MODIFIED); $this->response($data,REST_Controller::HTTP_NOT_MODIFIED);
} }
} }
/** /**

View File

@ -21,7 +21,7 @@ class User_Management_Model extends SPARQ_Model {
$this->db->join(DESIGNATION.' as DESIGNATION','USERPROFILE.fk_designation = DESIGNATION.designation_id and DESIGNATION.isactive = 1'); $this->db->join(DESIGNATION.' as DESIGNATION','USERPROFILE.fk_designation = DESIGNATION.designation_id and DESIGNATION.isactive = 1');
$this->db->join(STATE.' as STATE','USERPROFILE.fk_state = STATE.state_id and STATE.isactive = 1'); $this->db->join(STATE.' as STATE','USERPROFILE.fk_state = STATE.state_id and STATE.isactive = 1');
$this->db->join(CITY.' as CITY','USERPROFILE.fk_city = CITY.city_id and CITY.isactive = 1'); $this->db->join(CITY.' as CITY','USERPROFILE.fk_city = CITY.city_id and CITY.isactive = 1');
$this->db->join(USERPROFILE.' as USERPROFILE1','USERPROFILE.fk_createdby = USERPROFILE1.userid and USERPROFILE1.isactive = 1'); $this->db->join(USERPROFILE.' as USERPROFILE1','USERPROFILE.fk_createdby = USERPROFILE1.userid and USERPROFILE1.isactive = 1','LEFT');
$this->db->join(USERPROFILE.' as USERPROFILE2','USERPROFILE.fk_updatedby = USERPROFILE2.userid and USERPROFILE2.isactive = 1','LEFT'); $this->db->join(USERPROFILE.' as USERPROFILE2','USERPROFILE.fk_updatedby = USERPROFILE2.userid and USERPROFILE2.isactive = 1','LEFT');
$this->db->join(USERPROFILEHIERARCHY.' as USERPROFILEHIERARCHY','USERPROFILE.userid = USERPROFILEHIERARCHY.fk_user_id and USERPROFILEHIERARCHY.isactive = 1','LEFT'); $this->db->join(USERPROFILEHIERARCHY.' as USERPROFILEHIERARCHY','USERPROFILE.userid = USERPROFILEHIERARCHY.fk_user_id and USERPROFILEHIERARCHY.isactive = 1','LEFT');
$this->db->join(LENDERHIERARCHY.' as LENDERHIERARCHY','USERPROFILEHIERARCHY.user_lender_hierarchy_id = LENDERHIERARCHY.lender_hierarchy_id and LENDERHIERARCHY.isactive = 1','LEFT'); $this->db->join(LENDERHIERARCHY.' as LENDERHIERARCHY','USERPROFILEHIERARCHY.user_lender_hierarchy_id = LENDERHIERARCHY.lender_hierarchy_id and LENDERHIERARCHY.isactive = 1','LEFT');