[Rt-commit] r4871 - in rtir/branches/1.9-EXPERIMENTAL: html/RTIR
html/RTIR/Elements
alexmv at bestpractical.com
alexmv at bestpractical.com
Wed Mar 29 15:39:41 EST 2006
Author: alexmv
Date: Wed Mar 29 15:39:40 2006
New Revision: 4871
Added:
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/MergeWith
Modified:
rtir/branches/1.9-EXPERIMENTAL/ (props changed)
rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html
Log:
r11949 at zoq-fot-pik: chmrr | 2006-03-29 15:38:44 -0500
* Merge incident reports into investigations
Added: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/MergeWith
==============================================================================
--- (empty file)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/MergeWith Wed Mar 29 15:39:40 2006
@@ -0,0 +1,48 @@
+<form action="<% RT->Config->Get('WebPath') %>/RTIR/Merge.html" method="post">
+<input type="hidden" name="id" value="<% $id %>" />
+<h3><% $Type %>s</h3>
+<& /RTIR/Search/Elements/ShowResults,
+ Queue => $Queue,
+ BaseQuery => $BaseQuery,
+ Query => $Query,
+ Format => '__RTIR_Radio__,'. $Format,
+ Rows => $Rows,
+ Page => $Page,
+ OrderBy => $OrderBy,
+ Order => $Order,
+ BaseURL => "RTIR/Merge.html?id=$id",
+&>
+
+<& /Elements/Submit, Caption=> loc('Merge into selected Ticket'), Label => loc("Merge") &>
+</form>
+
+<%INIT>
+my ($Type) = $m->comp( '/RTIR/Elements/Type', Queue => $Queue );
+
+$Query ||= $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue);
+unless ( $BaseQuery ) {
+ $BaseQuery = $m->comp('/RTIR/Elements/BaseQuery', Queue => $Queue);
+ $BaseQuery = join ' AND ', map "( $_ )", grep $_, $BaseQuery, " id != $id";
+}
+
+# XXX: clear radio, checkboxes from format
+$Format =~ s/__RTIR_(?:Radio|Check)__,//;
+
+</%INIT>
+
+<%ARGS>
+$id => undef
+$Ticket => undef
+$Queue => undef
+
+$Format => undef
+$Rows => undef
+$Page => undef
+$OrderBy => undef
+$Order => undef
+
+$SelectedTicket => undef
+
+$BaseQuery => undef
+$Query => undef
+</%ARGS>
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 Wed Mar 29 15:39:40 2006
@@ -37,23 +37,15 @@
<& /Elements/ListActions, actions => \@results &>
-<form action="<% RT->Config->Get('WebPath') %>/RTIR/Merge.html" method="post">
-<input type="hidden" name="id" value="<% $id %>" />
+<& /RTIR/Elements/MergeWith, %defaults, %ARGS, Queue => $Ticket->QueueObj->Name, Ticket => $Ticket &>
-<& /RTIR/Search/Elements/ShowResults,
- Queue => $Queue,
- BaseQuery => $BaseQuery,
- Query => $Query,
- Format => '__RTIR_Radio__,'. $Format,
- Rows => $Rows,
- Page => $Page,
- OrderBy => $OrderBy,
- Order => $Order,
- BaseURL => $current_tab,
-&>
-
-<& /Elements/Submit, Caption=> loc('Merge into selected Ticket'), Label => loc("Merge") &>
-</form>
+% if ($Ticket->QueueObj->Name eq "Incident Reports") {
+<& /RTIR/Elements/MergeWith, %defaults, %ARGS, Queue => "Investigations", Ticket => $Ticket &>
+% }
+
+% if ($Ticket->QueueObj->Name eq "Investigations") {
+<& /RTIR/Elements/MergeWith, %defaults, %ARGS, Queue => "Incident Reports", Ticket => $Ticket &>
+% }
<%INIT>
my $Ticket = LoadTicket($id);
@@ -70,11 +62,16 @@
my (@results);
if ( $SelectedTicket ) {
my $MergeTicket = LoadTicket( $SelectedTicket );
- $ARGS{ $id .'-MergeInto' } = $MergeTicket->id;
- if ( $MergeTicket->QueueObj->id ne $Ticket->QueueObj->id ) {
- push @results, loc("Merge failed: Ticket #[_1] is not the right type", $MergeTicket->Id );
- } else {
+ my @queues = sort map {$_->Name} $Ticket->QueueObj, $MergeTicket->QueueObj;
+ if ( $queues[0] eq $queues[1] or ($queues[0] eq "Incident Reports" and $queues[1] eq "Investigations")) {
+ if ($MergeTicket->QueueObj->Name eq "Incident Reports") {
+ # We always want to merge into the Investigation
+ ($Ticket, $MergeTicket) = ($MergeTicket, $Ticket);
+ }
+
+ $ARGS{ $Ticket->id .'-MergeInto' } = $MergeTicket->id;
+
foreach ( $Ticket, $MergeTicket ) {
my ($status, $msg) = $take_or_steal->( $_ );
push @results, $msg if $msg;
@@ -83,10 +80,12 @@
$Ticket = LoadTicket($id);
$id = $ARGS{'id'} = $Ticket->id;
+ } else {
+ push @results, loc("Merge failed: Ticket #[_1] is not the right type", $MergeTicket->Id );
}
}
-my ($Type) = $m->comp( 'Elements/Type', TicketObj => $Ticket );
+my ($Type) = $m->comp( '/RTIR/Elements/Type', TicketObj => $Ticket );
my $Queue = $Ticket->QueueObj->Name;
# XXX: clear radio, checkboxes from format
@@ -100,8 +99,8 @@
$BaseQuery = join ' AND ', map "( $_ )", grep $_, $BaseQuery, " id != $id";
}
-my $QueryString = $m->comp('/Elements/QueryString',
- Query => $Query,
+
+my %defaults = (
Format => $Format,
Rows => $Rows,
Page => $Page,
@@ -109,6 +108,8 @@
Order => $Order,
);
+my $QueryString = $m->comp('/Elements/QueryString', Query => $Query, %defaults);
+
my $current_tab = "RTIR/Merge.html?id=$id";
</%INIT>
More information about the Rt-commit
mailing list