Re: [rt-users] RT 4.2 and ownership of tickets after comments

2013-11-06 Thread Chris Hall
Fixed

It was as I suspected. (I think)  The scrips were running and changing the
owner of the ticket, and then RT was applying everything to the ticket
update, including the "Ticket and Transaction" section afterwards.  Since
this section holds a field marked "Owner" and is defaultly populated by the
old owner, RT was reading that value and using it to re-set the owner after
the scrip had ran.

I'm not a programmer, so my fix is quick and dirty.  But this is what I
did.  I removed the following code from Update.html

{   name => 'Owner',
comp => '/Elements/SelectOwner',
args => {
Name => "Owner",
TicketObj=> $TicketObj,
QueueObj => $TicketObj->QueueObj,
DefaultLabel => loc("[_1] (Unchanged)",
$m->scomp('/Elements/ShowUser', User => $TicketObj->OwnerObj)),
Default  => $ARGS{'Owner'}
}
},

This removed the owner field from the comment page.  My users never change
the owner here anyways.

I know changing this file in this way means in the future upgrades will
probably overwrite my changes, but for now everybody is happy and I just
have to be aware that this fix is needed if it's ever overwritten by an
upgrade.


On Wed, Nov 6, 2013 at 2:02 PM, Asif Iqbal  wrote:

>
> On Wed, Nov 6, 2013 at 12:20 PM, Chris Hall  wrote:
>
>> Nov  6 09:56:39 rt RT: [30613]
>>  #57417/999087 - Scrip
>> 2 On Owner Change Notify Owner
>> Nov  6 09:56:39 rt RT: [30613]
>>  No recipients found.
>> Not sending.
>> Nov  6 09:56:39 rt RT: [30613]
>>  #57417/999089 - Scrip
>> 2 On Owner Change Notify Owner
>> Nov  6 09:56:39 rt RT: [30613]
>>  sent  To: x...@xxx.com
>>
>
>
> This log does not really show the event when RT forcibly changed the
> owner. You might need to provide a fresh complete log for a new event.
>
> Also, do you might have any scrip in "Scrips which apply to all queues"
> and "Current Scrips" section? A snapshot of /Admin/Queues/Scrips.html?id=XX
> where XX is the ``id'' of the queue might show that.
>
> Please include all when you reply.
>
>
> --
> Asif Iqbal
> PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
>
>


Re: [rt-users] RT 4.2 and ownership of tickets after comments

2013-11-06 Thread Asif Iqbal
On Wed, Nov 6, 2013 at 12:20 PM, Chris Hall  wrote:

> Nov  6 09:56:39 rt RT: [30613]
>  #57417/999087 - Scrip 2
> On Owner Change Notify Owner
> Nov  6 09:56:39 rt RT: [30613]
>  No recipients found.
> Not sending.
> Nov  6 09:56:39 rt RT: [30613]
>  #57417/999089 - Scrip
> 2 On Owner Change Notify Owner
> Nov  6 09:56:39 rt RT: [30613]
>  sent  To: x...@xxx.com
>


This log does not really show the event when RT forcibly changed the owner.
You might need to provide a fresh complete log for a new event.

Also, do you might have any scrip in "Scrips which apply to all queues" and
"Current Scrips" section? A snapshot of /Admin/Queues/Scrips.html?id=XX
where XX is the ``id'' of the queue might show that.

Please include all when you reply.

-- 
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


Re: [rt-users] RT 4.2 and ownership of tickets after comments

2013-11-06 Thread Chris Hall
To better illustrate what I'm seeing, here's a screen cap.
http://i.imgur.com/FTlLGYO.jpg
On the top is what I see when I tried to comment on a ticket.
On the bottom is a clip from the history, where you can see one person
commenting, RT changing ownership to them, and then they immediately return
ownership.

I have a theory as to what might be happening.  Could it be possible that
the scrips are processed before the changes?  If so, perhaps my scrip is
changing ownership of the ticket, and then RT sees on the right in the
"Ticket and Transaction" section a different owner than the ticket now has,
and the user changes it?

This is all I can really find in the log as far as anything useful.  Below
you can see that scrip 2 fires off when my scrip forcefully changes
ownership.  It then immediately fires off again because the user has given
ownership back to the original owner.

