[rt-users] Setting owner with _Set breaks queries (may be a bug)

Scotto Alberto al.scotto at reply.it
Thu Oct 4 07:05:58 EDT 2012


Hi all,
I think I found a bug.
I have a scrip called "On closure Auto set owner", which sets the owner while closing the ticket in case nobody has never taken it, so that I don't get resolved tickets assigned to "Nobody in particular".
Everything seemed ok until today a colleague of mine noticed something weird with a chart that acts like a hall of fame, showing the top Owners. This chart is very simple: it retrieves all the tickets and it is grouped by Owner.RealName.
The weird thing is not the chart itself, but the fact that the following two queries should return the same tickets but they don't:

-          Owner.RealName = 'Nobody in particular' returns 706 tickets

-          Owner = 'Nobody in particular' returns 369 tickets
The results of the former are not correct: it includes also the tickets for which the owner was set by my scrip, though the column "Owner" is correct (filled with "John Doe", not "Nobody in particular").

Here are the relevant lines of the code of my scrip:

# get actor ID
my $Actor = $self->TransactionObj->Creator;
my $tkt = $self->TicketObj;
# try to change owner
my ($status, $msg) = $tkt->_Set(Field => 'Owner', Value => $Actor, RecordTransaction => 0);

I solved the problem using SetOwner instead of _Set, like this:

my ($status, $msg) = $tkt->SetOwner($Actor);

With the new code, the tickets whose owner is set by my scrip don't get caught by the query Owner.RealName = 'Nobody in particular'.

Looks like _Set doesn't update correctly some field in some table in the DB. But I have no idea of what field and what table! I had a quick look at the DB, and it seems that the relation ticket-owner is based on an user ID, not a string (the real name).

Finally, a weird thing with the chart: on the right side, it displays all the owners and the number of tickets associated. For "Nobody in particular", the number is 369 (correct); but if I click on this number it generates the query "Owner.RealName = 'Nobody in particular'" saying "Found 706 tickets".

The questions are:
Should I file a bug?
How can I "convert" the tickets that were processed with the old code?

Hope everything is clear

Thank you very much!



Alberto Scotto

Blue Reply
Via Cardinal Massaia, 83
10147 - Torino - ITALY
phone: +39 011 29100
al.scotto at reply.it
www.reply.it

[Blue Reply]


________________________________

--
The information transmitted is intended for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20121004/1006d585/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: blue.png
Type: image/png
Size: 2329 bytes
Desc: blue.png
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20121004/1006d585/attachment.png>


More information about the rt-users mailing list