[freeside-commits] branch FREESIDE_3_BRANCH updated. 43530fe13141377a688b498d72617cd02ea93fae
Ivan
ivan at 420.am
Fri Sep 5 18:22:48 PDT 2014
The branch, FREESIDE_3_BRANCH has been updated
via 43530fe13141377a688b498d72617cd02ea93fae (commit)
from 5a76902cdaee8a0276c49af42352efd673c4e2d0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 43530fe13141377a688b498d72617cd02ea93fae
Author: Ivan Kohler <ivan at freeside.biz>
Date: Fri Sep 5 18:22:47 2014 -0700
add invnum to payment import, RT#29673
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index 139837c..01736f7 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -1183,7 +1183,7 @@ sub batch_import {
my @fields;
my $payby;
if ( $format eq 'simple' ) {
- @fields = qw( custnum agent_custid paid payinfo );
+ @fields = qw( custnum agent_custid paid payinfo invnum );
$payby = 'BILL';
} elsif ( $format eq 'extended' ) {
die "unimplemented\n";
@@ -1268,9 +1268,20 @@ sub batch_import {
$cust_pay{custnum} = $2;
}
+ my $custnum = $cust_pay{custnum};
+
my $cust_pay = new FS::cust_pay( \%cust_pay );
my $error = $cust_pay->insert;
+ if ( ! $error && $cust_pay->custnum != $custnum ) {
+ #invnum was defined, and ->insert set custnum to the customer for that
+ #invoice, but it wasn't the one the import specified.
+ $dbh->rollback if $oldAutoCommit;
+ $error = "specified invoice #". $cust_pay{invnum}.
+ " is for custnum ". $cust_pay->custnum.
+ ", not specified custnum $custnum";
+ }
+
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return "can't insert payment for $line: $error";
diff --git a/httemplate/misc/cust_pay-import.cgi b/httemplate/misc/cust_pay-import.cgi
index 28ad6e7..05a6c4f 100644
--- a/httemplate/misc/cust_pay-import.cgi
+++ b/httemplate/misc/cust_pay-import.cgi
@@ -59,7 +59,9 @@ Field information:
<li><i>amount</i>: A positive numeric value with at most two digits after the decimal point.
- <li><i>checknum</i>: A sequences of digits. May be left blank.
+ <li><i>checknum</i>: A sequence of digits. May be left blank.
+
+ <li><i>invnum</i>: Invoice number, optional
</ul>
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_pay.pm | 13 ++++++++++++-
httemplate/misc/cust_pay-import.cgi | 4 +++-
2 files changed, 15 insertions(+), 2 deletions(-)
More information about the freeside-commits
mailing list