-sub check_taxzone {
- my ($self, $entry) = @_;
-
- my $object = $entry->{object};
-
- # Check wether or not taxzone ID is valid.
- if ($object->taxzone_id && !$self->taxzones_by->{id}->{ $object->taxzone_id }) {
- push @{ $entry->{errors} }, $::locale->text('Error: Invalid tax zone');
- return 0;
- }
-
- # Map description to ID if given.
- if (!$object->taxzone_id && $entry->{raw_data}->{taxzone}) {
- my $taxzone = $self->taxzones_by->{description}->{ $entry->{raw_data}->{taxzone} };
- if (!$taxzone) {
- push @{ $entry->{errors} }, $::locale->text('Error: Invalid tax zone');
- return 0;
- }
-
- $object->taxzone_id($taxzone->id);
- }
-
- return 1;
-}
-