X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/e8c424de675ba308c1eb478403402d5474276c45..a28a585e4cc989f4428d47352ef5f118035c237f:/SL/DB/Buchungsgruppe.pm diff --git a/SL/DB/Buchungsgruppe.pm b/SL/DB/Buchungsgruppe.pm index eb467c541..9074fb90b 100644 --- a/SL/DB/Buchungsgruppe.pm +++ b/SL/DB/Buchungsgruppe.pm @@ -21,6 +21,13 @@ sub validate { my @errors; push @errors, $::locale->text('The description is missing.') if !$self->description; + if( $self->inventory_accno_id ) { + require SL::DB::Chart; + my $inventory_accno = SL::DB::Manager::Chart->find_by( id => $self->inventory_accno_id ); + push(@errors, $::locale->text('Buchungsgruppe #1 needs a valid inventory account', $self->description)) unless $inventory_accno; + } else { + push @errors, $::locale->text('The Buchungsgruppe needs an inventory account.'); + }; return @errors; }