employee edit (ticket 1412)
[freeside.git] / httemplate / misc / download-batch.cgi
index a1e7b5c..74805b2 100644 (file)
 %my $dbh = dbh;
 %
 %my $pay_batch = qsearchs('pay_batch', {'batchnum'=>$batchnum, 'status'=>'O'} );
+%unless ($pay_batch) {
+%  $pay_batch = qsearchs('pay_batch', {'batchnum'=>$batchnum, 'status'=>'I'} )
+%    if $FS::CurrentUser::CurrentUser->access_right('Reprocess batches');
+%}
 %die "No pending batch. \n" unless $pay_batch;
 %
 %my %batchhash = $pay_batch->hash;
 %
 %  $cust_pay_batch->exp =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;
 %  my( $mon, $y ) = ( $2, $1 );
-%  $mon = "0$mon" if $mon < 10;
+%  if ( $conf->exists('batch-increment_expiration') ) {
+%    my( $curmon, $curyear ) = (localtime(time))[4,5];
+%    $curmon++; $curyear-=100;
+%    $y++ while $y < $curyear || ( $y == $curyear && $mon < $curmon );
+%  }
+%  $mon = "0$mon" if $mon =~ /^\d$/;
+%  $y = "0$y" if $y =~ /^\d$/;
 %  my $exp = "$mon$y";
 %  $batchcount++;
 %  $batchtotal += $cust_pay_batch->amount;