[BACK]Return to rt_invoices.pl CVS log [TXT][DIR] Up to [local] / RT / Invoicing

Diff for /RT/Invoicing/rt_invoices.pl between version 1.50 and 1.51

version 1.50, 2013/06/20 05:36:06 version 1.51, 2015/05/07 06:21:49
Line 1 
Line 1 
 #!/usr/bin/perl  #!/usr/bin/perl
 # $AFresh1: rt_invoices.pl,v 1.49 2013/02/05 03:41:58 andrew Exp $  # $AFresh1: rt_invoices.pl,v 1.50 2013/06/20 04:36:06 andrew Exp $
 ########################################################################  ########################################################################
 # Copyright (c) 2011 Andrew Fresh <andrew@afresh1.com>  # Copyright (c) 2011 Andrew Fresh <andrew@afresh1.com>
 #  #
Line 422 
Line 422 
     while ( $date < $billend ) {      while ( $date < $billend ) {
         my $start = $date->clone;          my $start = $date->clone;
   
         $date->add($freq);          $date->add_duration($freq);
   
         my $end = $date > $billend ? $billend->clone : $date->clone;          my $end = $date > $billend ? $billend->clone : $date->clone;
         $end->subtract( seconds => 1 );          $end->subtract( seconds => 1 );
Line 637 
Line 637 
         }          }
     }      }
   
     return $newest_invoice->clone->subtract($max_duration)      $newest_invoice ||= DateTime->now;
   
       return $newest_invoice->clone->subtract_duration($max_duration)
         ->subtract( days => 1 );          ->subtract( days => 1 );
 }  }
   
Line 650 
Line 652 
     my $end = DateTime->now( time_zone => 'local' )      my $end = DateTime->now( time_zone => 'local' )
         ->set( hour => 0, minute => 0, second => 0 );          ->set( hour => 0, minute => 0, second => 0 );
   
     my $start = $end->clone->subtract($freq);      my $start = $end->clone->subtract_duration($freq);
   
     # XXX This is helpful, but monthly and billday > 28 == !!!      # XXX This is helpful, but monthly and billday > 28 == !!!
     $end->subtract( days => 1 ) while $day && $end->$day_method != $day;      $end->subtract( days => 1 ) while $day && $end->$day_method != $day;
Line 666 
Line 668 
         ? DateTime->now->subtract( days => $cust->{net} )          ? DateTime->now->subtract( days => $cust->{net} )
         : 0;          : 0;
   
     $cust->{no_invoice} = 1 if $start->clone->add($freq) > $end;      $cust->{no_invoice} = 1 if $start->clone->add_duration($freq) > $end;
     $cust->{billend}    = $end;      $cust->{billend}    = $end;
     $cust->{billstart}  = $start;      $cust->{billstart}  = $start;
 }  }

Legend:
Removed from v.1.50  
changed lines
  Added in v.1.51

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>