ShuanghongS 10 mēneši atpakaļ
vecāks
revīzija
34ce60fa8e
1 mainītis faili ar 12 papildinājumiem un 10 dzēšanām
  1. 12 10
      service/ocean_order.class.php

+ 12 - 10
service/ocean_order.class.php

@@ -150,7 +150,8 @@ class ocean_order {
             //查询存在的文件类型最大序号
             $num = common::excuteOneSql("select count(*) from $_table where lower(bol) = '" . strtolower($bol) . "' and  format_serailno = '".$format['serial_no']."'");
             try {
-                $allow_extend = "|.pdf|.xls|.xlsx|.doc|.docx|";
+                //$allow_extend = "|.pdf|.xls|.xlsx|.doc|.docx|";
+                $allow_extend = "|.pdf|";
                 $file_name = $_FILES['file']["name"];
                 $errorMsg = "";
                 $sql = "";
@@ -160,18 +161,19 @@ class ocean_order {
                         continue;
                     }
                     $size = floor($_FILES ["file"]['size'][$i] / 1024 / 1024);
-                    if ($size > 2) {
-                        $errorMsg .= $_FILES['file']["name"][$i] . " larger than 2M.";
+                    if ($size > 5) {
+                        $errorMsg .= $_FILES['file']["name"][$i] . " larger than 5M;";
                         continue;
                     }
                     if ($_FILES["file"]["error"][$i] > 0) {
-                        $errorMsg .= "File Upload Error(" . $_FILES ["file"]["error"][$i] . ").";
+                        $errorMsg .= " File Upload Error(" . $_FILES ["file"]["error"][$i] . ");";
                         continue;
                     }
                     $path_parts = pathinfo($file_name[$i]);
                     $exten = $path_parts['extension'];
                     if (stristr($allow_extend, "|." . $exten . "|") === FALSE) {
-                        $errorMsg .= 'Only can upload PDF/Excel/Doc/TXT/JPG/png/tif file.<br>';
+                        //$errorMsg .= ' Only can upload PDF/Excel/Doc file;';
+                        $errorMsg .= ' Only can upload PDF file;';
                     }
 
                     //$filename = $file_name[$i];
@@ -200,10 +202,8 @@ class ocean_order {
     
                     $save_path = $folder . DS . date("Ymd") . DS;
                     if (common::mkdirs($save_path) === FALSE){
-                        $errorMsg .= "Save folder create error";
+                        $errorMsg .= " Save folder create error;";
                     }
-                    $ppp =  $_FILES['file']['tmp_name'];
-                    $sss = $save_path . $filename;
                     if (move_uploaded_file($_FILES['file']['tmp_name'][$i], $save_path . $filename)) {
                         $sql .= "insert into $_schemas.$_table (file_name, file_path, upload_date, upload_ip, upload_by, bol, file_type, file_size, online_upload, 
                             origin, destination, from_station, serial_no, 
@@ -237,8 +237,10 @@ class ocean_order {
                     $ks_from = common::excuteOneSql("select ksmart_station from public.contract_region_mapping where overeas = '".$count["from_station"]."' limit 1");
                     $ks_to = common::excuteOneSql("select ksmart_station from public.contract_region_mapping where overeas = '".$count["destination_station"]."' limit 1");
                     $ks_from = empty($ks_from)? 'f' : $ks_from;
-                    $ks_from = 't';
                     $ks_to = empty($ks_to)? 'f' : $ks_to;
+                    if($ks_from == "f" && $ks_to == "f"){
+                        $errorMsg .= " System Error,Both Non Ksmart;";
+                    }
                     
                     $curr_date_config = common::excuteObjectSql("SELECT to_char(now()::date,'Mon_DD_YYYY') as d1_day,to_char(now()::date,'Mon_DD_YYYY HH:MM') as d2_day");
                     $subject = "External Documentation Upload Notification"."_".$curr_date_config['d1_day'];
@@ -396,7 +398,7 @@ class ocean_order {
 
                 if (!empty($errorMsg)) {
                     $data = array(
-                        'msg' => "Save Failed $errorMsg"
+                        'msg' => "Failed $errorMsg"
                     );
                     common::echo_json_encode(500,$data);
                     exit();