[freeside-commits] freeside/FS/FS pay_batch.pm,1.15,1.15.2.1
Ivan,,,
ivan at wavetail.420.am
Fri Oct 30 11:56:00 PDT 2009
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv24014
Modified Files:
Tag: FREESIDE_1_9_BRANCH
pay_batch.pm
Log Message:
backporting recent paymentech changes to _1_9_BRANCH
Index: pay_batch.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/pay_batch.pm,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -d -r1.15 -r1.15.2.1
--- pay_batch.pm 3 Oct 2009 20:22:19 -0000 1.15
+++ pay_batch.pm 30 Oct 2009 18:55:58 -0000 1.15.2.1
@@ -196,7 +196,7 @@
or die "unknown format $format";
my $filetype = $info->{'filetype'}; # CSV or fixed
- my @fields = @{ $info->{'fields'} };
+ my @fields = @{ $info->{'fields'}};
my $formatre = $info->{'formatre'}; # for fixed
my @all_values;
my $begin_condition = $info->{'begin_condition'};
@@ -256,7 +256,7 @@
}
$rows = [ $rows ] if ref($rows) ne 'ARRAY';
foreach my $row (@$rows) {
- push @all_values, [ @{$row}{@xmlkeys} ];
+ push @all_values, [ @{$row}{@xmlkeys}, $row ];
}
}
else {
@@ -269,9 +269,9 @@
$dbh->rollback if $oldAutoCommit;
return "can't parse: ". $csv->error_input();
};
- push @all_values, [ $csv->fields() ];
+ push @all_values, [ $csv->fields(), $line ];
}elsif ($filetype eq 'fixed'){
- my @values = $line =~ /$formatre/;
+ my @values = ( $line =~ /$formatre/, $line );
unless (@values) {
$dbh->rollback if $oldAutoCommit;
return "can't parse: ". $line;
@@ -288,15 +288,20 @@
my @values = @$_;
my %hash;
+ my $line = pop @values;
foreach my $field ( @fields ) {
my $value = shift @values;
next unless $field;
$hash{$field} = $value;
}
- if ( defined($end_condition) and &{$end_condition}(\%hash) ) {
+ if ( defined($begin_condition) and &{$begin_condition}(\%hash, $line)) {
+ undef $begin_condition;
+ }
+
+ if ( defined($end_condition) and &{$end_condition}(\%hash, $line) ) {
my $error;
- $error = &{$end_hook}(\%hash, $total) if defined($end_hook);
+ $error = &{$end_hook}(\%hash, $total, $line) if defined($end_hook);
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
More information about the freeside-commits
mailing list