X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/d7a9026aeace4b76b815a276c61b90feac1724f8..36703a86a998c7c395f110f94b3b3feebc2a3a80:/SL/DB/Buchungsgruppe.pm diff --git a/SL/DB/Buchungsgruppe.pm b/SL/DB/Buchungsgruppe.pm index e71d0f270..d3ddcccb1 100644 --- a/SL/DB/Buchungsgruppe.pm +++ b/SL/DB/Buchungsgruppe.pm @@ -25,18 +25,6 @@ sub validate { return @errors; } -sub inventory_accno { - my ($self) = @_; - require SL::DB::Manager::Chart; - return SL::DB::Manager::Chart->find_by(id => $self->inventory_accno_id) ? SL::DB::Manager::Chart->find_by(id => $self->inventory_accno_id)->accno() : undef; -} - -sub inventory_accno_description { - my ($self) = @_; - require SL::DB::Manager::Chart; - return SL::DB::Manager::Chart->find_by(id => $self->inventory_accno_id) ? SL::DB::Manager::Chart->find_by(id => $self->inventory_accno_id)->description() : undef; -} - sub income_accno_id { my ($self, $taxzone) = @_; @@ -84,6 +72,15 @@ sub taxzonecharts { my ($self) = @_; return SL::DB::Manager::TaxzoneChart->get_all(where => [ buchungsgruppen_id => $self->id ]); } + +sub orphaned { + my ($self) = @_; + die 'not an accessor' if @_ > 1; + + require SL::DB::Part; + return 0 if SL::DB::Manager::Part->get_all_count(query => [ buchungsgruppen_id => $self->id ]); + return 1; +} 1; __END__ @@ -103,26 +100,29 @@ SL::DB::Buchungsgruppe - RDBO wrapper for the C table =item C Return the chart ID for the expense account for the given taxzone -(either an integer between 0 and 3 inclusively or an instance of -L). +(either the DB id or an instance of L). =item C Return the chart (an instance of L) for the expense -account for the given taxzone (either an integer between 0 and 3 -inclusively or an instance of L). +account for the given taxzone (either the DB id or an instance of +L). =item C Return the chart ID for the income account for the given taxzone -(either an integer between 0 and 3 inclusively or an instance of +(either the DB id or an instance of L). L). =item C Return the chart (an instance of L) for the income -account for the given taxzone (either an integer between 0 and 3 -inclusively or an instance of L). +account for the given taxzone (either the DB id or an instance of +L). + +=item C + +Checks whether this Buchungsgruppe is assigned to any parts. =back