ShuanghongS 3 сар өмнө
parent
commit
2346446c4f

+ 13 - 3
service/destination_delivery.class.php

@@ -76,8 +76,17 @@ class destination_delivery {
             $station = $_REQUEST['station'];
             $more_param = common::getInNotInSqlForSearch(utils::implode(';',$station));
 
-            $sql  = "select email from public.ra_online_user where user_type = 'Employee' and lower(contact_id) in ($more_param)
-                and email ilike '" . common::check_input($term) . "%' limit 20";
+            $sql = "select e.email from public.ra_online_user r, employee e 
+                    where r.employee_id=e.employee_id 
+                        and r.online_active = true
+                        and r.user_type = 'Employee' 
+                        and e.active = true
+                        and lower(e.contact_id) in ($more_param)
+                        and coalesce(e.email,'') <>''
+                        and e.email ilike '" . common::check_input($term) . "%' limit 20";
+
+            // $sql  = "select email from public.ra_online_user where user_type = 'Employee' and lower(contact_id) in ($more_param)
+            //     and email ilike '" . common::check_input($term) . "%' limit 20";
             $rs = common::excuteListSql($sql);
             $retData = array();
             foreach($rs as $key => $val){
@@ -596,7 +605,8 @@ class destination_delivery {
             $sqlWhere .= " and eta >= now() - INTERVAL '6 months' and eta <= now() + INTERVAL '6 months'";
             //代表employee 
             if(_isApexLogin()){
-                $sqlWhere .= " and kln_pic = '"._getLoginEamil()."'";
+                //$sqlWhere .= " and kln_pic ilike '"._getLoginEamil()."'";
+                $sqlWhere .= "and '".strtolower(_getLoginEamil())."' in (select regexp_split_to_table(lower(kln_pic), ','))";
             }    
 
             //条件带入