This is a shot in the dark and I may be way off, but is there a chance your scrip to set the owner runs in a transaction that happens after the transaction that resolves the ticket?
And the chart looks for the resolved transaction to get owner at the time of resolution? Just a thought. Sent from my mobile device. On Oct 4, 2012, at 7:05 AM, Scotto Alberto <[email protected]> wrote: > 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 > [email protected] > www.reply.it > > <blue.png> > > > > > -- > 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. > > -------- > Final RT training for 2012 in Atlanta, GA - October 23 & 24 > http://bestpractical.com/training > > We're hiring! http://bestpractical.com/jobs
-------- Final RT training for 2012 in Atlanta, GA - October 23 & 24 http://bestpractical.com/training We're hiring! http://bestpractical.com/jobs
