diff --git a/api/application/models/Sales_PD_Model.php b/api/application/models/Sales_PD_Model.php index 32640fd3..efc65db3 100644 --- a/api/application/models/Sales_PD_Model.php +++ b/api/application/models/Sales_PD_Model.php @@ -9,6 +9,17 @@ class Sales_PD_Model extends SPARQ_Model { parent::__construct(); } public function getSalesPDListwithFilters($pd_status = '',$pd_from_date = '',$pd_to_date = '',$pd_products = '',$pd_lender = '',$pd_applicant_name = '',$pd_officer_name = '',$sales_pd_officer_id,$sales_pd_type = '') { + $ignorerole = array(10,30); // System Admin 10 , Lender Sys Admin 30 + $this->db->select('user_role'); + $this->db->from(USERPROFILEROLES); + $this->db->where('fk_userid',$sales_pd_officer_id); + $this->db->where('isactive',1); + $query = $this->db->get(); + if ($query->num_rows() > 0) { + $checkThisRole = $query->row()->user_role; + //checkthisrole is matched withSystem admin and lendersysadmin means salespdofficer value is empty. + if (in_array($checkThisRole,$ignorerole)) $sales_pd_officer_id = ""; + } // SALES_PD_DATA.sales_pd_sno, SALES_PD_DATA.sales_pd_id, SALES_PD_DATA.applicant_name,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as officer_name,SALES_PD_DATA.applicant_id,SALES_PD_DATA.lender_id,SALES_PD_DATA.product_id,SALES_PD_DATA.is_pdf,SALES_PD_DATA.is_edited,ENTITY.short_name,PRODUCTS.abbr,DATE_FORMAT(SALES_PD_DATA.createdon, "%d/%m/%Y") as pd_createdon,SALES_PD_DATA.status $this->db->SELECT(' SALES_PD_DATA.sales_pd_sno, SALES_PD_DATA.sales_pd_id, SALES_PD_DATA.applicant_name,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as officer_name,SALES_PD_DATA.applicant_id,SALES_PD_DATA.lender_id,SALES_PD_DATA.product_id,SALES_PD_DATA.is_pdf,SALES_PD_DATA.is_edited,ENTITY.short_name,PRODUCTS.abbr, (CASE WHEN SALES_PD_DATA.status = "STARTED" THEN SALES_PD_DATA.createdon WHEN SALES_PD_DATA.status = "COMPLETED" THEN SALES_PD_DATA.completed_date ELSE NULL END) AS createdon, @@ -77,7 +88,7 @@ class Sales_PD_Model extends SPARQ_Model { $this->db->limit(1000,0); $result = $this->db->get()->result_array(); // if(ENVIRONMENT == 'development'){echo 'LAST QUERY '. $this->db->last_query();} - //echo $this->db->last_query();die(); + echo $this->db->last_query();die(); return $result; } public function testSaleSection($id){