this should finish adding the "inactive" status, i think?
[freeside.git] / httemplate / search / cust_main.cgi
index 5b7ccec..c72ab44 100755 (executable)
@@ -109,6 +109,7 @@ if ( $cgi->param('browse')
   push @qual, FS::cust_main->cancel_sql   if $cgi->param('cancelled');
   push @qual, FS::cust_main->prospect_sql if $cgi->param('prospect');
   push @qual, FS::cust_main->active_sql   if $cgi->param('active');
+  push @qual, FS::cust_main->inactive_sql if $cgi->param('inactive');
   push @qual, FS::cust_main->susp_sql     if $cgi->param('suspended');
 
   #EWWWWWW
@@ -415,48 +416,78 @@ END
 
     foreach my $addl_col ( @addl_cols ) { %>
 
-      <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %> ALIGN=right><FONT SIZE=-1>
-
-      <% if ( $addl_col eq 'tickets' ) {
-        if ( @custom_priorities ) {
-          print &itable('', 0);
-          foreach my $priority ( @custom_priorities, '' ) {
-          
-            my $num =
-              FS::TicketSystem->num_customer_tickets($custnum,$priority);
-            my $ahref = '';
-            $ahref= '<A HREF="'.
-                    FS::TicketSystem->href_customer_tickets($custnum,$priority).
-                    '">'
-              if $num;
-
-            print '<TR>'.
-                  "  <TD ALIGN=right><FONT SIZE=-1>$ahref$num</A></FONT></TD>".
-                  "<TD ALIGN=left><FONT SIZE=-1>$ahref".
-                  ( $priority || '<i>(none)</i>' ).
-                  "</A></FONT></TD></TR>";
-
-          }
-          print '<TR><TD BGCOLOR="#000000" COLSPAN=2></TD></TR>'.
-                '<TR><TD ALIGN=right><FONT SIZE=-1>';
-        }
-
-        my $ahref = '';
-        $ahref = '<A HREF="'.
-                    FS::TicketSystem->href_customer_tickets($custnum).
-                    '">'
-          if $cust_main->get($addl_col);
-
-        print $ahref. $cust_main->get($addl_col). '</A>';
-        print "</FONT></TD><TD ALIGN=left>".
-              "<FONT SIZE=-1>${ahref}Total</A><FONT>".
-              "</TD></TR></TABLE>"
-          if @custom_priorities;
+      <% if ( $addl_col eq 'tickets' ) { %>
 
-      } else {
-        print $cust_main->get($addl_col);
+        <% if ( @custom_priorities ) { %>
+
+             <TD CLASS="inv" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %> ALIGN=right><FONT SIZE=-1>
+
+               <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
+
+               <% foreach my $priority ( @custom_priorities, '' ) { %>
+
+                 <%
+                    my $num =
+                      FS::TicketSystem->num_customer_tickets($custnum,$priority);
+                    my $ahref = '';
+                    $ahref= '<A HREF="'.
+                            FS::TicketSystem->href_customer_tickets($custnum,$priority).
+                            '">'
+                      if $num;
+                 %>
+        
+                 <TR>
+                   <TD ALIGN=right>
+                     <FONT SIZE=-1><%= $ahref.$num %></A></FONT>
+                   </TD>
+                   <TD ALIGN=left>
+                     <FONT SIZE=-1><%= $ahref %><%= $priority || '<i>(none)</i>' %></A></FONT>
+                   </TD>
+                 </TR>
+   
+               <% } %>
+
+             <TR>
+               <TH ALIGN=right STYLE="border-top: dashed 1px black">
+               <FONT SIZE=-1>
+
+        <% } else { %>
+
+          <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %> ALIGN=right><FONT SIZE=-1>
+
+        <% } %>
+
+        <%
+           my $ahref = '';
+           $ahref = '<A HREF="'.
+                       FS::TicketSystem->href_customer_tickets($custnum).
+                       '">'
+             if $cust_main->get($addl_col);
+        %>
+
+        <%= $ahref %><%= $cust_main->get($addl_col) %></A>
+
+        <% if ( @custom_priorities ) { %>
+
+          </FONT></TH>
+            <TH ALIGN=left STYLE="border-top: dashed 1px black">
+              <FONT SIZE=-1><%= ${ahref} %>Total</A><FONT>
+            </TH>
+          </TR>
+          </TABLE>
+
+        <% } %>
+
+        </FONT></TD>
+
+      } else { %>
+
+        <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %> ALIGN=right><FONT SIZE=-1>
+          <%= $cust_main->get($addl_col) %>
+        </FONT></TD>
+
+<%
       }
-      print "</FONT></TD>";
     }
 
     my($n1)='';
@@ -473,6 +504,7 @@ END
       my $rowspan = scalar(@cust_svc) || 1;
 
       print $n1, qq!<TD CLASS="grid" BGCOLOR="$bgcolor"  ROWSPAN=$rowspan><A HREF="$pkgview"><FONT SIZE=-1>$pkg - $comment</FONT></A></TD>!;
+
       my($n2)='';
       foreach my $cust_svc ( @cust_svc ) {
          my($label, $value, $svcdb) = $cust_svc->label;
@@ -482,9 +514,19 @@ END
                qq!<TD CLASS="grid" BGCOLOR="$bgcolor" ><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$value</FONT></A></TD>!;
          $n2="</TR><TR>";
       }
+
+      unless ( @cust_svc ) {
+        print qq!<TD CLASS="grid" BGCOLOR="$bgcolor" COLSPAN=2>&nbsp;</TD>!;
+      }
+
       #print qq!</TR><TR>\n!;
       $n1="</TR><TR>";
     }
+
+    unless ( @{$all_pkgs{$custnum}} ) {
+      print qq!<TD CLASS="grid" BGCOLOR="$bgcolor" COLSPAN=3>&nbsp;</TD>!;
+    }
+    
     print "</TR>";
   }