pg 8.1 fix from Chris Cappuccio
[freeside.git] / httemplate / search / report_receivables.cgi
index 535afcc..1dd0fee 100755 (executable)
@@ -110,7 +110,7 @@ END
     $owed_cols =~
       s/cust_bill\.custnum/cust_bill.custnum AND cust_main.agentnum = '$agentnum'/g;
   }
-  my $total_sql = "select $owed_cols";
+  my $total_sql = "select $owed_cols from cust_main";
   my $total_sth = dbh->prepare($total_sql) or die dbh->errstr;
   $total_sth->execute or die $total_sth->errstr;
   my $row = $total_sth->fetchrow_hashref();
@@ -121,6 +121,8 @@ END
   my $align = join('', map { /#/ ? 'r' : 'l' } FS::UI::Web::cust_header() ).
              'crrrrr';
 
+  my $clink = [ "${p}view/cust_main.cgi?", 'custnum' ];
+
 %><%= include( 'elements/search.html',
                  'title'       => 'Accounts Receivable Aging Summary',
                  'name'        => 'customers',
@@ -185,8 +187,7 @@ END
                                                    shift->get('owed_total') ) },
                                   ],
                  'links'       => [
-                                    [ "${p}view/cust_main.cgi?", 'custnum' ],
-                                    [ "${p}view/cust_main.cgi?", 'custnum' ],
+                                    ( map $clink, FS::UI::Web::cust_header() ),
                                     '',
                                     #'',
                                     '',