Automaticaly close tickets [SOLVED]

Moderator: crythias

Locked
kenmurimi
Znuny newbie
Posts: 87
Joined: 24 May 2010, 10:21
Znuny Version: 2.4.7

Automaticaly close tickets [SOLVED]

Post by kenmurimi »

Hi all.

i added a new state resolved in my OTRS. Agents are to set the tickets to resolved after resolving an issue. The customer then gets an email requesting them to close the tickets. The issue i have is that if a ticket is in the state resolved for more that five days i.e the customer doesn't resolve the ticket, the system should then Automatically close it.

any help greatly appreciated.
thanks in advance
Last edited by kenmurimi on 07 Oct 2010, 07:18, edited 1 time in total.
OTRS 2.4.7 on SUSE and on MySQL database
OTRS 3.2.10 on CentOS and MySQL database
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Automaticaly close tickets

Post by crythias »

and the Generic Agent you have configured isn't working? :) :) :)
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
kenmurimi
Znuny newbie
Posts: 87
Joined: 24 May 2010, 10:21
Znuny Version: 2.4.7

Re: Automaticaly close tickets

Post by kenmurimi »

Thanks Crythias. The issue with generic agent is that the only available options for ticket with an action done sometime ago are created, closed, pending and escalated. since i have added a new state resolved its not there on the list and am looking for a way of closing the ticket resolved 5 days ago.
Thanks.
OTRS 2.4.7 on SUSE and on MySQL database
OTRS 3.2.10 on CentOS and MySQL database
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Automaticaly close tickets

Post by crythias »

Actually, once you say that, it does make perfect sense, and I apologize for being snarky about it. The problem exists that there is no Generic Agent option to determine age of a given ticket state or priority.

It's too bad your Resolved isn't a [clone of] Pending autoclose successful, which would otherwise make sense.

Check this in SysConfig:

Config Options: Ticket -> Frontend::Agent
Ticket::Frontend::PendingDiffTime:
Time in seconds that gets added to the actual time if setting a pending-state (default: 86400 = 1 day).

(432000 = 5 days).
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
kenmurimi
Znuny newbie
Posts: 87
Joined: 24 May 2010, 10:21
Znuny Version: 2.4.7

Re: Automaticaly close tickets

Post by kenmurimi »

Thanks Crythias.

I agree with you " Pending autoclose successful" could work better for my case.. ill try it out later and post here how to go about it if it works.
OTRS 2.4.7 on SUSE and on MySQL database
OTRS 3.2.10 on CentOS and MySQL database
kenmurimi
Znuny newbie
Posts: 87
Joined: 24 May 2010, 10:21
Znuny Version: 2.4.7

Re: Automaticaly close tickets

Post by kenmurimi »

Pending auto close+ is working well but there is an issue there. My agents can be able to change the pending till date which will then affect the time the ticket is auto closed. I am looking for a way to remove the pending till on this page when resolving the ticket.
thanks.
OTRS 2.4.7 on SUSE and on MySQL database
OTRS 3.2.10 on CentOS and MySQL database
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Automaticaly close tickets

Post by crythias »

A thought. Maybe not worth it... change AgentTicketPending.dtl (your own theme) replace $Data{"DateString"} with

Code: Select all

<input type="hidden" id="Month" name="Month"> 
<input type="hidden" id="Day" name="Day"> 
<input type="hidden" id="Year" name="Year"> 
<input type="hidden" id="Hour" name="Hour"> 
<input type="hidden" id="Minute" name="Minute"> 

<script language="JavaScript" type="text/javascript">
<!--
var d=new Date();
d.setDate(d.getDate()+5);
document.compose.Month.value = d.getMonth(); 
document.compose.Day.value = d.getDate(); 
document.compose.Year.value = d.getYear(); 
document.compose.Hour.value = d.getHours(); 
document.compose.Minute.value = d.getMinutes(); 

//-->
</script>
(you might need to put the <script> stuff outside the </form>) It doesn't pay attention to time zone differences, so if that matters, you'll have to do your own dirty work regarding that.
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
kenmurimi
Znuny newbie
Posts: 87
Joined: 24 May 2010, 10:21
Znuny Version: 2.4.7