I've noticed that if I revoke the ModifyTicket permission the RT scrip will
change the owner to them, and then they are aunable to change the owner
back.  The result at the top is a message saying the comment was added,
followed by a line that reads "Permission Denied".  As far as I can tell,
this achieves the desired effect.  However, a lot of people aren't happy
about doing it this way.

I just tried removing all scrips from the queue except my scrip that
changes owner, and the result was the same.  So it's not a problem w/
another scrip that's running.  Below is a log snippet.

Nov  6 09:56:39 rt RT: [30613]
 #57417/999085 - Scrip 8
On Comment Notify AdminCcs as Comment
Nov  6 09:56:39 rt RT: [30613]
 sent  Bcc: x...@xxx.com,
x...@xxx.com
Nov  6 09:56:39 rt RT: [30613]
 #57417/999085 - Scrip 9
On Comment Notify Other Recipients as Comment
Nov  6 09:56:39 rt RT: [30613]
 No recipients found. Not
sending.
Nov  6 09:56:39 rt RT: [30613] Auto assign ticket #57417 to user #230355
Nov  6 09:56:39 rt RT: [30613]
 #57417/999087 - Scrip 2
On Owner Change Notify Owner
Nov  6 09:56:39 rt RT: [30613]
 No recipients found. Not
sending.
Nov  6 09:56:39 rt RT: [30613]
 #57417/999089 - Scrip 2
On Owner Change Notify Owner
Nov  6 09:56:39 rt RT: [30613]
 sent  To: x...@xxx.com
Nov  6 09:56:39 rt RT: [30613] Use of uninitialized value in concatenation
(.) or string at /opt/rt4/sbin/../lib/RT/Interface/Web.pm line 1793.
Nov  6 09:56:39 rt RT: [30613] More than 50 possible Owners found for Queue
41; switching to autocompleter


On Wed, Nov 6, 2013 at 10:54 AM, Asif Iqbal  wrote:

>
>
>
> On Wed, Nov 6, 2013 at 10:04 AM, Chris Hall  wrote:
>
>> I'm officially stumped.  This apparently is an issue that doesn't effect
>> everybody, but the people it does I can't pin down why.  I did a separate
>> RT installation on another server and verified that my scrip works.  This
>> wasn't a problem before 4.2, so it must be some sort of fail safe I'm
>> guessing.  So here's what I've noticed..
>>
>> The logs show a scrip firing twice that emails the owner when the owner
>> changes.
>> In the history it shows RT forcefully changing the owner.
>> The next thing that happens is the new owner "gives" the ticket to the
>> old owner.
>> Some people in some queues are not affected.
>>
>> I've double, triple checked permissions on people and groups.  I've
>> re-read through all my scrips and nothing except my scrip is changing
>> ownership.  No queues have any special scrips, they are all global.  I'm at
>> a complete loss what could be causing this anomaly.  Is there somewhere I
>> can go or something I can turn on that will enable like a debug mode so I
>> can see what's happening on a step by step basis when something happens
>> like a comment?
>>
>
>
> Some log related to one of this event would help, even if you have to
> sanitize it first.
> But make sure you provide complete logs, so no scrip action gets skipped
> while you are
> pasting it here.
>
>
>
>>
>>
>> On Tue, Nov 5, 2013 at 3:45 PM, Alex Vandiver 
>> wrote:
>>
>>> On Tue, 2013-11-05 at 15:36 -0500, Chris Hall wrote:
>>> > Still haven't found anything.  What's odd is that it's not a problem
>>> > w/ the scrip.  The scrip still works.  RT force changes the owner to
>>> > whoever made the comment.  It even shows up in the history.  But it's
>>> > like the very next thing that happens is the new owner "gives" the
>>> > ownership back to the original owner.  I can't seem to figure out why.
>>>
>>> Look at your logs; I suspect you have a second scrip which is firing to
>>> give it back.
>>>  - Alex
>>>
>>>
>>>
>>
>
>
> --
> Asif Iqbal
> PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
>
>


Re: [rt-users] RT 4.2 and ownership of tickets after comments

2013-11-06 Thread Asif Iqbal
On Wed, Nov 6, 2013 at 10:04 AM, Chris Hall  wrote:

