add Excel and CSV download of templated reports and clean up their HTML formatting...
[freeside.git] / httemplate / search / cust_main.cgi
index 209c508..a325667 100755 (executable)
@@ -285,7 +285,7 @@ if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) {
       or eidiot "Illegal referral_custnum\n";
     my $referral_custnum = $1;
     my $cust_main = qsearchs('cust_main', { custnum => $referral_custnum } );
-    print '<FORM METHOD=POST>'.
+    print '<FORM METHOD="GET">'.
           qq!<INPUT TYPE="hidden" NAME="referral_custnum" VALUE="$referral_custnum">!.
           'referrals of <A HREF="'. popurl(2).
           "view/cust_main.cgi?$referral_custnum\">$referral_custnum: ".
@@ -398,36 +398,47 @@ END
     }
 
     foreach my $addl_col ( @addl_cols ) {
-      print "<TD ROWSPAN=$rowspan ALIGN=right>";
+      print "<TD ROWSPAN=$rowspan ALIGN=right><FONT SIZE=-1>";
       if ( $addl_col eq 'tickets' ) {
         if ( @custom_priorities ) {
-          print '<TABLE>';
+          print &itable('', 0);
           foreach my $priority ( @custom_priorities, '' ) {
-            my $ahref =
-              '<A HREF="'.
-                FS::TicketSystem->href_customer_tickets($custnum,$priority).
-              '">';
-            print "<TR><TD ALIGN=right>$ahref".
-                    FS::TicketSystem->num_customer_tickets($custnum,$priority).
-                  "</A></TD>".
-                  "<TD ALIGN=left>$ahref".
+          
+            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></TD></TR>";
+                  "</A></FONT></TD></TR>";
+
           }
-          print '<TR><TD BGCOLOR="#000000" COLSPAN=2>&nbsp;</TD></TR>'.
-                '<TR><TD ALIGN=right>';
+          print '<TR><TD BGCOLOR="#000000" COLSPAN=2></TD></TR>'.
+                '<TR><TD ALIGN=right><FONT SIZE=-1>';
         }
-        my $ahref =
-          '<A HREF="'.
-            FS::TicketSystem->href_customer_tickets($custnum).
-          '">';
+
+        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 "</TD><TD ALIGN=left>${ahref}Total</A></TD></TR></TABLE>"
+        print "</FONT></TD><TD ALIGN=left>".
+              "<FONT SIZE=-1>${ahref}Total</A><FONT>".
+              "</TD></TR></TABLE>"
           if @custom_priorities;
+
       } else {
         print $cust_main->get($addl_col);
       }
-      print "</TD>";
+      print "</FONT></TD>";
     }
 
     my($n1)='';