turn debug off
[freeside.git] / httemplate / edit / part_virtual_field.html
1 <% include('elements/edit.html',
2              'name_singular' => 'custom field',
3              'viewall_dir'  => 'browse',
4              'table'         => 'part_virtual_field',
5              'labels' => { 'vfieldpart'     => '',
6                            'dbtable'        => 'Table',
7                            'name'           => 'Name',
8                            'length'         => 'Length',
9                            'label'          => 'Label',
10                            'dbtable_dummy'  => 'Table',
11                          },
12              'fields' => [ 
13                            { field=>'vfieldpart', type=>'hidden', },
14                            { field=>'name', type=>'text', },
15                            { field  => 'dbtable',
16                              type   => 'select',
17                              options => [ 'svc_broadband', 'router', 'cust_main', ],
18                            },
19                            { field=>'label', type=>'text', },
20                            { field=>'length', type=>'text', },
21                          ],
22             'edit_callback' => $callback,
23             'error_callback' => $callback,
24             'html_init'      => 'Please be patient after clicking the button as 
25                                 this process may take more than 10 seconds.
26                                 <br><br>',
27           )
28 %>
29 <%init>
30
31 my $callback = sub {
32   my ($cgi, $object, $fields) = (shift, shift, shift);
33   my @edit_fixed_fields = qw( dbtable name length );
34   foreach my $f ( @{$fields} ) {
35       # XXX: editing anything other than label is disabled for now
36       $f->{type} = 'fixed' 
37         if $object->vfieldpart && grep { $f->{field} eq $_ } @edit_fixed_fields;
38   }
39 };
40
41 die "access denied"
42   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
43
44 </%init>