update custom priorioty field BS for RT 3.4.4
authorivan <ivan>
Fri, 18 Nov 2005 09:44:26 +0000 (09:44 +0000)
committerivan <ivan>
Fri, 18 Nov 2005 09:44:26 +0000 (09:44 +0000)
FS/FS/TicketSystem/RT_External.pm

index b69af43..f8f5472 100644 (file)
@@ -56,7 +56,7 @@ sub customer_tickets {
 
   my( $from_sql, @param) = $self->_from_customer( $custnum, $priority );
   my $sql = "select tickets.*, queues.name".
-            ( length($priority) ? ", ticketcustomfieldvalues.content" : '' ).
+            ( length($priority) ? ", objectcustomfieldvalues.content" : '' ).
             " $from_sql order by priority desc limit $limit";
   my $sth = $dbh->prepare($sql) or die $dbh->errstr. "preparing $sql";
   $sth->execute(@param)         or die $sth->errstr. "executing $sql";
@@ -91,10 +91,11 @@ sub _from_customer {
       #";
       push @param, $priority;
 
-      $join = "join TicketCustomFieldValues
-                 on ( tickets.id = TicketCustomFieldValues.ticket )";
+      $join = "join ObjectCustomFieldValues
+                 on ( tickets.id = ObjectCustomFieldValues.ObjectId )";
       
-      $where = "and content = ?
+      $where = "and ObjectType = 'RT::Ticket'
+                and content = ?
                 and customfield = ( select id from customfields
                                      where name = ?
                                        and ( $queue_sql )
@@ -102,8 +103,9 @@ sub _from_customer {
                ";
     } else {
       $where =
-               "and 0 = ( select count(*) from TicketCustomFieldValues
-                           where ticket = tickets.id
+               "and 0 = ( select count(*) from ObjectCustomFieldValues
+                           where ObjectId    = tickets.id
+                             and ObjectType  = 'RT::Ticket'
                              and customfield = ( select id from customfields
                                                   where name = ?
                                                     and ( $queue_sql )