%# BEGIN LICENSE BLOCK %# %# Copyright (c) 1996-2003 Jesse Vincent %# %# (Except where explictly superceded by other copyright notices) %# %# 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. %# %# %# Unless otherwise specified, all modifications, corrections or %# extensions to this work which alter its source code become the %# property of Best Practical Solutions, LLC when submitted for %# inclusion in the work. %# %# %# END LICENSE BLOCK <& /RTIR/Elements/Header, Title => $Title &> <& '/RTIR/'.$Type.'/Elements/Tabs', Ticket => $Ticket, current_tab => "RTIR/Merge.html?id=".$Ticket->Id, current_subtab => "RTIR/Merge.html?id=".$Ticket->Id, Title => $Title &> <& /RTIR/Elements/ListActions, actions => \@results &> % if (!$Ticket->CurrentUserHasRight('ModifyTicket')) { <%loc("You are not allowed to merge this [_1].", $Type)%> % $m->abort(); % }
%if ($ticketcount && ! $ARGS{'HideResults'}) { <& /RTIR/Elements/TicketHeader, check => "check", %ARGS &> % my $i; %while (my $Ticket = $session{'tickets'}->Next) { % next unless ($Ticket->Id ne $id); % $i++; <& /RTIR/Elements/TicketRow, Type => $Type, Ticket => $Ticket, i=> $i, check => "radio", %ARGS &> % }
<&|/l&>First page    % if ( $session{'tickets'}->FirstRow >= $session{'tickets_rows_per_page'}-1 ) { <<&|/l&>Previous page    % } % if ( $session{'tickets'}->FirstRow + $session{'tickets_rows_per_page'} < $ticketcount ) { <&|/l&>Next page> % } %#  <&|/l&>Goto page
(<&|/l, ($session{'tickets'}->FirstRow+1), ($session{'tickets'}->FirstRow() + $session{'tickets'}->RowsPerPage() ) &>[_1] - [_2] shown)
% } <& /Elements/Submit, Caption=> loc('Merge into selected Ticket') &>
<& /Elements/TitleBoxStart, title => loc('Current search criteria')&> <& /RTIR/Elements/SearchCriteria, Path => '/RTIR/Merge.html', %ARGS &> <& /Elements/TitleBoxEnd &> <& /RTIR/Elements/PickRestriction, Queue => $Ticket->QueueObj->Id, %ARGS &>
<%INIT> my $Ticket = LoadTicket($id); my $Type = $m->scomp('Elements/Type', Ticket => $Ticket->Id); $Type =~ s/\s+$//; my $name; if ($Type eq 'Report') { $name = "Incident Report"; } else { $name = $Type; } my ($title, $ticketcount); $session{'i'}++; my ($bgcolor, @results); if ($session{'tickets'}) { if ($ARGS{'DeleteRestriction'}) { $session{'tickets'}->DeleteRestriction($ARGS{'DeleteRestriction'}); } if ( ($ARGS{'ClearRestrictions'}) || ($ARGS{'NewSearch'}) ) { $session{'tickets'}->ClearRestrictions; } } ProcessSearchQuery(ARGS=>\%ARGS); $session{'tickets'}->RedoSearch(); if ( $session{'tickets'}->DescribeRestrictions()) { $ticketcount = $session{tickets}->Count(); $title = loc('Found [quant,_1,incident]', $ticketcount); } else { $title = loc("Find incidents"); } # Iterate through the ARGS hash and remove anything with a null value. map ($ARGS{$_} =~ /^$/ && (delete $ARGS{$_}), keys %ARGS); my @cols = qw(id Status Priority Subject QueueObj->Name OwnerObj->Name RequestorAddresses DueAsString ); Abort(loc("No search to operate on.")) unless ($session{'tickets'}); my $merge = $ARGS{'SelectedTicket'}; my $MergeTicket; if ($merge) { $ARGS{$id.'-MergeInto'} = $merge; $MergeTicket = LoadTicket($merge); if ($MergeTicket->QueueObj->id ne $Ticket->QueueObj->id) { push @results, loc("Merge failed: Ticket #[_1] is not the right type", $MergeTicket->Id); } else { @results = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS); } } my $Title = loc("Merge [_1] #[_2]: [_3]", $name, $id, $Ticket->Subject); <%ARGS> $id => undef