summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_pkg/Search.pm23
-rw-r--r--FS/FS/part_export/broadband_snmp.pm7
-rw-r--r--FS/FS/pay_batch/eft_canada.pm75
3 files changed, 82 insertions, 23 deletions
diff --git a/FS/FS/cust_pkg/Search.pm b/FS/FS/cust_pkg/Search.pm
index 543ef1a61..1a9132df6 100644
--- a/FS/FS/cust_pkg/Search.pm
+++ b/FS/FS/cust_pkg/Search.pm
@@ -17,13 +17,15 @@ Valid parameters are
=item agentnum
-=item magic
+=item status
-on hold, active, inactive (or one-time charge), suspended, cancel (or cancelled)
+on hold, active, inactive (or one-time charge), suspended, canceled (or cancelled)
-=item status
+=item magic
-on hold, active, inactive (or one-time charge), suspended, cancel (or cancelled)
+Equivalent to "status", except that "canceled"/"cancelled" will exclude
+packages that were changed into a new package with the same pkgpart (i.e.
+location or quantity changes).
=item custom
@@ -208,6 +210,19 @@ sub search {
push @where, FS::cust_pkg->cancelled_sql();
}
+
+ ### special case: "magic" is used in detail links from browse/part_pkg,
+ # where "cancelled" has the restriction "and not replaced with a package
+ # of the same pkgpart". Be consistent with that.
+ ###
+
+ if ( $params->{'magic'} =~ /^cancell?ed$/ ) {
+ my $new_pkgpart = "SELECT pkgpart FROM cust_pkg AS cust_pkg_next ".
+ "WHERE cust_pkg_next.change_pkgnum = cust_pkg.pkgnum";
+ # ...may not exist, if this was just canceled and not changed; in that
+ # case give it a "new pkgpart" that never equals the old pkgpart
+ push @where, "COALESCE(($new_pkgpart), 0) != cust_pkg.pkgpart";
+ }
###
# parse package class
diff --git a/FS/FS/part_export/broadband_snmp.pm b/FS/FS/part_export/broadband_snmp.pm
index 9afca0872..0ba275670 100644
--- a/FS/FS/part_export/broadband_snmp.pm
+++ b/FS/FS/part_export/broadband_snmp.pm
@@ -34,9 +34,10 @@ tie my %options, 'Tie::IxHash',
},
'community' => { label=>'Community', default=>'public' },
- 'action' => { multiple=>1 },
- 'oid' => { multiple=>1 },
- 'value' => { multiple=>1 },
+ 'action' => { multiple=>1 },
+ 'oid' => { multiple=>1 },
+ 'value' => { multiple=>1 },
+ 'datatype'=> { multiple=>1 },
'ip_addr_change_to_new' => {
label=>'Send IP address changes to new address',
diff --git a/FS/FS/pay_batch/eft_canada.pm b/FS/FS/pay_batch/eft_canada.pm
index 64fd2f971..310c400b1 100644
--- a/FS/FS/pay_batch/eft_canada.pm
+++ b/FS/FS/pay_batch/eft_canada.pm
@@ -66,23 +66,9 @@ my %holiday = (
@config = $conf->config('batchconfig-eft_canada');
}
# SFTP login, password, trans code, delay time
- my $process_delay;
- ($trans_code, $process_delay) = @config[2,3];
- $process_delay ||= 1; # days
-
- my $pt = time + ($process_delay * 86400);
- my @lt = localtime($pt);
- while ( $lt[6] == 0 #Sunday
- || $lt[6] == 6 #Saturday
- || $holiday_yearly{ $lt[4]+1 }{ $lt[3] }
- || $holiday{ $lt[5]+1900 }{ $lt[4]+1 }{ $lt[3] }
- )
- {
- $pt += 86400;
- @lt = localtime($pt);
- }
+ ($trans_code) = $config[2];
- $process_date = time2str('%D', $pt);
+ $process_date = time2str('%D', process_date($conf, $agentnum));
},
delimiter => '', # avoid blank lines for header/footer
@@ -124,4 +110,61 @@ my %holiday = (
);
+sub download_note { # is a class method
+ my $class = shift;
+ my $pay_batch = shift;
+ my $conf = FS::Conf->new;
+ my $agentnum = $pay_batch->agentnum;
+ my $tomorrow = (localtime(time))[2] >= 10;
+ my $process_date = process_date($conf, $agentnum);
+ my $upload_date = $process_date - 86400;
+ my $date_format = $conf->config('date_format') || '%D';
+
+ my $note = '';
+ if ( $process_date - time < 86400*2 ) {
+ $note = 'Upload this file before 11:00 AM '.
+ ($tomorrow ? 'tomorrow' : 'today') .
+ ' (' . time2str($date_format, $upload_date) . '). ';
+ } else {
+ $note = 'Upload this file before 11:00 AM on '.
+ time2str($date_format, $upload_date) . '. ';
+ }
+ $note .= 'Payments will be processed on '.
+ time2str($date_format, $process_date) . '.';
+
+ $note;
+}
+
+sub process_date {
+ my ($conf, $agentnum) = @_;
+ my @config;
+ if ( $conf->exists('batch-spoolagent') ) {
+ @config = $conf->config('batchconfig-eft_canada', $agentnum);
+ } else {
+ @config = $conf->config('batchconfig-eft_canada');
+ }
+
+ my $process_delay = $config[3] || 1;
+
+ if ( (localtime(time))[2] >= 10 and $process_delay == 1 ) {
+ # If downloading the batch after 10:00 local time, it likely won't make
+ # the cutoff for next-day turnaround, and EFT will reject it.
+ $process_delay++;
+ }
+
+ my $pt = time + ($process_delay * 86400);
+ my @lt = localtime($pt);
+ while ( $lt[6] == 0 #Sunday
+ || $lt[6] == 6 #Saturday
+ || $holiday_yearly{ $lt[4]+1 }{ $lt[3] }
+ || $holiday{ $lt[5]+1900 }{ $lt[4]+1 }{ $lt[3] }
+ )
+ {
+ $pt += 86400;
+ @lt = localtime($pt);
+ }
+
+ $pt;
+}
+
1;