Re: RT 4.4.1 - Change owner on corrospond Scrip - Strange issue

Alex Hall <[email protected]> Thu, 23 Feb 2017 13:10:53 -0500
Newsgroups gmane.comp.bug-tracking.request-tracker.user
Message-ID <CA+Q8_Jdf1gtOH-LKquJ4r8Gs_m93nXmhH4uKPqWtGomsiavUXg@mail.gmail.com>
--001a113cd0dab297ae0549368821
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Thank you! This seems to be doing the right thing, while still not
notifying the user of the change. It's exactly what I was hoping for. It
felt great to close the ticket my boss made on this issue back in November!

On Thu, Feb 23, 2017 at 12:06 PM, Shawn M Moore <[email protected]>
wrote:

> Hey Robert, Alex,
>
> Is this just a display bug or are we not using the proper method to chang=
e
> the owner of the Ticket?
>
>
> You're not using the proper method.
>
> # do the actual 'status update'
> my ($status, $msg) =3D $self->TicketObj->_Set(Field =3D> 'Owner', Value =
=3D>
> $Actor, RecordTransaction =3D> 0);
>
>
> Should instead be:
>
> my ($status, $msg) =3D $self->TicketObj->SetOwner($Actor);
>
> What works: When user is first to correspond, Scrip executes and in Ticke=
t
> view the Owner is set as expected.
>
>
> What doesn=E2=80=99t work: If we go into the queue and list all the open =
tickets,
> the owner will be listed as =E2=80=9Cnobody=E2=80=9D in this view, but if=
 you open the
> ticket, there is an owner. If you change the owner to someone else and
> change it back, then it seems to fix this issue.
>
>
> The reason you need to use SetOwner is that the owner of a ticket is
> represented in two different database tables. The first is in the
> GroupMembers table, alongside Requestors, Ccs, and AdminCcs, and custom
> roles. This is what provides features like permissions. It's also what's
> used when you display the "Owner" column in search results. Tickets _also=
_
> store their owner denormalized in the tickets table. This is used in, amo=
ng
> other places, displaying the owner on ticket display, and in email
> notifications.
>
> ->Set(Field =3D> 'Owner') only updates the latter. ->SetOwner updates bot=
h.
>
> This explains the inconsistencies you're seeing. Please try switching you=
r
> scrip to ->SetOwner and seeing if it helps for tickets going forward. For
> existing tickets with this problem, you'll need to address the consistenc=
y
> issue.
>
> It turns out that, for different reasons entirely (
> https://issues.bestpractical.com/Ticket/Display.html?id=3D32381 ), RT 4.4=
.2
> adds an upgrade step and an rt-validator rule that detects and fixes such
> inconsistencies. You can find them here:
>
> https://github.com/bestpractical/rt/commit/58bacce6ada754657c7f56fd91f20c
> 573108c1ab
> https://github.com/bestpractical/rt/commit/20d8daf6855e3c53ee8a79d6827194
> 1d4cdca159
>
> Best,
> Shawn
>



--=20
Alex Hall
Automatic Distributors, IT department
[email protected]

--001a113cd0dab297ae0549368821
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Thank you! This seems to be doing the right thing, while s=
till not notifying the user of the change. It&#39;s exactly what I was hopi=
ng for. It felt great to close the ticket my boss made on this issue back i=
n November!<br></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Thu, Feb 23, 2017 at 12:06 PM, Shawn M Moore <span dir=3D"ltr">&lt;<=
a href=3D"mailto:[email protected]" target=3D"_blank">shawn@bestpract=
ical.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div sty=
le=3D"word-wrap:break-word">Hey Robert, Alex,<div><div><div><br></div><div>=
<div><blockquote type=3D"cite">Is this just a display bug or are we not usi=
ng the proper method to change the owner of the Ticket?<br></blockquote><di=
v><br></div>You&#39;re not using the proper method.</div><div><br><blockquo=
te type=3D"cite"># do the actual &#39;status update&#39;<br>my ($status, $m=
sg) =3D $self-&gt;TicketObj-&gt;_Set(Field =3D&gt; &#39;Owner&#39;, Value =
=3D&gt; $Actor, RecordTransaction =3D&gt; 0);<br></blockquote><br></div></d=
iv><div>Should instead be:</div><div><br></div><div>my ($status, $msg) =3D =
$self-&gt;TicketObj-&gt;SetOwner($<wbr>Actor);</div><div><br></div><blockqu=
ote type=3D"cite"><div><div>What works: When user is first to correspond, S=
crip executes and in Ticket view the Owner is set as expected.<br><br><br>W=
hat doesn=E2=80=99t work: If we go into the queue and list all the open tic=
kets, the owner will be listed as =E2=80=9Cnobody=E2=80=9D in this view, bu=
t if you open the ticket, there is an owner. If you change the owner to som=
eone else and change it back, then it seems to fix this issue.<br></div></d=
iv></blockquote></div></div><div><br></div><div>The reason you need to use =
SetOwner is that the owner of a ticket is represented in two different data=
base tables. The first is in the GroupMembers table, alongside Requestors, =
Ccs, and AdminCcs, and custom roles. This is what provides features like pe=
rmissions. It&#39;s also what&#39;s used when you display the &quot;Owner&q=
uot; column in search results. Tickets _also_ store their owner denormalize=
d in the tickets table. This is used in, among other places, displaying the=
 owner on ticket display, and in email notifications.</div><div><br></div><=
div>-&gt;Set(Field =3D&gt; &#39;Owner&#39;) only updates the latter. -&gt;S=
etOwner updates both.</div><div><br></div><div>This explains the inconsiste=
ncies you&#39;re seeing. Please try switching your scrip to -&gt;SetOwner a=
nd seeing if it helps for tickets going forward. For existing tickets with =
this problem, you&#39;ll need to address the consistency issue.</div><div><=
br></div><div>It turns out that, for different reasons entirely ( <a href=
=3D"https://issues.bestpractical.com/Ticket/Display.html?id=3D32381" target=
=3D"_blank">https://issues.bestpractical.<wbr>com/Ticket/Display.html?id=3D=
<wbr>32381</a>=C2=A0), RT 4.4.2 adds an upgrade step and an rt-validator ru=
le that detects and fixes such inconsistencies. You can find them here:</di=
v><div><br></div><div><a href=3D"https://github.com/bestpractical/rt/commit=
/58bacce6ada754657c7f56fd91f20c573108c1ab" target=3D"_blank">https://github=
.com/<wbr>bestpractical/rt/commit/<wbr>58bacce6ada754657c7f56fd91f20c<wbr>5=
73108c1ab</a></div><div><a href=3D"https://github.com/bestpractical/rt/comm=
it/20d8daf6855e3c53ee8a79d68271941d4cdca159" target=3D"_blank">https://gith=
ub.com/<wbr>bestpractical/rt/commit/<wbr>20d8daf6855e3c53ee8a79d6827194<wbr=
>1d4cdca159</a></div><div><br></div><div>Best,</div><div>Shawn</div></div><=
/blockquote></div><br><br clear=3D"all"><br>-- <br><div class=3D"gmail_sign=
ature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div><div>Alex H=
all<br></div>Automatic Distributors, IT department<br></div><a href=3D"mail=
to:[email protected]" target=3D"_blank">[email protected]</a><br></div></=
div>
</div>

--001a113cd0dab297ae0549368821--