altered FS::UI::Web::cust_sort_fields() and cust_sql_fields() so that ->param('cust_f...
authorC.J. Adams-Collier <cjac@colliertech.org>
Wed, 10 Sep 2014 00:42:19 +0000 (17:42 -0700)
committerC.J. Adams-Collier <cjac@colliertech.org>
Wed, 17 Sep 2014 00:19:38 +0000 (17:19 -0700)
when the parameter is not passed, the initial value previously passed to cust_header() is used
if @cust_fields is empty, cust_header() is called with no arguments

FS/FS/UI/Web.pm
httemplate/search/elements/cust_main_dayranges.html

index fba4a45..0aeaa5b 100644 (file)
@@ -325,7 +325,7 @@ sub cust_header {
 }
 
 sub cust_sort_fields {
-  cust_header(@_);
+  cust_header(@_) if( @_ or !@cust_fields );
   #inefficientish, but tiny lists and only run once per page
 
   map { $_ eq 'custnum' ? 'custnum' : '' } @cust_fields;
@@ -347,7 +347,7 @@ sub cust_sql_fields {
   my @fields = qw( last first company );
 #  push @fields, map "ship_$_", @fields;
 
-  cust_header(@_);
+  cust_header(@_) if( @_ or !@cust_fields );
   #inefficientish, but tiny lists and only run once per page
 
   my @location_fields;
@@ -487,6 +487,7 @@ element.
 
 sub cust_fields_subs {
   my $unlinked_warn = 0;
+
   return map { 
     my $f = $_;
     if ( $unlinked_warn++ ) {
index ddde23a..5dbece8 100644 (file)
@@ -187,7 +187,7 @@ my $sql_query = {
                    'cust_main.custnum',
                    $range_cols,
                    $packages_cols,
-                   FS::UI::Web::cust_sql_fields($cgi->param('cust_fields')),
+                   FS::UI::Web::cust_sql_fields(),
                    'payby',
                  ),
   'extra_sql' => $where,