X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FPriceFactor.pm;h=e5fab1ce7368a0a17c5e27f8f4f2ec8d83c6b1a9;hb=4c3c1d8ca30914dde03f68b816526015e91360bb;hp=af8b4ef2a65b9747206ace81a711b987718c81af;hpb=0701c7ef6828c8ab64e3381d4b69bf8d9ac1d870;p=kivitendo-erp.git 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__