summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-05-14 09:40:07 -0700
committerMark Wells <mark@freeside.biz>2016-05-14 09:40:07 -0700
commit5f26e344a894a65dfa7ccff7d3063e2f20eb0eff (patch)
tree61a0a4687021245f3fd6d8973353346dd091daf8
parent07f96113f8da936c6255245c42f941ae8a3bb16f (diff)
parentdadbfd8b7e4e471151ed828f5173ceb7dee95fe5 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
-rw-r--r--FS/FS/API.pm5
-rw-r--r--FS/FS/Record.pm5
-rw-r--r--FS/FS/Schema.pm4
-rw-r--r--FS/FS/cdr/conexiant.pm3
-rwxr-xr-xFS/bin/freeside-cdr-conexiant-import9
-rw-r--r--httemplate/search/cust_event.html12
6 files changed, 26 insertions, 12 deletions
diff --git a/FS/FS/API.pm b/FS/FS/API.pm
index 9d0ef2515..6ca2b553b 100644
--- a/FS/FS/API.pm
+++ b/FS/FS/API.pm
@@ -66,6 +66,10 @@ Amount paid
Option date for payment
+=item order_number
+
+Optional order number
+
=back
Example:
@@ -78,6 +82,7 @@ Example:
#optional
'_date' => 1397977200, #UNIX timestamp
+ 'order_number' => '12345',
);
if ( $result->{'error'} ) {
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index a117b7477..7f76d9988 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -2152,6 +2152,7 @@ sub batch_import {
#my $job = $param->{job};
my $line;
my $imported = 0;
+ my $unique_skip = 0; #lines skipped because they're already in the system
my( $last, $min_sec ) = ( time, 5 ); #progressbar foo
while (1) {
@@ -2254,6 +2255,7 @@ sub batch_import {
}
last if exists( $param->{skiprow} );
}
+ $unique_skip++ if $param->{unique_skip}; #line is already in the system
next if exists( $param->{skiprow} );
if ( $preinsert_callback ) {
@@ -2299,7 +2301,8 @@ sub batch_import {
unless ( $imported || $param->{empty_ok} ) {
$dbh->rollback if $oldAutoCommit;
- return "Empty file!";
+ # freeside-cdr-conexiant-import is sensitive to the text of this message
+ return $unique_skip ? "All records in file were previously imported" : "Empty file!";
}
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 4f7dadef9..cdb0d28a6 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -2463,7 +2463,7 @@ sub tables_hashref {
'gatewaynum', 'int', 'NULL', '', '', '', # payment_gateway FK
'processor', 'varchar', 'NULL', $char_d, '', '', # module name
'auth', 'varchar', 'NULL', 16, '', '', # CC auth number
- 'order_number','varchar', 'NULL', $char_d, '', '', # transaction number
+ 'order_number','varchar', 'NULL', 256, '', '', # transaction number
],
'primary_key' => 'paynum',
#i guess not now, with cust_pay_pending, if we actually make it here, we _do_ want to record it# 'unique' => [ [ 'payunique' ] ],
@@ -2517,7 +2517,7 @@ sub tables_hashref {
'gatewaynum', 'int', 'NULL', '', '', '', # payment_gateway FK
'processor', 'varchar', 'NULL', $char_d, '', '', # module name
'auth', 'varchar', 'NULL', 16, '', '', # CC auth number
- 'order_number','varchar', 'NULL', $char_d, '', '', # transaction number
+ 'order_number','varchar', 'NULL', 256, '', '', # transaction number
#void fields
'void_date', @date_type, '', '',
diff --git a/FS/FS/cdr/conexiant.pm b/FS/FS/cdr/conexiant.pm
index 852c2f60f..4ee3f149d 100644
--- a/FS/FS/cdr/conexiant.pm
+++ b/FS/FS/cdr/conexiant.pm
@@ -15,9 +15,10 @@ use FS::cdr qw( _cdr_date_parser_maker _cdr_min_parser_maker );
skip(3), #LookupError,Direction,LegType
sub { #CallId
my($cdr,$value,$conf,$param) = @_;
+ #filter out already-imported cdrs here
if (qsearchs('cdr',{'uniqueid' => $value})) {
$param->{'skiprow'} = 1;
- $param->{'empty_ok'} = 1;
+ $param->{'unique_skip'} = 1; #tell batch_import why we're skipping
} else {
$cdr->uniqueid($value);
}
diff --git a/FS/bin/freeside-cdr-conexiant-import b/FS/bin/freeside-cdr-conexiant-import
index a79477c51..f2b469111 100755
--- a/FS/bin/freeside-cdr-conexiant-import
+++ b/FS/bin/freeside-cdr-conexiant-import
@@ -68,13 +68,11 @@ my $ua = LWP::UserAgent->new;
# Download files are created automatically at regular frequent intervals,
# but they contain overlapping data.
#
-# FS::cdr::conexiant automatically skips previously imported cdrs,
-# though if it does so for all records in a file,
-# then batch_import thinks the file is empty
+# FS::cdr::conexiant automatically skips previously imported cdrs
foreach my $file (@$files) {
next unless $file->{'BilledCallsOnly'};
my $cdrbatch = 'conexiant-' . $file->{'Identifier'};
- # files that were "empty" will unfortunately be re-downloaded,
+ # files that contained no new records will unfortunately be re-downloaded,
# but the alternative is to leave an excess of empty batches in system,
# and re-downloading is harmless (all files expire after 48 hours anyway)
if (qsearchs('cdr_batch',{ 'cdrbatch' => $cdrbatch })) {
@@ -113,6 +111,9 @@ foreach my $file (@$files) {
'format' => 'conexiant'
});
if ($error eq 'Empty file!') {
+ print "File contains no records\n" if $verbose;
+ $error = '';
+ } elsif ($error eq "All records in file were previously imported") {
print "File contains no new cdrs, no batch created\n" if $verbose;
$error = '';
} elsif ($verbose && !$error) {
diff --git a/httemplate/search/cust_event.html b/httemplate/search/cust_event.html
index 122bee09b..b1ba9090e 100644
--- a/httemplate/search/cust_event.html
+++ b/httemplate/search/cust_event.html
@@ -157,7 +157,7 @@ die "access denied"
|| $cgi->param('pkgnum') =~ /^(\d+)$/
);
-my @statuses = $cgi->multi_param('event_status');
+my @statuses = $cgi->param('event_status');
my $title = 'Billing events';
if ( $statuses[0] eq 'failed' and !defined($statuses[1]) ) {
# tweak the title if we're showing only failed events
@@ -181,12 +181,16 @@ $search{'ending'} = $ending;
my $where = ' WHERE '. FS::cust_event->search_sql_where( \%search );
my $join = FS::cust_event->join_sql() .
+ # warning: does not show the true service address for package events.
+ # the query to do that would be painfully slow.
'LEFT JOIN cust_location bill_location '.
'ON (cust_main.bill_locationnum = bill_location.locationnum) '.
'LEFT JOIN cust_location ship_location '.
- 'ON (cust_main.ship_locationnum = ship_location.locationnum)';
- # warning: does not show the true service address for package events.
- # the query to do that would be painfully slow.
+ 'ON (cust_main.ship_locationnum = ship_location.locationnum)'.
+ # include link to referral in case it's in cust-fields
+ # (maybe we should be using FS::UI::Web::join_cust_main instead?)
+ 'LEFT JOIN (select refnum, referral from part_referral) AS part_referral_x '.
+ 'ON (cust_main.refnum = part_referral_x.refnum) ';
my $sql_query = {
'table' => 'cust_event',