From 45764298d40087327c5947f2eaf74b3ea32a7b69 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: Wed, 14 Jul 2021 12:28:31 +0800 Subject: 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 --- config/pikul_cost.tag | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/config/pikul_cost.tag b/config/pikul_cost.tag index 0906414..f8e656c 100644 --- a/config/pikul_cost.tag +++ b/config/pikul_cost.tag @@ -2,27 +2,26 @@ UserTag pikul_cost Order company district city province weight service UserTag pikul_cost Routine <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'; - } - when (1) { - @provisions = ( - "$Tag->var('SICEPAT_API_KEY', 2)" - ); - $origin = "$Tag->var('SICEPAT_ORIGIN', 2)"; - $table = 'sicepat_destination'; - } + 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'; + } elsif ($company == 1) { + @provisions = ( + "$Global::Variable->{SICEPAT_API_KEY}" + ); + $origin = "$Global::Variable->{SICEPAT_ORIGIN}"; + $table = 'sicepat_destination'; } 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); -- cgit v1.2.3