Ver Fonte

code11/6

ShuanghongS há 1 ano atrás
pai
commit
8d0c57cd04
1 ficheiros alterados com 15 adições e 28 exclusões
  1. 15 28
      service/ajax.class.php

+ 15 - 28
service/ajax.class.php

@@ -557,46 +557,33 @@ class ajax {
         }
         if($search_field == "Origin" && $search_mode == "tracking"){
             $sqlWhere = $this->getTrackingSearchWhere();
-          
-            $count_sql = "select COUNT(DISTINCT city) from (select left(shippr_uncode, 2) as country,shipper_city as city, shippr_uncode as uncode
-                from public.online_ocean $sqlWhere 
-                    and COALESCE(shippr_uncode)<>''
-                    and  (shipper_city ilike '%" . common::check_input($term) . "%' 
-                    or shippr_uncode ilike '%" . common::check_input($term) . "%') 
-                union
-                    select left(consignee_uncode, 2) as country,consignee_city as city, consignee_uncode as uncode
+            $count_sql = "select COUNT(DISTINCT shipper_city)
                 from public.online_ocean $sqlWhere
-                    and COALESCE(consignee_uncode)<>'' 
-                    and  (consignee_city ilike '%" . common::check_input($term) . "%' 
-                    or consignee_uncode ilike '%" . common::check_input($term) . "%')) as temp";
+                    and COALESCE(shippr_uncode)<>'' 
+                    and  (shipper_city ilike '%" . common::check_input($term) . "%' 
+                    or shippr_uncode ilike '%" . common::check_input($term) . "%')";
 
-            $sql = "select country, city,uncode from(select left(shippr_uncode, 2) as country,shipper_city as city, shippr_uncode as uncode,etd,eta
+            $sql = "select left(shippr_uncode, 2) as country,shipper_city as city, shippr_uncode as uncode
                 from public.online_ocean $sqlWhere
                     and COALESCE(shippr_uncode)<>'' 
                     and  (shipper_city ilike '%" . common::check_input($term) . "%' 
-                    or shippr_uncode ilike '%" . common::check_input($term) . "%') 
-                union
-                    select left(consignee_uncode, 2) as country,consignee_city as city, consignee_uncode as uncode,etd,eta
-                from public.online_ocean $sqlWhere
-                    and COALESCE(consignee_uncode)<>''  
-                    and  (consignee_city ilike '%" . common::check_input($term) . "%' 
-                    or consignee_uncode ilike '%" . common::check_input($term) . "%')) as temp order by $order_by";
-            return  array("count_sql"=>$count_sql,"sql"=>$sql);        
+                    or shippr_uncode ilike '%" . common::check_input($term) . "%') order by $order_by";
+            return  array("count_sql"=>$count_sql,"sql"=>$sql);
         }
 
         if($search_field == "Destination" && $search_mode == "tracking"){
             $sqlWhere = $this->getTrackingSearchWhere();
-            $count_sql = "select COUNT(DISTINCT final_desination_exp)
+            $count_sql = "select COUNT(DISTINCT consignee_city)
                 from public.online_ocean $sqlWhere
-                    and COALESCE(final_desination_uncode)<>'' 
-                    and  (final_desination_exp ilike '%" . common::check_input($term) . "%' 
-                    or final_desination_uncode ilike '%" . common::check_input($term) . "%')";
+                    and COALESCE(consignee_uncode)<>'' 
+                    and  (consignee_city ilike '%" . common::check_input($term) . "%' 
+                    or consignee_uncode ilike '%" . common::check_input($term) . "%')";
 
-            $sql = "select left(final_desination_uncode, 2) as country,final_desination_exp as city, final_desination_uncode as uncode
+            $sql = "select left(consignee_uncode, 2) as country,consignee_city as city, consignee_uncode as uncode
                 from public.online_ocean $sqlWhere
-                    and COALESCE(final_desination_uncode)<>'' 
-                    and  (final_desination_exp ilike '%" . common::check_input($term) . "%' 
-                    or final_desination_uncode ilike '%" . common::check_input($term) . "%') order by $order_by";
+                    and COALESCE(consignee_uncode)<>'' 
+                    and  (consignee_city ilike '%" . common::check_input($term) . "%' 
+                    or consignee_uncode ilike '%" . common::check_input($term) . "%') order by $order_by";
             return  array("count_sql"=>$count_sql,"sql"=>$sql);             
         }