[BACK]Return to State.pm CVS log [TXT][DIR] Up to [local] / RT / Invoicing / lib / RTI

Diff for /RT/Invoicing/lib/RTI/State.pm between version 1.5 and 1.8

version 1.5, 2012/08/15 01:52:28 version 1.8, 2012/11/28 02:25:13
Line 29 
Line 29 
             $invoice->{$_} = ymd_to_DateTime( $invoice->{$_} )              $invoice->{$_} = ymd_to_DateTime( $invoice->{$_} )
                 for qw/ invdate start end /;                  for qw/ invdate start end /;
         }          }
           foreach my $custid (keys %{ $self->{payment} || {} }) {
               foreach my $payment (@{ $self->{payment}->{$custid} || [] }) {
                    $payment->{date} = ymd_to_DateTime( $payment->{date} )
                        if $payment->{date};
               }
           }
     }      }
   
     bless $self, $class;      bless $self, $class;
Line 106 
Line 112 
         : $self->{_table}->{unpaid};          : $self->{_table}->{unpaid};
 }  }
   
   sub credits {
       my ( $self, $custid ) = @_;
   
       $self->_match_payments;
       return defined $custid
           ? $self->{_table}->{credit}->{$custid}
           : $self->{_table}->{credit};
   }
   
 sub save {  sub save {
     my ($self) = @_;      my ($self) = @_;
   
Line 138 
Line 153 
             }              }
         }          }
     }      }
       foreach my $custid (keys %{ $self->{payment} || {} }) {
           foreach my $payment (@{ $self->{payment}->{$custid} || [] }) {
                $payment->{date} = $payment->{date}->ymd
                    if ref $payment->{date} eq 'DateTime';
           }
       }
     DumpFile( $file, {%$self} ) or die "Unable to save state: $!";      DumpFile( $file, {%$self} ) or die "Unable to save state: $!";
 }  }
   
Line 182 
Line 203 
         delete $credit{$custid} unless $credit{$custid};          delete $credit{$custid} unless $credit{$custid};
     }      }
   
     foreach my $id ( sort { $b <=> $a } keys %owes ) {      foreach my $id ( sort { $a <=> $b } keys %owes ) {
         my $i = $invoices->{$id};          my $i = $invoices->{$id};
         my $custid = $i->{custid} or next;          my $custid = $i->{custid} or next;
   

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.8

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