From eec23ec2b3a4555da17d2955be1bd135d779349b Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Thu, 21 Apr 2022 13:02:39 +0530 Subject: [PATCH] role id added in notification api : ps --- api/application/controllers/PD_Controller.php | 1 + api/application/helpers/pdalerts_helper.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index ead4e1ed..2df46f86 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -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']; diff --git a/api/application/helpers/pdalerts_helper.php b/api/application/helpers/pdalerts_helper.php index adb5d3cc..4da86494 100644 --- a/api/application/helpers/pdalerts_helper.php +++ b/api/application/helpers/pdalerts_helper.php @@ -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 = "";