Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0c3c9aa1

Von Tamino Steinert vor 3 Monaten hinzugefügt

  • ID 0c3c9aa12fcc3927e2ad352dcedfc34bb9fa9d5d
  • Vorgänger 9c4876f7
  • Nachfolger 3ba87b60

S:D:Order: validiere Konfiguration für Wiederkehrende-Rechnung

Unterschiede anzeigen:

SL/DB/Order.pm
81 81

  
82 82
__PACKAGE__->before_save('_before_save_set_ord_quo_number');
83 83
__PACKAGE__->before_save('_before_save_create_new_project');
84
__PACKAGE__->before_save('_valid_periodic_invoice_config');
84 85
__PACKAGE__->before_save('_before_save_remove_empty_custom_shipto');
85 86
__PACKAGE__->before_save('_before_save_set_custom_shipto_module');
86 87
__PACKAGE__->after_save('_after_save_link_records');
......
125 126
  return 1;
126 127
}
127 128

  
129
sub _valid_periodic_invoice_config {
130
  my ($self) = @_;
131

  
132
  if ($self->periodic_invoices_config) {
133
    if ($self->periodic_invoices_config->periodicity eq 'o') {
134
      my @error_pos;
135
      foreach my $item (@{$self->items_sorted()}) {
136
        push @error_pos, $item->position if $item->periodic_invoice_items_config;
137
      }
138
      die t8("Periodic invoice config of order set to once. Can not have periodic invoice config for item(s) at position #1.",
139
        join(', ', @error_pos)
140
      ) if scalar @error_pos;
141
    } else {
142
      my $error_string;
143
      foreach my $item (@{$self->items_sorted()}) {
144
        my $item_config = $item->periodic_invoice_items_config
145
          or next;
146
        $error_string .= t8("Start date before order start date at position #1.", $item->position) . "\n"
147
          if $item_config->start_date
148
           && $item_config->start_date < $self->periodic_invoices_config->start_date;
149
        $error_string .= t8("Start date after end date at position #1.", $item->position) . "\n"
150
           if $item_config->start_date && $item_config->end_date
151
           && $item_config->start_date >  $item_config->end_date;
152
      }
153
      die $error_string if $error_string;
154
    }
155
  } else {
156
    my @error_pos;
157
    foreach my $item (@{$self->items_sorted()}) {
158
      push @error_pos, $item->position if $item->periodic_invoice_items_config;
159
    }
160
    die t8("Periodic invoice config for item(s) at position #1, but no for order.",
161
      join(', ', @error_pos)
162
    ) if scalar @error_pos;
163
  }
164

  
165
  return 1;
166
}
128 167

  
129 168
sub _before_save_remove_empty_custom_shipto {
130 169
  my ($self) = @_;
locale/de/all
2876 2876
  'Period:'                     => 'Zeitraum:',
2877 2877
  'Periodic Invoices'           => 'Wiederkehrende Rechnungen',
2878 2878
  'Periodic inventory'          => 'Aufwandsmethode',
2879
  'Periodic invoice config for item(s) at position #1, but no for order.' => 'Wiederkehrende-Rechnungs-Konfiguration für Artikel von  an Position #1, aber keine für Auftrag.',
2880
  'Periodic invoice config of order set to once. Can not have periodic invoice config for item(s) at position #1.' => 'Wiederkehrende-Rechnungs-Konfiguration des Auftrags auf einmalig gesetzt. Kann keine Wiederkehrende-Rechnungs-Konfiguration für Artikel an Position #1 besitzen.',
2879 2881
  'Periodic invoices active'    => 'Wiederkehrende Rechnungen aktiv',
2880 2882
  'Periodic invoices inactive'  => 'Wiederkehrende Rechnungen inaktiv',
2881 2883
  'Periods'                     => 'Zeiträume',
......
3774 3776
  'Start (verb)'                => 'Starten',
3775 3777
  'Start Dunning Process'       => 'Mahnprozess starten',
3776 3778
  'Start date'                  => 'Startdatum',
3779
  'Start date after end date at position #1.' => 'Startdatum nach Enddatum an Position #1.',
3780
  'Start date before order start date at position #1.' => 'Startdatum des Artikels vor Startdatum des Auftras an Position #1.',
3777 3781
  'Start of year'               => 'Jahresanfang',
3778 3782
  'Start process'               => 'Prozess starten',
3779 3783
  'Start the correction assistant' => 'Korrekturassistenten starten',
locale/en/all
2875 2875
  'Period:'                     => '',
2876 2876
  'Periodic Invoices'           => '',
2877 2877
  'Periodic inventory'          => '',
2878
  'Periodic invoice config for item(s) at position #1, but no for order.' => '',
2879
  'Periodic invoice config of order set to once. Can not have periodic invoice config for item(s) at position #1.' => '',
2878 2880
  'Periodic invoices active'    => '',
2879 2881
  'Periodic invoices inactive'  => '',
2880 2882
  'Periods'                     => '',
......
3773 3775
  'Start (verb)'                => '',
3774 3776
  'Start Dunning Process'       => '',
3775 3777
  'Start date'                  => '',
3778
  'Start date after end date at position #1.' => '',
3779
  'Start date before order start date at position #1.' => '',
3776 3780
  'Start of year'               => '',
3777 3781
  'Start process'               => '',
3778 3782
  'Start the correction assistant' => '',

Auch abrufbar als: Unified diff