send commission reports by email, #33101
[freeside.git] / httemplate / search / cust_main.cgi
index 7c3ad33..f48ea3f 100755 (executable)
@@ -54,7 +54,7 @@
 %   my $refcustlabel = "$referral_custnum: " .
 %         ( $cust_main->company || $cust_main->last. ', '. $cust_main->first );
         referrals of
-        <A HREF="<% popurl(2)."view/cust_main.cgi?$referral_custnum" %>"><% $refcustlabel %></A>
+        <A HREF="<% popurl(2)."view/cust_main.cgi?$referral_custnum" %>"><% $refcustlabel |h %></A>
         <SELECT NAME="referral_depth" SIZE="1" onChange="changed(this)">';
 
 %    my $max = 8;
 %      $view = $p. 'view/cust_main.cgi?'. $custnum;
 %    }
 %    my $pcompany = $company
-%      ? qq!<A HREF="$view"><FONT SIZE=-1>$company</FONT></A>!
+%      ? qq!<A HREF="$view"><FONT SIZE=-1>!. encode_entities($company). '</FONT></A>'
 %      : '<FONT SIZE=-1>&nbsp;</FONT>';
 %    
-%    my $status = $cust_main->status;
-%    my $statuscol = $cust_main->statuscolor;
+%    my $status_label = $cust_main->status_label;
+%    my $statuscolor = $cust_main->statuscolor;
 
     <TR>
       <TD CLASS="grid" ALIGN="right" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
         <A HREF="<% $view %>"><FONT SIZE=-1><% $cust_main->display_custnum %></FONT></A>
       </TD>
       <TD CLASS="grid" ALIGN="center" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
-        <FONT SIZE="-1" COLOR="#<% $statuscol %>"><B><% ucfirst($status) %></B></FONT>
+        <FONT SIZE="-1" COLOR="#<% $statuscolor %>"><B><% $status_label %></B></FONT>
       </TD>
       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
-        <A HREF="<% $view %>"><FONT SIZE=-1><% "$last, $first" %></FONT></A>
+        <A HREF="<% $view %>"><FONT SIZE=-1><% "$last, $first" |h %></FONT></A>
       </TD>
       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
         <% $pcompany %>
 %      my $pkgnum = $_->pkgnum;
 %      my $part_pkg = $_->part_pkg;
 %
-%      my $pkg_comment = $part_pkg->pkg_comment(nopkgpart => 1);
+%      my $pkg_comment = $part_pkg->pkg_comment( cust_pkg=>$_, nopkgpart=>1 );
 %      my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/
 %                   ? ''
 %                   : ';show=packages';
 %      my $pkg_rowspan = shift @pkg_rowspans;
 
         <% $n1 %><TD CLASS="grid" BGCOLOR="<% $bgcolor %>"  ROWSPAN="<% $pkg_rowspan%>">
-            <A HREF="<% $pkgview %>"><FONT SIZE=-1><% $pkg_comment %></FONT></A>
+            <A HREF="<% $pkgview %>"><FONT SIZE=-1><% $pkg_comment |h %></FONT></A>
         </TD>
 
 %       my $n2 = '';
@@ -393,6 +393,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->ordered_sql  if $cgi->param('ordered');
   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');
@@ -470,7 +471,9 @@ if ( $cgi->param('browse')
     $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )";
     push @cust_main, smart_search(
       'search'            => scalar($cgi->param('search_cust')),
-      'no_fuzzy_on_exact' => ! $curuser->option('enable_fuzzy_on_exact'),
+      'no_fuzzy_on_exact' => ! ( $curuser->option('enable_fuzzy_on_exact')
+                                 || $conf->exists('enable_fuzzy_on_exact')
+                               ),
     );
   }