Change the generic tax driver to remove spaces around commas when adding a new row. Add tests and a convenience method for getting one line of tax information. Upgrade sub fixes any information already in the db.
This commit is contained in:
parent
6ac46be8bd
commit
2bcda0c9f5
5 changed files with 69 additions and 7 deletions
|
|
@ -83,6 +83,10 @@ sub add {
|
|||
unless exists($params->{taxRate}) and defined $params->{taxRate};
|
||||
|
||||
$params->{taxId} = 'new';
|
||||
##Remove spaces around commas, which will break tax lookups
|
||||
foreach my $param (qw/country city state code/) {
|
||||
$params->{$param} =~ s/\s*,\s*/,/g;
|
||||
}
|
||||
my $id = $self->session->db->setRow('tax_generic_rates', 'taxId', $params);
|
||||
return $id;
|
||||
}
|
||||
|
|
@ -222,6 +226,24 @@ sub getAllItems {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getItem ( $taxId )
|
||||
|
||||
Returns all data for one tax item as a hash reference.
|
||||
|
||||
=head3 $taxId
|
||||
|
||||
The identifier for the row of tax data to return.
|
||||
|
||||
=cut
|
||||
|
||||
sub getItem {
|
||||
my $self = shift;
|
||||
my $result = $self->session->db->quickHashRef('select * from tax_generic_rates where taxId=?',[shift]);
|
||||
return $result;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getItems ( )
|
||||
|
||||
Returns a WebGUI::SQL::Result object for accessing all of the data in the tax table. This
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue