X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Faccess_user.html;h=8eb3e330aa957180f81d412b983c2f994212acc3;hb=79f1e3f6d8172bbb4e85bc063f19ba0010c9253f;hp=38d5430b12653ac310b718318d6757e0e9cee744;hpb=2c757d7db4cb6a7b9655de13206fcc84fb7ce61f;p=freeside.git diff --git a/httemplate/browse/access_user.html b/httemplate/browse/access_user.html index 38d5430b1..8eb3e330a 100644 --- a/httemplate/browse/access_user.html +++ b/httemplate/browse/access_user.html @@ -1,10 +1,40 @@ -<% +<% include( 'elements/browse.html', + 'title' => 'Internal Users', + 'menubar' => [ #'Main menu' => $p, + 'Internal access groups' => $p.'browse/access_group.html', + ], + 'html_init' => $html_init, + 'html_posttotal' => $posttotal, + 'name' => 'internal users', + 'query' => { 'table' => 'access_user', + 'hashref' => \%search, + 'extra_sql' => 'ORDER BY last, first', + }, + 'count_query' => $count_query, + 'header' => \@header, + 'fields' => \@fields, + 'links' => \@links, + 'style' => \@style, + ) +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); my $html_init = "Internal users have access to the back-office interface. Typically, this is your employees and contractors, but in a VISP setup, you can also add accounts for your reseller's employees. It is highly recommended to add a separate account for each person rather than using role accounts.

". qq!Add an internal user

!; -#false laziness w/agent_type.cgi +#false laziness w/part_pkg.cgi +my %search = (); +my $search = ''; +unless ( $cgi->param('showdisabled') ) { + %search = ( 'disabled' => '' ); + $search = "( disabled = '' OR disabled IS NULL )"; +} + +#false laziness w/access_group.html & agent_type.cgi my $groups_sub = sub { my $access_user = shift; @@ -28,36 +58,45 @@ my $groups_sub = sub { }; +my $posttotal; +if ( $cgi->param('showdisabled') ) { + $cgi->param('showdisabled', 0); + $posttotal = '( hide disabled users )'; + $cgi->param('showdisabled', 1); +} else { + $cgi->param('showdisabled', 1); + $posttotal = '( show disabled users )'; + $cgi->param('showdisabled', 0); +} + my $count_query = 'SELECT COUNT(*) FROM access_user'; +$count_query .= " WHERE $search" + if $search; my $link = [ $p.'edit/access_user.html?', 'usernum' ]; -%><%= include( 'elements/browse.html', - 'title' => 'Internal Users', - 'menubar' => [ #'Main menu' => $p, - 'Internal access groups' => $p.'browse/access_group.html', - ], - 'html_init' => $html_init, - 'name' => 'internal users', - 'query' => { 'table' => 'access_user', - 'hashref' => {}, - 'extra_sql' => 'ORDER BY last, first', - }, - 'count_query' => $count_query, - 'header' => [ '#', - 'Username', - 'Full name', - 'Groups' - ], - 'fields' => [ 'usernum', - 'username', - 'name', # sub { shift->name }, - $groups_sub, - ], - 'links' => [ $link, - $link, - $link, - '' - ], - ) -%> +my @header = ( '#', 'Username' ); +my @fields = ( 'usernum', 'username' ); +my $align = 'rl'; +my @links = ( $link, $link ); +my @style = ( '', '' ); + +#false laziness w/part_pkg.cgi +#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'; +} + +push @header, 'Full name', 'Groups'; +push @fields, 'name', $groups_sub; +push @links, $link, ''; +$align .= 'll'; + +