Skip to content

Commit

Permalink
Fix Enable checkbox behavior on Scrip Creation
Browse files Browse the repository at this point in the history
In fee8a9b, the previous EditScrip page was split into Create and
Modify. In the process of doing so, some elements were not properly
adapted to the Create scrip page. This led to the fact that the
"Enable" checkbox had no effect on Scrip Creation page and Scrips were
being created as enabled regardless of the checkbox state.
  • Loading branch information
richieri-bps authored and sunnavy committed Dec 22, 2023
1 parent c29acbe commit d4a613f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions share/html/Admin/Scrips/Create.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@
<& /Admin/Elements/SelectStage, Default => $ARGS{"Stage"} &>
</&>

<input type="hidden" class="hidden" name="SetEnabled" value="1" />

<&| /Elements/LabeledValue, Label => '' &>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input checkbox" name="Enabled" id="Enabled" value="1" <% $ARGS{'Enabled'}? 'checked="checked"': '' |n%> />
% # If $Create is not defined, it means that it's the first time the user
% # sees the form and we should check the box by default.
<input type="checkbox" class="custom-control-input checkbox" name="Enabled" id="Enabled" value="1" <% ($ARGS{'Enabled'} || !$Create ) ? 'checked="checked"' : '' |n %> />
<label class="custom-control-label" for="Enabled"><&|/l&>Enabled (Unchecking this box disables this scrip)</&></label>
</div>
</&>
Expand Down Expand Up @@ -96,8 +96,6 @@
<%INIT>
my @results;

$ARGS{'Enabled'} = 1 unless $ARGS{'SetEnabled'};

my $queue_obj;
if ( $Queue ) {
$queue_obj = RT::Queue->new( $session{'CurrentUser'} );
Expand All @@ -120,7 +118,7 @@

Queue => $Queue || 0,
Stage => $ARGS{"Stage"},
Disabled => $ARGS{"Disabled"},
Disabled => $ARGS{"Enabled"} ? 0 : 1,

ScripAction => $ARGS{"ScripAction"},
ScripCondition => $ARGS{"ScripCondition"},
Expand Down

0 comments on commit d4a613f

Please sign in to comment.