From c8b227b1508ceef861a7f3dc1225ba9bb07735d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Sat, 24 Jul 2021 19:44:11 +0800 Subject: Revert "Destination code relies on district only" This reverts commit f6204deab03d98ff78a999463879a0f9063ff61d. --- config/pikul.tag | 6 ++++-- config/pikul_cost.tag | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/pikul.tag b/config/pikul.tag index 7a447e7..db2d8ea 100644 --- a/config/pikul.tag +++ b/config/pikul.tag @@ -3,6 +3,8 @@ UserTag pikul Routine <value('address2'); + my $city = $Tag->value('city'); + my $province = $Tag->value('state'); my $weight = 0.0; for my $item (@{$Carts->{main}}) { $weight += $Tag->data('products', 'weight', $item->{code}) * $item->{quantity}; @@ -36,8 +38,8 @@ sub { ]); $origins[$company] = $::Variable->{ANTERAJA_ORIGIN} || $Global::Variable->{ANTERAJA_ORIGIN}; - $destinations[$company] = $Tag->query({sql => "SELECT code FROM anteraja WHERE\ - district LIKE '%$district%'", + $destinations[$company] = $Tag->query({sql => "SELECT code FROM anteraja WHERE \ + district='$district' AND city='$city' AND province='$province'", wantarray => 1})->[0]->[0] || ''; $code_prefixes[$company] = 'anteraja_'; $name_prefixes[$company] = 'Anteraja '; diff --git a/config/pikul_cost.tag b/config/pikul_cost.tag index 2b2e5e1..4b8aad0 100644 --- a/config/pikul_cost.tag +++ b/config/pikul_cost.tag @@ -19,7 +19,8 @@ sub { $service, $origin, $Tag->query({ - sql => "SELECT code FROM $table WHERE district LIKE '%$district%'", + sql => "SELECT code FROM $table WHERE district='$district' AND \ + city='$city' AND province='$province'", wantarray => 1 })->[0]->[0] || '', $weight); -- cgit v1.2.3