[freeside-commits] branch master updated. 54c7d50f5c0da30367315ec3a169c03a5d6eedc1
Ivan
ivan at 420.am
Fri Sep 5 18:22:47 PDT 2014
The branch, master has been updated
via 54c7d50f5c0da30367315ec3a169c03a5d6eedc1 (commit)
via 7538d1559b61a18a817917cb76cb0c6a0645456f (commit)
from a2c70ba55a0b69c310534774334d859c2e907692 (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 54c7d50f5c0da30367315ec3a169c03a5d6eedc1
Author: Ivan Kohler <ivan at freeside.biz>
Date: Fri Sep 5 18:22:46 2014 -0700
add invnum to payment import, RT#29673
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index 54b8e90..80a1e3e 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -1157,7 +1157,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";
@@ -1242,9 +1242,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>
commit 7538d1559b61a18a817917cb76cb0c6a0645456f
Author: Ivan Kohler <ivan at freeside.biz>
Date: Fri Sep 5 17:21:45 2014 -0700
compat with old Pg used for RADIUS: use str2time_sql_closing
diff --git a/FS/FS/part_export/sqlradius.pm b/FS/FS/part_export/sqlradius.pm
index 5a8da7b..d1387d6 100644
--- a/FS/FS/part_export/sqlradius.pm
+++ b/FS/FS/part_export/sqlradius.pm
@@ -4,7 +4,7 @@ use strict;
use vars qw(@ISA @EXPORT_OK $DEBUG %info %options $notes1 $notes2);
use Exporter;
use Tie::IxHash;
-use FS::Record qw( dbh qsearch qsearchs str2time_sql );
+use FS::Record qw( dbh qsearch qsearchs str2time_sql str2time_sql_closing );
use FS::part_export;
use FS::svc_acct;
use FS::export_svc;
@@ -689,15 +689,16 @@ sub usage_sessions {
qw( datasrc username password ) );
#select a unix time conversion function based on database type
- my $str2time = str2time_sql( $dbh->{Driver}->{Name} );
+ my $str2time = str2time_sql( $dbh->{Driver}->{Name} );
+ my $closing = str2time_sql_closing( $dbh->{Driver}->{Name} );
my @fields = (
qw( username realm framedipaddress
acctsessiontime acctinputoctets acctoutputoctets
callingstationid calledstationid
),
- "$str2time acctstarttime ) as acctstarttime",
- "$str2time acctstoptime ) as acctstoptime",
+ "$str2time acctstarttime $closing as acctstarttime",
+ "$str2time acctstoptime $closing as acctstoptime",
);
@fields = ( 'username', 'sum(acctsessiontime) as acctsessiontime', 'sum(acctinputoctets) as acctinputoctets',
@@ -736,12 +737,12 @@ sub usage_sessions {
my $acctstoptime = '';
if ( $opt->{session_status} ne 'open' ) {
if ( $start ) {
- $acctstoptime .= "$str2time AcctStopTime ) >= ?";
+ $acctstoptime .= "$str2time AcctStopTime $closing >= ?";
push @param, $start;
$acctstoptime .= ' AND ' if $end;
}
if ( $end ) {
- $acctstoptime .= "$str2time AcctStopTime ) <= ?";
+ $acctstoptime .= "$str2time AcctStopTime $closing <= ?";
push @param, $end;
}
}
@@ -755,11 +756,11 @@ sub usage_sessions {
push @where, $acctstoptime;
if ( $opt->{starttime_start} ) {
- push @where, "$str2time AcctStartTime ) >= ?";
+ push @where, "$str2time AcctStartTime $closing >= ?";
push @param, $opt->{starttime_start};
}
if ( $opt->{starttime_end} ) {
- push @where, "$str2time AcctStartTime ) <= ?";
+ push @where, "$str2time AcctStartTime $closing <= ?";
push @param, $opt->{starttime_end};
}
@@ -798,7 +799,9 @@ sub update_svc {
my $dbh = sqlradius_connect( map $self->option($_),
qw( datasrc username password ) );
- my $str2time = str2time_sql( $dbh->{Driver}->{Name} );
+ my $str2time = str2time_sql( $dbh->{Driver}->{Name} );
+ my $closing = str2time_sql_closing( $dbh->{Driver}->{Name} );
+
my @fields = qw( radacctid username realm acctsessiontime );
my @param = ();
@@ -806,7 +809,7 @@ sub update_svc {
my $sth = $dbh->prepare("
SELECT RadAcctId, UserName, Realm, AcctSessionTime,
- $str2time AcctStartTime), $str2time AcctStopTime),
+ $str2time AcctStartTime $closing, $str2time AcctStopTime $closing,
AcctInputOctets, AcctOutputOctets
FROM radacct
WHERE FreesideStatus IS NULL
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_pay.pm | 13 ++++++++++++-
FS/FS/part_export/sqlradius.pm | 23 +++++++++++++----------
httemplate/misc/cust_pay-import.cgi | 4 +++-
3 files changed, 28 insertions(+), 12 deletions(-)
More information about the freeside-commits
mailing list