> I'm officially stumped.  This apparently is an issue that doesn't effect
> everybody, but the people it does I can't pin down why.  I did a separate
> RT installation on another server and verified that my scrip works.  This
> wasn't a problem before 4.2, so it must be some sort of fail safe I'm
> guessing.  So here's what I've noticed..
>
> The logs show a scrip firing twice that emails the owner when the owner
> changes.
> In the history it shows RT forcefully changing the owner.
> The next thing that happens is the new owner "gives" the ticket to the old
> owner.
> Some people in some queues are not affected.
>
> I've double, triple checked permissions on people and groups.  I've
> re-read through all my scrips and nothing except my scrip is changing
> ownership.  No queues have any special scrips, they are all global.  I'm at
> a complete loss what could be causing this anomaly.  Is there somewhere I
> can go or something I can turn on that will enable like a debug mode so I
> can see what's happening on a step by step basis when something happens
> like a comment?
>


Some log related to one of this event would help, even if you have to
sanitize it first.
But make sure you provide complete logs, so no scrip action gets skipped
while you are
pasting it here.



>
>
> On Tue, Nov 5, 2013 at 3:45 PM, Alex Vandiver wrote:
>
>> On Tue, 2013-11-05 at 15:36 -0500, Chris Hall wrote:
>> > Still haven't found anything.  What's odd is that it's not a problem
>> > w/ the scrip.  The scrip still works.  RT force changes the owner to
>> > whoever made the comment.  It even shows up in the history.  But it's
>> > like the very next thing that happens is the new owner "gives" the
>> > ownership back to the original owner.  I can't seem to figure out why.
>>
>> Look at your logs; I suspect you have a second scrip which is firing to
>> give it back.
>>  - Alex
>>
>>
>>
>


-- 
Asif Iqbal
PGP Key: 0xE62693C5 KeyServer: pgp.mit.edu
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


Re: [rt-users] RT 4.2 and ownership of tickets after comments

2013-11-06 Thread Chris Hall
I'm officially stumped.  This apparently is an issue that doesn't effect
everybody, but the people it does I can't pin down why.  I did a separate
RT installation on another server and verified that my scrip works.  This
wasn't a problem before 4.2, so it must be some sort of fail safe I'm
guessing.  So here's what I've noticed..

The logs show a scrip firing twice that emails the owner when the owner
changes.
In the history it shows RT forcefully changing the owner.
The next thing that happens is the new owner "gives" the ticket to the old
owner.
Some people in some queues are not affected.

I've double, triple checked permissions on people and groups.  I've re-read
through all my scrips and nothing except my scrip is changing ownership.
 No queues have any special scrips, they are all global.  I'm at a complete
loss what could be causing this anomaly.  Is there somewhere I can go or
something I can turn on that will enable like a debug mode so I can see
what's happening on a step by step basis when something happens like a
comment?


On Tue, Nov 5, 2013 at 3:45 PM, Alex Vandiver wrote:

> On Tue, 2013-11-05 at 15:36 -0500, Chris Hall wrote:
> > Still haven't found anything.  What's odd is that it's not a problem
> > w/ the scrip.  The scrip still works.  RT force changes the owner to
> > whoever made the comment.  It even shows up in the history.  But it's
> > like the very next thing that happens is the new owner "gives" the
> > ownership back to the original owner.  I can't seem to figure out why.
>
> Look at your logs; I suspect you have a second scrip which is firing to
> give it back.
>  - Alex
>
>
>


Re: [rt-users] RT 4.2 and ownership of tickets after comments

2013-11-05 Thread Alex Vandiver
On Tue, 2013-11-05 at 15:36 -0500, Chris Hall wrote:
> Still haven't found anything.  What's odd is that it's not a problem
> w/ the scrip.  The scrip still works.  RT force changes the owner to
> whoever made the comment.  It even shows up in the history.  But it's
> like the very next thing that happens is the new owner "gives" the
> ownership back to the original owner.  I can't seem to figure out why.

Look at your logs; I suspect you have a second scrip which is firing to
give it back.
 - Alex




Re: [rt-users] RT 4.2 and ownership of tickets after comments

2013-11-05 Thread Chris Hall
Still haven't found anything.  What's odd is that it's not a problem w/ the
scrip.  The scrip still works.  RT force changes the owner to whoever made
the comment.  It even shows up in the history.  But it's like the very next
thing that happens is the new owner "gives" the ownership back to the
original owner.  I can't seem to figure out why.


On Tue, Nov 5, 2013 at 12:32 PM, Chris Hall  wrote:

> My mistake, the custom action commit code is this:
>
> # get actor ID
> my $Actor = $self->TransactionObj->Creator;
>
> # ok, try to change owner
> $RT::Logger->info("Auto assign ticket #". $self->TicketObj->id ." to user
> #".$Actor );
> my ($status, $msg) = $self->TicketObj->SetOwner( $Actor,'Force' );
> unless( $status ) {
>   $RT::Logger->error( "Impossible to assign the ticket to $Actor: $msg" );
>   return undef;
> }
> return 1;
>
>
> On Tue, Nov 5, 2013 at 12:10 PM, Chris Hall  wrote:
>
>> This is my scrip that sets the owner to themselves after a comment.  Like
>> I said though it's working fine.  However, something else seems to be
>> kicking off now afterwards that is giving the ticket back to the previous
>> owner.
>>
>>
>> Condition: On Create
>> Action: User Defined
>> Template: Blank
>>
>> Custom Condition: 
>>
>> Custom action preparation code:
>>   return 1;
>>
>> Custom action commit code:
>>   # get actor ID
>>   my $Actor = $self->TransactionObj->Creator;
>>
>>   # if actor is RT_SystemUser then get out of here
>>   return 1 if $Actor == $RT::SystemUser->id;
>>
>>   # get out unless ticket owner is nobody
>>   return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;
>>
>>   # ok, try to change owner
>>   $RT::Logger->info("Auto assign ticket #". $self->TicketObj->id ." to
>> user #".$Actor );
>>   my ($status, $msg) = $self->TicketObj->SetOwner( $Actor );
>>   unless( $status ) {
>> $RT::Logger->error( "Impossible to assign the ticket to $Actor: $msg"
>> );
>> return undef;
>>   }
>>   return 1;
>>
>>
>>
>> On Tue, Nov 5, 2013 at 12:03 PM, Alex Vandiver 
>> wrote:
>>
>>> On Tue, 2013-11-05 at 11:40 -0500, Chris Hall wrote:
>>> > I'm noticing a strange problem after my upgrade from 4.0.0 to 4.2.
>>> >  Before my upgrade I'd made a global script that would have the user
>>> > attempt to take ownership of a ticket after commenting on it.  This is
>>> > still working after the upgrade.  However, now it is immediately given
>>> > back to the previous owner for some reason.  History reads like this:
>>> >
>>> >
>>> >
>>> >
>>> > # The RT System itself - Owner forcibly changed from UserA to UserB
>>> > # UserB - Given to UserA
>>> >
>>> >
>>> > Any ideas what might be causing this and how to stop it?
>>>
>>> You will need to provide the scrip before we will be able to hazard any
>>> guesses.
>>>  - Alex
>>>
>>>
>>
>


Re: [rt-users] RT 4.2 and ownership of tickets after comments

2013-11-05 Thread Chris Hall
My mistake, the custom action commit code is this:

# get actor ID
my $Actor = $self->TransactionObj->Creator;

# ok, try to change owner
$RT::Logger->info("Auto assign ticket #". $self->TicketObj->id ." to user
#".$Actor );
my ($status, $msg) = $self->TicketObj->SetOwner( $Actor,'Force' );
unless( $status ) {
  $RT::Logger->error( "Impossible to assign the ticket to $Actor: $msg" );
  return undef;
}
return 1;


On Tue, Nov 5, 2013 at 12:10 PM, Chris Hall  wrote:

> This is my scrip that sets the owner to themselves after a comment.  Like
> I said though it's working fine.  However, something else seems to be
> kicking off now afterwards that is giving the ticket back to the previous
> owner.
>
>
> Condition: On Create
> Action: User Defined
> Template: Blank
>
> Custom Condition: 
>
> Custom action preparation code:
>   return 1;
>
> Custom action commit code:
>   # get actor ID
>   my $Actor = $self->TransactionObj->Creator;
>
>   # if actor is RT_SystemUser then get out of here
>   return 1 if $Actor == $RT::SystemUser->id;
>
>   # get out unless ticket owner is nobody
>   return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;
>
>   # ok, try to change owner
>   $RT::Logger->info("Auto assign ticket #". $self->TicketObj->id ." to
> user #".$Actor );
>   my ($status, $msg) = $self->TicketObj->SetOwner( $Actor );
>   unless( $status ) {
> $RT::Logger->error( "Impossible to assign the ticket to $Actor: $msg"
> );
> return undef;
>   }
>   return 1;
>
>
>
> On Tue, Nov 5, 2013 at 12:03 PM, Alex Vandiver 
> wrote:
>
>> On Tue, 2013-11-05 at 11:40 -0500, Chris Hall wrote:
>> > I'm noticing a strange problem after my upgrade from 4.0.0 to 4.2.
>> >  Before my upgrade I'd made a global script that would have the user
>> > attempt to take ownership of a ticket after commenting on it.  This is
>> > still working after the upgrade.  However, now it is immediately given
>> > back to the previous owner for some reason.  History reads like this:
>> >
>> >
>> >
>> >
>> > # The RT System itself - Owner forcibly changed from UserA to UserB
>> > # UserB - Given to UserA
>> >
>> >
>> > Any ideas what might be causing this and how to stop it?
>>
>> You will need to provide the scrip before we will be able to hazard any
>> guesses.
>>  - Alex
>>
>>
>


Re: [rt-users] RT 4.2 and ownership of tickets after comments

2013-11-05 Thread Chris Hall
This is my scrip that sets the owner to themselves after a comment.  Like I
said though it's working fine.  However, something else seems to be kicking
off now afterwards that is giving the ticket back to the previous owner.


Condition: On Create
Action: User Defined
Template: Blank

Custom Condition: 

Custom action preparation code:
  return 1;

Custom action commit code:
  # get actor ID
  my $Actor = $self->TransactionObj->Creator;

  # if actor is RT_SystemUser then get out of here
  return 1 if $Actor == $RT::SystemUser->id;

  # get out unless ticket owner is nobody
  return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;

  # ok, try to change owner
  $RT::Logger->info("Auto assign ticket #". $self->TicketObj->id ." to user
#".$Actor );
  my ($status, $msg) = $self->TicketObj->SetOwner( $Actor );
  unless( $status ) {
$RT::Logger->error( "Impossible to assign the ticket to $Actor: $msg" );
return undef;
  }
  return 1;



On Tue, Nov 5, 2013 at 12:03 PM, Alex Vandiver wrote:

> On Tue, 2013-11-05 at 11:40 -0500, Chris Hall wrote:
> > I'm noticing a strange problem after my upgrade from 4.0.0 to 4.2.
> >  Before my upgrade I'd made a global script that would have the user
> > attempt to take ownership of a ticket after commenting on it.  This is
> > still working after the upgrade.  However, now it is immediately given
> > back to the previous owner for some reason.  History reads like this:
> >
> >
> >
> >
> > # The RT System itself - Owner forcibly changed from UserA to UserB
> > # UserB - Given to UserA
> >
> >
> > Any ideas what might be causing this and how to stop it?
>
> You will need to provide the scrip before we will be able to hazard any
> guesses.
>  - Alex
>
>


Re: [rt-users] RT 4.2 and ownership of tickets after comments

2013-11-05 Thread Alex Vandiver
On Tue, 2013-11-05 at 11:40 -0500, Chris Hall wrote:
> I'm noticing a strange problem after my upgrade from 4.0.0 to 4.2.
>  Before my upgrade I'd made a global script that would have the user
> attempt to take ownership of a ticket after commenting on it.  This is
> still working after the upgrade.  However, now it is immediately given
> back to the previous owner for some reason.  History reads like this:
> 
> 
> 
> 
> # The RT System itself - Owner forcibly changed from UserA to UserB
> # UserB - Given to UserA 
> 
> 
> Any ideas what might be causing this and how to stop it?

You will need to provide the scrip before we will be able to hazard any
guesses.
 - Alex



[rt-users] RT 4.2 and ownership of tickets after comments

2013-11-05 Thread Chris Hall
I'm noticing a strange problem after my upgrade from 4.0.0 to 4.2.  Before
my upgrade I'd made a global script that would have the user attempt to
take ownership of a ticket after commenting on it.  This is still working
after the upgrade.  However, now it is immediately given back to the
previous owner for some reason.  History reads like this:


# The RT System itself - Owner forcibly changed from
U
serA to UserB
# U serB - Given to UserA

Any ideas what might be causing this and how to stop it?