[otrs-cvs] CVS: otrs/Kernel/System Ticket.pm,1.212,1.213

cvs-log at otrs.org cvs-log at otrs.org
Mon Jul 3 15:23:16 CEST 2006


Update of /home/cvs/otrs/Kernel/System
In directory lancelot:/tmp/cvs-serv28647/Kernel/System

Modified Files:
	Ticket.pm 
Log Message:
add WatchUserIDs to TicketSearch() and remove WatchList()

Index: Ticket.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/Ticket.pm,v
retrieving revision 1.212
retrieving revision 1.213
diff -C2 -r1.212 -r1.213
*** Ticket.pm	30 Jun 2006 14:19:26 -0000	1.212
--- Ticket.pm	3 Jul 2006 12:23:14 -0000	1.213
***************
*** 1916,1919 ****
--- 1916,1921 ----
        ResponsibleIDs => [1, 12, 455, 32]
  
+       WatchUserIDs => [1, 12, 455, 32]
+ 
        # CustomerID (optional) as STRING or as ARRAYREF
        CustomerID => '123',
***************
*** 2072,2075 ****
--- 2074,2081 ----
          }
      }
+     if ($Param{WatchUserIDs}) {
+         $SQL .= ", ticket_watcher tw ";
+         $SQLExt .= " AND st.id = tw.ticket_id";
+     }
      $SQLExt = " WHERE sq.id = st.queue_id".$SQLExt;
  
***************
*** 2371,2374 ****
--- 2377,2393 ----
          }
      }
+     # watch user ids
+     if ($Param{WatchUserIDs} && ref($Param{WatchUserIDs}) eq 'ARRAY') {
+         $SQLExt .= " AND tw.user_id IN (";
+         my $Exists = 0;
+         foreach (@{$Param{WatchUserIDs}}) {
+             if ($Exists) {
+                 $SQLExt .= ",";
+             }
+             $SQLExt .= $Self->{DBObject}->Quote($_);
+             $Exists = 1;
+         }
+         $SQLExt .= ")";
+     }
      # created priority ids
      if ($Param{CreatedPriorityIDs} && ref($Param{CreatedPriorityIDs}) eq 'ARRAY') {
***************
*** 4341,4399 ****
  }
  
- =item TicketWatchList()
- 
- to get a array, a hash or the count of all subscribed tickets of one user
- 
-     my @List = $TicketObject->TicketWatchList(
-         Type => 'ARRAY', # ARRAY|HASH|COUNT
-         UserID => 123,
-     );
- 
- =cut
- 
- sub TicketWatchList {
-     my $Self = shift;
-     my %Param = @_;
-     my %Hash = ();
-     my @Array = ();
-     my $Count = 0;
-     # check needed stuff
-     foreach (qw(Type UserID)) {
-         if (!$Param{$_}) {
-             $Self->{LogObject}->Log(Priority => 'error', Message => "Need $_!");
-             return;
-         }
-     }
-     foreach (qw(UserID)) {
-         $Param{$_} = $Self->{DBObject}->Quote($Param{$_}, 'Integer');
-     }
-     # database query
-     my $SQL = "SELECT ticket_id FROM ticket_watcher ".
-         " WHERE ".
-         " user_id = $Param{UserID} ORDER BY create_time DESC";
-     $Self->{DBObject}->Prepare(SQL => $SQL);
-     while (my @Row = $Self->{DBObject}->FetchrowArray()) {
-         if ($Param{Type} eq 'HASH') {
-             $Hash{$Row[0]} = 1;
-         }
-         elsif ($Param{Type} eq 'ARRAY') {
-             push(@Array, $Row[0]);
-         }
-         else {
-             $Count++;
-         }
-     }
-     # return
-     if ($Param{Type} eq 'HASH') {
-         return %Hash;
-     }
-     elsif ($Param{Type} eq 'ARRAY') {
-         return @Array;
-     }
-     else {
-         return $Count;
-     }
- }
- 
  =item TicketWatchGet()
  
--- 4360,4363 ----



More information about the cvs-log mailing list