[Rt-commit] r5167 - in rtir/branches/1.9-EXPERIMENTAL: html/RTIR
html/RTIR/Elements
ruz at bestpractical.com
ruz at bestpractical.com
Fri May 5 09:57:21 EDT 2006
Author: ruz
Date: Fri May 5 09:57:19 2006
New Revision: 5167
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/MergeWith
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html
Log:
r1417 at cubic-pc: cubic | 2006-05-05 17:57:34 +0400
* show siblings of the ticket in standalone box for merging
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/MergeWith
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/MergeWith (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/MergeWith Fri May 5 09:57:19 2006
@@ -1,5 +1,5 @@
-<h3><% $Type %>s</h3>
-<& /RTIR/Search/Elements/ShowResults,
+<h3><% $Title %></h3>
+<& /RTIR/Search/Elements/ShowResults,
Queue => $Queue,
BaseQuery => $BaseQuery,
Query => $Query,
@@ -13,6 +13,7 @@
<%INIT>
my ($Type) = $m->comp( '/RTIR/Elements/Type', Queue => $Queue );
+$Title ||= $Type .'s';
$Query ||= $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue);
unless ( $BaseQuery ) {
@@ -29,6 +30,7 @@
$id => undef
$Ticket => undef
$Queue => undef
+$Title => ''
$Format => undef
$Rows => undef
Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html (original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html Fri May 5 09:57:19 2006
@@ -40,13 +40,22 @@
<form action="<% RT->Config->Get('WebPath') %>/RTIR/Merge.html" method="post">
<input type="hidden" name="id" value="<% $id %>" />
+% if ( $siblings_query ) {
+<& /RTIR/Elements/MergeWith,
+ %defaults,
+ %ARGS,
+ Title => loc('Other children of the parent incident(s) of #[_1]', $id),
+ Ticket => $Ticket,
+ BaseQuery => "id != $id",
+ Query => $siblings_query,
+&>
+% }
+
<& /RTIR/Elements/MergeWith, %defaults, %ARGS, Queue => $Ticket->QueueObj->Name, Ticket => $Ticket &>
-% if ($Ticket->QueueObj->Name eq "Incident Reports") {
+% if ( $Type eq 'Report' ) {
<& /RTIR/Elements/MergeWith, %defaults, %ARGS, Queue => "Investigations", Ticket => $Ticket &>
-% }
-
-% if ($Ticket->QueueObj->Name eq "Investigations") {
+% } elsif ( $Type eq 'Investigation' ) {
<& /RTIR/Elements/MergeWith, %defaults, %ARGS, Queue => "Incident Reports", Ticket => $Ticket &>
% }
<& /Elements/Submit, Caption=> loc('Merge into selected Ticket'), Label => loc("Merge") &>
@@ -107,6 +116,26 @@
Order => $Order,
);
+my $siblings_query = '';
+if ( $Type ne 'Incident' ) {
+ my $parents = RT::Tickets->new( $session{'CurrentUser'} );
+ $parents->FromSQL( "Queue = 'Incidents' AND HasMember = $id" );
+ if ( $parents->Count ) {
+ my $parents_query = '';
+ while ( my $parent = $parents->Next ) {
+ $parents_query .= ' OR ' if $parents_query;
+ $parents_query .= "MemberOf = ". $parent->id;
+ }
+ if ( $parents_query ) {
+ $siblings_query .= "( $parents_query )";
+ my $queue_query = "Queue = '$Queue'";
+ $queue_query .= " OR Queue = 'Investigations'" if $Type eq 'Report';
+ $queue_query .= " OR Queue = 'Incident Reports'" if $Type eq 'Investigation';
+ $siblings_query .= " AND ( $queue_query )";
+ }
+ }
+}
+
my $QueryString = $m->comp('/Elements/QueryString', Query => $Query, %defaults);
my $current_tab = "RTIR/Merge.html?id=$id";
More information about the Rt-commit
mailing list