|
|
@@ -107,7 +107,7 @@ class ocean_order {
|
|
|
$file_serial_nos[] = $type;
|
|
|
}
|
|
|
}
|
|
|
- $file_serial_nos = implode(';',$file_serial_nos);
|
|
|
+ $file_serial_nos = utils::implode(';',$file_serial_nos);
|
|
|
if($transport_mode == 'sea'){
|
|
|
$sql = "select display_name,format_name as file_type,serial_no,m_h from public.ra_online_file_format where lower(serial_no) " . common::getInNotInSql($file_serial_nos) . "
|
|
|
and active = true and client_upload = true";
|
|
|
@@ -128,7 +128,7 @@ class ocean_order {
|
|
|
//checked from
|
|
|
if(empty($_POST['file_type']) || empty($_FILES['file']["name"])){
|
|
|
$data = array(
|
|
|
- 'msg' => 'File Type or File must select'
|
|
|
+ 'msg' => 'File Type or File must select.'
|
|
|
);
|
|
|
common::echo_json_encode(500,$data);
|
|
|
exit();
|
|
|
@@ -141,9 +141,9 @@ class ocean_order {
|
|
|
} elseif ($transport_mode == "air") {
|
|
|
$count = common::excuteObjectSql("select * from air where lower(hawb) = '" . strtolower($bol) . "'");
|
|
|
}
|
|
|
- if (empty($count) || count($count) <= 0){
|
|
|
+ if (empty($count) || utils::count($count) <= 0){
|
|
|
$data = array(
|
|
|
- 'msg' => 'HBOL does not exist'
|
|
|
+ 'msg' => 'HBOL does not exist.'
|
|
|
);
|
|
|
common::echo_json_encode(500,$data);
|
|
|
exit();
|
|
|
@@ -157,7 +157,7 @@ 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|.xlsx|.docx|";
|
|
|
$allow_extend = "|.pdf|";
|
|
|
$file_name = $_FILES['file']["name"];
|
|
|
$errorMsg = "";
|
|
|
@@ -169,22 +169,18 @@ class ocean_order {
|
|
|
}
|
|
|
$size = floor($_FILES ["file"]['size'][$i] / 1024 / 1024);
|
|
|
if ($size > 5) {
|
|
|
- $errorMsg = $_FILES['file']["name"][$i] . "is larger than 5M.";
|
|
|
+ $errorMsg = $_FILES['file']["name"][$i] ." is 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;
|
|
|
}
|
|
|
- // if (utils::hasMacro($_FILES['file']['tmp_name'][$i])) {
|
|
|
- // $errorMsg .= $_FILES['file']["name"][$i] . " has Macro,pls remove;";
|
|
|
- // continue;
|
|
|
- // }
|
|
|
$path_parts = pathinfo($file_name[$i]);
|
|
|
$exten = $path_parts['extension'];
|
|
|
if (stristr($allow_extend, "|." . $exten . "|") === FALSE) {
|
|
|
- //$errorMsg .= ' Only can upload PDF/Excel/Doc file;';
|
|
|
- $errorMsg = $_FILES['file']["name"][$i].' must PDF Type.';
|
|
|
+ $errorMsg = $_FILES['file']["name"][$i].', File type error.';
|
|
|
+ //continue;
|
|
|
}
|
|
|
|
|
|
$filename = $bol."_".$format['standard']."_V".($i+1+$num). "." . $exten;
|
|
|
@@ -231,25 +227,26 @@ class ocean_order {
|
|
|
continue;
|
|
|
}
|
|
|
} else {
|
|
|
- //读取文件内容后,重新生成无宏版本文件,支持docx,xlsx
|
|
|
- // $from_filename = $file_name[$i];
|
|
|
- // $inputFileName = $save_path . $from_filename;
|
|
|
- // $outputFileName = $save_path . $filename;
|
|
|
- // if(move_uploaded_file($_FILES['file']['tmp_name'][$i],$outputFileName)){
|
|
|
- // $outputFileName = $save_path . $filename;
|
|
|
- // //按outputFileName路径重新生成文件,并且删除旧文件(inputFileName)
|
|
|
- // //utils::removeFIlemacro($inputFileName,$outputFileName,$exten);
|
|
|
- // //utils::hasMacros($outputFileName);
|
|
|
- // //utils::checkExcelMacros($outputFileName,$filename_no_exten);
|
|
|
- // $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,
|
|
|
- // online_format,format_serailno,source_filename)
|
|
|
- // values ('" . common::check_input($filename) . "','" . common::check_input($save_path) . "', now(), '" . common::ip() . "',
|
|
|
- // '" . common::check_input(_getLoginName()) . "','" . common::check_input(strtoupper($bol)) . "', '$order_type', '" . common::check_input($file_size) . "',
|
|
|
- // 't', '" . common::check_input($origin_station) . "', '" .common::check_input($destination_station) . "',
|
|
|
- // '" . common::check_input($from_station) . "', '" . $serial_no . "',
|
|
|
- // '" . common::check_input($file_type) . "','" . common::check_input($format_serialno) . "','" . common::check_input($filename) . "');";
|
|
|
- // }
|
|
|
+ $outputFileName = $save_path . $filename;
|
|
|
+ if(move_uploaded_file($_FILES['file']['tmp_name'][$i],$outputFileName)){
|
|
|
+ //判断文件时候待宏,如果则这删除
|
|
|
+ if(utils::hasMacros($outputFileName)){
|
|
|
+ unlink($outputFileName);
|
|
|
+ $errorMsg = "Upload Filed Has Macros,Please remove and re-upload.";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $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,
|
|
|
+ online_format,format_serailno,source_filename)
|
|
|
+ values ('" . common::check_input($filename) . "','" . common::check_input($save_path) . "', now(), '" . common::ip() . "',
|
|
|
+ '" . common::check_input(_getLoginName()) . "','" . common::check_input(strtoupper($bol)) . "', '$order_type', '" . common::check_input($file_size) . "',
|
|
|
+ 't', '" . common::check_input($origin_station) . "', '" .common::check_input($destination_station) . "',
|
|
|
+ '" . common::check_input($from_station) . "', '" . $serial_no . "',
|
|
|
+ '" . common::check_input($file_type) . "','" . common::check_input($format_serialno) . "','" . common::check_input($filename) . "');";
|
|
|
+ } else {
|
|
|
+ $errorMsg = "Upload Filed Failed.";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
//根据配置,看需要同步文件,
|
|
|
$doc_upload_log_table = $transport_mode == "sea" ? "ra_online_doc_upload_log" : "air_doc_upload_log";
|
|
|
@@ -272,8 +269,6 @@ class ocean_order {
|
|
|
$sql .= "INSERT INTO public.$doc_upload_log_table(serial_no, station, download_time)
|
|
|
VALUES ('".$serial_no."', '" .common::check_input($origin_station) . "', now());";
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
//根据配置发送通知邮件 相同文件类型只提醒一次
|
|
|
if(!empty($format['notify_station']) && empty($errorMsg)){
|
|
|
@@ -284,7 +279,7 @@ class ocean_order {
|
|
|
$ks_from = empty($ks_from)? 'f' : $ks_from;
|
|
|
$ks_to = empty($ks_to)? 'f' : $ks_to;
|
|
|
if($ks_from == "f" && $ks_to == "f"){
|
|
|
- $errorMsg = "Both Non Ksmart,pls checked";
|
|
|
+ $errorMsg = "Both Non Ksmart,Please checked.";
|
|
|
}
|
|
|
|
|
|
$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");
|
|
|
@@ -440,6 +435,7 @@ class ocean_order {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //代表前面有错误发生,终止SQL的执行
|
|
|
if (!empty($errorMsg)) {
|
|
|
$data = array(
|
|
|
'msg' => $errorMsg
|
|
|
@@ -790,7 +786,7 @@ class ocean_order {
|
|
|
$textSearch_arr = str_replace(",", ";", $textSearch_arr);
|
|
|
$textSearch_arr = array($textSearch_arr);
|
|
|
}
|
|
|
- $more_param = common::getInNotInSqlForSearch(strtolower(implode(';',$textSearch_arr)));
|
|
|
+ $more_param = common::getInNotInSqlForSearch(strtolower(utils::implode(';',$textSearch_arr)));
|
|
|
//$sqlWhere .= " and (ARRAY[$more_param] && array_append(array[lower(booking_no)::text,lower(h_bol)::text, lower(po_no),lower(carrier_booking),lower(tracking_no)],''))";
|
|
|
$sqlWhere .= " and ((ARRAY[$more_param] && array_append(ARRAY[lower(booking_no::text), lower(h_bol::text), lower(m_bol), lower(carrier_booking), lower(quote_no), lower(tracking_no)]||string_to_array(lower(ctnrs),','), ''::text))
|
|
|
or lower(po_no) like '%" . strtolower(common::check_input($_POST["_textSearch"])) . "%'
|
|
|
@@ -804,10 +800,10 @@ class ocean_order {
|
|
|
if(!is_array($transport_mode)){
|
|
|
$transport_mode = array($transport_mode);
|
|
|
}
|
|
|
- if((count($transport_mode) == 1 && strtolower($transport_mode[0]) == 'all')){
|
|
|
+ if((utils::count($transport_mode) == 1 && strtolower($transport_mode[0]) == 'all')){
|
|
|
$transport_mode = array("sea","air","road");
|
|
|
}
|
|
|
- $transport_mode = implode(";",$transport_mode);
|
|
|
+ $transport_mode = utils::implode(";",$transport_mode);
|
|
|
|
|
|
$mode_param = common::getInNotInSqlForSearch($transport_mode);
|
|
|
$sqlWhere .= " and transport_mode in ($mode_param)";
|