diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-14 11:48:48 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-14 11:48:48 +0800 |
commit | 85bc0f37e4a178f0d25441301316b76282d28d6a (patch) | |
tree | 86f63734e09c700d58e38c2bac083443b8acec2f /config | |
parent | 3e8f47da1d2c80285ab08f04e982f4d22d646876 (diff) |
Generalise template_tag so no need for shipping usertag
Diffstat (limited to 'config')
-rw-r--r-- | config/pikul_cost.tag | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/config/pikul_cost.tag b/config/pikul_cost.tag index c8f1052..9b36e3b 100644 --- a/config/pikul_cost.tag +++ b/config/pikul_cost.tag @@ -1,10 +1,24 @@ -UserTag pikul_cost Order company provisions origin destination weight service +UserTag pikul_cost Order company district city province weight service UserTag pikul_cost Routine <<EOR sub { - my ($company, $provisions, $origin, $destination, $weight, $service) = @_; + 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'; + } + } use Pikul; Pikul::init($company, $provisions); - my $cost = Pikul::cost($origin, $destination, $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; } |