Re: Automaticaly close tickets

Post by kenmurimi »

Thanks a million Crythias. my problem is at last solved.. :D :D :D

but i changed somethings;

<input type="hidden" id="Month" name="Month">
<input type="hidden" id="Day" name="Day">
<input type="hidden" id="Year" name="Year">
<input type="hidden" id="Hour" name="Hour">
<input type="hidden" id="Minute" name="Minute">

<script language="JavaScript" type="text/javascript">
<!--
var d=new Date();
document.compose.Year.value = d.getFullYear();
document.compose.Month.value = d.getMonth()+1;
document.compose.Day.value = d.getDate()+5;
document.compose.Hour.value = d.getHours();
document.compose.Minute.value = d.getMinutes();
//-->
</script>

at first it was not working but with the changes its working perfectly.
I added 1 to the getmonth() to correct the problem with January being 0 and December being 11. After adding 1, January will be 1, and December will be 12.
I also changed getyear() to getfullyear() since i noted that here otrs is using the full year.
Last edited by kenmurimi on 23 Sep 2010, 13:32, edited 1 time in total.
OTRS 2.4.7 on SUSE and on MySQL database
OTRS 3.2.10 on CentOS and MySQL database
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Automaticaly close tickets

Post by crythias »

You should be careful regarding that. It's better to increment the date before breaking out the day, because what happens to your code on February 24?
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
kenmurimi
Znuny newbie
Posts: 87
Joined: 24 May 2010, 10:21
Znuny Version: 2.4.7

Re: Automaticaly close tickets

Post by kenmurimi »

i don't get exactly what u mean?

you propose it should be something like this?

<input type="hidden" id="Month" name="Month">
<input type="hidden" id="Day" name="Day">
<input type="hidden" id="Year" name="Year">
<input type="hidden" id="Hour" name="Hour">
<input type="hidden" id="Minute" name="Minute">

<script language="JavaScript" type="text/javascript">
<!--
var d=new Date();
d.setDate(d.getDate()+5);
document.compose.Year.value = d.getFullYear();
document.compose.Month.value = d.getMonth()+1;
document.compose.Day.value = d.getDate();
document.compose.Hour.value = d.getHours();
document.compose.Minute.value = d.getMinutes();
//-->
</script>
OTRS 2.4.7 on SUSE and on MySQL database
OTRS 3.2.10 on CentOS and MySQL database
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Automaticaly close tickets

Post by crythias »

Yes.

Imagine that it's February 25 or December 29.

Your original code doesn't care what month it is and blindly adds 5 days to the day. Now you have a potential February 30, December 34, etc. entry.

The d.setDate=getDate()+5 takes care of that for you. It adds 5 days to the full date and adjusts the month and year for you.
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
kenmurimi
Znuny newbie
Posts: 87
Joined: 24 May 2010, 10:21
Znuny Version: 2.4.7

Re: Automaticaly close tickets

Post by kenmurimi »

Thanks, i now undersatnd, infact i just changed my date to 30th Sept and got the error.

i have changed the code to;
<script language="JavaScript" type="text/javascript">
<!--
var d=new Date();
d.setDate(d.getDate()+5);
document.compose.Year.value = d.getFullYear();
document.compose.Month.value = d.getMonth()+1;
document.compose.Day.value = d.getDate();
document.compose.Hour.value = d.getHours();
document.compose.Minute.value = d.getMinutes();
//-->
</script>

and still it does not work?
OTRS 2.4.7 on SUSE and on MySQL database
OTRS 3.2.10 on CentOS and MySQL database
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Automaticaly close tickets

Post by crythias »

I got it from here: http://www.w3schools.com/js/js_obj_date.asp
Set Dates

We can easily manipulate the date by using the methods available for the Date object.

In the example below we set a Date object to a specific date (14th January 2010):

var myDate=new Date();
myDate.setFullYear(2010,0,14);
And in the following example we set a Date object to be 5 days into the future:

var myDate=new Date();
myDate.setDate(myDate.getDate()+5);
Note: If adding five days to a date shifts the month or year, the changes are handled automatically by the Date object itself!
And this http://en.allexperts.com/q/Javascript-1 ... Date-1.htm site seems to concur:
In order to add a day to a date object in javascript, you have to use both the setDate() and getDate() methods. Here's how:

