ShuanghongS 1 năm trước cách đây
mục cha
commit
c4d14a8493

+ 18 - 0
libs/config.ini.php

@@ -27,6 +27,24 @@ $db = NewADOConnection($_DB['type']);
 $db->Connect($db_url) or die('Connect Database Error');
 $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
 
+//打開詳細頁面時指定模式
+if (!empty($_REQUEST['_schemas'])) {
+    $db->Execute("SET search_path TO " . $_REQUEST['_schemas'] . ";");
+} elseif (!empty($_REQUEST['__schemas'])) {//部分report
+    $db->Execute("SET search_path TO " . $_REQUEST['__schemas'] . ";");
+} else {
+    //超级管理员有没有选择数据库模式
+    if (!empty($_SESSION['_current_schemas'])) {
+        $db->Execute("SET search_path TO " . $_SESSION['_current_schemas'] . ";");
+    } else {
+        if (empty($_SESSION['ONLINE_USER']['main_schemas'])) {
+            $db->Execute("SET search_path TO public;");
+        } else {
+            $db->Execute("SET search_path TO " . $_SESSION['ONLINE_USER']['main_schemas'] . ";");
+        }
+    }
+}
+
 $_VERSION = 'RAO 1.0.0.8';
 $_COPYRIGHT = 'Copyright @ 2009 United Software Applications,Inc.';
 ?>

+ 2 - 2
main_new_version.php

