X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_pkg.cgi;h=78cb77d269c00c447b163c3d1aa4f5173825d645;hb=5bbee276dcee33d010a98930ab94d1e990c7e3ff;hp=5acf17ef2125e878e028c30bb2e078f465707dd4;hpb=0dd05e9ff98263d2d42b419b1e278a5a3bc594b2;p=freeside.git diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi index 5acf17ef2..78cb77d26 100755 --- a/httemplate/browse/part_pkg.cgi +++ b/httemplate/browse/part_pkg.cgi @@ -1,34 +1,29 @@ <% include( 'elements/browse.html', - 'title' => 'Package Definitions', - 'menubar' => [ 'Main Menu' => $p ], - 'html_init' => $html_init, - 'html_posttotal' => $posttotal, - 'name' => 'package definitions', - 'query' => { 'select' => $select, - 'table' => 'part_pkg', - 'hashref' => \%search, - 'extra_sql' => "ORDER BY $orderby", - }, - 'count_query' => $count_query, - 'header' => \@header, - 'fields' => \@fields, - 'links' => \@links, - 'align' => $align, - 'style' => \@style, + 'title' => 'Package Definitions', + 'html_init' => $html_init, + 'name' => 'package definitions', + 'disableable' => 1, + 'disabled_statuspos' => 3, + 'agent_virt' => 1, + 'agent_null_right' => 'Edit global package definitions', + 'agent_pos' => 4, + 'query' => { 'select' => $select, + 'table' => 'part_pkg', + 'hashref' => {}, + 'order_by' => "ORDER BY $orderby", + }, + 'count_query' => $count_query, + 'header' => \@header, + 'fields' => \@fields, + 'links' => \@links, + 'align' => $align, ) %> <%init> die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -#false laziness w/access_user.html -my %search = (); -my $search = ''; -unless ( $cgi->param('showdisabled') ) { - %search = ( 'disabled' => '' ); - $search = "( disabled = '' OR disabled IS NULL )"; -} + unless $FS::CurrentUser::CurrentUser->access_right('Edit package definitions') + || $FS::CurrentUser::CurrentUser->access_right('Edit global package definitions'); my $select = '*'; my $orderby = 'pkgpart'; @@ -72,18 +67,6 @@ my $html_init; !; #} -my $posttotal; -if ( $cgi->param('showdisabled') ) { - $cgi->param('showdisabled', 0); - $posttotal = '( hide disabled packages )'; - $cgi->param('showdisabled', 1); -} else { - $cgi->param('showdisabled', 1); - $posttotal = '( show disabled packages )'; - $cgi->param('showdisabled', 0); -} - - # ------ my $link = [ $p.'edit/part_pkg.cgi?', 'pkgpart' ]; @@ -92,20 +75,6 @@ my @header = ( '#', 'Package', 'Comment' ); my @fields = ( 'pkgpart', 'pkg', 'comment' ); my $align = 'rll'; my @links = ( $link, $link, '' ); -my @style = ( '', '', '' ); - -#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 - ? 'DISABLED' - : 'Active' - }; - push @links, ''; - $align .= 'c'; - push @style, 'b'; -} unless ( 0 ) { #already showing only one class or something? push @header, 'Class'; @@ -254,8 +223,9 @@ $align .= 'lrl'; #rr'; # -------- -my $count_query = 'SELECT COUNT(*) FROM part_pkg'; -$count_query .= " WHERE $search" - if $search; +my $count_query = 'SELECT COUNT(*) FROM part_pkg WHERE '. + $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'Edit global package definitions', + );