X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/0701c7ef6828c8ab64e3381d4b69bf8d9ac1d870..008b51c43d064b8172168aee7fdff393c5d4b13a:/SL/DB/PriceFactor.pm diff --git a/SL/DB/PriceFactor.pm b/SL/DB/PriceFactor.pm index af8b4ef2a..e5fab1ce7 100644 --- a/SL/DB/PriceFactor.pm +++ b/SL/DB/PriceFactor.pm @@ -8,6 +8,26 @@ use SL::DB::Helper::ActsAsList; __PACKAGE__->meta->initialize; +sub orphaned { + my ($self) = @_; + + die 'not an accessor' if @_ > 1; + + require SL::DB::DeliveryOrderItem; + require SL::DB::InvoiceItem; + require SL::DB::OrderItem; + require SL::DB::Part; + + return 1 if !$self->id; + + return 0 if SL::DB::Manager::DeliveryOrderItem->get_first(query => [ price_factor_id => $self->id ]); + return 0 if SL::DB::Manager::InvoiceItem ->get_first(query => [ price_factor_id => $self->id ]); + return 0 if SL::DB::Manager::OrderItem ->get_first(query => [ price_factor_id => $self->id ]); + return 0 if SL::DB::Manager::Part ->get_first(query => [ price_factor_id => $self->id ]); + + return 1; +} + 1; __END__