fix some problems with ordering packages on alt. locations, #23189, #940
[freeside.git] / httemplate / edit / access_user.html
1 <% include( 'elements/edit.html',
2                  'name'   => 'Employee',
3                  'table'  => 'access_user',
4                  'fields' => [
5                                'username',
6                                { field=>'_password', type=>'password' },
7                                { field=>'_password2', type=>'password' },
8                                'last',
9                                'first',
10                                { field=>'user_custnum', type=>'search-cust_main', },
11                                { field=>'disabled', type=>'checkbox', value=>'Y' },
12                              ],
13                  'labels' => { 
14                                'usernum'      => 'User number',
15                                'username'     => 'Username',
16                                '_password'    => 'Password',
17                                '_password2'   => 'Re-enter Password',
18                                'last'         => 'Last name',
19                                'first'        => 'First name',
20                                'user_custnum' => 'Customer (optional)',
21                                'disabled'     => 'Disable employee',
22                              },
23                  'edit_callback' => \&edit_callback,
24                  'field_callback'=> \&field_callback,
25                  'viewall_dir' => 'browse',
26                  'html_bottom' =>
27                    sub {
28                      my $access_user = shift;
29
30                      '<BR>Employee Groups<BR>'.
31                      ntable("#cccccc",2).
32                      '<TR><TD>'.
33                      include( '/elements/checkboxes-table.html',
34                                 'source_obj'   => $access_user,
35                                 'link_table'   => 'access_usergroup',
36                                 'target_table' => 'access_group',
37                                 'name_col'     => 'groupname',
38                                 'target_link'  => $p.'edit/access_group.html?',
39                                 #'disable-able' => 1,
40                             ).
41                      '</TR></TD></TABLE>'
42                      ;
43                    },
44                  'onsubmit'  => 'check_user_custnum_search',
45                  'html_foot' => $check_user_custnum_search,
46            )
47 %>
48 <%init>
49
50 die "access denied"
51   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
52
53 my $check_user_custnum_search = <<END;
54   <SCRIPT TYPE="text/javascript">
55     function check_user_custnum_search(what) {
56       while ( user_custnum_search_active ) {
57         // javascript needs ambien
58       }
59       return true;
60     }
61   </SCRIPT>
62 END
63
64 sub edit_callback {
65   my ($c, $o, $f, $opt) = @_;
66   $o->set('_password', '');
67 }
68
69 sub field_callback {
70   my ($c, $o, $f) = @_;
71   if($f->{'type'} eq 'password' and $o->is_system_user) {
72     $f->{'type'} = 'hidden';
73     $f->{'disabled'} = 1;
74   }
75 }
76
77 </%init>