From e5770f1c578ba47f730488df7fb5a03307ac71ab Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Wed, 13 Aug 2014 19:19:18 -0700 Subject: avoid counting location-changed packages in total canceled packages --- FS/FS/cust_pkg/Search.pm | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'FS') 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 -- cgit v1.2.1 From a8aacbc2ef8cc36bcdae327be7d0f59a1b1f3666 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 14 Aug 2014 19:42:39 -0700 Subject: adjust EFT Canada processing delay based on time of day, and warn the user, #20384 --- FS/FS/pay_batch/eft_canada.pm | 68 +++++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 16 deletions(-) (limited to 'FS') diff --git a/FS/FS/pay_batch/eft_canada.pm b/FS/FS/pay_batch/eft_canada.pm index 64fd2f971..3c1d21986 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,54 @@ 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 $upload_date = time; + $upload_date += 86400 if $tomorrow; + my $process_date = process_date($conf, $agentnum); + my $date_format = $conf->config('date_format') || '%D'; + + 'Upload this file before 11:00 AM '. + ($tomorrow ? 'tomorrow' : 'today') . + ' (' . time2str($date_format, $upload_date) . '). '. + 'Payments will be processed on '. + time2str($date_format, $process_date) . '.'; +} + +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 ) { + # 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; -- cgit v1.2.1 From 383f177db523f12b88e7b3c4dd2c3ee51f750cff Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 14 Aug 2014 20:14:55 -0700 Subject: adjust calculation of upload date, #20384 --- FS/FS/pay_batch/eft_canada.pm | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'FS') diff --git a/FS/FS/pay_batch/eft_canada.pm b/FS/FS/pay_batch/eft_canada.pm index 3c1d21986..310c400b1 100644 --- a/FS/FS/pay_batch/eft_canada.pm +++ b/FS/FS/pay_batch/eft_canada.pm @@ -116,16 +116,23 @@ sub download_note { # is a class method my $conf = FS::Conf->new; my $agentnum = $pay_batch->agentnum; my $tomorrow = (localtime(time))[2] >= 10; - my $upload_date = time; - $upload_date += 86400 if $tomorrow; my $process_date = process_date($conf, $agentnum); + my $upload_date = $process_date - 86400; my $date_format = $conf->config('date_format') || '%D'; - 'Upload this file before 11:00 AM '. - ($tomorrow ? 'tomorrow' : 'today') . - ' (' . time2str($date_format, $upload_date) . '). '. - 'Payments will be processed on '. + 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 { @@ -139,7 +146,7 @@ sub process_date { my $process_delay = $config[3] || 1; - if ( (localtime(time))[2] >= 10 ) { + 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++; -- cgit v1.2.1 From d87c9f804b0cb7b6798bf770f753fb83022f5e6a Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Fri, 15 Aug 2014 16:08:24 -0700 Subject: SNMP export: allow manually entering OIDs, #20945 --- FS/FS/part_export/broadband_snmp.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'FS') 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', -- cgit v1.2.1