X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fedit%2Fpart_virtual_field.html;fp=httemplate%2Fedit%2Fpart_virtual_field.html;h=f3fb53065c5df23f9691183b936c144f965669bf;hb=c405e80203f323a83b447d6fc899dbba32d52f2a;hp=0000000000000000000000000000000000000000;hpb=99e8e2006117bd4b97ebb1daf897cc257265dc3f;p=freeside.git diff --git a/httemplate/edit/part_virtual_field.html b/httemplate/edit/part_virtual_field.html new file mode 100644 index 000000000..f3fb53065 --- /dev/null +++ b/httemplate/edit/part_virtual_field.html @@ -0,0 +1,44 @@ +<% include('elements/edit.html', + 'name_singular' => 'custom field', + 'viewall_dir' => 'browse', + 'table' => 'part_virtual_field', + 'labels' => { 'vfieldpart' => '', + 'dbtable' => 'Table', + 'name' => 'Name', + 'length' => 'Length', + 'label' => 'Label', + 'dbtable_dummy' => 'Table', + }, + 'fields' => [ + { field=>'vfieldpart', type=>'hidden', }, + { field=>'name', type=>'text', }, + { field => 'dbtable', + type => 'select', + options => [ 'svc_broadband', 'router', 'cust_main', ], + }, + { field=>'label', type=>'text', }, + { field=>'length', type=>'text', }, + ], + 'edit_callback' => $callback, + 'error_callback' => $callback, + 'html_init' => 'Please be patient after clicking the button as + this process may take more than 10 seconds. +

', + ) +%> +<%init> + +my $callback = sub { + my ($cgi, $object, $fields) = (shift, shift, shift); + my @edit_fixed_fields = qw( dbtable name length ); + foreach my $f ( @{$fields} ) { + # XXX: editing anything other than label is disabled for now + $f->{type} = 'fixed' + if $object->vfieldpart && grep { $f->{field} eq $_ } @edit_fixed_fields; + } +}; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +