ShuanghongS пре 1 недеља
родитељ
комит
bdcc6f4b2e
3 измењених фајлова са 32 додато и 24 уклоњено
  1. 11 11
      include.ini.php
  2. 0 0
      service/ocean_order.class.php
  3. 21 13
      utils/common.class.php

+ 11 - 11
include.ini.php

@@ -140,7 +140,7 @@ function _isVipReportAdmin($username) {
            || strtolower($username) == "mark.szymanowski@kln.com" || strtolower($username) == "cynthia.sy.lee@kln.com";
 }
 
-function _customerFilerSearchHandNew($user, $schemas = "public", $p = 'place_of_delivery', $s = 'shipper_id', $c = 'consignee_id', $b = 'billto_id', $n = 'notify_party_id', $d = 'port_of_discharge_code') {
+function _customerFilerSearchHandNew($tableName,$user, $schemas = "public", $p = 'place_of_delivery', $s = 'shipper_id', $c = 'consignee_id', $b = 'billto_id', $n = 'notify_party_id', $d = 'port_of_discharge_code') {
     $tt = $user['customer_search_type'];
     $sales = $user['ocean_sales'];
     if (empty($tt)) {
@@ -185,9 +185,9 @@ function _customerFilerSearchHandNew($user, $schemas = "public", $p = 'place_of_
     //controlling_customer_code
     if (utils::checkExist($tt, 't')) {
         if (empty($sqlWhere1)) {
-            $sqlWhere1 = " exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)."  limit 1)";
+            $sqlWhere1 = " exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = ".$tableName.".serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)."  limit 1)";
         } else {
-            $sqlWhere1 .= " or exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
+            $sqlWhere1 .= " or exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = ".$tableName.".serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
         }
     }
     if (empty($sqlWhere1))
@@ -374,7 +374,7 @@ function _getAirContactID($schemas = "public") {
     }
 }
 
-function _customerAirFilerSearch($schemas = "public", $s = 'shipper_id', $c = 'consignee_id', $b = 'billto_id', $n = 'notify_party_id') {
+function _customerAirFilerSearch($tableName,$schemas = "public", $s = 'shipper_id', $c = 'consignee_id', $b = 'billto_id', $n = 'notify_party_id') {
     $tt = _customerAirSearchType($schemas);
     if (empty($tt))
         return "1<>1";
@@ -414,9 +414,9 @@ function _customerAirFilerSearch($schemas = "public", $s = 'shipper_id', $c = 'c
     //controlling_customer_code
     if (utils::checkExist($tt, 't')) {
         if (empty($sqlWhere1)) {
-            $sqlWhere1 = " exists(select 1 from $schemas.air_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)."  limit 1)";
+            $sqlWhere1 = " exists(select 1 from $schemas.air_extend ex where ex.serial_no = ".$tableName.".serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)."  limit 1)";
         } else {
-            $sqlWhere1 .= " or exists(select 1 from $schemas.air_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
+            $sqlWhere1 .= " or exists(select 1 from $schemas.air_extend ex where ex.serial_no = ".$tableName.".serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
         }
     }
     if (empty($sqlWhere1))
@@ -430,7 +430,7 @@ function _customerAirFilerSearch($schemas = "public", $s = 'shipper_id', $c = 'c
  * 员工的有关的group_name 和contact id 权限配置查询 ocean air 合并写
  * @return string sql
  */
-function _employeeFilerSearch($ocean_air,$contact_field,$group_name_field,$schemas = "public", $p = 'place_of_delivery', $s = 'shipper_id', $c = 'consignee_id', $b = 'billto_id', $n = 'notify_party_id', $d = 'port_of_discharge_code'){
+function _employeeFilerSearch($tableName,$ocean_air,$contact_field,$group_name_field,$schemas = "public", $p = 'place_of_delivery', $s = 'shipper_id', $c = 'consignee_id', $b = 'billto_id', $n = 'notify_party_id', $d = 'port_of_discharge_code'){
     if($ocean_air == "ocean"){
         $tt = _employeeSearchType($schemas,"employee_search_type");
     }else{
@@ -475,17 +475,17 @@ function _employeeFilerSearch($ocean_air,$contact_field,$group_name_field,$schem
     if($ocean_air == "ocean"){
         if (utils::checkExist($tt, 't')) {
             if (empty($sqlWhere1)) {
-                $sqlWhere1 = " exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)."  limit 1)";
+                $sqlWhere1 = " exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = ".$tableName.".serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)."  limit 1)";
             } else {
-                $sqlWhere1 .= " or exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
+                $sqlWhere1 .= " or exists(select 1 from $schemas.ocean_extend ex where ex.serial_no = ".$tableName.".serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
             }
         }
     }else{
         if (utils::checkExist($tt, 't')) {
             if (empty($sqlWhere1)) {
-                $sqlWhere1 = " exists(select 1 from $schemas.air_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)."  limit 1)";
+                $sqlWhere1 = " exists(select 1 from $schemas.air_extend ex where ex.serial_no = ".$tableName.".serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)."  limit 1)";
             } else {
-                $sqlWhere1 .= " or exists(select 1 from $schemas.air_extend ex where ex.serial_no = serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
+                $sqlWhere1 .= " or exists(select 1 from $schemas.air_extend ex where ex.serial_no = ".$tableName.".serial_no and lower(ex.customer_code) " . common::getInNotInSql($_contact_id)." limit 1)";
             }
         }
     }

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
service/ocean_order.class.php


+ 21 - 13
utils/common.class.php

@@ -291,11 +291,11 @@ class common {
                 $sqlWhere .= self::_bookingHandNew($user, $schames);
             }
             if (strtolower($type) == "air_booking") {
-                $sqlWhere .= self::_air($schames);
+                $sqlWhere .= self::_air($type,$schames);
             }
             
             if (strtolower($type) == "air") {
-                $sqlWhere .= self::_air($schames);
+                $sqlWhere .= self::_air($type,$schames);
             }
 
         } elseif (utils::count($schemas_list) == 2) {
@@ -349,24 +349,24 @@ class common {
             }
             if (strtolower($type) == "air_booking") {
                 $sqlWhere .= " and ((order_from='public' ";
-                $sqlWhere .= self::_air("public");
+                $sqlWhere .= self::_air($type,"public");
                 $sqlWhere .= ") or (order_from='sfs' ";
                 if (empty($user["sfs_ONLINE_USER"])) {
                     $user = $_SESSION["sfs_ONLINE_USER"];
                 }
-                $sqlWhere .= self::_air("sfs");
+                $sqlWhere .= self::_air($type,"sfs");
                 $sqlWhere .= "))";
             }
             
             if (strtolower($type) == "air") {
                 $sqlWhere .= " and ((order_from='public' ";
-                $sqlWhere .= self::_air($user, "public");
+                $sqlWhere .= self::_air($type, "public");
                 $sqlWhere .= ") or (order_from='sfs' ";
 
                 if (empty($user["sfs_ONLINE_USER"])) {
                     $user = $_SESSION["sfs_ONLINE_USER"];
                 }
-                $sqlWhere .= self::_air($user, "sfs");
+                $sqlWhere .= self::_air($type, "sfs");
                 $sqlWhere .= ") )";
             }
         } else {
@@ -596,12 +596,13 @@ class common {
         $follow = $user['ocean_following_sales'];
         $follow_or = $user['ocean_following_sales_or'];
 
+        $tableName = "kln_ocean";
         $sqlWhere = "";
         if (_isCustomerLoginHandNew($user)) {
-            $sqlWhere .= " and " . _customerFilerSearchHandNew($user, $schemas);
+            $sqlWhere .= " and " . _customerFilerSearchHandNew($tableName,$user, $schemas);
         } else {
             //employee_search_type 的设置
-            $sqlStr = _employeeFilerSearch('ocean','employee_contact_id_user','employee_company_name',$schemas);
+            $sqlStr = _employeeFilerSearch($tableName,'ocean','employee_contact_id_user','employee_company_name',$schemas);
 
             if (empty($o) && empty($d) && empty($sales) && empty($op) && empty($follow)&& $sqlStr == "1<>1") {
                 return " and 1<>1";
@@ -724,12 +725,13 @@ class common {
                 $follow = $user['ocean_following_sales'];
                 $follow_or = $user['ocean_following_sales_or'];
         
+                $tableName = "kln_booking";
                 $sqlWhere = "";
                 if (_isCustomerLoginHandNew($user)) {
-                    $sqlWhere .= " and " . _customerFilerSearchHandNew($user, $schames);
+                    $sqlWhere .= " and " . _customerFilerSearchHandNew($tableName,$user, $schames);
                 } else {
                     //employee_search_type 的设置
-                    $sqlStr = _employeeFilerSearch('ocean','employee_contact_id_user','employee_company_name',$schames);
+                    $sqlStr = _employeeFilerSearch($tableName,'ocean','employee_contact_id_user','employee_company_name',$schames);
                     
                     if (empty($o) && empty($d) && empty($sales) && empty($op) && empty($follow)&& $sqlStr == "1<>1") {
                         return " and 1<>1";
@@ -829,18 +831,24 @@ class common {
     /**
      * online air
      */
-    private static function _air($schemas = "public") {
+    private static function _air($type,$schemas = "public") {
         $station = _getAirStation($schemas);
         $station_or = _getAirStationOr($schemas);
         $sales = _getAirSales($schemas);
         $sales_or = _getAirSalesOr($schemas);
 
+        if (strtolower($type) == "air_booking") {
+            $tableName = "kln_booking";
+        } else {
+            $tableName = "kln_ocean";
+        }
+        
         $sqlWhere = " 1=1 ";
         if (_isCustomerLogin()) {
-            $sqlWhere .= " and " . _customerAirFilerSearch($schemas);
+            $sqlWhere .= " and " . _customerAirFilerSearch($tableName,$schemas);
         } else {
             //employee_search_type 的设置
-            $sqlStr = _employeeFilerSearch('air','employee_air_contact_id_user','employee_air_company_name',$schemas);
+            $sqlStr = _employeeFilerSearch($tableName,'air','employee_air_contact_id_user','employee_air_company_name',$schemas);
 
             if (empty($station) && empty($sales) && $sqlStr == "1<>1") {
                 return "and 1<>1";

Неке датотеке нису приказане због велике количине промена