Hello,

our Agents did missing the feature to merge more than one Ticket at one
time. So I did try to integrate the merge feature into the Bulk-Action.

I attached two diffs which seems to make it possible, but only very
simple and I think there should be some more checks.

In AgentTicketBulk.pm I did for each Ticket a Ticket->Merge, if it fails
it do an Notice(?). After the first merge I set a flag, so that a note
would not be added twice. I think the Queue-Set is ok. The State-Set
should be overwritte through Ticket-Merge. The unlock should also be ok.

All works for us, are there some conditions which I did not mind? Also I
don't understand how to report errors the right way, what happen if one
merge fails -- I don't know how to test this.

Regards,
Alex

PS: We are running OTRS 2.0.1

-- 
   Alexander Koch, mailto: [EMAIL PROTECTED]
   ILK Internet GmbH, Akademiestrasse 25 - 27, D-76133 Karlsruhe
   Tel: +49 (0) 721 9100 0, Fax: +49 (0) 721 9100 191
   http://www.ilk.net
--- AgentTicketBulk.dtl.orig    2005-10-27 14:32:55.000000000 +0200
+++ AgentTicketBulk.dtl 2005-10-27 15:55:04.000000000 +0200
@@ -96,6 +96,11 @@
         <td class="contentkey">$Text{"Unlock Tickets"}:</td>
         <td class="contentvalue">$Data{"UnlockYesNoOption"}</td>
       </tr>
+      <tr>
+        <td class="contentkey">$Text{"Merge to:"}:</td>
+        <td class="contentvalue"><input type="text" name="MainTicket" 
size="30"></td>
+      </tr>
+
       </table>
     <input class="button" accesskey="g" type="submit" value="$Text{"submit"}" 
onclick="return submit_compose();">
     </form>
--- AgentTicketBulk.pm.orig     2005-10-27 15:55:45.000000000 +0200
+++ AgentTicketBulk.pm  2005-10-27 16:27:35.000000000 +0200
@@ -63,6 +63,8 @@
     }
     $Output = $Self->{LayoutObject}->Header();
     # process tickets
+    # tag for merge feature
+    my $merged = 0;
     foreach (@TicketIDs) {
         my %Ticket = $Self->{TicketObject}->TicketGet(TicketID => $_);
         # check permissions
@@ -125,7 +127,7 @@
                     my $ArticleTypeID = $Self->{ParamObject}->GetParam(Param 
=> 'ArticleTypeID') || '';
                     my $ArticleType = $Self->{ParamObject}->GetParam(Param => 
'ArticleType') || '';
 
-                    if (($Subject || $Body) && ($ArticleTypeID||$ArticleType)) 
{
+                    if (($Subject || $Body) && ($ArticleTypeID||$ArticleType) 
&& ! $merged ) {
                       my $ArticleID = $Self->{TicketObject}->ArticleCreate(
                         TicketID => $_,
                         ArticleTypeID => $ArticleTypeID,
@@ -163,6 +165,20 @@
                             );
                         }
                     }
+                   # merge
+                   my $MainTicket = $Self->{ParamObject}->GetParam(Param => 
'MainTicket') || '';
+                   my $MainTicketID = $Self->{TicketObject}->TicketIDLookup( 
TicketNumber => $MainTicket ,
+                               UserID => $Self->{UserID} ) || '';
+
+                   if( $MainTicketID ) {
+                     if( $_ == $MainTicketID || 
!$Self->{TicketObject}->TicketMerge(MainTicketID => $MainTicketID, 
MergeTicketID => $_, UserID => $Self->{UserID})) {
+                           $Output .= $Self->{LayoutObject}->Notify( Info =>
+                 "Can't Merge $_ to $_" );
+                       }       
+                       else {
+                           $merged = 1;
+                       }
+                   }
                                        # Should I unlock tickets at user 
request?
                                        if 
($Self->{ParamObject}->GetParam(Param => 'Unlock')) {
                                                $Self->{TicketObject}->LockSet(
_______________________________________________
OTRS mailing list: dev - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/dev
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev

Reply via email to