[Bps-public-commit] RT-Extension-MandatoryOnTransition branch, always-display-fields-option, created. 0.09_01-3-ga2f09d2

Todd Wade todd at bestpractical.com
Thu Oct 1 15:19:08 EDT 2015


The branch, always-display-fields-option has been created
        at  a2f09d2d4ff5a55f1874daa75fee1406745b87b3 (commit)

- Log -----------------------------------------------------------------
commit a2f09d2d4ff5a55f1874daa75fee1406745b87b3
Author: Todd Wade <todd at bestpractical.com>
Date:   Thu Oct 1 15:15:51 2015 -0400

    Add a config option that always displays the mandatory fields
    
    Before this change the fields that were flagged by the extension config
    would only show on the display page when it is required that they be
    givne a value. This update provides a configuration option to always
    show the fields on the update page even if they are not required to be set
    for the current update.

diff --git a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/AfterWorked b/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/AfterWorked
index b00e7d7..772b910 100644
--- a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/AfterWorked
+++ b/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/AfterWorked
@@ -3,6 +3,7 @@ $Ticket
 </%args>
 <%init>
 my ($core, $cfs) = RT::Extension::MandatoryOnTransition->RequiredFields(
+    Display => 1,
     Ticket  => $Ticket,
     To      => $ARGS{'Status'} || $ARGS{'DefaultStatus'},
 );
diff --git a/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/reply/AfterWorked b/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/reply/AfterWorked
index ca9ae5d..77a3c76 100644
--- a/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/reply/AfterWorked
+++ b/html/Callbacks/RT-Extension-MandatoryOnTransition/m/ticket/reply/AfterWorked
@@ -4,6 +4,7 @@ $Ticket
 <%init>
 
 my ($core, $cfs) = RT::Extension::MandatoryOnTransition->RequiredFields(
+    Display => 1,
     Ticket  => $Ticket,
     To      => $ARGS{'Status'} || $ARGS{'DefaultStatus'},
 );
diff --git a/lib/RT/Extension/MandatoryOnTransition.pm b/lib/RT/Extension/MandatoryOnTransition.pm
index 7d3fec2..22b50c7 100644
--- a/lib/RT/Extension/MandatoryOnTransition.pm
+++ b/lib/RT/Extension/MandatoryOnTransition.pm
@@ -260,19 +260,23 @@ sub RequiredFields {
         $args{Queue} ||= $args{Ticket}->QueueObj->Name;
         $args{From}  ||= $args{Ticket}->Status;
     }
-    my ($from, $to) = @args{qw(From To)};
-    return ([], []) unless $from and $to;
-
     my %config = $self->Config($args{Queue});
     return ([], []) unless %config;
 
-    # No transition.
-    return ([], []) if $from eq $to;
+    my $required;
+    if ( $args{Display} and RT->Config->Get('MandatoryOnTransitionAlwaysShow') ) {
+        $required = [ map { ref $_ ? @$_ : $_ } values %config ];
+    } else {
+        my ($from, $to) = @args{qw(From To)};
+        # No transition
+        return ([], []) unless $from and $to;
+        return ([], []) if $from eq $to;
 
-    my $required = $config{"$from -> $to"}
+        $required = $config{"$from -> $to"}
                 || $config{"* -> $to"}
                 || $config{"$from -> *"}
                 || [];
+    }
 
     my %core_supported = map { $_ => 1 } @CORE_SUPPORTED;
 

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


More information about the Bps-public-commit mailing list