diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/pikul.tag | 20 | ||||
-rw-r--r-- | config/pikul_cost.tag | 6 | ||||
-rw-r--r-- | config/pikul_order.tag | 7 |
3 files changed, 33 insertions, 0 deletions
diff --git a/config/pikul.tag b/config/pikul.tag index db2d8ea..0164851 100644 --- a/config/pikul.tag +++ b/config/pikul.tag @@ -43,6 +43,26 @@ sub { wantarray => 1})->[0]->[0] || ''; $code_prefixes[$company] = 'anteraja_'; $name_prefixes[$company] = 'Anteraja '; + } elsif ($company == $::Variable->{PIKUL_SICEPAT}) { + my $api_key = $::Variable->{SICEPAT_API_KEY} + || $Global::Variable->{SICEPAT_API_KEY}; + if (!$api_key) { + $origins[$company] = undef; + $destinations[$company] = undef; + $code_prefixes[$company] = undef; + $name_prefixes[$company] = undef; + next; + } + Pikul::init($company, [ + $api_key + ]); + $origins[$company] = $::Variable->{SICEPAT_ORIGIN} + || $Global::Variable->{SICEPAT_ORIGIN}; + $destinations[$company] = $Tag->query({sql => "SELECT code FROM sicepat_destination\ + WHERE district='$district' AND city='$city' AND \ + province='$province'", wantarray => 1})->[0]->[0] || ''; + $code_prefixes[$company] = 'sicepat_'; + $name_prefixes[$company] = 'SiCepat '; } } my $elements = Pikul::html( diff --git a/config/pikul_cost.tag b/config/pikul_cost.tag index 4b8aad0..199e503 100644 --- a/config/pikul_cost.tag +++ b/config/pikul_cost.tag @@ -11,6 +11,12 @@ sub { ); $origin = $::Variable->{ANTERAJA_ORIGIN}; $table = 'anteraja'; + } elsif ($company == $::Variable->{PIKUL_SICEPAT}) { + @provisions = ( + $Global::Variable->{SICEPAT_API_KEY} + ); + $origin = $::Variable->{SICEPAT_ORIGIN}; + $table = 'sicepat_destination'; } use Pikul; Pikul::init($company, \@provisions); diff --git a/config/pikul_order.tag b/config/pikul_order.tag index f8bf255..35845f6 100644 --- a/config/pikul_order.tag +++ b/config/pikul_order.tag @@ -21,6 +21,13 @@ sub { $Global::Variable->{ANTERAJA_PREFIX} ); $origin = $::Variable->{ANTERAJA_ORIGIN}; + } elsif (substr($table, 0, 7) eq 'sicepat') { + $company = $::Variable->{PIKUL_SICEPAT}; + @provisions = ( + $Global::Variable->{SICEPAT_API_KEY} + ); + $origin = $::Variable->{SICEPAT_ORIGIN}; + $table .= '_destination'; } my @items = @{$Tag->query({sql => "SELECT sku,quantity FROM orderline WHERE \ order_number='$order_number'", |