customer package browse: reset page on option change, RT#39822
[freeside.git] / httemplate / view / cust_main / packages.html
index 9add4b2..43ebb28 100755 (executable)
@@ -139,7 +139,7 @@ if ( el ) el.scrollIntoView(true);
       window.location = '<% $cgi->self_url %>;locationnum=' + what.options[what.selectedIndex].value;
 %     $cgi->param('locationnum', $locationnum);
     }
-    
+
   </SCRIPT>
 
 % }
@@ -302,16 +302,17 @@ if ( $cgi->param('locationnum') =~ /^(\d+)$/ ) {
 
 my $total_pkgs = $cust_main->all_pkgs;
 
-my $num_method = $hide_cancelled ? 'ncancelled_pkgs' : 'all_pkgs';
-my $num_pkgs = $cust_main->$num_method({ 
+my $method = $hide_cancelled ? 'ncancelled_pkgs' : 'all_pkgs';
+my $num_pkgs = $cust_main->$method({ 
   'addl_from' => $addl_from,
   'extra_sql' => $extra_sql,
 });
 
 my $maxrecords = 10;
 my $offset = $cgi->param('offset') =~ /^(\d+)$/ ? $1 : 0;
+$cgi->delete('offset');
 
-my @packages = $cust_main->all_pkgs( {
+my @packages = $cust_main->$method( {
   'select'    => "$cust_pkg_fields, $part_pkg_fields, $num_svcs",
   'addl_from' => $addl_from. "
     LEFT JOIN part_pkg_option AS setup_option