SimpleSystemSetting: Umstellung von »Preisfaktoren«
[kivitendo-erp.git] / SL / DB / PriceFactor.pm
1 package SL::DB::PriceFactor;
2
3 use strict;
4
5 use SL::DB::MetaSetup::PriceFactor;
6 use SL::DB::Manager::PriceFactor;
7 use SL::DB::Helper::ActsAsList;
8
9 __PACKAGE__->meta->initialize;
10
11 sub orphaned {
12   my ($self) = @_;
13
14   die 'not an accessor' if @_ > 1;
15
16   require SL::DB::DeliveryOrderItem;
17   require SL::DB::InvoiceItem;
18   require SL::DB::OrderItem;
19   require SL::DB::Part;
20
21   return 1 if !$self->id;
22
23   return 0 if SL::DB::Manager::DeliveryOrderItem->get_first(query => [ price_factor_id => $self->id ]);
24   return 0 if SL::DB::Manager::InvoiceItem      ->get_first(query => [ price_factor_id => $self->id ]);
25   return 0 if SL::DB::Manager::OrderItem        ->get_first(query => [ price_factor_id => $self->id ]);
26   return 0 if SL::DB::Manager::Part             ->get_first(query => [ price_factor_id => $self->id ]);
27
28   return 1;
29 }
30
31 1;
32
33 __END__
34
35 =pod
36
37 =head1 NAME
38
39 SL::DB::PriceFactor: Model for the 'price_factors' table
40
41 =head1 SYNOPSIS
42
43 This is a standard Rose::DB::Object based model and can be used as one.
44
45 =head1 FUNCTIONS
46
47 None so far.
48
49 =head1 AUTHOR
50
51 Moritz Bunkus E<lt>m.bunkus@linet-services.deE<gt>
52
53 =cut