//create the date
var myDate = new Date();

//add a day to the date
myDate.setDate(myDate.getDate() + 1);

//add a week
myDate.setDate(myDate.getDate() + 7);

//add a month
myDate.setMonth(myDate.getMonth() + 1);

//add a year
myDate.setYear(myDate.getYear() + 1);
However, a post here: http://www.webmasterworld.com/forum91/1199.htm seems to have a better way:
var today = new Date();
var d=new Date(today.getTime() + (5 * 24 * 60 * 60 * 1000));
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
kenmurimi
Znuny newbie
Posts: 87
Joined: 24 May 2010, 10:21
Znuny Version: 2.4.7

Re: Automaticaly close tickets

Post by kenmurimi »

Thanks alot Crythias.. its now working perfectly
I used this:

<input type="hidden" id="Month" name="Month">
<input type="hidden" id="Day" name="Day">
<input type="hidden" id="Year" name="Year">
<input type="hidden" id="Hour" name="Hour">
<input type="hidden" id="Minute" name="Minute">

<script language="JavaScript" type="text/javascript">
<!--
var d=new Date();
d.setDate(d.getDate()+5);
document.compose.Month.value = d.getMonth()+1;
document.compose.Day.value = d.getDate();
document.compose.Year.value = d.getFullYear();
document.compose.Hour.value = d.getHours();
document.compose.Minute.value = d.getMinutes();
//-->
</script>


I then used the generic agent to change the state from resolved to closed for all pending tickets in state resolved and past pending time
OTRS 2.4.7 on SUSE and on MySQL database
OTRS 3.2.10 on CentOS and MySQL database
dvmat
Znuny newbie
Posts: 5
Joined: 25 Nov 2010, 23:23
Znuny Version: 3.0.10

Re: Automaticaly close tickets [SOLVED]

Post by dvmat »

I follow your recommandations for AgentTicketPending.dtl :
<tr>
<td colspan="2" class="contentkey">$Text{"Pending date"}:</td>
<td class="contentvalue">
<script language="JavaScript" type="text/javascript">
<!--
var d=new Date();
d.setDate(d.getDate()+15);
document.compose.Year.value=d.getFullYear();
document.compose.Month.value=d.getMonth()+1;
document.compose.Day.value=d.getDate();
document.compose.Hour.value=d.getHours();
document.compose.Minute.value=d.getMinutes();
//-->
</script>
<font color="red" size="-2">$Text{"$Data{"Date invalid"}"}</font>
</td>
</tr>

I always get the error *invalid near pending date.
Did i miss something ?
Damien
OTRS 3.0.10 on Debian with MySQL
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Automaticaly close tickets [SOLVED]

Post by crythias »

why did you add this? <font color="red" size="-2">$Text{"$Data{"Date invalid"}"}</font>
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
dvmat
Znuny newbie
Posts: 5
Joined: 25 Nov 2010, 23:23
Znuny Version: 3.0.10

Re: Automaticaly close tickets

Post by dvmat »

I didn't add this.
The original code was :
<tr>
<td colspan="2" class="contentkey">$Text{"Pending date"}:</td>
<td class="contentvalue">$Data{"DateString"} <font color="red" size="-2">$Text{"$Data{"Date invalid"}"}</font></td>
</tr>
OTRS 3.0.10 on Debian with MySQL
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Automaticaly close tickets [SOLVED]

Post by crythias »

I don't have enough information to assist you.
Do you have this in as well?
<input type="hidden" id="Month" name="Month">
<input type="hidden" id="Day" name="Day">
<input type="hidden" id="Year" name="Year">
<input type="hidden" id="Hour" name="Hour">
<input type="hidden" id="Minute" name="Minute">
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
dvmat
Znuny newbie
Posts: 5
Joined: 25 Nov 2010, 23:23
Znuny Version: 3.0.10

Re: Automaticaly close tickets [SOLVED]

Post by dvmat »

Yes and NO (I've made a mistake).
Thanks a lot.
Damien.
OTRS 3.0.10 on Debian with MySQL
Locked