diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-14 12:28:31 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-14 13:21:50 +0800 |
commit | 517b2b42b5c21c615ad612813239a59ba5ff019b (patch) | |
tree | 9b58bb4be749f9bdff0e2e351611e9c4bf71e6a2 | |
parent | 85bc0f37e4a178f0d25441301316b76282d28d6a (diff) |
Fix so the template tag runs
Variable declarations have to be separated in Perl (or maybe use
parentheses?).
Using given when failed (maybe can't modify variables).
Fix provisions referral.
Template tag can't access catalog settings, I guess.. and the syntax
also has to be the one in GlobalSub.
Reference:
Interchange doc 5.5 -> Glossary -> variable
-rw-r--r-- | config/pikul_cost.tag | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/config/pikul_cost.tag b/config/pikul_cost.tag index 9b36e3b..315b608 100644 --- a/config/pikul_cost.tag +++ b/config/pikul_cost.tag @@ -2,20 +2,20 @@ UserTag pikul_cost Order company district city province weight service UserTag pikul_cost Routine <<EOR sub { my ($company, $district, $city, $province, $weight, $service) = @_; - my @provisions, $origin, $table; - given ($company) { - when (0) { - @provisions = ( - "$Tag->var('ANTERAJA_BASE_PATH', 2)", - "$Tag->var('ANTERAJA_ACCESS_KEY_ID', 2)", - "$Tag->var('ANTERAJA_SECRET_ACCESS_KEY', 2)" - ); - $origin = "$Tag->var('ANTERAJA_ORIGIN', 2)"; - $table = 'anteraja'; - } + my @provisions; + my $origin; + my $table; + if ($company == 0) { + @provisions = ( + "$Global::Variable->{ANTERAJA_BASE_PATH}", + "$Global::Variable->{ANTERAJA_ACCESS_KEY_ID}", + "$Global::Variable->{ANTERAJA_SECRET_ACCESS_KEY}" + ); + $origin = "$Global::Variable->{ANTERAJA_ORIGIN}"; + $table = 'anteraja'; } use Pikul; - Pikul::init($company, $provisions); + 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); |