Default Time Worked

Due to the nature of our beast, we need to default the Time Worked value to 5 on
replies and comments. Anyone know where I go to look at this?

Keep up with me and what I’m up to: http://theillien.blogspot.com

Mathew,
You could accomplish this using a Scrip with conditions “On Comment” and
“On Correspond”. Then just grab the current Time Worked, increment by 5
and update the db field. So something like this might work for your
custom Scrip Action:
my $temp = $self->TicketObj->TimeWorked;
$temp += 5;
$self->TicketObj->SetTimeWorked($temp);
return 1;

-Sean-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Mathew
Snyder
Sent: Tuesday, June 26, 2007 6:55 AM
To: RT Users
Subject: [rt-users] Default Time Worked

Due to the nature of our beast, we need to default the Time Worked value
to 5 on replies and comments. Anyone know where I go to look at this?

Keep up with me and what I’m up to: http://theillien.blogspot.com
The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

This email (including any attachments) is for its intended-recipient’s
use only. This email may contain information that is confidential or
privileged. If you received this email in error, please immediately
advise the sender by replying to this email and then delete this message
from your system. For further information and disclaimers that apply to
this email, see [http://www.viacom.com/email_disclaimer.jhtml].

That will be good plan “B”. I’ll have to clarify with the powers that be what
they want because we want the ticket to start at 5 and go up as people add time.
Not necessarily go up by 5 each time. Although, that might actually make more
sense just in case people forget to add any time anyway.

Thanks. I’ll keep your suggestion in mind. :slight_smile:

Keep up with me and what I’m up to: http://theillien.blogspot.com

Edge, Sean wrote:

Oh, sorry, I thought that’s what you were asking.

If you just want it to start at 5 minutes by default you can simply make
the condition “On Create” and just make the action:
$self->TicketObj->SetTimeWorked(5);
return 1;

Any new ticket in any Queue (provided you make it a Global Scrip) would,
on creation, have 5 minutes in the TimeWorked field.

-SeanFrom: Mathew Snyder [mailto:theillien@yahoo.com]
Sent: Tuesday, June 26, 2007 9:25 AM
To: Edge, Sean
Cc: RT Users
Subject: Re: [rt-users] Default Time Worked

That will be good plan “B”. I’ll have to clarify with the powers that
be what they want because we want the ticket to start at 5 and go up as
people add time.
Not necessarily go up by 5 each time. Although, that might actually
make more sense just in case people forget to add any time anyway.

Thanks. I’ll keep your suggestion in mind. :slight_smile:

Keep up with me and what I’m up to: http://theillien.blogspot.com

Edge, Sean wrote:

Mathew,
You could accomplish this using a Scrip with conditions “On Comment”
and “On Correspond”. Then just grab the current Time Worked,
increment by 5 and update the db field. So something like this might
work for your custom Scrip Action:
my $temp = $self->TicketObj->TimeWorked; $temp += 5;
$self->TicketObj->SetTimeWorked($temp);
return 1;

-Sean

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Mathew
Snyder
Sent: Tuesday, June 26, 2007 6:55 AM
To: RT Users
Subject: [rt-users] Default Time Worked

Due to the nature of our beast, we need to default the Time Worked
value to 5 on replies and comments. Anyone know where I go to look at
this?


Keep up with me and what I’m up to: http://theillien.blogspot.com


The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

This email (including any attachments) is for its intended-recipient’s

use only. This email may contain information that is confidential or
privileged. If you received this email in error, please immediately
advise the sender by replying to this email and then delete this
message from your system. For further information and disclaimers
that apply to this email, see
[http://www.viacom.com/email_disclaimer.jhtml].

This email (including any attachments) is for its intended-recipient’s
use only. This email may contain information that is confidential or
privileged. If you received this email in error, please immediately
advise the sender by replying to this email and then delete this message
from your system. For further information and disclaimers that apply to
this email, see [http://www.viacom.com/email_disclaimer.jhtml].

It isn’t working. This is how I’ve configured it:
Description: Default Time Worked
Condition: On Create
Action: User Defined
Template: Global template: Transaction
Stage: TransactionCreate

Custom Condition: $self->TicketObj->SetTimeWorked(5);
Custom action preparation code:
Custom action cleanup code: return 1;

I’m wondering though, by using SetTimeWorked(5), won’t I just be setting the
time to 5 regardless of the value entered in the field during a comment or reply?

I think what would be preferable in the situation I’m looking at is to have the
value of the field automatically set on the comment/reply screen rather than
have the addition made upon transaction creation. This is what I meant by a
default. Rather than present the user with a blank field to have it populated
with “5” and allow them to alter it as necessary.

Keep up with me and what I’m up to: http://theillien.blogspot.com

Edge, Sean wrote:

Mathew,
It isn’t working. This is how I’ve configured it:
Description: Default Time Worked
Condition: On Create
Action: User Defined
Template: Global template: Transaction
Stage: TransactionCreate

I generally use a Blank template so there’s no correspondance sent when
making a change like this.

Custom Condition: $self->TicketObj->SetTimeWorked(5);
Custom action preparation code:
Custom action cleanup code: return 1;

This is already using an “On Create” condition so you should just put
“return 1;” in that box and move the code to the “action preparation
code”.

I’m wondering though, by using SetTimeWorked(5), won’t I just be setting
the time to 5 regardless of the value entered in the field during a
comment or reply?

The condition is set to “On Create” so it will only happen when a new
ticket is created.

I think what would be preferable in the situation I’m looking at is to
have the value of the field automatically set on the comment/reply
screen rather than have the addition made upon transaction creation.
This is what I meant by a default. Rather than present the user with a
blank field to have it populated with “5” and allow them to alter it as
necessary.

You could (probably should) put a check in that Scrip to see if
TimeWorked has already been set so if someone has created a ticket with
TimeWorked it’s not automatically overwritten.

The only way I could think to have the “Time Worked” field automatically
filled would be to modify the RT code or db schema, neither of which I
would recommend.

-Sean

This email (including any attachments) is for its intended-recipient’s
use only. This email may contain information that is confidential or
privileged. If you received this email in error, please immediately
advise the sender by replying to this email and then delete this message
from your system. For further information and disclaimers that apply to
this email, see [http://www.viacom.com/email_disclaimer.jhtml].

Edge, Sean wrote:

Mathew,

It isn’t working. This is how I’ve configured it:
Description: Default Time Worked
Condition: On Create
Action: User Defined
Template: Global template: Transaction
Stage: TransactionCreate

I generally use a Blank template so there’s no correspondance sent when
making a change like this.


Custom Condition: $self->TicketObj->SetTimeWorked(5);
Custom action preparation code:
Custom action cleanup code: return 1;

This is already using an “On Create” condition so you should just put
“return 1;” in that box and move the code to the “action preparation
code”.


I’m wondering though, by using SetTimeWorked(5), won’t I just be setting
the time to 5 regardless of the value entered in the field during a
comment or reply?

The condition is set to “On Create” so it will only happen when a new
ticket is created.


I think what would be preferable in the situation I’m looking at is to
have the value of the field automatically set on the comment/reply
screen rather than have the addition made upon transaction creation.
This is what I meant by a default. Rather than present the user with a
blank field to have it populated with “5” and allow them to alter it as
necessary.

You could (probably should) put a check in that Scrip to see if
TimeWorked has already been set so if someone has created a ticket with
TimeWorked it’s not automatically overwritten.

The only way I could think to have the “Time Worked” field automatically
filled would be to modify the RT code or db schema, neither of which I
would recommend.

-Sean

I’ve clarified with my boss. He does want the field to be pre-populated.
Fortunately, the local directory supports the .pm files as well. I’ll have to
tinker to find the solution. However, if anyone has any thoughts on where I
should change this I’d appreciate it.

Mathew

Mathew,
The only way I could think to have the “Time Worked” field automatically
filled would be to modify the RT code or db schema, neither of which I
would recommend.

Matt,

Does visitng the following URL give you
what you want?

$RT_URL/Ticket/Update.html?Action=Comment&UpdateTimeWorked=5&id=$TICKETID

If so youcould change either the links in the main rt pages to append
‘&UpdateTimeWorked=5’ to the edit urls or or
$RTPATH/html/Ticket/Update.html to set a deafult on this variable.

($ARGS{UpdateTimeWorked} in the perl.

TTFN
Roger. Home| http://www.sandman.uklinux.net/
Master of Peng Shui. (Ancient oriental art of Penguin Arranging)
Work|Independent Sys Consultant | http://www.computer-surgery.co.uk/
New key Fpr: 72AF 0ACC 9A53 E59F B1B6 DC14 1983 A13E 5C3D 3CEB

YES!!! That’s exactly what I need. And the change worked perfectly.

Thanks
Keep up with me and what I’m up to: http://theillien.blogspot.com

Roger Gammans wrote:> On Tue, Jun 26, 2007 at 10:46:46AM -0400, Edge, Sean wrote:

Mathew,
The only way I could think to have the “Time Worked” field automatically
filled would be to modify the RT code or db schema, neither of which I
would recommend.

Matt,

Does visitng the following URL give you
what you want?

$RT_URL/Ticket/Update.html?Action=Comment&UpdateTimeWorked=5&id=$TICKETID

If so youcould change either the links in the main rt pages to append
‘&UpdateTimeWorked=5’ to the edit urls or or
$RTPATH/html/Ticket/Update.html to set a deafult on this variable.

($ARGS{UpdateTimeWorked} in the perl.

TTFN

Mathew Snyder writes:

I’ve clarified with my boss. He does want the field to be
pre-populated. […]

If the string ‘&UpdateTimeWorked=5’ is added to the update URL,
e.g. https://www.example.com/rt/Ticket/Update.html?Action=Comment&id=50&UpdateTimeWorked=5,
the field will be pre-populated.

I.e. if you copy html/Ticket/Update.html to your local directory and
replace ‘value=“<% $ARGS{UpdateTimeWorked} %>”’ with ‘value=“5”’ the
field will always be pre-populated.

I haven’t figured out how to set a default value for UpdateTimeWorked
though. The field won’t be pre-populated if you add
‘$UpdateTimeWorked => “5”’ to the %ARGS section at the bottom of
Update.html.

What you have there won’t work, as it’s using what you want to do, as
it’s condition on if it should work or not.

In addition, create isn’t fired, when someone adds a comment, or reply.
If you were to add a condition for those, it would add 5 to the time
worked, no matter what someone put in on the reply, however, this would
be in addition to what they put in.

You’ll have to take a copy of Update.html from /rt3/share/html/Ticket
and put it into local/html/Ticket and update it there.

Steve AndersonFrom: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Mathew
Snyder
Sent: 26 June 2007 15:05
To: Edge, Sean
Cc: RT Users
Subject: Re: [rt-users] Default Time Worked

It isn’t working. This is how I’ve configured it:
Description: Default Time Worked
Condition: On Create
Action: User Defined
Template: Global template: Transaction
Stage: TransactionCreate

Custom Condition: $self->TicketObj->SetTimeWorked(5);
Custom action preparation code:
Custom action cleanup code: return 1;

I’m wondering though, by using SetTimeWorked(5), won’t I just be setting
the
time to 5 regardless of the value entered in the field during a comment
or reply?

I think what would be preferable in the situation I’m looking at is to
have the
value of the field automatically set on the comment/reply screen rather
than
have the addition made upon transaction creation. This is what I meant
by a
default. Rather than present the user with a blank field to have it
populated
with “5” and allow them to alter it as necessary.

Keep up with me and what I’m up to: http://theillien.blogspot.com

Edge, Sean wrote:

Oh, sorry, I thought that’s what you were asking.

If you just want it to start at 5 minutes by default you can simply
make
the condition “On Create” and just make the action:
$self->TicketObj->SetTimeWorked(5);
return 1;

Any new ticket in any Queue (provided you make it a Global Scrip)
would,
on creation, have 5 minutes in the TimeWorked field.

-Sean

-----Original Message-----
From: Mathew Snyder [mailto:theillien@yahoo.com]
Sent: Tuesday, June 26, 2007 9:25 AM
To: Edge, Sean
Cc: RT Users
Subject: Re: [rt-users] Default Time Worked

That will be good plan “B”. I’ll have to clarify with the powers that
be what they want because we want the ticket to start at 5 and go up
as
people add time.
Not necessarily go up by 5 each time. Although, that might actually
make more sense just in case people forget to add any time anyway.

Thanks. I’ll keep your suggestion in mind. :slight_smile:

Keep up with me and what I’m up to: http://theillien.blogspot.com

Edge, Sean wrote:

Mathew,
You could accomplish this using a Scrip with conditions “On Comment”
and “On Correspond”. Then just grab the current Time Worked,
increment by 5 and update the db field. So something like this might

work for your custom Scrip Action:
my $temp = $self->TicketObj->TimeWorked; $temp += 5;
$self->TicketObj->SetTimeWorked($temp);
return 1;

-Sean

-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Mathew

Snyder
Sent: Tuesday, June 26, 2007 6:55 AM
To: RT Users
Subject: [rt-users] Default Time Worked

Due to the nature of our beast, we need to default the Time Worked
value to 5 on replies and comments. Anyone know where I go to look
at
this?

Keep up with me and what I’m up to: http://theillien.blogspot.com


The rt-users Archives

Community help: http://wiki.bestpractical.com Commercial support:
sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

This email (including any attachments) is for its
intended-recipient’s

use only. This email may contain information that is confidential or
privileged. If you received this email in error, please immediately
advise the sender by replying to this email and then delete this
message from your system. For further information and disclaimers
that apply to this email, see
[http://www.viacom.com/email_disclaimer.jhtml].

This email (including any attachments) is for its intended-recipient’s
use only. This email may contain information that is confidential or
privileged. If you received this email in error, please immediately
advise the sender by replying to this email and then delete this
message
from your system. For further information and disclaimers that apply
to
this email, see [http://www.viacom.com/email_disclaimer.jhtml].

http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

This email has been scanned by Netintelligence

I haven’t figured out how to set a default value for UpdateTimeWorked
though. The field won’t be pre-populated if you add
‘$UpdateTimeWorked => “5”’ to the %ARGS section at the bottom of
Update.html.

From the O’reilly book on Mason:-
Any assignment of defaults in the <%args> block is not visible
in %ARGS

What I’d do to set the default (untested) would be to add something
like:-

<%perl>
if (not defined $ARGS{UpdateTimeWorked} ) {
$ARGS{UpdateTimeWorked}=5;
}
</%perl>

at the top of the file.

TTFN
Roger. Home| http://www.sandman.uklinux.net/
Master of Peng Shui. (Ancient oriental art of Penguin Arranging)
Work|Independent Sys Consultant | http://www.computer-surgery.co.uk/
New key Fpr: 72AF 0ACC 9A53 E59F B1B6 DC14 1983 A13E 5C3D 3CEB