diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-16 15:39:11 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-16 15:39:11 +0800 |
commit | 8e597aa6979cc414c64224ef1f8c452a4ee78ad5 (patch) | |
tree | 0fb5051b6d2600ab49dae381e01c551ffd09a39d /config | |
parent | 5638731b0464e5b12f7c04fba3e0010ca1f5fca6 (diff) |
Origin is set in the template tag
Diffstat (limited to 'config')
-rw-r--r-- | config/pikul_cost.tag | 19 |
1 files changed, 13 insertions, 6 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 <<EOR sub { - my ($company, $origin, $district, $city, $province, $weight, $service) = @_; - my (@provisions, $table); + my ($company, $service, $district, $city, $province, $weight) = @_; + my (@provisions, $origin, $table); if ($company == $::Variable->{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; } |