[freeside-commits] freeside/FS/FS/TicketSystem RT_External.pm, 1.25.2.5, 1.25.2.6
Ivan,,,
ivan at wavetail.420.am
Thu Jan 24 13:19:54 PST 2008
Update of /home/cvs/cvsroot/freeside/FS/FS/TicketSystem
In directory wavetail:/tmp/cvs-serv18091/FS/FS/TicketSystem
Modified Files:
Tag: FREESIDE_1_7_BRANCH
RT_External.pm
Log Message:
slightly more sane names for customer tickets hash, display ticket owners on customer view page
Index: RT_External.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/TicketSystem/RT_External.pm,v
retrieving revision 1.25.2.5
retrieving revision 1.25.2.6
diff -u -d -r1.25.2.5 -r1.25.2.6
--- RT_External.pm 17 Dec 2007 19:52:07 -0000 1.25.2.5
+++ RT_External.pm 24 Jan 2008 21:19:52 -0000 1.25.2.6
@@ -71,11 +71,19 @@
$limit ||= 0;
my( $from_sql, @param) = $self->_from_customer( $custnum, $priority );
- my $sql="SELECT Tickets.*, Queues.name, ".
- "position(Tickets.status in 'newopenstalledresolvedrejecteddeleted')".
- " AS svalue " .
- ( length($priority) ? ", objectcustomfieldvalues.content" : '' ).
- " $from_sql ORDER BY svalue, priority DESC, id DESC LIMIT $limit";
+ my $sql = "
+ SELECT Tickets.*,
+ Queues.Name AS Queue,
+ Users.Name AS Owner,
+ position(Tickets.Status in 'newopenstalledresolvedrejecteddeleted')
+ AS svalue
+ ". ( length($priority) ? ", ObjectCustomFieldValues.Content" : '' )."
+ $from_sql
+ ORDER BY svalue,
+ Priority DESC,
+ id DESC
+ LIMIT $limit
+ ";
warn "$me $sql (@param)" if $DEBUG;
my $sth = $dbh->prepare($sql) or die $dbh->errstr. "preparing $sql";
$sth->execute(@param) or die $sth->errstr. "executing $sql";
@@ -95,7 +103,7 @@
if ( defined($priority) ) {
my $queue_sql = " ObjectCustomFields.ObjectId = ( SELECT id FROM Queues
- WHERE Queues.name = ? )
+ WHERE Queues.Name = ? )
OR ( ? = '' AND ObjectCustomFields.ObjectId = 0 )";
my $customfield_sql =
@@ -104,7 +112,7 @@
JOIN ObjectCustomFields
ON ( CustomFields.id = ObjectCustomFields.CustomField )
WHERE LookupType = 'RT::Queue-RT::Ticket'
- AND name = ?
+ AND Name = ?
AND ( $queue_sql )
)";
@@ -127,15 +135,15 @@
$join = "JOIN ObjectCustomFieldValues
ON ( Tickets.id = ObjectCustomFieldValues.ObjectId )";
- $where = " AND content = ?
- AND ObjectCustomFieldValues.disabled != 1
+ $where = " AND Content = ?
+ AND ObjectCustomFieldValues.Disabled != 1
AND ObjectType = 'RT::Ticket'
AND $customfield_sql";
} else {
$where =
- "AND 0 = ( SELECT count(*) FROM ObjectCustomFieldValues
+ "AND 0 = ( SELECT COUNT(*) FROM ObjectCustomFieldValues
WHERE ObjectId = Tickets.id
AND ObjectType = 'RT::Ticket'
AND $customfield_sql
@@ -147,11 +155,12 @@
my $sql = "
FROM Tickets
- JOIN Queues ON ( Tickets.queue = Queues.id )
- JOIN Links ON ( Tickets.id = Links.localbase )
+ JOIN Queues ON ( Tickets.Queue = Queues.id )
+ JOIN Links ON ( Tickets.id = Links.LocalBase )
+ JOIN Users ON ( Tickets.Owner = Users.id )
$join
- WHERE ( ". join(' OR ', map "status = '$_'", $self->statuses ). " )
- AND target = 'freeside://freeside/cust_main/$custnum'
+ WHERE ( ". join(' OR ', map "Status = '$_'", $self->statuses ). " )
+ AND Target = 'freeside://freeside/cust_main/$custnum'
$where
";
@@ -263,7 +272,7 @@
sub queues {
my($self) = @_;
- my $sql = "SELECT id, name FROM Queues WHERE disabled = 0";
+ my $sql = "SELECT id, Name FROM Queues WHERE Disabled = 0";
my $sth = $dbh->prepare($sql) or die $dbh->errstr. " preparing $sql";
$sth->execute() or die $sth->errstr. " executing $sql";
@@ -276,7 +285,7 @@
return '' unless $queueid;
- my $sql = "SELECT name FROM Queues WHERE id = ?";
+ my $sql = "SELECT Name FROM Queues WHERE id = ?";
my $sth = $dbh->prepare($sql) or die $dbh->errstr. " preparing $sql";
$sth->execute($queueid) or die $sth->errstr. " executing $sql";
More information about the freeside-commits
mailing list