1 day to autoclose nofification (SOLVED)

Moderator: crythias

Locked
qnetworks
Znuny newbie
Posts: 16
Joined: 21 Oct 2010, 09:24
Znuny Version: 3.0

1 day to autoclose nofification (SOLVED)

Post by qnetworks »

hi,
i have a pending autoclose state called "waiting for client" and i use this state to clean the helpdesk of inactive tickets, for example, i say to a customer: "please send me the ref number". if the customer don't reply in the next 3 days the ticket will be closed.
exist any form to send a notification at the second day of pending? like: if you don't reply, your ticket will be closed in 24 hours.
any idea will be gratefull.
Last edited by qnetworks on 24 Nov 2010, 17:20, edited 1 time in total.
OTRS 3.0
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: 1 day to autoclose nofification

Post by crythias »

I believe the answer lies in Generic Agent, with the criteria of Pending Time Reached.
It's a long way to get there, but ...

Create a new Ticket State/Status "1 day left" of type pending auto.

You'll probably want to make the Pending Status "closed successful" in

Ticket::StateAfterPending:
Define which State should be set automatically (Value) after pending time of State (Key) has been reached.
[New]
Key: 1 day left
Content: closed successful

In Generic Agent
Enter a name and click add
select how often you want to run this

Check for State "Waiting for client"
Ticket pending time reached (here's where I'm not sure, but LAST 1 day sounds about right)
New State "1 day left"

In Notification (Event)
Add a notification
give it a name
choose recipients
...
Event: Ticket State Update
State: 1 day left
Subject: Your ticket will close in one day!
Text:
Click here to get your ticket...

Code: Select all

<OTRS_CONFIG_HttpType>://<OTRS_CONFIG_FQDN>/<OTRS_CONFIG_ScriptAlias>customer.pl?Action=CustomerTicketZoom&TicketID=<OTRS_TICKET_ID>
Valid: valid
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
qnetworks
Znuny newbie
Posts: 16
Joined: 21 Oct 2010, 09:24
Znuny Version: 3.0

Re: 1 day to autoclose nofification

Post by qnetworks »

yes, that's what i had thought, but i found two problems, one of them was at the generic agent filter, but i made some tests and i reach the solution, if you set at pending times: Ticket pending time reached (for example) LAST 5 min, you are taking all the tickets which have the pending time > -5 min; BEFORE 5 min means, all the tickets which have pending time < -5 min. (it's a bit strange for me this filter :lol: )
So i set Before 1 min.
the other issue i found is: when the "waiting for client" state , change to "1 day left", the pending counter don't change, do you know how to load 24 more hours?
thanks for your answer crythias. =)
OTRS 3.0
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: 1 day to autoclose nofification

Post by crythias »

qnetworks wrote:yes, that's what i had thought, but i found two problems, one of them was at the generic agent filter, but i made some tests and i reach the solution, if you set at pending times: Ticket pending time reached (for example) LAST 5 min, you are taking all the tickets which have the pending time > -5 min; BEFORE 5 min means, all the tickets which have pending time < -5 min. (it's a bit strange for me this filter :lol: )
So i set Before 1 min.
You mean Before 1 day? But, yes, I agree with the filter being rather untranslatable, even as an English speaker.
qnetworks wrote:the other issue i found is: when the "waiting for client" state , change to "1 day left", the pending counter don't change, do you know how to load 24 more hours?
thanks for your answer crythias. =)
The pending counter doesn't change. which is the point :). You set the total time to ticket close as 3 days. In 2 days, you change the state to "1 day left", and Notification (Event) does its thing. When the total pending time finishes, the "1 day left" becomes "closed successful" and the ticket is "really closed."
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
qnetworks
Znuny newbie
Posts: 16
Joined: 21 Oct 2010, 09:24
Znuny Version: 3.0

Re: 1 day to autoclose nofification

Post by qnetworks »

if you set 3 days pending its impossible with this filter to get a ticket when the counter reach 24 h left :shock:, the only way to make this, i think, is to set 2 days pending , when the "waiting for client" ticket reach 0 change to "1 day left" by cron pendingjobs.pl, and then yo make a generic agent filtering by "before 1 day" wich gets the tickets with pending till: < -1 day or less (- 2 days, - 3 days, -infinite days)
im gonna try this

i think that is something wrong at the filter because when you set a "valuetime" at Ticket pending time reached: happend the next:

(infinitetime)---------0---------(-("valuetime"))--------(- infinite time)

otrs set your "valuetime" like negative and:
if you set last "valuetime" you are taking tickets with counter from infinitetime to -valuetime
if you set before "valuetime" you are taking tickets with counter from -valuetime to -infinitetime

example: last 5 min: tickets with Pending till: 1 year, 3 months, 3 min, -4 min.
before 5 min: tickets with Pending till: -6 min, -3 months, -1 year.

i think that its impossible to take a ticket from (valuetime) to (-infinitetime) in the next line.
(infinitetime)---------("valuetime")---------0--------(- infinite time)

thanks crythias, otrs is gonna drive my crazy :lol:
OTRS 3.0
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: 1 day to autoclose nofification

Post by crythias »

Here's the code in pseudo code as I understand it

When you have enter a number of minutes, days, etc... that gets subtracted from the current SystemTime, a Date is created from that delta, and that is the comparison:

Code: Select all

    # get tickets pending older (BEFORE) than x minutes
    if ( defined $Param{TicketPendingTimeOlderMinutes} ) {

        $Param{TicketPendingTimeOlderMinutes} ||= 0;

        my $TimeStamp = $Self->{TimeObject}->SystemTime();
        $TimeStamp -= ( $Param{TicketPendingTimeOlderMinutes} * 60 );

        $Param{TicketPendingTimeOlderDate} = $Self->{TimeObject}->SystemTime2TimeStamp(
            SystemTime => $TimeStamp,
        );
    }
The comparison is made later on:

Code: Select all

        $SQLExt .= " AND st.until_time <= $TimeStamp"
or
>= $TimeStamp
for Newer (LAST)

st.until_time is the unix epoch of the pending time.

What's it all mean?
Generic Agent:
What time is it Now?
is the until_time less than or equal to Now -1 day? (BEFORE)
Set State "1 day left"
(this should probably never work).

Ah! The problem is simply fixed, I think. change the - to + in Kernel/System/Ticket.pm (see the above code). This makes the TimeStamp add a day instead of subtract a day. Then, the until_time can be less than or equal to Now PLUS 1 day.

Edit: Not Modules, System.
Last edited by crythias on 24 Nov 2010, 19:13, edited 1 time in total.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
qnetworks
Znuny newbie
Posts: 16
Joined: 21 Oct 2010, 09:24
Znuny Version: 3.0

Re: 1 day to autoclose nofification

Post by qnetworks »

both of the solutions works, but i prefer yours :D
time to (SOLVED)
thx!
OTRS 3.0
Locked