From 8e597aa6979cc414c64224ef1f8c452a4ee78ad5 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: Fri, 16 Jul 2021 15:39:11 +0800 Subject: Origin is set in the template tag --- config/pikul_cost.tag | 19 +++++++++++++------ products/ship/shipping.asc | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/config/pikul_cost.tag b/config/pikul_cost.tag index 75e84b9..eb99dde 100644 --- a/config/pikul_cost.tag +++ b/config/pikul_cost.tag @@ -1,21 +1,28 @@ -UserTag pikul_cost Order company origin district city province weight service +UserTag pikul_cost Order company service district city province weight UserTag pikul_cost Routine <{PIKUL_ANTERAJA}) { @provisions = ( "$Global::Variable->{ANTERAJA_BASE_PATH}", "$Global::Variable->{ANTERAJA_ACCESS_KEY_ID}", "$Global::Variable->{ANTERAJA_SECRET_ACCESS_KEY}" ); + $origin = $::Variable->{ANTERAJA_ORIGIN}; $table = 'anteraja'; } use Pikul; Pikul::init($company, \@provisions); - my $cost = Pikul::cost($origin, $Tag->query({sql => "SELECT code FROM $table WHERE \ - district='$district' AND city='$city' AND province='$province'", - wantarray => 1})->[0]->[0] || '', $weight, $service); + my $cost = Pikul::cost( + $origin, + $Tag->query({ + sql => "SELECT code FROM $table WHERE district='$district' AND \ + city='$city' AND province='$province'", + wantarray => 1 + })->[0]->[0] || '', + $weight, + $service); Pikul::cleanup(); return $cost; } diff --git a/products/ship/shipping.asc b/products/ship/shipping.asc index 9af6f2e..cf98af7 100644 --- a/products/ship/shipping.asc +++ b/products/ship/shipping.asc @@ -1,3 +1,3 @@ anteraja_reg: Anteraja Regular crit weight - cost f [pikul_cost company=0 origin='@_ANTERAJA_ORIGIN_@' district='[evalue address3]' city='[evalue city]' province='[evalue state]' weight=@@TOTAL@@ service='REG'] + cost f [pikul_cost company=__PIKUL_ANTERAJA__ service='REG' district='[evalue address2]' city='[evalue city]' province='[evalue state]' weight=@@TOTAL@@] -- cgit v1.2.3