kivitendo/SL/DB/TaxZone.pm @ 7b1da9c3
4fd22b56 | Sven Schöling | # This file has been auto-generated only because it didn't exist.
|
||
# Feel free to modify it at will; it will not be overwritten automatically.
|
||||
f97b0778 | Sven Schöling | package SL::DB::TaxZone;
|
||
4fd22b56 | Sven Schöling | |||
use strict;
|
||||
f97b0778 | Sven Schöling | use SL::DB::MetaSetup::TaxZone;
|
||
f5c454e3 | Niclas Zimmermann | use SL::DB::Manager::TaxZone;
|
||
use SL::DB::Helper::ActsAsList;
|
||||
4fd22b56 | Sven Schöling | |||
2d7e4203 | Sven Schöling | __PACKAGE__->meta->initialize;
|
||
4fd22b56 | Sven Schöling | # Creates get_all, get_all_count, get_all_iterator, delete_all and update_all.
|
||
f5c454e3 | Niclas Zimmermann | #__PACKAGE__->meta->make_manager_class;
|
||
sub validate {
|
||||
my ($self) = @_;
|
||||
my @errors;
|
||||
push @errors, $::locale->text('The description is missing.') if !$self->description;
|
||||
return @errors;
|
||||
}
|
||||
4fd22b56 | Sven Schöling | |||
bdc944ea | Geoffrey Richardson | sub orphaned {
|
||
my ($self) = @_;
|
||||
die 'not an accessor' if @_ > 1;
|
||||
my @classes = qw(Customer Vendor Invoice Order DeliveryOrder PurchaseInvoice);
|
||||
foreach my $class ( @classes ) {
|
||||
my $module = 'SL::DB::' . $class;
|
||||
eval "require $module";
|
||||
my $manager = 'SL::DB::Manager::' . $class;
|
||||
return 0 if $manager->get_all_count( query => [ taxzone_id => $self->id ] );
|
||||
};
|
||||
return 1;
|
||||
}
|
||||
4fd22b56 | Sven Schöling | 1;
|