Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / view / cust_main / packages / status.html
index 9d5a88e..ed360cc 100644 (file)
@@ -14,6 +14,8 @@
 
     <% pkg_status_row($cust_pkg, emt('Cancelled'), 'cancel', 'color'=>'FF0000', %opt ) %>
 
+    <% pkg_status_row_detached($cust_pkg, %opt) %>
+
     <% pkg_reason_row($cust_pkg, $cpr, color => 'ff0000', %opt) %>
 
 %   unless ( $cust_pkg->get('setup') ) { 
 
 %   } 
 %
-%   if ( $part_pkg->freq and !$supplemental ) { #?
+%   if ( $part_pkg->freq && !$supplemental && !$cust_pkg->change_custnum ) { #?
 
       <TR>
         <TD COLSPAN=<%$opt{colspan}%>>
           <FONT SIZE=-1>
-%           if ( $curuser->access_right('Un-cancel customer package') ) { 
+%           if ( $curuser->access_right('Un-cancel customer package') && ! $opt{no_links} ) { 
               (&nbsp;<% pkg_uncancel_link($cust_pkg) %>&nbsp;)
 %           } 
           <FONT>
@@ -77,7 +79,7 @@
     <% pkg_status_row_if( $cust_pkg, emt('Expires'), 'expire', %opt, curuser=>$curuser ) %>
     <% pkg_status_row_if( $cust_pkg, emt('Contract ends'), 'contract_end', %opt ) %>
 
-% if ( !$supplemental ) {
+% if ( !$supplemental && ! $opt{no_links} ) {
       <TR>
         <TD COLSPAN=<%$opt{colspan}%>>
           <FONT SIZE=-1>
 
           <% pkg_status_row_if($cust_pkg, emt('Un-cancelled'), 'uncancel', %opt ) %>
 
-%         if (!$supplemental) {
+%         if ( !$supplemental && ! $opt{no_links} ) {
           <TR>
             <TD COLSPAN=<%$opt{colspan}%>>
               <FONT SIZE=-1>
       <% pkg_status_row_if( $cust_pkg, emt('Expires'), 'expire', %opt, curuser=>$curuser ) %>
       <% pkg_status_row_if( $cust_pkg, emt('Contract ends'), 'contract_end', %opt ) %>
 
-%     if ( $part_pkg->freq and !$supplemental ) { 
+%     if ( $part_pkg->freq and !$supplemental && ! $opt{no_links} ) { 
 
         <TR>
           <TD COLSPAN=<%$opt{colspan}%>>
@@ -360,6 +362,37 @@ sub pkg_status_row_changed {
   $html;
 }
 
+sub pkg_status_row_detached {
+  my( $cust_pkg, %opt ) = @_;
+
+  return '' unless $cust_pkg->change_custnum;
+
+  my $html = '';
+
+  my $cust_main = $cust_pkg->change_cust_main;
+  if ( $cust_main ) {
+
+    my $cust_link = '<A HREF="cust_main.cgi?'.  $cust_pkg->change_custnum. '">'.
+                      encode_entities( $cust_main->name ).
+                    '</A>';
+
+    my $what = $opt{'pkg_attached'} ? 'Attached' : 'Detached';
+
+    $html .= pkg_status_row_colspan( $cust_pkg, 
+                                     emt("$what to customer #[_1]: ",
+                                            $cust_pkg->change_custnum
+                                        ).
+                                       $cust_link,
+                                     '',
+                                     'size'    => '-1',
+                                     'align'   => 'right',
+                                     'colspan' => 4,
+                                   );
+  }
+
+  $html;
+}
+
 sub pkg_status_row_noauto {
   my( $cust_pkg, %opt ) = @_;
   my $part_pkg = $opt{'part_pkg'};