[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
[mv] Bug Report and fix: errata
****** message to minivend-users from Murray Gibbins <murray@scotweb.ltd.uk> ******
I've found a potenial bug in the salestax.asc file
if the line...
"SCO<tab>.175"
is in the file it works fine and uses VAT of 17.5%
however a line of
"SCO<tab>.175 "
with the extra space at the end causes it to be interpreted as a fixed price.
the Minivend code concerned is in Data.pm.....
First the code, then the fix :-)
oop's that should have read.....
Fix 2
=====================================================
# Read in the sales tax file.
sub read_salestax {
my($code, $percent);
return unless $Vend::Cfg->{SalesTax};
my $file = Vend::Util::catfile($Vend::Cfg->{ProductDir}, "salestax.asc");
$Vend::Cfg->{SalesTaxTable} = {};
open(Vend::SALESTAX, $file) or do {
logError( "Could not open salestax file %s: %s" ,
$file,
$!
)
if ! $Vend::Cfg->{SalesTaxFunction};
return undef;
};
while(<Vend::SALESTAX>) {
chomp;
tr/\r//d;
($code, $percent) = split(/\s+/, $_, 2); # this causes the extra space
foreach my $list_elements ($code, $percent){
$list_elements =~ s/\s*$//o;
$list_elements =~ s/^\s*//o;
}
if($percent =~ m/S$/o){
$percent =~ s/S$//o; # remove the "S"
$percent .= " ";
} # allow a static value
# not a percent if "S" is appended to the
# VAT number.
$Vend::Cfg->{SalesTaxTable}->{"\U$code"} = $percent;
}
close Vend::SALESTAX;
if(not defined $Vend::Cfg->{SalesTaxTable}->{DEFAULT}) {
$Vend::Cfg->{SalesTaxTable}->{DEFAULT} = 0;
}
1;
}
===========================================================
Fix 2 allows static VAT values to be entered useing ".175S" in salestax.asc
Yours
____
\__/ Murray Gibbins murray@scotweb.ltd.uk
/ \ Programmer
_ \__/ _ ================================================
\\ || // Scotweb Limited, info@scotweb.ltd.uk
\\||// 13a Albert Terrace, http://www.scotweb.ltd.uk
\||/ Edinburgh EH10 5EA Tel: +44 (0) 131 270 82 33
|| Scotland. Europe. Fax: +44 (0) 7020 93 49 04
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list