[Bps-public-commit] RT-Extension-MandatoryOnTransition branch, check-for-to-field, created. 0.18-1-gcdb9b2e
Craig Kaiser
craig at bestpractical.com
Tue Jul 2 13:38:15 EDT 2019
The branch, check-for-to-field has been created
at cdb9b2e419f1137fb557cd121c5918baa5f09509 (commit)
- Log -----------------------------------------------------------------
commit cdb9b2e419f1137fb557cd121c5918baa5f09509
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/lib/RT/Extension/MandatoryOnTransition.pm b/lib/RT/Extension/MandatoryOnTransition.pm
index 97bf52c..4d5d4a1 100644
--- a/lib/RT/Extension/MandatoryOnTransition.pm
+++ b/lib/RT/Extension/MandatoryOnTransition.pm
@@ -479,14 +479,16 @@ sub CheckMandatoryFields {
}
# Some convenience variables set depending on what gets passed
- my ($CFs, $CurrentUser);
+ my ($CFs, $CurrentUser, $queue_current);
if ( $args{'Ticket'} ){
$CFs = $args{'Ticket'}->CustomFields;
$CurrentUser = $args{'Ticket'}->CurrentUser();
+ $queue_current = $args{'Ticket'}->QueueObj->Name;
}
elsif ( $args{'Queue'} ){
$CFs = $args{'Queue'}->TicketCustomFields;
$CurrentUser = $args{'Queue'}->CurrentUser();
+ $queue_current = $args{'Queue'}->Name;
}
else{
$RT::Logger->error("CheckMandatoryFields requires a Ticket object or a Queue object");
@@ -503,6 +505,8 @@ 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'} && $queue_current ne $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