add internal user disable-ing
[freeside.git] / httemplate / browse / part_pkg.cgi
index 0afa547..a5e212d 100755 (executable)
@@ -1,5 +1,6 @@
 <%
 
+#false laziness w/access_user.html
 my %search = ();
 my $search = '';
 unless ( $cgi->param('showdisabled') ) {
@@ -11,8 +12,8 @@ my $select = '*';
 my $orderby = 'pkgpart';
 if ( $cgi->param('active') ) {
 
-  $orderby = 'num_active';
-
+  $orderby = 'num_active DESC';
+}
   $select = "
 
     *,
@@ -33,13 +34,13 @@ if ( $cgi->param('active') ) {
 
   ";
 
-}
+#}
 
 my $conf = new FS::Conf;
 my $taxclasses = $conf->exists('enable_taxclasses');
 
 my $html_init;
-unless ( $cgi->param('active') ) {
+#unless ( $cgi->param('active') ) {
   $html_init = qq!
     One or more service definitions are grouped together into a package 
     definition and given pricing information.  Customers purchase packages
@@ -47,17 +48,20 @@ unless ( $cgi->param('active') ) {
     <A HREF="${p}edit/part_pkg.cgi"><I>Add a new package definition</I></A>
     <BR><BR>
   !;
-}
+#}
 
 my $posttotal;
 if ( $cgi->param('showdisabled') ) {
   $cgi->param('showdisabled', 0);
   $posttotal = '( <a href="'. $cgi->self_url. '">hide disabled packages</a> )';
+  $cgi->param('showdisabled', 1);
 } else {
   $cgi->param('showdisabled', 1);
   $posttotal = '( <a href="'. $cgi->self_url. '">show disabled packages</a> )';
+  $cgi->param('showdisabled', 0);
 }
 
+
 # ------
 
 my $link = [ $p.'edit/part_pkg.cgi?', 'pkgpart' ];
@@ -68,7 +72,9 @@ my $align = 'rll';
 my @links = ( $link, $link, '' );
 my @style = ( '', '', '' );
 
-unless ( $cgi->param('showdisabled') ) { #its been reversed already
+#false laziness w/access_user.html
+#unless ( $cgi->param('showdisabled') ) { #its been reversed already
+if ( $cgi->param('showdisabled') ) { #its been reversed already
   push @header, 'Status';
   push @fields, sub { shift->disabled
                         ? '<FONT COLOR="#FF0000">DISABLED</FONT>'
@@ -85,7 +91,7 @@ unless ( 0 ) { #already showing only one class or something?
   $align .= 'l';
 }
 
-if ( $cgi->param('active') ) {
+#if ( $cgi->param('active') ) {
   push @header, 'Customer<BR>packages';
   my %col = (
     'active'      => '00CC00',
@@ -117,7 +123,7 @@ if ( $cgi->param('active') ) {
                             } (qw( active suspended cancelled ))
                       ]; };
   $align .= 'r';
-}
+#}
 
 push @header, 'Frequency';
 push @fields, sub { shift->freq_pretty; };