diff options
author | jeff <jeff> | 2008-09-26 03:54:25 +0000 |
---|---|---|
committer | jeff <jeff> | 2008-09-26 03:54:25 +0000 |
commit | f411189684b0ca7cc1b4b3e9be1895607245b595 (patch) | |
tree | 8d219fe11c5554a304b8d6c56407a1922cb370ca /httemplate/view/cust_main/packages.html | |
parent | e2d78a94d7806862da7fcea0025cd380d49d5a75 (diff) |
push out event triggered suspensions
Diffstat (limited to 'httemplate/view/cust_main/packages.html')
-rwxr-xr-x | httemplate/view/cust_main/packages.html | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html index ad5595c..5f1db4a 100755 --- a/httemplate/view/cust_main/packages.html +++ b/httemplate/view/cust_main/packages.html @@ -456,10 +456,13 @@ Current packages % } % % } +% my $autosuspend = pkg_autosuspend_time( $cust_pkg ); +% $cust_pkg->set('autosuspend', $autosuspend) if $autosuspend; <% pkg_status_row_changed( $cust_pkg, conf=>$conf ) %> <% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill', conf=>$conf, curuser=>$curuser ) %> <% pkg_status_row_if( $cust_pkg, $next_bill_or_prepaid_until, 'bill', conf=>$conf, curuser=>$curuser ) %> + <% pkg_status_row_if($cust_pkg, 'Will automatically suspend by', 'autosuspend', conf=>$conf) %> <% pkg_status_row_if( $cust_pkg, 'Will suspend on', 'adjourn', conf=>$conf, curuser=>$curuser ) %> <% pkg_status_row_if( $cust_pkg, 'Expires', 'expire', conf=>$conf, curuser=>$curuser ) %> @@ -474,6 +477,9 @@ Current packages % if ( $curuser->access_right('Suspend customer package later') ) { ( <% pkg_adjourn_link($cust_pkg) %> ) % } +% if ( $curuser->access_right('Delay suspension events') ) { + ( <% pkg_delay_link($cust_pkg) %> ) +% } % if ( $curuser->access_right('Cancel customer package immediately') ) { ( <% pkg_cancel_link($cust_pkg) %> ) % } @@ -759,10 +765,19 @@ sub pkg_adjourn_link { include( '/elements/popup_link-cust_pkg.html', ) } +sub pkg_delay_link { include( '/elements/popup_link-cust_pkg.html', + { 'action' => $p. 'misc/delay_susp_pkg.html', + 'label' => 'Delay suspend', + 'actionlabel' => 'Delay suspend for', + 'cust_pkg' => shift, + } + ) + } + sub pkg_unsuspend_link { pkg_link('misc/unsusp_pkg', 'Unsuspend', @_ ); } sub pkg_dates_link { pkg_link('edit/REAL_cust_pkg', 'Edit dates', @_ ); } -sub pkg_unadjourn_link { pkg_link('misc/unadjourn_pkg', 'Abort', @_ ); } -sub pkg_unexpire_link { pkg_link('misc/unexpire_pkg', 'Abort', @_ ); } +sub pkg_unadjourn_link { pkg_link('misc/unadjourn_pkg', 'Abort', @_ ); } +sub pkg_unexpire_link { pkg_link('misc/unexpire_pkg', 'Abort', @_ ); } sub pkg_cancel_link { include( '/elements/popup_link-cust_pkg.html', { 'action' => $p. 'misc/cancel_pkg.html?method=cancel', @@ -827,4 +842,25 @@ sub pkg_customize_link { qq!">Customize</A>!; } +sub pkg_autosuspend_time { + my $cust_pkg = shift or return ''; + my $days = 7; + my $time = time; + my $pending_suspend = 0; + while ( $days > 0 && + scalar( + grep { $_->part_event->action eq 'suspend' } + @{$cust_pkg->cust_main->due_cust_event( time => $time + 86400*$days, + testonly => 1, + ) } + ) + ) + { + $pending_suspend = 1; + $days--; + } + + $pending_suspend ? time + ($days + 1) * 86400 : ''; + +} </%init> |