Skip to content
This repository
tree: 1a00958f5a
Fetching contributors…

Cannot retrieve contributors at this time

file 51 lines (46 sloc) 1.513 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
# Copyright 2002-2007 Interchange Development Group and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. See the LICENSE file for details.
#
# $Id: write_shipping.coretag,v 1.6 2007-03-30 23:40:54 pajamian Exp $

UserTag write-shipping Order file
UserTag write-shipping PosNumber 1
UserTag write-shipping addAttr
UserTag write-shipping Version $Revision: 1.6 $
UserTag write-shipping Routine <<EOR
sub {
my ($file, $opt) = @_;
if(! $file) {
unless($file = $Vend::Cfg->{Special}{'shipping.asc'}) {
my $dir = $Vend::Cfg->{Shipping}{dir} || $Vend::Cfg->{ProductDir};
$file = Vend::Util::catfile($dir,'shipping.asc');
}
}

## This is set so the UI knows where to check for changes
$::Scratch->{ui_shipping_asc} = $file;

my $lines = $Vend::Cfg->{Shipping_line};
my @outlines;
for (@$lines) {
# 0 1 2 3 4 5 6 7
# ($mode, $desc, $crit, $min, $max, $cost, $query, $opt)
my @line = @$_;
my $opt = '';
if (ref($line[7]) =~ /HASH/) {
$line[7] = uneval_it($line[7]);
}
push @outlines, \@line;
}

# Back the file up
$Tag->backup_file($file);

open(SHIPOUT, ">$file")
or die errmsg("Can't write shipping to %s: %s", $file, $!);
for(@outlines) {
print SHIPOUT join "\t", @$_;
print SHIPOUT "\n";
}
close SHIPOUT;
}
EOR
Something went wrong with that request. Please try again.