my ($self, $source, $spec) = @_;
my $rule = SL::DB::Manager::PriceRule->find_by(id => $spec);
+
+ return SL::PriceSource::Discount->new(
+ price_source => $self,
+ missing => t8('The price rule for this price does not exist anymore'),
+ ) if !$rule;
+
if ($rule->price_type != SL::DB::Manager::PriceRule::PRICE_DISCOUNT()) {
return $self->make_price_from_rule($rule);
+ } else {
+ return SL::PriceSource::Price->new(
+ price_source => $self,
+ invalid => t8('The price rule is not a rule for prices'),
+ );
}
-
- return;
}
sub discount_from_source {
my ($self, $source, $spec) = @_;
my $rule = SL::DB::Manager::PriceRule->find_by(id => $spec);
+
+ return SL::PriceSource::Discount->new(
+ price_source => $self,
+ missing => t8('The price rule for this discount does not exist anymore'),
+ ) if !$rule;
+
if ($rule->price_type == SL::DB::Manager::PriceRule::PRICE_DISCOUNT()) {
return $self->make_discount_from_rule($rule);
+ } else {
+ return SL::PriceSource::Discount->new(
+ price_source => $self,
+ invalid => t8('The price rule is not a rule for discounts'),
+ );
}
-
- return;
}
sub best_price {
'The predefined text has been saved.' => 'Der vordefinierte Textblock wurde gespeichert.',
'The predefined text is in use and cannot be deleted.' => 'Der vordefinierte Textblock wird verwendet und kann nicht gelöscht werden.',
'The preferred one is to install packages provided by your operating system distribution (e.g. Debian or RPM packages).' => 'Die bevorzugte Art, ein Perl-Modul zu installieren, ist durch Installation eines von Ihrem Betriebssystem zur Verfügung gestellten Paketes (z.B. Debian-Pakete oder RPM).',
+ 'The price rule for this discount does not exist anymore' => 'Die Preisregel für diesen Rabatt existiert nicht mehr',
+ 'The price rule for this price does not exist anymore' => 'Die Preisregel für diesen Preis existiert nicht mehr',
'The price rule has been created.' => 'Die Preisregel wurde angelegt.',
'The price rule has been deleted.' => 'Die Preisregel wurde gelöscht.',
'The price rule has been saved.' => 'Die Preisregel wurde gespeichert.',
+ 'The price rule is not a rule for discounts' => 'Die Preisregel ist keine Regel für Rabatte',
+ 'The price rule is not a rule for prices' => 'Die Preisregel ist keine Regel für Preise',
'The printer could not be deleted.' => 'Der Drucker konnte nicht gelöscht werden.',
'The printer has been created.' => 'Der Drucker wurde angelegt.',
'The printer has been deleted.' => 'Der Drucker wurde entfernt.',
'The payment term is in use and cannot be deleted.' => '',
'The payments have been posted.' => '',
'The preferred one is to install packages provided by your operating system distribution (e.g. Debian or RPM packages).' => '',
+ 'The price rule for this discount does not exist anymore' => '',
+ 'The price rule for this price does not exist anymore' => '',
+ 'The price rule is not a rule for discounts' => '',
+ 'The price rule is not a rule for prices' => '',
'The printer could not be deleted.' => '',
'The printer has been created.' => '',
'The printer has been deleted.' => '',