@@ -71,7 +71,7 @@ switch ($action) {
         //$bdate = "null";
 
         $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
-        $sqlWhere = common::check_input($sqlWhere);
+        //$sqlWhere = common::check_input($sqlWhere);
         $sqlWhere = " " . $sqlWhere;
         //online_order_status_date_new 与本地的区分,发布上去这去掉new
         $list = common::excuteListSql("select * from public.online_order_status_date('$type'::text, 'eta'::text, 'etd'::text, $bdate, $edate, '$sqlWhere'::text, '$container_type'::text) "
@@ -126,7 +126,7 @@ switch ($action) {
         //$bdate = "null";
 
         $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
-        $sqlWhere = common::check_input($sqlWhere);
+        //$sqlWhere = common::check_input($sqlWhere);
         $sqlWhere = " " . $sqlWhere;
 
         $list = common::excuteListSql("select * from public.online_order_status_date_kpi_new('$type'::text,'$sqlWhere'::text) "

+ 8 - 4
service/ocean_booking.class.php

@@ -299,6 +299,10 @@ class ocean_booking {
     private function _booking_detail() {
         $serial_no = common::deCode($_GET['a'], 'D');
         $status = common::deCode($_GET['status'], 'D');
+        $_schemas = $_GET['_schemas'];
+        if($_schemas == 'public'){
+            $_schemas = "ocean";
+        }
         $sql = "SELECT o.serial_no, o.booking_no as _booking_no, o.* ,sh.*, cn.* ,aa.*,dd.* from ocean o
             LEFT JOIN LATERAL ( SELECT company as cn_company,
                 address_1 as cn_address_1,
@@ -307,7 +311,7 @@ class ocean_booking {
                 address_4 as cn_address_4,
                 city as cn_city, state as cn_state, zipcode as cn_zipcode, country as cn_country,
                 phone_1 as cn_phone
-            FROM contacts c WHERE o.consignee::text = c.contact_id::text) cn ON true
+            FROM $_schemas.contacts c WHERE o.consignee::text = c.contact_id::text) cn ON true
             LEFT JOIN LATERAL ( SELECT company as sh_company,
                 address_1 as sh_address_1,
                 address_2 as sh_address_2,
@@ -315,7 +319,7 @@ class ocean_booking {
                 address_4 as sh_address_4,
                 city as sh_city, state as sh_state, zipcode as sh_zipcode, country as sh_country,
                 phone_1 as sh_phone
-            FROM contacts c WHERE o.shipper::text = c.contact_id::text) sh ON true
+            FROM $_schemas.contacts c WHERE o.shipper::text = c.contact_id::text) sh ON true
             LEFT JOIN LATERAL ( SELECT company as aa_company,
                 address_1 as aa_address_1,
                 address_2 as aa_address_2,
@@ -323,7 +327,7 @@ class ocean_booking {
                 address_4 as aa_address_4,
                 city as aa_city, state as aa_state, zipcode as aa_zipcode, country as aa_country,
                 phone_1 as aa_phone
-            FROM contacts c WHERE o.origin_station::text = c.contact_id::text) aa ON true
+            FROM $_schemas.contacts c WHERE o.origin_station::text = c.contact_id::text) aa ON true
             LEFT JOIN LATERAL ( SELECT company as dd_company,
                 address_1 as dd_address_1,
                 address_2 as dd_address_2,
@@ -331,7 +335,7 @@ class ocean_booking {
                 address_4 as dd_address_4,
                 city as dd_city, state as dd_state, zipcode as dd_zipcode, country as dd_country,
                 phone_1 as dd_phone
-            FROM contacts c WHERE o.destination_station::text = c.contact_id::text) dd ON true
+            FROM $_schemas.contacts c WHERE o.destination_station::text = c.contact_id::text) dd ON true
         where lower(serial_no) = '" . strtolower($serial_no) . "'";
         $ocean = common::excuteObjectSql($sql);
 

+ 8 - 4
service/ocean_order.class.php

@@ -1157,6 +1157,10 @@ class ocean_order {
     }
 
     private function getOceanDetail($serial_no) {
+        $_schemas = $_REQUEST['_schemas'];
+        if($_schemas == 'public'){
+            $_schemas = "ocean";
+        }
         $sql = "SELECT m_eta as _m_eta,  h_bol as _h_bol, m_bol as _m_bol,job_no as _job_bol,
                 public.z_get_eta_dest(o.final_eta::date, o.eta_dest::text, o.service::text, o.m_eta::date, o.place_of_delivery::text, o.mport_of_discharge::text) as _eta_dest, 
                 to_char(final_eta, 'MM/DD/YYYY') as _final_eta,
@@ -1180,7 +1184,7 @@ class ocean_order {
                 address_4 as cn_address_4,
                 city as cn_city, state as cn_state, zipcode as cn_zipcode, country as cn_country,
                 phone_1 as cn_phone
-            FROM contacts c WHERE o.consignee::text = c.contact_id::text) cn ON true
+            FROM $_schemas.contacts c WHERE o.consignee::text = c.contact_id::text) cn ON true
             LEFT JOIN LATERAL ( SELECT company as sh_company,
                 address_1 as sh_address_1,
                 address_2 as sh_address_2,
@@ -1188,7 +1192,7 @@ class ocean_order {
                 address_4 as sh_address_4,
                 city as sh_city, state as sh_state, zipcode as sh_zipcode, country as sh_country,
                 phone_1 as sh_phone
-            FROM contacts c WHERE o.shipper::text = c.contact_id::text) sh ON true
+            FROM $_schemas.contacts c WHERE o.shipper::text = c.contact_id::text) sh ON true
             LEFT JOIN LATERAL ( SELECT company as aa_company,
                 address_1 as aa_address_1,
                 address_2 as aa_address_2,
@@ -1196,7 +1200,7 @@ class ocean_order {
                 address_4 as aa_address_4,
                 city as aa_city, state as aa_state, zipcode as aa_zipcode, country as aa_country,
                 phone_1 as aa_phone
-            FROM contacts c WHERE o.origin_station::text = c.contact_id::text) aa ON true
+            FROM $_schemas.contacts c WHERE o.origin_station::text = c.contact_id::text) aa ON true
             LEFT JOIN LATERAL ( SELECT company as dd_company,
                 address_1 as dd_address_1,
                 address_2 as dd_address_2,
@@ -1204,7 +1208,7 @@ class ocean_order {
                 address_4 as dd_address_4,
                 city as dd_city, state as dd_state, zipcode as dd_zipcode, country as dd_country,
                 phone_1 as dd_phone
-            FROM contacts c WHERE o.destination_station::text = c.contact_id::text) dd ON true
+            FROM $_schemas.contacts c WHERE o.destination_station::text = c.contact_id::text) dd ON true
         where lower(serial_no) = '" . strtolower($serial_no) . "'";
         return $sql;
     }

+ 2 - 2
utils/common.class.php

@@ -1182,7 +1182,7 @@ class common {
         $shipment_mode_arr = array("air","sea","road");
 
         $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
-        $sqlWhere = common::check_input($sqlWhere);
+        //$sqlWhere = common::check_input($sqlWhere);
         $sqlWhere = " " . $sqlWhere;
 
         $ContainerCount_Title = array();
@@ -1257,7 +1257,7 @@ class common {
 
     public static function getTopBar(){
         $sqlWhere = ' and ' . common::searchExtendHandNew("ocean", $_SESSION["ONLINE_USER"]);
-        $sqlWhere = common::check_input($sqlWhere);
+        //$sqlWhere = common::check_input($sqlWhere);
         $sqlWhere = " " . $sqlWhere;
 
         $shippr_uncode_10_sql = "select count(shippr_uncode) as num,shippr_uncode from online_ocean  where 1=1 $sqlWhere group by shippr_uncode order by num desc limit 10";