Preisquellen: Fehlerbehandlung in MakeModel
[kivitendo-erp.git] / SL / PriceSource / Makemodel.pm
index e1146a3..3c5031d 100644 (file)
@@ -30,7 +30,11 @@ sub price_from_source {
 
   my $makemodel = SL::DB::Manager::MakeModel->find_by(id => $spec);
 
-  # TODO: if someone deletes the prices entry, this fails. add a fallback
+  return SL::PriceSource::Price->new(
+    price_source => $self,
+    missing      => t8('This makemodel price does not exist anymore'),
+  ) if !$makemodel;
+
   return $self->make_price_from_makemodel($makemodel);
 
 }
@@ -57,5 +61,4 @@ sub make_price_from_makemodel {
   );
 }
 
-
 1;