From 548bde0209edab634e5b2ea919e4a2096607d2d0 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 30 Mar 2010 02:53:10 +0000 Subject: employee (otaker / access_user) commissioning, RT#6991 --- httemplate/browse/access_user.html | 24 ++++++++++++--- httemplate/edit/access_user.html | 16 +++++----- httemplate/elements/search-cust_main.html | 44 +++++++++++++++------------- httemplate/elements/tr-search-cust_main.html | 15 ++++++++++ 4 files changed, 67 insertions(+), 32 deletions(-) create mode 100644 httemplate/elements/tr-search-cust_main.html (limited to 'httemplate') diff --git a/httemplate/browse/access_user.html b/httemplate/browse/access_user.html index 321025b69..3162e3a6c 100644 --- a/httemplate/browse/access_user.html +++ b/httemplate/browse/access_user.html @@ -49,13 +49,29 @@ my $groups_sub = sub { }; +my $cust_sub = sub { + my $access_user = shift; + $access_user->user_custnum ? $access_user->user_cust_main->name : ''; +}; +my $cust_link = [ $p.'view/cust_main.cgi?custnum=', 'user_custnum' ]; + my $count_query = 'SELECT COUNT(*) FROM access_user'; my $link = [ $p.'edit/access_user.html?', 'usernum' ]; -my @header = ( '#', 'Username', 'Full name', 'Groups' ); -my @fields = ( 'usernum', 'username', 'name', $groups_sub ); -my $align = 'rlll'; -my @links = ( $link, $link, $link, '' ); +my @header = ( '#', 'Username', 'Full name', 'Groups', 'Customer' ); +my @fields = ( 'usernum', 'username', 'name', $groups_sub, $cust_sub, ); +my $align = 'rllll'; +my @links = ( $link, $link, $link, '', $cust_link ); + +#if ( FS::Conf->new->config('ticket_system') ) { +# push @header, 'Ticketing'; +# push @fields, sub { +# my $access_user = shift; +# +# }; +# $align .= 'l'; +# push @links, ''; +#} diff --git a/httemplate/edit/access_user.html b/httemplate/edit/access_user.html index 73488ef9a..1f52b4789 100644 --- a/httemplate/edit/access_user.html +++ b/httemplate/edit/access_user.html @@ -7,16 +7,18 @@ { field=>'_password2', type=>'password' }, 'last', 'first', + { field=>'user_custnum', type=>'search-cust_main', }, { field=>'disabled', type=>'checkbox', value=>'Y' }, ], 'labels' => { - 'usernum' => 'User number', - 'username' => 'Username', - '_password' => 'Password', - '_password2'=> 'Re-enter Password', - 'last' => 'Last name', - 'first' => 'First name', - 'disabled' => 'Disable employee', + 'usernum' => 'User number', + 'username' => 'Username', + '_password' => 'Password', + '_password2 '=> 'Re-enter Password', + 'last' => 'Last name', + 'first' => 'First name', + 'user_custnum' => 'Customer (optional)', + 'disabled' => 'Disable employee', }, 'edit_callback' => sub { my( $c, $o ) = @_; $o->set('_password', ''); diff --git a/httemplate/elements/search-cust_main.html b/httemplate/elements/search-cust_main.html index ef0d22ced..23c4369e8 100644 --- a/httemplate/elements/search-cust_main.html +++ b/httemplate/elements/search-cust_main.html @@ -3,36 +3,37 @@ Example: include( '/elements/search-cust_main.html, - 'field_name' => 'custnum', + 'field' => 'custnum', + #slightly deprecated old synonym for field#'field_name'=>'custnum', 'find_button' => 1, #add a "find" button to the field 'curr_value' => 54, #current value 'value => 32, #deprecated synonym for curr_value ); - + % if ( $opt{'find_button'} ) { % } - <% include('/elements/xmlhttp.html', @@ -43,7 +44,7 @@ Example: