X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/5c30247d29f4d03d4f1ec9ecefeab292d060ccdd..bdc944eae9567aa4bd256b56b89f6004890fc585:/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;