[Bps-public-commit] RT-Extension-MandatoryOnTransition branch, check-for-to-field, created. 0.18-1-g30ff3b7

Craig Kaiser craig at bestpractical.com
Tue Jul 2 09:01:07 EDT 2019


The branch, check-for-to-field has been created
        at  30ff3b78edc717bd0e64eef0aa1c6f01b5cd5b7c (commit)

- Log -----------------------------------------------------------------
commit 30ff3b78edc717bd0e64eef0aa1c6f01b5cd5b7c
Author: Craig Kaiser <craig at bestpractical.com>
Date:   Mon Jul 1 17:20:41 2019 -0400

    Check if we have a 'To' field before checking mandatory conditions
    
    If there is no 'To' field then a error will default to complaining that
    some field(s) are mandatory on queue change, even when the change being
    made is not a queue change.

diff --git a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/BeforeUpdate b/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/BeforeUpdate
index 171893f..70c49be 100644
--- a/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/BeforeUpdate
+++ b/html/Callbacks/RT-Extension-MandatoryOnTransition/Ticket/Update.html/BeforeUpdate
@@ -8,7 +8,7 @@ $results => []
 my $errors_ref = RT::Extension::MandatoryOnTransition->CheckMandatoryFields(
     ARGSRef => $ARGSRef,
     Ticket  => $TicketObj,
-    To      => $ARGSRef->{'Status'},
+    To      => $ARGSRef->{'Status'} || $ARGSRef->{'DefaultStatus'},
 );
 
 if (@$errors_ref) {
diff --git a/lib/RT/Extension/MandatoryOnTransition.pm b/lib/RT/Extension/MandatoryOnTransition.pm
index 97bf52c..5a6ee2a 100644
--- a/lib/RT/Extension/MandatoryOnTransition.pm
+++ b/lib/RT/Extension/MandatoryOnTransition.pm
@@ -503,6 +503,7 @@ sub CheckMandatoryFields {
     return \@errors unless @$core or @$cfs or @$roles;
 
     my $transition =  ($args{'From'} ||'') ne ($args{'To'} || '') ? 'Status' : 'Queue';
+    return \@errors unless $field_label{'Queue'} || $args{'To'} and defined $args{'From'} ? $args{'From'} ne $args{'To'} : 1;
 
     # If we were called from Modify.html (Basics) or ModifyAll.html
     # (Jumbo), where the SubmitTicket button goes by 'Save Changes',

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


More information about the Bps-public-commit mailing list