ShuanghongS 3 сар өмнө
parent
commit
c51c612051

+ 7 - 12
service/destination_delivery.class.php

@@ -93,9 +93,6 @@ class destination_delivery {
                         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";
-            //error_log($sql);
             $rs = common::excuteListSql($sql);
             $retData = array();
             foreach($rs as $key => $val){
@@ -176,11 +173,11 @@ class destination_delivery {
             $more_param_country = common::getInNotInSqlForSearch(utils::implode(';',$country));
 
             $delivery_serial_no = common::deCode($_REQUEST['delivery_serial_no'], 'D');
-            //$delivery_serial_no = 'c4d2951f438a4c9fccde37f26614740a';
+            //contact_person,contact_number,  现在系统还没有把这两个字段接入
             if(!empty($delivery_serial_no)){
                 $sql = "SELECT addr1,addr2,addr3,addr4,
                             ctry_code,city_code,postal_code,
-                            contact_person,contact_number,
+                            '' as contact_person,'' as contact_number,
                             create_user,contact_id,sync_key,
                             from_station,
                             'from Ksmart' as op_action
@@ -201,7 +198,7 @@ class destination_delivery {
             }else{
                 $sql = "SELECT addr1,addr2,addr3,addr4,
                             ctry_code,city_code,postal_code,
-                            contact_person,contact_number,
+                            '' as contact_person,'' as contact_number,
                             create_user,contact_id,sync_key,
                             from_station,
                             'from Ksmart' as op_action
@@ -426,7 +423,8 @@ class destination_delivery {
             $booking_window_date_start = common::check_input($_POST['booking_window_date_start']);
             $booking_window_date_end = common::check_input($_POST['booking_window_date_end']);
             $recommended_delivery = common::check_input($_POST['recommended_delivery']);
-            $kln_pic = common::check_input($_POST['kln_pic']);
+            $kln_pic = $_POST['kln_pic'];
+            $kln_pic = utils::implode(";",$kln_pic);
             $booking_window_desc = common::check_input($_POST['booking_window_desc']);
             $recommended_delivery_date_desc = common::check_input($_POST['recommended_delivery_date_desc']);
 
@@ -616,7 +614,7 @@ class destination_delivery {
             $sqlDeliveryWhere = " 1=1"; 
             if(_isApexLogin()){
                 //$sqlDeliveryWhere .=  " and '".strtolower("CATHY.LEE@APEXSHIPPING.COM")."' =  ANY(regexp_split_to_array(LOWER(kd.kln_pic), ','))";
-                $sqlDeliveryWhere .= " and '".strtolower(_getLoginEmployeeEamil())."' =  ANY(regexp_split_to_array(LOWER(kd.kln_pic), ','))";
+                //$sqlDeliveryWhere .= " and '".strtolower(_getLoginEmployeeEamil())."' =  ANY(regexp_split_to_array(LOWER(kd.kln_pic), ','))";
             }    
 
             //条件带入
@@ -717,6 +715,7 @@ class destination_delivery {
                     $rs[$key]["_serial_no"] = common::deCode($val['serial_no'], 'E');
                     $rs[$key]["status"] = common::deliveryStatusConvert($val['status']);
                     $rs[$key]["h_bol"] = json_decode($val['h_bol_multiple_link']);
+                    $rs[$key]["kln_pic"] = empty($val['kln_pic']) ? array() : explode(";", $val['kln_pic']);
                 }
                 $arrTmp = array('searchData' => $rs,
                         'is_employee' => _isApexLogin(), 
@@ -1193,10 +1192,6 @@ class destination_delivery {
         //兜底规则
         $sqlWhere = $sqlWhere_common;
         $sqlWhere .= " and  eta >= now() - INTERVAL '6 months' and eta <= now() + INTERVAL '6 months'";
-        // $checkOpenSql = "with oo as ( select DISTINCT agent from public.kln_ocean oo ". $sqlWhere.")
-        //         select agent from  oo 
-        //             where exists(select 1 from public.kln_destination_delivery_config where oo.agent in (select regexp_split_to_table(station, E','))) 
-        //         limit 1";
         $checkOpenSql = "select station from public.kln_destination_delivery_config dc
                             where exists(select 1 from  
                                     public.kln_ocean oo ". $sqlWhere." 

+ 2 - 1
service/login.class.php

@@ -296,7 +296,8 @@ class login {
 
                 //添加FAQ客户的访问类型
                 $loginCount = common::excuteOneSql("select count(*) from public.ra_online_user_login_log where lower(user_name) = '".strtolower(common::check_input($uname))."' and date_time >= CURRENT_DATE - INTERVAL '30 day' AND date_time <= CURRENT_DATE");
-                $kln_user_info = array("uname"=>$uname,
+                $kln_user_info = array("uname"=>$rs['user_login'],
+                                    "employee_email"=>$rs['employee_email'],
                                     "user_type"=>strtolower($rs['user_type']),
                                     "first_name"=>$rs['first_name'],
                                     "last_name"=>$rs['last_name'],

+ 1 - 1
utils/utils.class.php

@@ -1085,7 +1085,7 @@ class utils {
 
             if (empty($templateVars) || count($templateVars) <> count($cells)) continue;
 
-            // 检查每个变量是否都在 SQL 字段中
+            // 检查每个变量是否都在 SQL 字段中:这里逻辑是无效的,这里是按模板取的,sql查询有多余字段不影响,也不影响单独去渲染
             foreach ($templateVars as $var) {
                 if (!utils::in_array(strtolower($var), array_map('strtolower', $sqlFields))) {
                     continue; // 跳出当前循环,继续检查下一行