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

Scotto Alberto al.scotto at reply.it
Fri Oct 5 11:15:40 EDT 2012


Very interesting, thank you!
Now I understand the relationships.
So I think I should correct all the _Set I've used all around in my custom scrips :(

Talking about correcting the old tickets processed with _Set, I think rt-validator doesn't help, can you please confirm?
Here is the output of rt-validator --check: http://pastebin.com/1PTL8mY8
To verify if it finds the errors caused by _Set I searched in the ouput for "2985", which is the number of a ticket affected by the issue. I also searched for "12626", the ID of the owner group associated with that ticket. But none of them are there.

Thanks


PS: (OT) if at every moment the Owner is one and only one, I wonder why you defined a group for role Owner. Maybe in order to have a history of past owners? Or for some code consistency?




Alberto Scotto

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

-----Original Message-----
From: rt-users-bounces at lists.bestpractical.com [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of Thomas Sibley
Sent: giovedì 4 ottobre 2012 18:50
To: rt-users at lists.bestpractical.com
Subject: Re: [rt-users] Setting owner with _Set breaks queries (may be a bug)

On 10/04/2012 04:05 AM, Scotto Alberto wrote:
> I think I found a bug.

Not a bug in RT, only your scrip. :)

> 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).

Using _Set to change the Owner is incorrect as it only updates the Owner column in the Tickets table.  It doesn't also update the Owner role group for the ticket.  SetOwner does both.

In general you shouldn't be calling private methods (starting with an
underscore) from code you write, for reasons just like this.

rt-validator may be able to fix your existing tickets, but I haven't checked so I'm not certain.

http://bestpractical.com/rt/docs/latest/rt-validator.html

--------
Final RT training for 2012 in Atlanta, GA - October 23 & 24
  http://bestpractical.com/training

We're hiring! http://bestpractical.com/jobs



________________________________

--
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.


More information about the rt-users mailing list