code merged for forget password and multiple role access

This commit is contained in:
venbatechnologies@gmail.com 2018-05-02 18:01:02 +05:30
parent 76d9188978
commit 541e146eb8
4 changed files with 31 additions and 7 deletions

View File

@ -133,7 +133,8 @@ class Employee_Controller extends REST_Controller {
public function getMasterBranchDetails_post () {
$reqRoleID = $this->post('reqRoleID');
$reqUserID = $this->post('reqUserID');
$resMasterBranchDetails = $this->employee_model->get_req_master_branch_detail( $reqRoleID, $reqUserID );// Check if the employee exist
$branchId= $this->post('branchId');
$resMasterBranchDetails = $this->employee_model->get_req_master_branch_detail( $reqRoleID, $reqUserID,$branchId);// Check if the employee exist
if ($resMasterBranchDetails)
{
$resMasterBranchDetails['status'] = REST_Controller::HTTP_OK;

View File

@ -274,7 +274,7 @@ class Employee_model extends CI_Model
}
// get branch details based on login user
public function get_req_master_branch_detail($reqRoleId, $reqUserID)
public function get_req_master_branch_detail($reqRoleId, $reqUserID,$branchId)
{
if ($reqRoleId == SUPER_ADMIN) {
// res for SuperAdmin
@ -290,6 +290,7 @@ class Employee_model extends CI_Model
$subQuery = "SELECT t1.BranchCode, t1.BranchName
FROM T_BranchMaster as t1
LEFT JOIN T_Staff_BranchAccess as t2 ON t2.StaffID = '$staffId'
WHERE t1.BranchCode='$branchId' and t2.ListCode='$listcode'
WHERE t2.BranchCode = t1.BranchCode
AND t1.IsActive = 1
AND t2.IsActive = 1";
@ -365,8 +366,8 @@ class Employee_model extends CI_Model
if ($this->db->affected_rows() == '1') {
$loginArr['StaffID'] = $empArr['StaffID'];
$loginArr['ListCode'] = $empArr['ListCode'];
// $loginArr['MobileNumber'] = $empArr['MobileNumber'];
$loginArr['MobileNumber'] = $empArr['StaffID'];
$loginArr['MobileNumber'] = $empArr['MobileNumber'];
//$loginArr['MobileNumber'] = $empArr['StaffID'];
$loginArr['EmailId'] = $empArr['EmailID'];
$loginArr['IsActive'] = $empArr['IsActive'];
$loginArr['CreatedBy'] = $createdBy;

View File

@ -12,12 +12,33 @@ class Forgot_model extends CI_Model {
//
function forget($user=null, $password)
{
$this->db->select('ID,Emailid,MobileNumber,Password');
$this->db->select('ID,Emailid,MobileNumber,Password,StaffID');
$this->db->from(LOGIN);
$this->db->where('MobileNumber', $user['MobileNumber']);
$this->db->or_where('StaffID', $user['MobileNumber']);
$forgotDetails1 = $this->db->get()->first_row();
// echo $forgotDetails->MobileNumber;exit();
// $result = $query->result_array();
$mobile='';
$emid=$forgotDetails1->StaffID;
if($forgotDetails1->MobileNumber == $forgotDetails1->StaffID)
{
$this->db->select('MobileNumber');
$this->db->from(STAFF);
$this->db->where('StaffID',$emid);
$empphone = $this->db->get()->first_row();
$mobile=$empphone->MobileNumber;
}
else
{
$mobile=$forgotDetails1->MobileNumber;
}
if($forgotDetails1){
$this->db->select('ID,Emailid,MobileNumber,Password');
$this->db->from(LOGIN);
@ -31,7 +52,7 @@ class Forgot_model extends CI_Model {
// print_r ($upatePassword) ;
//exit();
if($upatePassword) {
$this->smssend($user['MobileNumber'], $password);
$this->smssend($mobile, $password);
$result['forgotstatus'] = true;
$result['resPass'] = "Check your registered Mobile Number!!";
$result['message'] = "Password updated successfully";

View File

@ -69,7 +69,7 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$
if (localDetail != null) {
$scope.currentDate = new Date();
$scope.localUserListCode = localDetail.localType;
$scope.localBranchID = localDetails.localBranchID;
// $scope.currentPage = 1;
$scope.getEmployeeList();
$scope.getRoleList();
@ -459,6 +459,7 @@ app.controller('staffCtrl', ["$scope", "toaster", "$filter", "ngTableParams", "$
data: {
reqRoleID: localDetails.localType,
reqUserID: localDetails.localUserID,
branchId : localDetails.localBranchID,
}
};
$http(req).then(function (response) {