X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/f5c454e3855012bdb1928f3e4c4964403d4d8163..3f21f766920411eeb17e21887943e6fb6ff43b5c:/SL/DB/TaxZone.pm diff --git a/SL/DB/TaxZone.pm b/SL/DB/TaxZone.pm index ad96ee259..6545d0854 100644 --- a/SL/DB/TaxZone.pm +++ b/SL/DB/TaxZone.pm @@ -23,4 +23,18 @@ sub validate { return @errors; } +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; +} + 1;