From a5b2f9b48cb83d0746d73d969179ad5a4c220a32 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Wed, 7 Dec 2016 13:44:55 +0100 Subject: [PATCH] =?utf8?q?Preisquelle=20Preisgruppe:=20Fallback=20f=C3=BCr?= =?utf8?q?=20entfernte=20Preise.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/PriceSource/Pricegroup.pm | 8 +++++++- locale/de/all | 1 + locale/en/all | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/SL/PriceSource/Pricegroup.pm b/SL/PriceSource/Pricegroup.pm index 62fabf518..3bae2d0d5 100644 --- a/SL/PriceSource/Pricegroup.pm +++ b/SL/PriceSource/Pricegroup.pm @@ -51,7 +51,13 @@ sub price_from_source { my $price = SL::DB::Manager::Price->find_by(pricegroup_id => $spec, parts_id => $self->part->id); - # TODO: if someone deletes the prices entry, this fails. add a fallback + if (!$price) { + return SL::PriceSource::Price->new( + price_source => $self, + missing => t8('Could not find an entry for this part in the pricegroup.'), + ); + } + return $self->make_price($price); } diff --git a/locale/de/all b/locale/de/all index 952912898..f8c5dcd42 100755 --- a/locale/de/all +++ b/locale/de/all @@ -635,6 +635,7 @@ $self->{texts} = { 'Copy template' => 'Vorlage kopieren', 'Correct taxkey' => 'Richtiger Steuerschlüssel', 'Costs' => 'Kosten', + 'Could not find an entry for this part in the pricegroup.' => 'Konnte keine Eintrag für diesen Artikel in der Preisgruppe finden.', 'Could not load class #1 (#2): "#3"' => 'Konnte Klasse #1 (#2) nicht laden: "#3"', 'Could not load class #1, #2' => 'Konnte Klasse #1 nicht laden: "#2"', 'Could not load employee' => 'Konnte Benutzer nicht laden', diff --git a/locale/en/all b/locale/en/all index 10c54b08d..e3269a1a1 100644 --- a/locale/en/all +++ b/locale/en/all @@ -633,6 +633,7 @@ $self->{texts} = { 'Copy template' => '', 'Correct taxkey' => '', 'Costs' => '', + 'Could not find an entry for this part in the pricegroup.' => '', 'Could not load class #1 (#2): "#3"' => '', 'Could not load class #1, #2' => '', 'Could not load employee' => '', -- 2.20.1