Tax: add the delete method, with tests

This commit is contained in:
Colin Kuskie 2008-02-16 05:36:25 +00:00
parent 19591d37d4
commit 645c21bc3b
2 changed files with 58 additions and 1 deletions

View file

@ -3,6 +3,7 @@ package WebGUI::Shop::Tax;
use strict;
use Class::InsideOut qw{ :std };
use Carp qw(croak);
=head1 NAME
@ -67,6 +68,33 @@ sub add {
#-------------------------------------------------------------------
=head2 delete ( [$params] )
Deletes data from the tax table by taxId.
=head3 $params
A hashref containing the taxId of the data to delete from the table.
=head4 taxId
The taxId of the data to delete from the table.
=cut
sub delete {
my $self = shift;
my $params = shift;
croak "Must pass in a hashref"
unless ref($params) eq 'HASH';
croak "Hash ref must contain a taxId key with a defined value"
unless exists($params->{taxId}) and defined $params->{taxId};
$self->session->db->write('delete from tax where taxId=?', [$params->{taxId}]);
return;
}
#-------------------------------------------------------------------
=head2 getItems ( )
Returns a WebGUI::SQL::Result object for accessing all of the data in the tax table. This