role id added in notification api : ps

This commit is contained in:
VE10-Sanjeev 2022-04-21 13:02:39 +05:30
parent 69da7583b1
commit eec23ec2b3
2 changed files with 5 additions and 2 deletions

View File

@ -11775,6 +11775,7 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post()
$this->db->JOIN(USERPROFILEROLES.' as USERPROFILEROLES','USERPROFILE.userid = USERPROFILEROLES.fk_userid');
$this->db->JOIN(ROLES.' as ROLES','USERPROFILEROLES.user_role = ROLES.role_id');
$this->db->WHERE('USERPROFILE.userid',$pdofficer['fk_user_id']);
$this->db->WHERE_IN("USERPROFILEROLES.user_role",[5]);//pd officer role only
$names = $this->db->GET()->result_array();
if(count($names)){
$list_of_pd_officers[$key]['first_name'] = $names[0]['first_name'];

View File

@ -852,18 +852,20 @@ class PDALERTS
// notification_token_id, fk_user_id, web_token, mob_token, createdon, updatedon
$CI->db->SELECT("USERNOTIFICATIONTOKENS.notification_token_id,USERNOTIFICATIONTOKENS.fk_user_id,USERNOTIFICATIONTOKENS.mob_token");
$CI->db->FROM(USERNOTIFICATIONTOKENS." as USERNOTIFICATIONTOKENS");
$CI->db->JOIN(USERPROFILEROLES.' as USERPROFILEROLES','USERPROFILEROLES.fk_userid = USERNOTIFICATIONTOKENS.fk_user_id');
$CI->db->JOIN(USERPROFILEROLES.' as USERPROFILEROLES','USERPROFILEROLES.fk_userid = USERNOTIFICATIONTOKENS.fk_user_id and USERPROFILEROLES.isactive = 1');
// $CI->db->WHERE('ROLES.role_id',2);
if(is_array($users) && count($users)){
if($users[0] != 0){
$CI->db->WHERE_IN('USERNOTIFICATIONTOKENS.fk_user_id ',$users);
}else{
$CI->db->WHERE_IN("USERPROFILEROLES.user_role",[2,22]);//pd officer roles only
$CI->db->WHERE_IN("USERPROFILEROLES.user_role",[5]);//pd officer roles only
// $CI->db->WHERE_IN("USERPROFILEROLES.user_role",[2,5,22]);
}
}
$CI->db->WHERE('USERNOTIFICATIONTOKENS.mob_token != ""');
$notification_details = $CI->db->GET()->result_array();
// print_r($CI->db->last_query());die();
// print_r($notification_details);die();
$additional_data_for_logs['to_whom'] = 'PDOFFICERS';
$web_token = "";