]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/DB/Buchungsgruppe.pm
Typos in Doku
[kivitendo-erp.git] / SL / DB / Buchungsgruppe.pm
index eb467c541b5791ed5aca4c235fd52b0a16d09e2a..9074fb90bfd41ed4a9bbea001b94bbaf3a8c7237 100644 (file)
@@ -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;
 }