[freeside-commits] branch FREESIDE_3_BRANCH updated. 7637e26a0a5f422e6f3db3567d6c5e272ed1ffd4
Jonathan Prykop
jonathan at 420.am
Wed Apr 29 13:24:07 PDT 2015
The branch, FREESIDE_3_BRANCH has been updated
via 7637e26a0a5f422e6f3db3567d6c5e272ed1ffd4 (commit)
from 601c221a20048eb96fa584bda348fda5f7d9f86f (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 7637e26a0a5f422e6f3db3567d6c5e272ed1ffd4
Author: Jonathan Prykop <jonathan at freeside.biz>
Date: Tue Apr 28 14:22:20 2015 -0500
RT#28526: Package tab takes a long time to load with lots of packages
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index f7de235..a03a446 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -3504,6 +3504,9 @@ cust_pkg status is 'suspended' and expire is set
to cancel package within the next day (or however
many days are set in global config part_pkg-delay_cancel-days.
+Accepts option I<part_pkg-delay_cancel-days> which should be
+the value of the config setting, to avoid looking it up again.
+
This is not a real status, this only meant for hacking display
values, because otherwise treating the package as suspended is
really the whole point of the delay_cancel option.
@@ -3511,15 +3514,18 @@ really the whole point of the delay_cancel option.
=cut
sub is_status_delay_cancel {
- my ($self) = @_;
+ my ($self,%opt) = @_;
if ( $self->main_pkgnum and $self->pkglinknum ) {
return $self->main_pkg->is_status_delay_cancel;
}
return 0 unless $self->part_pkg->option('delay_cancel',1);
return 0 unless $self->status eq 'suspended';
return 0 unless $self->expire;
- my $conf = new FS::Conf;
- my $expdays = $conf->config('part_pkg-delay_cancel-days') || 1;
+ my $expdays = $opt{'part_pkg-delay_cancel-days'};
+ unless ($expdays) {
+ my $conf = new FS::Conf;
+ $expdays = $conf->config('part_pkg-delay_cancel-days') || 1;
+ }
my $expsecs = 60*60*24*$expdays;
return 0 unless $self->expire < time + $expsecs;
return 1;
diff --git a/httemplate/view/cust_main/packages/section.html b/httemplate/view/cust_main/packages/section.html
index e888c94..b196b64 100755
--- a/httemplate/view/cust_main/packages/section.html
+++ b/httemplate/view/cust_main/packages/section.html
@@ -114,6 +114,7 @@ my %conf_opt = (
#for status.html
'cust_pkg-show_autosuspend' => $conf->exists('cust_pkg-show_autosuspend'),
'pkg_attached' => $pkg_attached,
+ 'part_pkg-delay_cancel-days' => $conf->config('part_pkg-delay_cancel-days') || 1,
#for status.html pkg-balances
'pkg-balances' => $conf->exists('pkg-balances'),
'money_char' => ( $conf->config('money_char') || '$' ),
diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html
index 66df1ce..690f858 100644
--- a/httemplate/view/cust_main/packages/status.html
+++ b/httemplate/view/cust_main/packages/status.html
@@ -55,7 +55,7 @@
% } else { #status: suspended
% my ($cpr,$susplabel);
-% if ($cust_pkg->is_status_delay_cancel) {
+% if ($cust_pkg->is_status_delay_cancel(%opt)) {
% $cpr = $cust_pkg->last_cust_pkg_reason('expire');
% $susplabel = 'Suspended (Cancelled)';
% } else {
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_pkg.pm | 12 +++++++++---
httemplate/view/cust_main/packages/section.html | 1 +
httemplate/view/cust_main/packages/status.html | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
More information about the freeside-commits
mailing list