[freeside-commits] freeside/httemplate/view/cust_main packages.html, 1.20.2.12, 1.20.2.13

Jeff Finucane,420,, jeff at wavetail.420.am
Mon Jun 30 22:01:32 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/view/cust_main
In directory wavetail.420.am:/tmp/cvs-serv21844/httemplate/view/cust_main

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	packages.html 
Log Message:
correct internal reason searching, prevent interleaved suspend/cancel/expire/adjourn, backporting and refactoring

Index: packages.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/view/cust_main/packages.html,v
retrieving revision 1.20.2.12
retrieving revision 1.20.2.13
diff -u -d -r1.20.2.12 -r1.20.2.13
--- packages.html	29 Jun 2008 04:33:50 -0000	1.20.2.12
+++ packages.html	1 Jul 2008 05:01:29 -0000	1.20.2.13
@@ -131,15 +131,12 @@
 %
 %
 % if ( $cust_pkg->get('cancel') ) { #status: cancelled
-%   my $cpr = $cust_pkg->last_cust_pkg_reason;
+%   my $cpr = $cust_pkg->last_cust_pkg_reason('cancel');
 
     <% pkg_status_row($cust_pkg, 'Cancelled', 'cancel', 'color'=>'FF0000', conf=>$conf ) %>
 
     <% pkg_status_row_colspan(
-         ( ( $cpr && ( $cpr->date == $cust_pkg->get('cancel') ||
-                       $cpr->date == $cust_pkg->expire
-                     )
-           ) ? $cpr->reasontext. ' by '. $cpr->otaker : '' ), '',
+         ( $cpr ? $cpr->reasontext. ' by '. $cpr->otaker : '' ), '',
          'align' => 'right', 'color' => 'ff0000', 'size' => '-2',
        )
     %>
@@ -160,15 +157,12 @@
 % } else { 
 %
 %   if ( $cust_pkg->get('susp') ) { #status: suspended
-%     my $cpr = $cust_pkg->last_cust_pkg_reason;
+%     my $cpr = $cust_pkg->last_cust_pkg_reason('susp');
 
     <% pkg_status_row( $cust_pkg, 'Suspended', 'susp', 'color'=>'FF9900', conf=>$conf ) %>
 
     <% pkg_status_row_colspan(
-         ( ( $cpr && ( $cpr->date == $cust_pkg->susp ||
-                       $cpr->date == $cust_pkg->adjourn
-                     )
-           ) ? $cpr->reasontext. ' by '. $cpr->otaker : '' ), '',
+         ( $cpr ? $cpr->reasontext. ' by '. $cpr->otaker : '' ), '',
          'align' => 'right', 'color' => 'FF9900', 'size' => '-2',
        )
     %>
@@ -391,7 +385,18 @@
 
 sub pkg_status_row_if {
   my( $cust_pkg, $title, $field, %opt ) = @_;
-  $cust_pkg->get($field) ? pkg_status_row(@_) : '';
+  
+  $title = '<FONT SIZE=-1>(&nbsp;'. pkg_unadjourn_link($cust_pkg). '&nbsp;)&nbsp;</FONT>'. $title
+    if ( $field eq 'adjourn' &&
+         $curuser->access_right('Suspend customer package later')
+       );
+
+  $title = '<FONT SIZE=-1>(&nbsp;'. pkg_unexpire_link($cust_pkg). '&nbsp;)&nbsp;</FONT>'. $title
+    if ( $field eq 'expire' &&
+         $curuser->access_right('Cancel customer package later')
+       );
+
+  $cust_pkg->get($field) ? pkg_status_row($cust_pkg, $title, $field, %opt) : '';
 }
 
 sub pkg_status_row_changed {
@@ -527,6 +532,8 @@
 
 sub pkg_unsuspend_link { pkg_link('misc/unsusp_pkg',    'Unsuspend',           @_ ); }
 sub pkg_expire_link    { pkg_link('misc/expire_pkg',    'Cancel&nbsp;later',   @_ ); }
+sub pkg_unadjourn_link { pkg_link('misc/unadjourn_pkg', 'Abort',               @_ ); }
+sub pkg_unexpire_link  { pkg_link('misc/unexpire_pkg',  'Abort',               @_ ); }
 sub pkg_dates_link     { pkg_link('edit/REAL_cust_pkg', 'Edit&nbsp;dates',     @_ ); }
 
 sub pkg_cancel_link { include( '/elements/popup_link-cust_pkg.html',



More information about the freeside-commits mailing list