[Rt-commit] [rtir] 03/03: When creating an incident, try to load a queue in the correct constituency
Jesse Vincent
jesse at bestpractical.com
Wed Mar 25 00:59:00 EDT 2015
This is an automated email from the git hooks/post-receive script.
jesse pushed a commit to branch 3.4/remove_old_constituencies
in repository rtir.
commit ab80fb031ca83a21acf9a6dc4e28c5f553e19b3f
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Tue Mar 24 21:56:45 2015 -0700
When creating an incident, try to load a queue in the correct
constituency
---
html/RTIR/Incident/Create.html | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 14052f5..6d837b6 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -330,8 +330,25 @@ for my $related_ticket ($ChildObj, $SplitObj) {
}
-my $QueueObj = RT::Queue->new( $session{'CurrentUser'} );
-$QueueObj->Load( 'Incidents' ) || Abort( loc("Queue could not be loaded.") );
+my $QueueObj;
+
+# XXX TODO refactor this into library code
+# that 'finds the first plausible queue with the right constituency
+my $collection = RT::Queues->new($session{'CurrentUser'});
+$collection->Limit(FIELD => 'Lifecycle', VALUE => RT::IR->lifecycle_incident);
+while (my $queue = $collection->Next) {
+ if (($queue->FirstCustomFieldValue('RTIR Constituency') ||'')
+ eq $constituency) {
+ $QueueObj = $queue;
+ last;
+ }
+}
+
+if (!$QueueObj) {
+ $QueueObj->Load( 'Incidents' )
+ || Abort( loc("Queue could not be loaded.") );
+}
+
my $ticket = RT::Ticket->new($session{'CurrentUser'}); # empty ticket object
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list