From 783eefa4a70dd88dd13ffd73c4e23361288628f0 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 21 Jun 2011 22:14:20 +0000 Subject: [PATCH] rework suspension delays, RT#6956 --- FS/FS/part_event/Condition/pkg_dundate.pm | 10 +++++----- httemplate/search/cust_pkg.cgi | 13 ++++++++----- httemplate/search/report_cust_pkg.html | 29 ++++++++++++++++------------- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/FS/FS/part_event/Condition/pkg_dundate.pm b/FS/FS/part_event/Condition/pkg_dundate.pm index 08b4e0abc..f25db2ae8 100644 --- a/FS/FS/part_event/Condition/pkg_dundate.pm +++ b/FS/FS/part_event/Condition/pkg_dundate.pm @@ -23,10 +23,10 @@ sub condition { } -#sub condition_sql { -# my( $self, $table ) = @_; -# -# 'true'; -#} +sub condition_sql { + my( $class, $table, %opt ) = @_; + return 'true' unless $table eq 'cust_pkg'; + "COALESCE($table.dundate,0) <= ". $opt{'time'}; +} 1; diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 3606a3d24..7a6f49a23 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -17,6 +17,7 @@ emt('Next bill'), emt('Adjourn'), emt('Susp.'), + emt('Susp. delay'), emt('Expire'), emt('Contract end'), emt('Cancel'), @@ -44,7 +45,7 @@ sub { FS::part_pkg::freq_pretty(shift); }, ( map { time_or_blank($_) } - qw( setup last_bill bill adjourn susp expire contract_end cancel ) ), + qw( setup last_bill bill adjourn susp dundate expire contract_end cancel ) ), sub { my $self = shift; my $return = ''; @@ -104,13 +105,14 @@ '', '', '', + '', FS::UI::Web::cust_colors(), '', ], - 'style' => [ '', '', '', '', 'b', '', '', '', '', '', '', '', '', '', '', '', '', + 'style' => [ '', '', '', '', 'b', '', '', '', '', '', '', '', '', '', '', '', '', '', FS::UI::Web::cust_styles() ], 'size' => [ '', '', '', '', '-1' ], - 'align' => 'rrlccrrlrrrrrrrrl'. FS::UI::Web::cust_aligns(). 'r', + 'align' => 'rrlccrrlrrrrrrrrrl'. FS::UI::Web::cust_aligns(). 'r', 'links' => [ $link, $link, @@ -129,6 +131,7 @@ '', '', '', + '', ( map { $_ ne 'Cust. Status' ? $clink : '' } FS::UI::Web::cust_header( $cgi->param('cust_fields') @@ -176,9 +179,9 @@ $search_hash{report_option} = join(',', @report_option) if @report_option; #false laziness w/report_cust_pkg.html my %disable = ( 'all' => {}, - 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, }, + 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, }, 'active' => { 'susp'=>1, 'cancel'=>1 }, - 'suspended' => { 'cancel' => 1 }, + 'suspended' => { 'cancel' =>1, 'dundate'=>1, }, 'cancelled' => {}, '' => {}, ); diff --git a/httemplate/search/report_cust_pkg.html b/httemplate/search/report_cust_pkg.html index 289fec458..d9b6cd7a1 100755 --- a/httemplate/search/report_cust_pkg.html +++ b/httemplate/search/report_cust_pkg.html @@ -33,7 +33,7 @@ if ( what.options[what.selectedIndex].value == '<% $status %>' ) { -% foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) { +% foreach my $field (@date_fields) { % if ( $disable{$status}->{$field} ) { what.form.<% $field %>_beginning_text.disabled = true; @@ -89,7 +89,7 @@ % } -% foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end cancel )) { +% foreach my $field (@date_fields) { <% $label{$field} %> @@ -174,24 +174,26 @@ if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { <%once> -my %label = ( - 'setup' => 'Setup', - 'last_bill' => 'Last bill', - 'bill' => 'Next bill', - 'adjourn' => 'Adjourns', - 'susp' => 'Suspended', - 'expire' => 'Expires', +tie my %label, 'Tie::IxHash', + 'setup' => 'Setup', + 'last_bill' => 'Last bill', + 'bill' => 'Next bill', + 'adjourn' => 'Adjourns', + 'susp' => 'Suspended', + 'dundate' => 'Suspension delayed until', + 'expire' => 'Expires', 'contract_end' => 'Contract ends', - 'cancel' => 'Cancelled', -); + 'cancel' => 'Cancelled', +; +my @date_fields = keys %label; #false laziness w/cust_pkg.cgi my %disable = ( 'all' => {}, 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, }, - 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, }, + 'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, }, 'active' => { 'susp'=>1, 'cancel'=>1 }, - 'suspended' => { 'cancel' => 1 }, + 'suspended' => { 'cancel'=>1, 'dundate'=>1, }, 'cancelled' => {}, '' => {}, ); @@ -202,6 +204,7 @@ my %checkbox = ( 'last_bill' => 0, 'bill' => 0, 'susp' => 1, + 'dundate' => 1, 'expire' => 1, 'cancel' => 1, ); -- 2.11.0