Preisquellen: Fehlerbehandlung in MakeModel
authorSven Schöling <s.schoeling@linet-services.de>
Mon, 19 Oct 2015 12:12:11 +0000 (14:12 +0200)
committerSven Schöling <s.schoeling@linet-services.de>
Mon, 19 Oct 2015 12:12:11 +0000 (14:12 +0200)
SL/PriceSource/Makemodel.pm
locale/de/all

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;
index 96250a3..3d86bbd 100755 (executable)
@@ -2959,6 +2959,7 @@ $self->{texts} = {
   'This is the default bin for parts' => 'Standard-Lagerplatz für Stammdaten/Waren',
   'This is the default warehouse for ignoring onhand' => 'Standardlager für Auslagern ohne Prüfung auf Bestand.',
   'This list is capped at 15 items to keep it fast. If you need a full list, please use reports.' => 'Diese Liste ist auf 15 Zeilen begrenzt. Wenn Sie eine vollständige Liste benötigen, erstellen Sie bitte einen Bericht.',
+  'This makemodel price does not exist anymore' => 'Dieser Lieferantenpries existiert nicht mehr',
   'This means that the user has created an AP transaction and chosen a taxkey for sales taxes, or that he has created an AR transaction and chosen a taxkey for input taxes.' => 'Das bedeutet, dass ein Benutzer eine Kreditorenbuchung angelegt und in ihr einen Umsatzsteuer-Steuerschlüssel verwendet oder eine Debitorenbuchung mit Vorsteuer-Steuerschlüssel angelegt hat.',
   'This module can help you identify and correct such entries by analyzing the general ledger and presenting you likely solutions but also allowing you to fix problems yourself.' => 'Dieses Modul kann Ihnen helfen, problematische Einträge im Hauptbuch zu identifizieren und teilweise zu beheben. Dabei werden je nach Problem mögliche Lösungen aufgezeigt, wobei Sie die entscheiden können, welche Probleme automatisch gelöst werden sollen.',
   'This option controls the inventory system.' => 'Dieser Parameter legt die Warenbuchungsmethode fest.',