[otrs-cvs] CVS: otrs/Kernel/System Ticket.pm,1.182,1.183

cvs-log at otrs.org cvs-log at otrs.org
Sat Aug 6 22:19:13 CEST 2005


Update of /home/cvs/otrs/Kernel/System
In directory osser:/tmp/cvs-serv5818/Kernel/System

Modified Files:
	Ticket.pm 
Log Message:
fixed bug 836 - GenericAgent (GUI based) seem to ignore priority - added some db quote

Index: Ticket.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/Ticket.pm,v
retrieving revision 1.182
retrieving revision 1.183
diff -C2 -r1.182 -r1.183
*** Ticket.pm	4 Aug 2005 09:55:03 -0000	1.182
--- Ticket.pm	6 Aug 2005 19:19:10 -0000	1.183
***************
*** 1897,1902 ****
      $SQLExt = " WHERE sq.id = st.queue_id".$SQLExt;
  
!     # current ticket states
!     if ($Param{States}) {
          foreach (@{$Param{States}}) {
              my %State = $Self->{StateObject}->StateGet(Name => $_, Cache => 1);
--- 1897,1902 ----
      $SQLExt = " WHERE sq.id = st.queue_id".$SQLExt;
  
!     # current state lookup
!     if ($Param{States} && ref($Param{States}) eq 'ARRAY') {
          foreach (@{$Param{States}}) {
              my %State = $Self->{StateObject}->StateGet(Name => $_, Cache => 1);
***************
*** 1909,1921 ****
          }
      }
!     if ($Param{StateIDs}) {
!         $SQLExt .= " AND st.ticket_state_id IN (${\(join ', ' , @{$Param{StateIDs}})})";
      }
!     # created ticket states
!     if ($Param{CreatedStates}) {
          foreach (@{$Param{CreatedStates}}) {
              my %State = $Self->{StateObject}->StateGet(Name => $_, Cache => 1);
              if ($State{ID}) {
!                 push (@{$Param{StateIDs}}, $State{ID});
              }
              else {
--- 1909,1931 ----
          }
      }
!     # state ids
!     if ($Param{StateIDs} && ref($Param{StateIDs}) eq 'ARRAY') {
!         $SQLExt .= " AND st.ticket_state_id IN (";
!         my $Exists = 0;
!         foreach (@{$Param{StateIDs}}) {
!             if ($Exists) {
!                 $SQLExt .= ",";
!             }
!             $SQLExt .= $Self->{DBObject}->Quote($_);
!             $Exists = 1;
!         }
!         $SQLExt .= ")";
      }
!     # created states lookup
!     if ($Param{CreatedStates} && ref($Param{CreatedStates}) eq 'ARRAY') {
          foreach (@{$Param{CreatedStates}}) {
              my %State = $Self->{StateObject}->StateGet(Name => $_, Cache => 1);
              if ($State{ID}) {
!                 push (@{$Param{CreatedStateIDs}}, $State{ID});
              }
              else {
***************
*** 1924,1932 ****
          }
      }
!     if ($Param{CreatedStateIDs}) {
          my $ID = $Self->HistoryTypeLookup(Type => 'NewTicket');
          if ($ID) {
!             $SQLExt .= " AND th.state_id IN (${\(join ', ' , @{$Param{CreatedStateIDs}})})";
!             $SQLExt .= " AND th.history_type_id = $ID ";
          }
      }
--- 1934,1951 ----
          }
      }
!     # states id
!     if ($Param{CreatedStateIDs} && ref($Param{CreatedStateIDs}) eq 'ARRAY') {
          my $ID = $Self->HistoryTypeLookup(Type => 'NewTicket');
          if ($ID) {
!             $SQLExt .= " AND th.state_id IN (";
!             my $Exists = 0;
!             foreach (@{$Param{CreatedStateIDs}}) {
!                 if ($Exists) {
!                     $SQLExt .= ",";
!                 }
!                 $SQLExt .= $Self->{DBObject}->Quote($_);
!                 $Exists = 1;
!             }
!             $SQLExt .= ") AND th.history_type_id = $ID ";
          }
      }
***************
*** 1956,1961 ****
          $SQLExt .= " st.ticket_state_id IN ( ${\(join ', ', @StateIDs)} ) ";
      }
!     # current ticket locks
!     if ($Param{Locks}) {
          foreach (@{$Param{Locks}}) {
              if ($Self->{LockObject}->LockLookup(Type => $_)) {
--- 1975,1980 ----
          $SQLExt .= " st.ticket_state_id IN ( ${\(join ', ', @StateIDs)} ) ";
      }
!     # current lock lookup
!     if ($Param{Locks} && ref($Param{Locks}) eq 'ARRAY') {
          foreach (@{$Param{Locks}}) {
              if ($Self->{LockObject}->LockLookup(Type => $_)) {
***************
*** 1967,1988 ****
          }
      }
!     # add lock ids
!     if ($Param{LockIDs}) {
!         $SQLExt .= " AND st.ticket_lock_id IN (${\(join ', ' , @{$Param{LockIDs}})})";
      }
      # current owners user ids
!     if ($Param{UserIDs}) {
!         $SQLExt .= " AND st.user_id IN (${\(join ', ' , @{$Param{UserIDs}})})";
      }
      # created owner user ids
!     if ($Param{CreatedUserIDs}) {
          my $ID = $Self->HistoryTypeLookup(Type => 'NewTicket');
          if ($ID) {
!             $SQLExt .= " AND th.create_by IN (${\(join ', ' , @{$Param{CreatedUserIDs}})})";
!             $SQLExt .= " AND th.history_type_id = $ID ";
          }
      }
!     # current ticket queues
!     if ($Param{Queues}) {
          foreach (@{$Param{Queues}}) {
              if ($Self->{QueueObject}->QueueLookup(Queue => $_)) {
--- 1986,2033 ----
          }
      }
!     # lock ids
!     if ($Param{LockIDs} && ref($Param{LockIDs}) eq 'ARRAY') {
!         $SQLExt .= " AND st.ticket_lock_id IN (";
!         my $Exists = 0;
!         foreach (@{$Param{LockIDs}}) {
!             if ($Exists) {
!                 $SQLExt .= ",";
!             }
!             $SQLExt .= $Self->{DBObject}->Quote($_);
!             $Exists = 1;
!         }
!         $SQLExt .= ")";
      }
      # current owners user ids
!     if ($Param{UserIDs} && ref($Param{UserIDs}) eq 'ARRAY') {
!         $SQLExt .= " AND st.user_id IN (";
!         my $Exists = 0;
!         foreach (@{$Param{UserIDs}}) {
!             if ($Exists) {
!                 $SQLExt .= ",";
!             }
!             $SQLExt .= $Self->{DBObject}->Quote($_);
!             $Exists = 1;
!         }
!         $SQLExt .= ")";
      }
      # created owner user ids
!     if ($Param{CreatedUserIDs} && ref($Param{CreatedUserIDs}) eq 'ARRAY') {
          my $ID = $Self->HistoryTypeLookup(Type => 'NewTicket');
          if ($ID) {
!             $SQLExt .= " AND th.create_by IN (";
!             my $Exists = 0;
!             foreach (@{$Param{CreatedUserIDs}}) {
!                 if ($Exists) {
!                     $SQLExt .= ",";
!                 }
!                 $SQLExt .= $Self->{DBObject}->Quote($_);
!                 $Exists = 1;
!             }
!             $SQLExt .= ") AND th.history_type_id = $ID ";
          }
      }
!     # current queue lookup
!     if ($Param{Queues} && ref($Param{Queues}) eq 'ARRAY') {
          foreach (@{$Param{Queues}}) {
              if ($Self->{QueueObject}->QueueLookup(Queue => $_)) {
***************
*** 1994,2002 ****
          }
      }
!     if ($Param{QueueIDs}) {
!         $SQLExt .= " AND st.queue_id IN (${\(join ', ' , @{$Param{QueueIDs}})})";
      }
!     # created in ticket queues
!     if ($Param{CreatedQueues}) {
          foreach (@{$Param{CreatedQueues}}) {
              if ($Self->{QueueObject}->QueueLookup(Queue => $_)) {
--- 2039,2057 ----
          }
      }
!     # current queue ids
!     if ($Param{QueueIDs} && ref($Param{QueueIDs}) eq 'ARRAY') {
!         $SQLExt .= " AND st.queue_id IN (";
!         my $Exists = 0;
!         foreach (@{$Param{QueueIDs}}) {
!             if ($Exists) {
!                 $SQLExt .= ",";
!             }
!             $SQLExt .= $Self->{DBObject}->Quote($_);
!             $Exists = 1;
!         }
!         $SQLExt .= ")";
      }
!     # created queue lookup
!     if ($Param{CreatedQueues} && ref($Param{CreatedQueues}) eq 'ARRAY') {
          foreach (@{$Param{CreatedQueues}}) {
              if ($Self->{QueueObject}->QueueLookup(Queue => $_)) {
***************
*** 2008,2016 ****
          }
      }
!     if ($Param{CreatedQueueIDs}) {
          my $ID = $Self->HistoryTypeLookup(Type => 'NewTicket');
          if ($ID) {
!             $SQLExt .= " AND th.queue_id IN (${\(join ', ' , @{$Param{CreatedQueueIDs}})})";
!             $SQLExt .= " AND th.history_type_id = $ID ";
          }
      }
--- 2063,2080 ----
          }
      }
!     # create queue ids
!     if ($Param{CreatedQueueIDs} && ref($Param{CreatedQueueIDs}) eq 'ARRAY') {
          my $ID = $Self->HistoryTypeLookup(Type => 'NewTicket');
          if ($ID) {
!             $SQLExt .= " AND th.queue_id IN (";
!             my $Exists = 0;
!             foreach (@{$Param{CreatedQueueIDs}}) {
!                 if ($Exists) {
!                     $SQLExt .= ",";
!                 }
!                 $SQLExt .= $Self->{DBObject}->Quote($_);
!                 $Exists = 1;
!             }
!             $SQLExt .= ") AND th.history_type_id = $ID ";
          }
      }
***************
*** 2066,2071 ****
          return;
      }
!     # current ticket priorities
!     if ($Param{Priorities}) {
          foreach (@{$Param{Priorities}}) {
              my $ID = $Self->PriorityLookup(Type => $_);
--- 2130,2135 ----
          return;
      }
!     # current priority lookup
!     if ($Param{Priorities} && ref($Param{Priorities}) eq 'ARRAY') {
          foreach (@{$Param{Priorities}}) {
              my $ID = $Self->PriorityLookup(Type => $_);
***************
*** 2078,2083 ****
          }
      }
!     # created ticket priorities
!     if ($Param{CreatedPriorities}) {
          foreach (@{$Param{CreatedPriorities}}) {
              my $ID = $Self->PriorityLookup(Type => $_);
--- 2142,2160 ----
          }
      }
!     # priority ids
!     if ($Param{PriorityIDs} && ref($Param{PriorityIDs}) eq 'ARRAY') {
!         $SQLExt .= " AND st.ticket_priority_id IN (";
!         my $Exists = 0;
!         foreach (@{$Param{PriorityIDs}}) {
!             if ($Exists) {
!                 $SQLExt .= ",";
!             }
!             $SQLExt .= $Self->{DBObject}->Quote($_);
!             $Exists = 1;
!         }
!         $SQLExt .= ")";
!     }
!     # created priority lookup
!     if ($Param{CreatedPriorities} && ref($Param{CreatedPriorities}) eq 'ARRAY') {
          foreach (@{$Param{CreatedPriorities}}) {
              my $ID = $Self->PriorityLookup(Type => $_);
***************
*** 2090,2098 ****
          }
      }
!     if ($Param{CreatedPriorityIDs}) {
          my $ID = $Self->HistoryTypeLookup(Type => 'NewTicket');
          if ($ID) {
!             $SQLExt .= " AND th.priority_id IN (${\(join ', ' , @{$Param{CreatedPriorityIDs}})})";
!             $SQLExt .= " AND th.history_type_id = $ID ";
          }
      }
--- 2167,2184 ----
          }
      }
!     # created priority ids
!     if ($Param{CreatedPriorityIDs} && ref($Param{CreatedPriorityIDs}) eq 'ARRAY') {
          my $ID = $Self->HistoryTypeLookup(Type => 'NewTicket');
          if ($ID) {
!             $SQLExt .= " AND th.priority_id IN (";
!             my $Exists = 0;
!             foreach (@{$Param{CreatedPriorityIDs}}) {
!                 if ($Exists) {
!                     $SQLExt .= ",";
!                 }
!                 $SQLExt .= $Self->{DBObject}->Quote($_);
!                 $Exists = 1;
!             }
!             $SQLExt .= ") AND th.history_type_id = $ID ";
          }
      }



More information about the cvs-log mailing list