diff options
author | ivan <ivan> | 2008-01-13 21:35:54 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-01-13 21:35:54 +0000 |
commit | 0930d22ffc440f80c1b222b2e750cadbabd9e8f6 (patch) | |
tree | 59d6738ed4c685cd9bec804e9d3f661f4f37d72c /httemplate/edit/part_virtual_field.cgi | |
parent | f49f11d4c3c4ba9480cc5c9acfaa606a5ba73ad1 (diff) |
ACLs
Diffstat (limited to 'httemplate/edit/part_virtual_field.cgi')
-rw-r--r-- | httemplate/edit/part_virtual_field.cgi | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/httemplate/edit/part_virtual_field.cgi b/httemplate/edit/part_virtual_field.cgi index f7f20cfd7..04ba9b0c0 100644 --- a/httemplate/edit/part_virtual_field.cgi +++ b/httemplate/edit/part_virtual_field.cgi @@ -1,27 +1,3 @@ -% -%my ($vfieldpart, $part_virtual_field); -% -%if ( $cgi->param('error') ) { -% $part_virtual_field = new FS::part_virtual_field ( { -% map { $_, scalar($cgi->param($_)) } fields('part_virtual_field')}); -% $vfieldpart = $part_virtual_field->vfieldpart; -%} else { -% my($query) = $cgi->keywords; -% if ( $query =~ /^(\d+)$/ ) { #editing -% $vfieldpart=$1; -% $part_virtual_field=qsearchs('part_virtual_field', -% {'vfieldpart' => $vfieldpart}) -% or die "Unknown vfieldpart!"; -% -% } else { #adding -% $part_virtual_field = new FS::part_virtual_field({}); -% } -%} -%my $action = $part_virtual_field->vfieldpart ? 'Edit' : 'Add'; -% -%my $p1 = popurl(1); -% -% <% include('/elements/header.html', "$action Virtual Field Definition") %> <% include('/elements/error.html') %> @@ -97,3 +73,32 @@ Field #<B><%$vfieldpart or "(NEW)"%></B><BR><BR> <I>list_source</I> mean, <B>LEAVE THEM BLANK</B>. We mean it.</FONT> <% include('/elements/footer.html') %> + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +my ($vfieldpart, $part_virtual_field); + +if ( $cgi->param('error') ) { + $part_virtual_field = new FS::part_virtual_field ( { + map { $_, scalar($cgi->param($_)) } fields('part_virtual_field')}); + $vfieldpart = $part_virtual_field->vfieldpart; +} else { + my($query) = $cgi->keywords; + if ( $query =~ /^(\d+)$/ ) { #editing + $vfieldpart=$1; + $part_virtual_field=qsearchs('part_virtual_field', + {'vfieldpart' => $vfieldpart}) + or die "Unknown vfieldpart!"; + + } else { #adding + $part_virtual_field = new FS::part_virtual_field({}); + } +} +my $action = $part_virtual_field->vfieldpart ? 'Edit' : 'Add'; + +my $p1 = popurl(1); + +</%init> |