Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a4415997

Von Bernd Bleßmann vor mehr als 9 Jahren hinzugefügt

  • ID a4415997ce2a52e766b1457ddac37184e14aff26
  • Vorgänger e1c3b6b7
  • Nachfolger 0db9ffc9

PriceSources: Fehlerbehandlung in PriceRules.

Unterschiede anzeigen:

SL/PriceSource/PriceRules.pm
45 45
  my ($self, $source, $spec) = @_;
46 46

  
47 47
  my $rule = SL::DB::Manager::PriceRule->find_by(id => $spec);
48

  
49
  return SL::PriceSource::Discount->new(
50
    price_source => $self,
51
    missing      => t8('The price rule for this price does not exist anymore'),
52
  ) if !$rule;
53

  
48 54
  if ($rule->price_type != SL::DB::Manager::PriceRule::PRICE_DISCOUNT()) {
49 55
    return $self->make_price_from_rule($rule);
56
  } else {
57
    return SL::PriceSource::Price->new(
58
      price_source => $self,
59
      invalid      => t8('The price rule is not a rule for prices'),
60
    );
50 61
  }
51

  
52
  return;
53 62
}
54 63

  
55 64
sub discount_from_source {
56 65
  my ($self, $source, $spec) = @_;
57 66

  
58 67
  my $rule = SL::DB::Manager::PriceRule->find_by(id => $spec);
68

  
69
  return SL::PriceSource::Discount->new(
70
    price_source => $self,
71
    missing      => t8('The price rule for this discount does not exist anymore'),
72
  ) if !$rule;
73

  
59 74
  if ($rule->price_type == SL::DB::Manager::PriceRule::PRICE_DISCOUNT()) {
60 75
    return $self->make_discount_from_rule($rule);
76
  } else {
77
    return SL::PriceSource::Discount->new(
78
      price_source => $self,
79
      invalid      => t8('The price rule is not a rule for discounts'),
80
    );
61 81
  }
62

  
63
  return;
64 82
}
65 83

  
66 84
sub best_price {
locale/de/all
2798 2798
  'The predefined text has been saved.' => 'Der vordefinierte Textblock wurde gespeichert.',
2799 2799
  'The predefined text is in use and cannot be deleted.' => 'Der vordefinierte Textblock wird verwendet und kann nicht gelöscht werden.',
2800 2800
  '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).',
2801
  'The price rule for this discount does not exist anymore' => 'Die Preisregel für diesen Rabatt existiert nicht mehr',
2802
  'The price rule for this price does not exist anymore' => 'Die Preisregel für diesen Preis existiert nicht mehr',
2801 2803
  'The price rule has been created.' => 'Die Preisregel wurde angelegt.',
2802 2804
  'The price rule has been deleted.' => 'Die Preisregel wurde gelöscht.',
2803 2805
  'The price rule has been saved.' => 'Die Preisregel wurde gespeichert.',
2806
  'The price rule is not a rule for discounts' => 'Die Preisregel ist keine Regel für Rabatte',
2807
  'The price rule is not a rule for prices' => 'Die Preisregel ist keine Regel für Preise',
2804 2808
  'The printer could not be deleted.' => 'Der Drucker konnte nicht gelöscht werden.',
2805 2809
  'The printer has been created.' => 'Der Drucker wurde angelegt.',
2806 2810
  'The printer has been deleted.' => 'Der Drucker wurde entfernt.',
locale/en/all
2213 2213
  'The payment term is in use and cannot be deleted.' => '',
2214 2214
  'The payments have been posted.' => '',
2215 2215
  'The preferred one is to install packages provided by your operating system distribution (e.g. Debian or RPM packages).' => '',
2216
  'The price rule for this discount does not exist anymore' => '',
2217
  'The price rule for this price does not exist anymore' => '',
2218
  'The price rule is not a rule for discounts' => '',
2219
  'The price rule is not a rule for prices' => '',
2216 2220
  'The printer could not be deleted.' => '',
2217 2221
  'The printer has been created.' => '',
2218 2222
  'The printer has been deleted.' => '',

Auch abrufbar als: Unified diff