Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 976b7115

Von Tamino Steinert vor etwa 2 Monaten hinzugefügt

  • ID 976b7115be2ff0d7ee16ccbb0476df8e407a03ae
  • Vorgänger 7589c136
  • Nachfolger 725b11b9

FIX: S:D:PeriodicInvoiceConfig: Positionsstart- und Enddatum in Periode

Unterschiede anzeigen:

SL/DB/PeriodicInvoicesConfig.pm
86 86
      my $next_period_start_date = $self->get_next_period_start_date(order_item => $item);
87 87
      my $period = $self->get_billing_period_length || 1;
88 88
      return if $period_start_date < $next_period_start_date
89
        || $period_start_date > add_months($next_period_start_date, $period);
89
        || $period_start_date >= add_months($next_period_start_date, $period);
90 90
    }
91
    return if $item_config->start_date && $item_config->start_date > $period_start_date;
92 91
    if ($item_config->terminated || !$item_config->extend_automatically_by) {
93
      return if $item_config->end_date   && $item_config->end_date   < $period_start_date;
92
      return if $item_config->end_date && $item_config->end_date < $period_start_date;
94 93
    }
95 94

  
96 95
    my $i_period = $item_config->get_item_period_length;
97 96
    my $b_period = $self->get_billing_period_length;
98
    return $new_item unless $i_period && $b_period;
97
    return $new_item if $i_period == 0 || $b_period == 0;
99 98

  
100 99
    if ($i_period > $b_period) {
100
      return if $item_config->start_date && $item_config->start_date > $period_start_date;
101 101
      my $start_date = $item_config->start_date
102 102
        || $self->first_billing_date || $self->start_date;
103 103
      my $months_from_start_date =
......
106 106
      my $first_in_sub_period = $months_from_start_date % ($i_period / $b_period) == 0 ? 1 : 0;
107 107
      return if !$first_in_sub_period;
108 108
    } elsif ($i_period < $b_period) {
109
      $new_item->qty($new_item->qty * $b_period / $i_period);
109
      my $periods = 0;
110
      my $max_periods = $b_period / $i_period;
111
      my $periods_from_start = 0;
112
      my $i_start_date = $period_start_date;
113
      if ($item_config->start_date) {
114
        while ($i_start_date < $item_config->start_date) {
115
          $periods_from_start++;
116
          $i_start_date = add_months($period_start_date, $periods_from_start);
117
        }
118
      }
119
      if ($item_config->end_date
120
        && ($item_config->terminated || !$item_config->extend_automatically_by)) {
121
        $periods++ while $periods < ($max_periods - $periods_from_start)
122
          && add_months($i_start_date, $periods * $i_period) <= $item_config->end_date;
123
        return if $periods == 0;
124
      } else {
125
        $periods = $max_periods - $periods_from_start;
126
      }
127
      $new_item->qty($new_item->qty * $periods);
110 128
    }
111 129
  }
112 130

  

Auch abrufbar als: Unified diff