From 433d1f2dbc046d7a0438b6ea299ced321a86d3d5 Mon Sep 17 00:00:00 2001 From: venbaSriram Date: Sat, 22 Sep 2018 15:38:48 +0530 Subject: [PATCH 1/3] usermangement module api --- .../User_Management_Controller.php | 7 ++++ .../models/User_Management_Model.php | 32 ++----------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/api/application/controllers/User_Management_Controller.php b/api/application/controllers/User_Management_Controller.php index 275ed13b..c3064b8d 100644 --- a/api/application/controllers/User_Management_Controller.php +++ b/api/application/controllers/User_Management_Controller.php @@ -233,6 +233,13 @@ class User_Management_Controller extends REST_Controller { $this->User_Management_Model->updateRecords(array('isactive'=>0),USERPROFILEHIERARCHY,array('fk_user_id'=>$records['userid'])); $hierarchy = array('fk_hierarchy_id'=>$hierarchy['lender_hierarchy_id'],'fk_user_id'=>$records['userid']);//insert hierarchy againest lender type users + + } + + foreach($lender_hierarchy as $hierarchy) + { + + //insert hierarchy againest lender type users $this->User_Management_Model->saveRecords($hierarchy,USERPROFILEHIERARCHY); } } diff --git a/api/application/models/User_Management_Model.php b/api/application/models/User_Management_Model.php index 8d2a9771..1fd64340 100644 --- a/api/application/models/User_Management_Model.php +++ b/api/application/models/User_Management_Model.php @@ -7,7 +7,6 @@ class User_Management_Model extends SPARQ_Model { public function __construct() { parent::__construct(); - $this->load->library('AWS_S3'); } @@ -16,10 +15,10 @@ class User_Management_Model extends SPARQ_Model { $result_data = array(); - $this->db->select('USERPROFILE.userid, USERPROFILE.aws_name, USERPROFILE.first_name as user_first_name, USERPROFILE.last_name as user_last_name, USERPROFILE.email, USERPROFILE.alt_email, USERPROFILE.mobile_no, USERPROFILE.alt_mobile_no, USERPROFILE.addressline1, USERPROFILE.addressline2, USERPROFILE.profilepic, USERPROFILE.createdon, USERPROFILE.fk_createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as created_full_name, USERPROFILE.updatedon, USERPROFILE.fk_updatedby,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name)as update_full_name, USERPROFILE.fk_entity_id,ENTITY.full_name, USERPROFILE.isactive, USERPROFILE.fk_designation,DESIGNATION.name, USERPROFILE.addressline3, USERPROFILE.fk_city,CITY.name as city_name, USERPROFILE.fk_state,STATE.name as state_name, USERPROFILE.pincode'); + $this->db->select('USERPROFILE.userid, USERPROFILE.aws_name, USERPROFILE.first_name as user_first_name, USERPROFILE.last_name as user_last_name, USERPROFILE.email, USERPROFILE.alt_email, USERPROFILE.mobile_no, USERPROFILE.alt_mobile_no, USERPROFILE.addressline1, USERPROFILE.addressline2, USERPROFILE.profilepic, USERPROFILE.createdon, USERPROFILE.fk_createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as created_full_name, USERPROFILE.updatedon, USERPROFILE.fk_updatedby,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name)as update_full_name, USERPROFILE.fk_entity_id,ENTITY.full_name, USERPROFILE.isactive, USERPROFILE.fk_designation,DESIGNATION.name, USERPROFILE.addressline3, USERPROFILE.fk_city,CITY.name as city_name, USERPROFILE.fk_state,STATE.name as state_name, USERPROFILE.pincode,USERPROFILEHIERARCHY.fk_hierarchy_id'); $this->db->from(USERPROFILE.' as USERPROFILE'); $this->db->join(ENTITY.' as ENTITY','USERPROFILE.fk_entity_id = ENTITY.entity_id and ENTITY.isactive = 1','LEFT'); - $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','left'); $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(USERPROFILE.' as USERPROFILE1','USERPROFILE.fk_createdby = USERPROFILE1.userid and USERPROFILE1.isactive = 1','LEFT'); @@ -32,32 +31,7 @@ class User_Management_Model extends SPARQ_Model { $result = $this->db->get()->result_array(); - - foreach($result as $key => $pics) - { - if($pics['profilepic'] != '' || $pics['profilepic'] != null) - { - $profilepics3path = ''; - if($pics['fk_entity_id'] == 1) //1 means sine_edge Profile - { - $profilepics3path = 'sineedge/'.$pics['profilepic']; - } - else if($pics['fk_entity_id'] == 2)//1 means lender Profile - { - $profilepics3path = 'lender/'.$pics['profilepic']; - } - else // else or 3 means vendor Profile - { - $profilepics3path = 'vendor/'.$pics['profilepic']; - } - $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI(PROFILE_PICTURE_BUCKET_NAME, $profilepics3path,'+5 minutes'); - - $result[$key]['profilepic_singed_url'] = $singed_uri; - - } - } - - if($result != '' ){ + if($result !=''){ foreach($result as $key =>$roles){ $role = $this->db->get_where(USERPROFILEROLES.' as USERPROFILEROLES',array('fk_userid'=>$roles['userid'],'isactive'=>1))->result_array(); From 02c7355275bd7b86ab9412a2a1afba222498a7a4 Mon Sep 17 00:00:00 2001 From: sriramv Date: Mon, 24 Sep 2018 10:27:43 +0000 Subject: [PATCH 2/3] User_Management_Controller.php edited online with Bitbucket --- api/application/controllers/User_Management_Controller.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/application/controllers/User_Management_Controller.php b/api/application/controllers/User_Management_Controller.php index c3064b8d..e321c1fa 100644 --- a/api/application/controllers/User_Management_Controller.php +++ b/api/application/controllers/User_Management_Controller.php @@ -221,6 +221,13 @@ class User_Management_Controller extends REST_Controller { { $this->User_Management_Model->updateRecords(array('isactive'=>0),USERPROFILEROLES,array('fk_userid'=>$records['userid'])); + + + } + foreach($roles as $role) + { + + $role_array = array('user_role'=>$role['user_role'],'fk_userid'=>$records['userid']); $this->User_Management_Model->saveRecords($role_array,USERPROFILEROLES); } From d028c36bf5a815547fd143a195e2ce89babba798 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Mon, 24 Sep 2018 11:47:40 +0000 Subject: [PATCH 3/3] Common_Masters_Controller.php edited online with Bitbucket --- api/application/controllers/Common_Masters_Controller.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/api/application/controllers/Common_Masters_Controller.php b/api/application/controllers/Common_Masters_Controller.php index a26122ec..f40b3768 100644 --- a/api/application/controllers/Common_Masters_Controller.php +++ b/api/application/controllers/Common_Masters_Controller.php @@ -999,12 +999,10 @@ class Common_Masters_Controller extends REST_Controller { public function saveMaster_post() { - echo 'dfsf'; + $records = $this->post('records'); $table_name = $this->post('master_name'); - print_r($records); - //die(); - + if(false !== array_key_exists(constant($table_name.'ID'),$records)) //Update Record { @@ -1057,7 +1055,7 @@ class Common_Masters_Controller extends REST_Controller { /* For Branch Listing */ public function getListOfBranches_get(){ - $columns = array('m_city.name as cityname','BRANCH.*'); + $columns = array('m_city.name as city_name','BRANCH.*'); $table = BRANCH.' as BRANCH'; $joins = array( array(