[Rt-commit] rt branch 5.0/fix-enable-checkbox-on-scrip-creation created. rt-5.0.4-227-gaf3b4da005

BPS Git Server git at git.bestpractical.com
Wed Sep 20 14:57:47 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/fix-enable-checkbox-on-scrip-creation has been created
        at  af3b4da00540c6dff9bca527a9ab5ea34438d355 (commit)

- Log -----------------------------------------------------------------
commit af3b4da00540c6dff9bca527a9ab5ea34438d355
Author: Ronaldo Richieri <ronaldo at bestpractical.com>
Date:   Wed Sep 20 11:54:21 2023 -0300

    Fix Enable checkbox behavior on Scrip Creation
    
    In fee8a9b4f0, 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.

diff --git a/share/html/Admin/Scrips/Create.html b/share/html/Admin/Scrips/Create.html
index a5e4b3de9d..4f05a6217f 100644
--- a/share/html/Admin/Scrips/Create.html
+++ b/share/html/Admin/Scrips/Create.html
@@ -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>
  </&>
@@ -96,7 +96,8 @@ $Global => undef
 <%INIT>
 my @results;
 
-$ARGS{'Enabled'} = 1 unless $ARGS{'SetEnabled'};
+my $disabled = 1;
+$disabled = 0 if $ARGS{"Enabled"};
 
 my $queue_obj;
 if ( $Queue ) {
@@ -120,7 +121,7 @@ if ( $Create ) {
 
         Queue                  => $Queue || 0,
         Stage                  => $ARGS{"Stage"},
-        Disabled               => $ARGS{"Disabled"},
+        Disabled               => $disabled,
 
         ScripAction            => $ARGS{"ScripAction"},
         ScripCondition         => $ARGS{"ScripCondition"},

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list