[Rt-commit] rtir branch, 3.4/popup-ticket-create, created. 3.3.0-83-gffaaf6d
Dustin Graves
dustin at bestpractical.com
Tue May 17 19:56:51 EDT 2016
The branch, 3.4/popup-ticket-create has been created
at ffaaf6da2367e5070aa31dcf6cd3e689f28e9f14 (commit)
- Log -----------------------------------------------------------------
commit e9e6d374c8fb7e0326acc50914ae661b93d31d5b
Author: Dustin Graves <dustin at bestpractical.com>
Date: Sat Feb 27 00:28:52 2016 +0000
popup select queues for RTIR ticket create
Fixes: I#31743, I#31750
diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 6c14392..1f27811 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -64,6 +64,7 @@
<form action="<%RT::IR->HREFTo("Split.html") %>" method="post" enctype="multipart/form-data" name="TicketCreate">
% }
<input type="hidden" name="id" value="new" />
+<input type="hidden" class="hidden" name="Queue" value="<% $QueueObj->Id %>" />
<input type="hidden" class="hidden" name="Token" value="<% $ARGS{'Token'} %>" />
% if ( $Split ) {
<input type="hidden" name="Split" value="<% $SplitObj->id %>" />
@@ -100,15 +101,10 @@
QueueObj => $QueueObj,
fields => [
{ name => 'Queue',
- comp => '/RTIR/Elements/SelectRTIRQueue',
+ comp => '/Ticket/Elements/ShowQueue',
args => {
- Name => 'Queue',
- Default => $ARGS{'Queue'} || $QueueObj->Id,
- ShowNullOption => 0,
- Lifecycle => $QueueObj->Lifecycle,
- LimitToConstituency => (RT::IR->StrictConstituencyLinking ? 1:0),
- Constituency => $constituency
- }
+ QueueObj => $QueueObj,
+ },
},
{
name => 'Status',
diff --git a/html/RTIR/Elements/CreateInRTIRQueueModal b/html/RTIR/Elements/CreateInRTIRQueueModal
new file mode 100644
index 0000000..cf98050
--- /dev/null
+++ b/html/RTIR/Elements/CreateInRTIRQueueModal
@@ -0,0 +1,70 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%ARGS>
+$Lifecycle
+$LifecycleDesc => $Lifecycle
+$Incident => undef
+</%ARGS>
+<%INIT>
+$Lifecycle = $Lifecycle->[0] if (ref $Lifecycle eq 'ARRAY');
+</%INIT>
+<form action="<% RT::IR->HREFTo('Create.html') %>" id="CreateInQueue">
+% if ($Incident) {
+<input type="hidden" name="Incident" value="<%$Incident%>"/>
+% }
+ <&|/l_unsafe, $LifecycleDesc,
+ $m->scomp('/RTIR/Elements/SelectRTIRQueue',
+ Name => 'Queue',
+ Lifecycle => $Lifecycle,
+ #%ARGS,
+ ShowNullOption => 0,
+ LimitToConstituency => $m->{'RTIR_ConstituencyFilter'} ? 1:0,
+ Constituency => $m->{'RTIR_ConstituencyFilter'})
+ &>Create a new [_1] in the queue [_2]</&>
+ <& /Elements/Submit, Label => loc("Go"), Caption => loc("This will take you to a partially prefilled [_1] creation form.", $LifecycleDesc) &>
+</form>
diff --git a/html/RTIR/Helpers/CreateInRTIRQueueModal b/html/RTIR/Helpers/CreateInRTIRQueueModal
new file mode 100644
index 0000000..39ef32a
--- /dev/null
+++ b/html/RTIR/Helpers/CreateInRTIRQueueModal
@@ -0,0 +1,49 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<& /RTIR/Elements/CreateInRTIRQueueModal, %ARGS &>
+% $m->abort;
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 3494189..c9aefce 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -72,6 +72,7 @@ if ( $ChildObj && $ChildObj->id && !$ChildObj->CurrentUserHasRight('ModifyTicket
% }
<input type="hidden" name="id" value="new" />
+<input type="hidden" class="hidden" name="Queue" value="<% $QueueObj->Id %>" />
<input type="hidden" class="hidden" name="Token" value="<% $ARGS{'Token'} %>" />
% if ( $ChildObj ) {
<input type="hidden" name="Child" value="<% $Child %>" />
@@ -108,13 +109,7 @@ if ( $ChildObj && $ChildObj->id && !$ChildObj->CurrentUserHasRight('ModifyTicket
<tr class="queue">
<td class="label"><&|/l&>Queue</&>:</td>
<td colspan="2">
- <& /RTIR/Elements/SelectRTIRQueue,
- Name => 'Queue',
- Default => $ARGS{'Queue'} || $QueueObj->Id,
- Lifecycle => RT::IR->lifecycle_incident,
- LimitToConstituency => ($m->{'RTIR_ConstituencyFilter'} || RT::IR->StrictConstituencyLinking ) ? 1:0,
- Constituency => $constituency
- &>
+ <& /Ticket/Elements/ShowQueue, QueueObj => $QueueObj &>
</td>
</tr>
@@ -270,6 +265,7 @@ if ( $ChildObj && $ChildObj->id && !$ChildObj->CurrentUserHasRight('ModifyTicket
<& /RTIR/Investigation/Elements/Create,
%ARGS,
NamePrefix => 'Investigation',
+ Queue => $ARGS{InvestigationQueue},
Lifecycle => RT::IR->lifecycle_investigation,
Constituency => $constituency,
SkipField => { Owner => 1, Attachments => 1, DateFields => 1 },
@@ -332,22 +328,14 @@ for my $related_ticket ($ChildObj, $SplitObj) {
}
-my $QueueObj;
+my $QueueObj = RT::Queue->new($session{'CurrentUser'});
+$QueueObj->Load( $ARGS{Queue} );
+
+if (!$QueueObj->Name) {
+Abort( loc("Queue '[_1]' could not be loaded.", $ARGS{Queue}) );
+ }
-# 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 ((RT::IR->ConstituencyFor($queue)||'') eq ($constituency||'')) {
- $QueueObj = $queue;
- last;
- }
-}
-if (!$QueueObj) {
- Abort( loc("Queue could not be loaded.") );
-}
my $ticket = RT::Ticket->new($session{'CurrentUser'}); # empty ticket object
diff --git a/html/RTIR/Incident/Elements/ShowChildren b/html/RTIR/Incident/Elements/ShowChildren
index 6402c72..fe6b278 100644
--- a/html/RTIR/Incident/Elements/ShowChildren
+++ b/html/RTIR/Incident/Elements/ShowChildren
@@ -115,6 +115,7 @@ if ( $IncidentObj->CurrentUserHasRight('ModifyTicket') ) {
# $QueueObj->Id and $QueueObj->CurrentUserHasRight('CreateTicket') ) {
push @box_actions, {
title => $Lifecycle ne RT::IR->lifecycle_investigation? loc('Create') : loc('Launch'),
+ class => 'create_child' . ($Lifecycle ? '_'.$Lifecycle : ''),
path => RT::IR->HREFTo("Create.html?Incident=$id&Lifecycle=".$Lifecycle),
};
}
@@ -131,7 +132,7 @@ if ( $total_count > $Rows ) {
};
}
my $box_actions = join ' 'x3,
- map qq{<a href="}. $_->{'path'} .q{">}
+ map q{<a href="} . $_->{'path'} . ( $_->{'class'} ? q{" class="} . $_->{'class'} : '' ) . q{">}
. $m->interp->apply_escapes( $_->{title}, 'h' ) . q{</a>},
@box_actions;
diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index 06f3da6..2d28013 100644
--- a/html/RTIR/Investigation/Elements/Create
+++ b/html/RTIR/Investigation/Elements/Create
@@ -46,6 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<input type="hidden" name="<% $NamePrefix %>Status" value="<% $ARGS{ $NamePrefix .'Status' } || $QueueObj->LifecycleObj->DefaultOnCreate %>" />
+<input type="hidden" class="hidden" name="<% $NamePrefix %>Queue" value="<% $QueueObj->Id %>" />
<div class="ticket-create-basics">
<&| /Widgets/TitleBox, title => loc("Basics"), class => 'ticket-info-basics' &>
@@ -60,13 +61,7 @@
<tr class="queue">
<td class="label"><&|/l&>Queue</&>:</td>
<td>
- <& /RTIR/Elements/SelectRTIRQueue,
- Name => $NamePrefix.'Queue',
- Default => $ARGS{'Queue'} || $QueueObj->Id,
- Lifecycle => RT::IR->lifecycle_investigation,
- LimitToConstituency => ($m->{'RTIR_ConstituencyFilter'} || RT::IR->StrictConstituencyLinking ) ? 1:0,
- Constituency => $Constituency
- &>
+ <& /Ticket/Elements/ShowQueue, QueueObj => $QueueObj &>
</td>
</tr>
% unless ( $SkipField{'Owner'} || $HideField{'Owner'} ) {
diff --git a/lib/RT/IR.pm b/lib/RT/IR.pm
index c03f5cf..29b3b5f 100644
--- a/lib/RT/IR.pm
+++ b/lib/RT/IR.pm
@@ -132,6 +132,7 @@ use Parse::BooleanLogic;
my $ticket_sql_parser = Parse::BooleanLogic->new;
RT->AddJavaScript('jquery.uncheckable-radio-0.1.js');
+RT->AddJavaScript('rtir.js');
RT->AddStyleSheets( 'rtir-styles.css' );
# Add the RTIR search result page to the whitelist to allow
diff --git a/static/js/rtir.js b/static/js/rtir.js
new file mode 100644
index 0000000..94abd8c
--- /dev/null
+++ b/static/js/rtir.js
@@ -0,0 +1,52 @@
+jQuery(function() {
+ var getQueryString = function(element) {
+ var href = jQuery(element).attr('href');
+ if (!href) return '';
+ var questionMarkIndex = href.indexOf('?');
+ if (!questionMarkIndex) return '';
+ return href.substring(questionMarkIndex+1);
+ };
+
+ var showModal = function(lifecycle, lifecycleDesc) {
+ var queryString = getQueryString(this);
+ jQuery.get(
+ RT.Config.WebHomePath + '/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=' + lifecycle + '&LifecycleDesc=' + lifecycleDesc + '&' + queryString,
+ function(html) {
+ jQuery("<div class='modal'></div>")
+ .append(html).appendTo("body")
+ .bind('modal:close', function(ev,modal) { modal.elm.remove(); })
+ .modal();
+ }
+ );
+ };
+
+ var showReportsModal = function(e) {
+ e.preventDefault();
+ showModal('incident_reports', 'report');
+ };
+
+ var showInvestigationsModal = function(e) {
+ e.preventDefault();
+ showModal('investigations', 'investigation');
+ };
+
+ var showBlocksModal = function(e) {
+ e.preventDefault();
+ showModal('blocks', 'block');
+ };
+
+ var showIncidentsModal = function(e) {
+ e.preventDefault();
+ showModal('incidents', 'incident');
+ };
+
+ jQuery("#reports-create").click(showReportsModal);
+ jQuery("#investigations-launch").click(showInvestigationsModal);
+ jQuery("#blocks-create").click(showBlocksModal);
+ jQuery("#incidents-create").click(showIncidentsModal);
+ jQuery("#create-incident").click(showIncidentsModal);
+
+ jQuery(".create_child_incident_reports").click(showReportsModal);
+ jQuery(".create_child_investigations").click(showInvestigationsModal);
+ jQuery(".create_child_blocks").click(showBlocksModal);
+});
commit 8e53511a1eee50572f1395e2be856f58a55323b1
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Mar 23 18:25:43 2016 +0000
remove "Create With Investigation" functionality
this prevents having to make incidents/investigations dropdowns dynamic
based on constituency selected
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index c9aefce..91d2306 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -47,7 +47,6 @@
%# END BPS TAGGED BLOCK }}}
<& /RTIR/Elements/Header,
Title => $Title,
- onload => "function () { hide('ticket-create-investigation') }",
&>
<& /Elements/Tabs &>
@@ -260,24 +259,6 @@ if ( $ChildObj && $ChildObj->id && !$ChildObj->CurrentUserHasRight('ModifyTicket
</div>
-<div id="ticket-create-investigation">
-<a name="investigation"></a>
-<& /RTIR/Investigation/Elements/Create,
- %ARGS,
- NamePrefix => 'Investigation',
- Queue => $ARGS{InvestigationQueue},
- Lifecycle => RT::IR->lifecycle_investigation,
- Constituency => $constituency,
- SkipField => { Owner => 1, Attachments => 1, DateFields => 1 },
- IncludeSignature => (exists $ARGS{'InvestigationContent'} ? 0 : 1),
-&>
-<& /Elements/Submit,
- Name => 'CreateWithInvestigation',
- Label => loc("Create Incident and run Investigation"),
- SubmitId => 'create-ticket-with-investigation'
-&>
-</div>
-
</form>
@@ -382,24 +363,6 @@ if ( $CreateIncident ) {
Fields => { Requestors => 'Requestor', Cc => 'Cc', AdminCc => 'AdminCc' },
results => \@results,
);
-
- if ( $CreateWithInvestigation ) {
- $checks_failure += RT::IR->FilterRTAddresses(
- ARGSRef => \%ARGS,
- Fields => {
- InvestigationRequestors => 'Requestor',
- InvestigationCc => 'Cc',
- InvestigationAdminCc => 'AdminCc',
- },
- results => \@results,
- );
- }
-
- if ( $CreateWithInvestigation && !$ARGS{'InvestigationRequestors'} ) {
- push @results, loc( "You must enter a correspondent for the investigation" );
- $checks_failure = 1;
- }
-
}
if ( !$checks_failure && $CreateIncident ) {
@@ -413,25 +376,6 @@ if ( !$checks_failure && $CreateIncident ) {
);
push @results, @tmp;
- my $inv_obj;
- if ( $inc_obj && $CreateWithInvestigation ) {
- my (@tmp);
- ($inv_obj, @tmp) = $m->comp(
- '/RTIR/Investigation/Elements/Create:Process',
- %ARGS,
- NamePrefix => 'Investigation',
- DefaultsNamePrefix => '',
- );
- push @results, @tmp;
- if ( $inv_obj ) {
- my($id, $msg) = $inv_obj->AddLink(
- Type => 'MemberOf',
- Target => $inc_obj->id
- );
- #XXX: correct message on success
- push @results, $msg if !$id || $msg;
- }
- }
if( $inc_obj ) {
$m->callback(CallbackName => 'BeforeDisplay', ARGSRef => \%ARGS, Child => $ChildObj);
@@ -451,19 +395,6 @@ else {
$SubmitLabel = loc('Create');
}
-PageMenu->child(
- incident => raw_html =>
- q{<a href="#incident"}
- . q{onclick="return switchVisibility('ticket-create-incident','ticket-create-investigation');"}
- . q{>} . loc('Incident') . q{</a>}
-);
-PageMenu->child(
- investigation => raw_html =>
- q[<a href="#investigation"]
- . q[ onclick="return switchVisibility('ticket-create-investigation','ticket-create-incident');"]
- . q[>] . loc('Launch Investigation') . q[</a>]
-);
-
unless ( exists $ARGS{'Content'} ) {
my $Transactions;
if ( $SplitObj ) {
@@ -486,8 +417,7 @@ unless ( exists $ARGS{'Content'} ) {
$Title => loc("Create a new Incident")
$QuoteTransaction => undef
-$CreateWithInvestigation => 0
-$CreateIncident => $CreateWithInvestigation
+$CreateIncident => 0
$Split => undef
commit 19bcb20a0c3dd276cd92f2b7958912f57d358fb9
Author: Dustin Graves <dustin at bestpractical.com>
Date: Fri Apr 29 22:34:12 2016 +0000
skip RTIR ticket create modal if there's only one choice
Like Self Service, if there is only one queue the user can create a
ticket it, they should be taken directly to the create page with no
popup.
diff --git a/static/js/rtir.js b/static/js/rtir.js
index 94abd8c..e583cd0 100644
--- a/static/js/rtir.js
+++ b/static/js/rtir.js
@@ -12,6 +12,13 @@ jQuery(function() {
jQuery.get(
RT.Config.WebHomePath + '/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=' + lifecycle + '&LifecycleDesc=' + lifecycleDesc + '&' + queryString,
function(html) {
+ // If there's only one queue, just create a ticket in it and skip the modal
+ var queues = jQuery(html).find("select[name='Queue'] > option");
+ if (queues.length === 1) {
+ window.location.href = RT.Config .WebHomePath + '/RTIR/Create.html?Queue=' + queues.first().val();
+ return;
+ }
+
jQuery("<div class='modal'></div>")
.append(html).appendTo("body")
.bind('modal:close', function(ev,modal) { modal.elm.remove(); })
commit 909b82aca038c2f5f1b54c38fcb3f2abe9125b80
Author: Dustin Graves <dustin at bestpractical.com>
Date: Fri Apr 29 22:44:08 2016 +0000
fix incident child ticket creation
On an incident, if you click on the Create or Launch links for IRs
or Investigations, the resulting ticket should be linked to the
originating Incident. It appears the incident linking is getting lost
with the new popup.
diff --git a/static/js/rtir.js b/static/js/rtir.js
index e583cd0..7a134d9 100644
--- a/static/js/rtir.js
+++ b/static/js/rtir.js
@@ -7,16 +7,17 @@ jQuery(function() {
return href.substring(questionMarkIndex+1);
};
- var showModal = function(lifecycle, lifecycleDesc) {
- var queryString = getQueryString(this);
+ var showModal = function(lifecycle, lifecycleDesc, triggeringObject) {
+ var queryString = getQueryString(triggeringObject);
+ console.log(queryString);
jQuery.get(
RT.Config.WebHomePath + '/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=' + lifecycle + '&LifecycleDesc=' + lifecycleDesc + '&' + queryString,
function(html) {
// If there's only one queue, just create a ticket in it and skip the modal
var queues = jQuery(html).find("select[name='Queue'] > option");
if (queues.length === 1) {
- window.location.href = RT.Config .WebHomePath + '/RTIR/Create.html?Queue=' + queues.first().val();
- return;
+ window.location.href = RT.Config .WebHomePath + '/RTIR/Create.html?Queue=' + queues.first().val() + '&' + queryString;
+ return;
}
jQuery("<div class='modal'></div>")
@@ -29,22 +30,22 @@ jQuery(function() {
var showReportsModal = function(e) {
e.preventDefault();
- showModal('incident_reports', 'report');
+ showModal('incident_reports', 'report', this);
};
var showInvestigationsModal = function(e) {
e.preventDefault();
- showModal('investigations', 'investigation');
+ showModal('investigations', 'investigation', this);
};
var showBlocksModal = function(e) {
e.preventDefault();
- showModal('blocks', 'block');
+ showModal('blocks', 'block', this);
};
var showIncidentsModal = function(e) {
e.preventDefault();
- showModal('incidents', 'incident');
+ showModal('incidents', 'incident', this);
};
jQuery("#reports-create").click(showReportsModal);
commit 6621c8c06d4639054e92380fb377dac5510727ec
Author: Dustin Graves <dustin at bestpractical.com>
Date: Thu May 12 23:28:41 2016 +0000
support constituency filtering with RTIR create in queue modal
diff --git a/static/js/rtir.js b/static/js/rtir.js
index 7a134d9..9bb4fe7 100644
--- a/static/js/rtir.js
+++ b/static/js/rtir.js
@@ -9,9 +9,18 @@ jQuery(function() {
var showModal = function(lifecycle, lifecycleDesc, triggeringObject) {
var queryString = getQueryString(triggeringObject);
- console.log(queryString);
+ var constituency = '';
+
+ var uri = window.location.href.split('/');
+ for (var i = 0; i < uri.length; i++) {
+ if (uri[i] === 'c') {
+ constituency = '/c/' + uri[i+1];
+ break;
+ }
+ }
+
jQuery.get(
- RT.Config.WebHomePath + '/RTIR/Helpers/CreateInRTIRQueueModal?Lifecycle=' + lifecycle + '&LifecycleDesc=' + lifecycleDesc + '&' + queryString,
+ RT.Config.WebHomePath + '/RTIR' + constituency + '/Helpers/CreateInRTIRQueueModal?Lifecycle=' + lifecycle + '&LifecycleDesc=' + lifecycleDesc + '&' + queryString,
function(html) {
// If there's only one queue, just create a ticket in it and skip the modal
var queues = jQuery(html).find("select[name='Queue'] > option");
commit 9bab6265d1a4b1b6915ea31c24cd3d1d8179ade2
Author: Dustin Graves <dustin at bestpractical.com>
Date: Thu May 12 23:32:33 2016 +0000
fix error and warnings in RT::Action::RTIR_ChangeChildConstituencies
error occured due to commit 9e9afd6c566 missing a variable declaration
warnings occured when moving to/from queue with no constituency
diff --git a/lib/RT/Action/RTIR_ChangeChildConstituencies.pm b/lib/RT/Action/RTIR_ChangeChildConstituencies.pm
index 29bb92c..b61f4aa 100644
--- a/lib/RT/Action/RTIR_ChangeChildConstituencies.pm
+++ b/lib/RT/Action/RTIR_ChangeChildConstituencies.pm
@@ -67,10 +67,10 @@ sub Prepare {
my $q2 = RT::Queue->new(RT->SystemUser);
$q2->Load($self->TransactionObj->NewValue);
- return 0 unless (RT::IR->ConstituencyFor($q2) ne RT::IR->ConstituencyFor($q1));
+ return 0 unless ((RT::IR->ConstituencyFor($q2)||'') ne (RT::IR->ConstituencyFor($q1)||''));
- $self->{'old_constituency'} = RT::IR->ConstituencyFor($q1);
- $self->{'new_constituency'} = RT::IR->ConstituencyFor($q2);
+ $self->{'old_constituency'} = RT::IR->ConstituencyFor($q1) || '';
+ $self->{'new_constituency'} = RT::IR->ConstituencyFor($q2) || '';
return 1;
}
@@ -85,6 +85,7 @@ sub Commit {
my $self = shift;
my $new_constituency = $self->{'new_constituency'};
+ my $old_constituency = $self->{'old_constituency'};
# find all the tickets related to this ticket
@@ -92,7 +93,7 @@ sub Commit {
# for each ticket,
while ( my $ticket = $kids->Next) {
- my $kid_constituency = RT::IR->ConstituencyFor($ticket);
+ my $kid_constituency = RT::IR->ConstituencyFor($ticket) || '';
next if ($kid_constituency eq $new_constituency);
next if ($kid_constituency ne $old_constituency);
# if the constituency of the other ticket isn't the same as the new
@@ -104,12 +105,12 @@ sub Commit {
my $new_queue = RT::Queue->new(RT->SystemUser);
$new_queue->Load($kid_queue);
if ( !$new_queue->id
- || ( RT::IR->ConstituencyFor($new_queue) ne $new_constituency)
+ || ( (RT::IR->ConstituencyFor($new_queue)||'') ne $new_constituency)
|| ($new_queue->Lifecycle ne $ticket->QueueObj->Lifecycle)) {
my $queues = RT::Queues->new(RT->SystemUser);
$queues->Limit(FIELD => 'Lifecycle', VALUE => $ticket->QueueObj->Lifecycle);
while (my $temp_queue = $queues->Next) {
- if (RT::IR->ConstituencyFor($temp_queue) eq $new_constituency) {
+ if ((RT::IR->ConstituencyFor($temp_queue)||'') eq $new_constituency) {
$new_queue = $temp_queue;
last;
}
commit 861df0fa0b3050d678377df472cc1af249d935d2
Author: Dustin Graves <dustin at bestpractical.com>
Date: Fri May 13 00:10:20 2016 +0000
add support in the create RTIR queue modal for child linked tickets and enforce strict contituency linking throughout
diff --git a/html/RTIR/Elements/CreateInRTIRQueueModal b/html/RTIR/Elements/CreateInRTIRQueueModal
index cf98050..5c6b479 100644
--- a/html/RTIR/Elements/CreateInRTIRQueueModal
+++ b/html/RTIR/Elements/CreateInRTIRQueueModal
@@ -49,22 +49,49 @@
$Lifecycle
$LifecycleDesc => $Lifecycle
$Incident => undef
+$Child => undef
</%ARGS>
<%INIT>
$Lifecycle = $Lifecycle->[0] if (ref $Lifecycle eq 'ARRAY');
+
+my ($linked_ticket, $linked_constituency);
+
+if ($Incident) {
+ $linked_ticket = RT::Ticket->new( $session{CurrentUser} );
+ $linked_ticket->Load($Incident);
+}
+
+if ($Child) {
+ $linked_ticket = RT::Ticket->new( $session{CurrentUser} );
+ $linked_ticket->Load($Child);
+}
+
+if ($linked_ticket && $linked_ticket->id) {
+ $linked_constituency = RT::IR->ConstituencyFor($linked_ticket);
+}
+
+my $limit_to_constituency =
+ # Limit no matter what if we have a filter
+ $m->{'RTIR_ConstituencyFilter'} ||
+ # Also limit if we have a linked constituency and StrictConstituencyLinking is set
+ (RT::IR->StrictConstituencyLinking && $linked_constituency)
+ ? 1:0;
</%INIT>
<form action="<% RT::IR->HREFTo('Create.html') %>" id="CreateInQueue">
% if ($Incident) {
<input type="hidden" name="Incident" value="<%$Incident%>"/>
% }
+% if ($Child) {
+<input type="hidden" name="Child" value="<%$Child%>"/>
+% }
<&|/l_unsafe, $LifecycleDesc,
$m->scomp('/RTIR/Elements/SelectRTIRQueue',
Name => 'Queue',
Lifecycle => $Lifecycle,
- #%ARGS,
ShowNullOption => 0,
- LimitToConstituency => $m->{'RTIR_ConstituencyFilter'} ? 1:0,
- Constituency => $m->{'RTIR_ConstituencyFilter'})
+ LimitToConstituency => $limit_to_constituency,
+ Constituency => $m->{'RTIR_ConstituencyFilter'} || $linked_constituency)
+
&>Create a new [_1] in the queue [_2]</&>
<& /Elements/Submit, Label => loc("Go"), Caption => loc("This will take you to a partially prefilled [_1] creation form.", $LifecycleDesc) &>
</form>
commit f8b6ad8a084162efb51c4ecec16a6fd2381e5150
Author: Dustin Graves <dustin at bestpractical.com>
Date: Tue May 17 23:45:42 2016 +0000
reordered CreateInRTIRQueueModal template to html/init/args convention
diff --git a/html/RTIR/Elements/CreateInRTIRQueueModal b/html/RTIR/Elements/CreateInRTIRQueueModal
index 5c6b479..7c7a9c2 100644
--- a/html/RTIR/Elements/CreateInRTIRQueueModal
+++ b/html/RTIR/Elements/CreateInRTIRQueueModal
@@ -45,12 +45,24 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<%ARGS>
-$Lifecycle
-$LifecycleDesc => $Lifecycle
-$Incident => undef
-$Child => undef
-</%ARGS>
+<form action="<% RT::IR->HREFTo('Create.html') %>" id="CreateInQueue">
+% if ($Incident) {
+<input type="hidden" name="Incident" value="<%$Incident%>"/>
+% }
+% if ($Child) {
+<input type="hidden" name="Child" value="<%$Child%>"/>
+% }
+ <&|/l_unsafe, $LifecycleDesc,
+ $m->scomp('/RTIR/Elements/SelectRTIRQueue',
+ Name => 'Queue',
+ Lifecycle => $Lifecycle,
+ ShowNullOption => 0,
+ LimitToConstituency => $limit_to_constituency,
+ Constituency => $m->{'RTIR_ConstituencyFilter'} || $linked_constituency)
+
+ &>Create a new [_1] in the queue [_2]</&>
+ <& /Elements/Submit, Label => loc("Go"), Caption => loc("This will take you to a partially prefilled [_1] creation form.", $LifecycleDesc) &>
+</form>
<%INIT>
$Lifecycle = $Lifecycle->[0] if (ref $Lifecycle eq 'ARRAY');
@@ -77,21 +89,10 @@ my $limit_to_constituency =
(RT::IR->StrictConstituencyLinking && $linked_constituency)
? 1:0;
</%INIT>
-<form action="<% RT::IR->HREFTo('Create.html') %>" id="CreateInQueue">
-% if ($Incident) {
-<input type="hidden" name="Incident" value="<%$Incident%>"/>
-% }
-% if ($Child) {
-<input type="hidden" name="Child" value="<%$Child%>"/>
-% }
- <&|/l_unsafe, $LifecycleDesc,
- $m->scomp('/RTIR/Elements/SelectRTIRQueue',
- Name => 'Queue',
- Lifecycle => $Lifecycle,
- ShowNullOption => 0,
- LimitToConstituency => $limit_to_constituency,
- Constituency => $m->{'RTIR_ConstituencyFilter'} || $linked_constituency)
+<%ARGS>
+$Lifecycle
+$LifecycleDesc => $Lifecycle
+$Incident => undef
+$Child => undef
+</%ARGS>
- &>Create a new [_1] in the queue [_2]</&>
- <& /Elements/Submit, Label => loc("Go"), Caption => loc("This will take you to a partially prefilled [_1] creation form.", $LifecycleDesc) &>
-</form>
commit ffaaf6da2367e5070aa31dcf6cd3e689f28e9f14
Author: Dustin Graves <dustin at bestpractical.com>
Date: Tue May 17 23:55:59 2016 +0000
added documentation in UPGRADING-3.4 to reflect the removal of "Launch Investigation" on incident creation
diff --git a/docs/UPGRADING-3.4 b/docs/UPGRADING-3.4
index fa8a14d..775fa70 100644
--- a/docs/UPGRADING-3.4
+++ b/docs/UPGRADING-3.4
@@ -12,6 +12,12 @@ When working inside RTIR, RT's menus are moved under the C<RT>
heading and RTIR's menus are expanded. We'd greatly appreciate your
suggestions for filling out RTIR's menus with additional useful functionality.
+=head3 Incidents and Investigations
+
+It is no longer possible to launch an investigation on the incident creation
+page. Users will find the 'Launch Investigation' menu item missing when
+creating an incident. This removal is a result of the flexibility granted by
+the constituency rewrite in RTIR 3.4.
=head2 Queues
-----------------------------------------------------------------------
More information about the rt-commit
mailing list