Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 263efcfd

Von Tamino Steinert vor 4 Monaten hinzugefügt

  • ID 263efcfde353f821477ace95e6c736a0cd2adf0d
  • Vorgänger 5d3e8761
  • Nachfolger 9c4876f7

FIX: S:D:PeriodicInvoicesConfig: Enddatum der Positionen beachten

Unterschiede anzeigen:

SL/DB/PeriodicInvoicesConfig.pm
184 184

  
185 185
  my $start_date = DateTime->from_ymd($params{start_date});
186 186
  my $end_date   = DateTime->from_ymd($params{end_date});
187

  
188
  if ($self->end_date
189
      && ($self->terminated || !$self->extend_automatically_by) ) {
190
    $end_date = min($end_date, $self->end_date);
191
  }
187
  my $last_end_date = $self->last_end_date;
188
  $end_date = min($end_date, $last_end_date) if $last_end_date;
192 189

  
193 190
  my $last_created_on_date = $self->get_previous_billed_period_start_date;
194 191

  
......
235 232
  return @start_dates;
236 233
}
237 234

  
235
sub last_end_date {
236
  my ($self) = @_;
237
  my $end_date = $self->end_date or
238
    return undef; # don't have a end_date
239
  if ($self->extend_automatically_by && !$self->terminated) {
240
    return undef;
241
  }
242
  for my $item (@{$self->order->items()}) {
243
    my $item_config = $item->periodic_invoice_items_config
244
      or next;
245
    next if $item_config->periodicity eq 'n';
246
    if ($item_config->periodicity eq 'o') {
247
      if (!$item_config->once_invoice_id) {
248
        return undef; # allways create for once positions
249
      } else {
250
        next;
251
      }
252
    } else {
253
      if ($item_config->end_date) {
254
        if ($item_config->extend_automatically_by && !$item_config->terminated) {
255
          return undef; # active end_date
256
        } else {
257
          $end_date = max($end_date, $item_config->end_date);
258
        }
259
      }
260
    }
261
  }
262
  return $end_date;
263
}
264

  
238 265
sub get_billing_period_length {
239 266
  my $self = shift;
240 267
  return $PERIOD_LENGTHS{ $self->periodicity };

Auch abrufbar als: Unified diff