From 22546b219a7a2a3ee134586afc8cc40bbad9bc32 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Wed, 17 Jul 2013 16:08:45 -0700 Subject: [PATCH] also prevent some edits to auto-created scrips --- rt/share/html/Admin/Elements/EditScrip | 35 ++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/rt/share/html/Admin/Elements/EditScrip b/rt/share/html/Admin/Elements/EditScrip index be475076e..05a33d4da 100755 --- a/rt/share/html/Admin/Elements/EditScrip +++ b/rt/share/html/Admin/Elements/EditScrip @@ -54,20 +54,30 @@ <&| /Widgets/TitleBox, title => loc('Scrip Fields') &> - +&> +% } + <& /Admin/Elements/EditScripOptions, Name => "Condition", @@ -77,12 +87,18 @@ &> +&> +% } + <& /Admin/Elements/EditScripOptions, Name => "Action", @@ -92,11 +108,17 @@ &> +&> +% } +
<&|/l&>Description:
<&|/l&>Description:\ +% if ( $immutable ) { +<% $scrip->Description %> (system scrip) + +% } else { Description || '' %>" /> +% }
<&|/l&>Condition:\ +% if ( $immutable ) { +<% loc( $scrip->ConditionObj->Name ) %> + +% } else { <& /Admin/Elements/SelectScripCondition, Name => "Scrip-$id-ScripCondition", Default => $ARGS{"Scrip-$id-ScripCondition"} || $scrip->ConditionObj->Id, ScripObj => $scrip, Queue => $Queue, -&>
<&|/l&>Action:\ +% if ( $immutable ) { +<% loc( $scrip->ActionObj->Name ) %> + +% } else { <& /Admin/Elements/SelectScripAction, Name => "Scrip-$id-ScripAction", Default => $ARGS{"Scrip-$id-ScripAction"} || $scrip->ActionObj->Id, ScripObj => $scrip, Queue => $Queue, -&>
<&|/l&>Template:\ +% if ( $immutable ) { +<% $scrip->TemplateObj->Name %> + +% } else { <& /Admin/Elements/SelectTemplate, Name => "Scrip-$id-Template", Default => $ARGS{"Scrip-$id-Template"} || $scrip->TemplateObj->Id, Queue => $Queue, -&>
<&|/l&>Stage:\ <& /Admin/Elements/SelectStage, @@ -155,6 +177,7 @@ my (@actions, $SubmitLabel); my $scrip = RT::Scrip->new( $session{'CurrentUser'} ); +my $immutable = 0; if ( $id ) { $scrip->Load( $id ); @@ -162,6 +185,10 @@ if ( $id ) { push @actions, loc("Couldn't load scrip #[_1]", $id); } $SubmitLabel = loc('Save Changes'); + my $a = $scrip->FirstAttribute('Immutable'); + if ( defined($a) and $a->Content ) { + $immutable = 1; + } } unless ( $id ) { -- 2.11.0