Bladeren bron

fixed city_timezone

ShuanghongS 1 jaar geleden
bovenliggende
commit
7621463194
4 gewijzigde bestanden met toevoegingen van 29 en 29 verwijderingen
  1. 5 5
      main_new_version.php
  2. 15 15
      service/login.class.php
  3. 8 8
      service/ocean_order.class.php
  4. 1 1
      utils/common.class.php

+ 5 - 5
main_new_version.php

@@ -504,25 +504,25 @@ switch ($action) {
                 }
                 $timezone = "";
                 if($value['dd_code'] == "IFFBCF" || $value['dd_code'] == "IFFCPU"){
-                    $sql = "SELECT (select timezonecode from public.city_ports where ctrycitycode = LEFT(country, 2) || COALESCE(city_code,'')) as timezone
+                    $sql = "SELECT (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'')) as timezone
                          FROM $_schemas.contacts c WHERE  c.contact_id = '".$value['origin']."'";
                     $timezone = common::excuteOneSql($sql);     
                 }
                 if($value['dd_code'] == "IFFREC" || $value['dd_code'] == "IFFDEP"){
-                    $sql = "select timezonecode from public.city_ports where ctrycitycode = '".$value['place_of_receipt_un']."'";
+                    $sql = "select time_zone from public.city_timezone where uncode = '".$value['place_of_receipt_un']."'";
                     $timezone = common::excuteOneSql($sql);
                     if(empty($timezone)){
-                        $sql = "select timezonecode from public.city_ports where ctrycitycode = '".$value['fport_of_loading_un']."'";
+                        $sql = "select time_zone from public.city_timezone where uncode = '".$value['fport_of_loading_un']."'";
                         $timezone = common::excuteOneSql($sql);
                     }     
                 }
                 if($value['dd_code'] == "IFFARR"){
-                    $sql = "select timezonecode from public.city_ports where ctrycitycode = '".$value['mport_of_discharge_un']."'";
+                    $sql = "select time_zone from public.city_timezone where uncode = '".$value['mport_of_discharge_un']."'";
                     $timezone = common::excuteOneSql($sql);
                 }
 
                 if($value['dd_code'] == "IFFAFD"){
-                    $sql = "select timezonecode from public.city_ports where ctrycitycode = '".$value['place_of_delivery_un']."'";
+                    $sql = "select time_zone from public.city_timezone where uncode = '".$value['place_of_delivery_un']."'";
                     $timezone = common::excuteOneSql($sql);
                 }
 

+ 15 - 15
service/login.class.php

@@ -1197,13 +1197,13 @@ class login {
                     mport_of_discharge_un,
                     place_of_receipt_un,
                     place_of_delivery_un,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.fport_of_loading_un limit 1) as pol_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.fport_of_loading_un limit 1) as pol_timezone,
                     (select uncity from public.ports where uncode = oo.fport_of_loading_un limit 1) as pol_uncity,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.mport_of_discharge_un limit 1) as mpod_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.mport_of_discharge_un limit 1) as mpod_timezone,
                     (select uncity from public.ports where uncode = oo.mport_of_discharge_un limit 1) as mpod_uncity,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.place_of_receipt_un limit 1) as por_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.place_of_receipt_un limit 1) as por_timezone,
                     (select uncity from public.ports where uncode = oo.place_of_receipt_un limit 1) as por_uncity,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.place_of_delivery_un limit 1) as pod_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.place_of_delivery_un limit 1) as pod_timezone,
                     (select uncity from public.ports where uncode = oo.place_of_delivery_un limit 1) as pod_uncity,
                     po_no as _po_no,
                     CASE
@@ -1238,7 +1238,7 @@ class login {
                 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,
-                (select timezonecode from public.city_ports where ctrycitycode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as aa_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as aa_timezone
             FROM ocean.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,
@@ -1247,11 +1247,11 @@ class login {
                 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,
-                (select timezonecode from public.city_ports where ctrycitycode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as dd_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as dd_timezone
             FROM ocean.contacts c WHERE o.destination_station::text = c.contact_id::text) dd ON true
             LEFT JOIN LATERAL ( SELECT 
                 city as fd_city,
-                (select timezonecode from public.city_ports where ctrycitycode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as fd_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as fd_timezone
             FROM ocean.contacts c WHERE o.final_desination::text = c.contact_id::text) fd ON true";
         $ocean_arr = common::excuteListSql($sql);
 
@@ -1355,7 +1355,7 @@ class login {
                     to_char(to_timestamp(s.event_time, 'HH24MI'), 'HH24:MI') as eventtime,
                     e.description,s.event_type as eventtype, 
                     s.event_code as eventcode, s.event_city as eventcity,
-                    (select timezonecode from public.city_ports where ctrycitycode = s.event_code) as timezone,
+                    (select time_zone from public.city_timezone where uncode = s.event_code) as timezone,
                     (select uncity from public.ports where uncode = s.event_code) as uncity,
                     case when event ='I'  then 'IFFREC'::text
                         when event ='AE'  then 'IFFONB'::text
@@ -1427,13 +1427,13 @@ class login {
                     mport_of_discharge_un,
                     place_of_receipt_un,
                     place_of_delivery_un,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.fport_of_loading_un limit 1) as pol_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.fport_of_loading_un limit 1) as pol_timezone,
                     (select uncity from public.ports where uncode = oo.fport_of_loading_un limit 1) as pol_uncity,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.mport_of_discharge_un limit 1) as mpod_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.mport_of_discharge_un limit 1) as mpod_timezone,
                     (select uncity from public.ports where uncode = oo.mport_of_discharge_un limit 1) as mpod_uncity,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.place_of_receipt_un limit 1) as por_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.place_of_receipt_un limit 1) as por_timezone,
                     (select uncity from public.ports where uncode = oo.place_of_receipt_un limit 1) as por_uncity,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.place_of_delivery_un limit 1) as pod_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.place_of_delivery_un limit 1) as pod_timezone,
                     (select uncity from public.ports where uncode = oo.place_of_delivery_un limit 1) as pod_uncity,
                     po_no as _po_no,
                     CASE
@@ -1468,7 +1468,7 @@ class login {
                 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,
-                (select timezonecode from public.city_ports where ctrycitycode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as aa_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as aa_timezone
             FROM sfs.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,
@@ -1477,11 +1477,11 @@ class login {
                 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,
-                (select timezonecode from public.city_ports where ctrycitycode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as dd_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as dd_timezone
             FROM sfs.contacts c WHERE o.destination_station::text = c.contact_id::text) dd ON true
             LEFT JOIN LATERAL ( SELECT 
                 city as fd_city,
-                (select timezonecode from public.city_ports where ctrycitycode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as fd_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as fd_timezone
             FROM sfs.contacts c WHERE o.final_desination::text = c.contact_id::text) fd ON true";
         return $sql;
     }

+ 8 - 8
service/ocean_order.class.php

@@ -1109,13 +1109,13 @@ class ocean_order {
                     mport_of_discharge_un,
                     place_of_receipt_un,
                     place_of_delivery_un,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.fport_of_loading_un limit 1) as pol_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.fport_of_loading_un limit 1) as pol_timezone,
                     (select uncity from public.ports where uncode = oo.fport_of_loading_un limit 1) as pol_uncity,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.mport_of_discharge_un limit 1) as mpod_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.mport_of_discharge_un limit 1) as mpod_timezone,
                     (select uncity from public.ports where uncode = oo.mport_of_discharge_un limit 1) as mpod_uncity,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.place_of_receipt_un limit 1) as por_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.place_of_receipt_un limit 1) as por_timezone,
                     (select uncity from public.ports where uncode = oo.place_of_receipt_un limit 1) as por_uncity,
-                    (select timezonecode from public.city_ports where ctrycitycode = oo.place_of_delivery_un limit 1) as pod_timezone,
+                    (select time_zone from public.city_timezone where uncode = oo.place_of_delivery_un limit 1) as pod_timezone,
                     (select uncity from public.ports where uncode = oo.place_of_delivery_un limit 1) as pod_uncity,
                     po_no as _po_no,
                     CASE
@@ -1150,7 +1150,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,
-                (select timezonecode from public.city_ports where ctrycitycode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as aa_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as aa_timezone
             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,
@@ -1159,11 +1159,11 @@ 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,
-                (select timezonecode from public.city_ports where ctrycitycode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as dd_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as dd_timezone
             FROM $_schemas.contacts c WHERE o.destination_station::text = c.contact_id::text) dd ON true
             LEFT JOIN LATERAL ( SELECT 
                 city as fd_city,
-                (select timezonecode from public.city_ports where ctrycitycode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as fd_timezone
+                (select time_zone from public.city_timezone where uncode = LEFT(country, 2) || COALESCE(city_code,'') limit 1) as fd_timezone
             FROM $_schemas.contacts c WHERE o.final_desination::text = c.contact_id::text) fd ON true
         where serial_no = '" . $serial_no . "'";
         //error_log($sql);
@@ -1193,7 +1193,7 @@ class ocean_order {
                     to_char(to_timestamp(s.event_time, 'HH24MI'), 'HH24:MI') as eventtime,
                     e.description,s.event_type as eventtype, 
                     s.event_code as eventcode, s.event_city as eventcity,
-                    (select timezonecode from public.city_ports where ctrycitycode = s.event_code) as timezone,
+                    (select time_zone from public.city_timezone where uncode = s.event_code) as timezone,
                     (select uncity from public.ports where uncode = s.event_code) as uncity,
                     case when event ='I'  then 'IFFREC'::text
                         when event ='AE'  then 'IFFONB'::text

+ 1 - 1
utils/common.class.php

@@ -1626,7 +1626,7 @@ class common {
      */
     public static function getCityPortsInfo($uncodes){
         $data =array();
-        $sql = "select timezonecode,ctrycitycode from public.city_ports where lower(ctrycitycode) ". common::getInNotInSql($uncodes);
+        $sql = "select time_zone as timezonecode,uncode as ctrycitycode from public.city_timezone where lower(uncode) ". common::getInNotInSql($uncodes);
         $uncode_rs = common::excuteListSql($sql);
         foreach($uncode_rs as $value){
             $data[$value['ctrycitycode']] = $value['timezonecode'];