[Solved] Shorten and change Ticket # format
Moderator: crythias
-
- Znuny newbie
- Posts: 43
- Joined: 07 Dec 2010, 23:54
- Znuny Version: 3.0.11
- Location: Seattle, WA
- Contact:
[Solved] Shorten and change Ticket # format
I am using OTRS 3.0.3. I've looked under Sysconfig, under CORE::TICKET, to try to change the Ticket # format, but it's not what I want since I'm only given 4 options. How do I get it to be: YYMMDDnn? For example, today's date is Dec. 07, 2010. I want the ticket number format to look like: 10120701. Is there any way to customize this, or will this be out in OTRS version 5.3? I don't mind modifying the source code if someone can point me to it or tell me exactly how to do this.
Last edited by earwax on 15 Dec 2010, 23:36, edited 3 times in total.
-
- Znuny newbie
- Posts: 43
- Joined: 07 Dec 2010, 23:54
- Znuny Version: 3.0.11
- Location: Seattle, WA
- Contact:
Re: Shorten and change Ticket # format
Just wanted to post an update, and now I can see why nobody wants to reply to this since it takes some work to customize your ticket number format. It requires you to build your own OTRS module. You basically create a new file in:
Once you do this, then the new module now appears under SysConfig in the ADMIN section in OTRS under Core::Ticket. Of course, you need to configure it to the ticket number format you want. What I did was copy /opt/otrs/Kernel/System/Ticket/Number/Date.pm to /opt/otrs/Kernel/System/Ticket/Number/ShorterDate.pm and started tweaking the ShorterDate.pm file to get the format I want. Below is what the DIFF shows from the default /opt/otrs/Kernel/System/Ticket/Number/Date.pm and my /opt/otrs/Kernel/System/Ticket/Number/ShorterDate.pm
Now that this is done, you must go into the Sysconfig in the ADMIN section and look under Core::Ticket. Change Ticket::NumberGenerator::CheckSystemID to NO. If you leave this as YES, and you have used OTRS already, then tickets will not properly be automatically merged, even though the ticket # is the same.
The technical documention is here for OTRS 3:
http://doc.otrs.org/developer/3.0/en/ht ... tml#AEN657
Look specifically for section: 2.2.1.1.12. Ticket Number Generator Modules
Code: Select all
/opt/otrs/Kernel/System/Ticket/Number/YourNewModule.pm
Code: Select all
< package Kernel::System::Ticket::Number::Date;
---
> package Kernel::System::Ticket::Number::ShorterDate;
< my $Tn = $Year . $Month . $Day . $SystemID . $Count;
---
> #Our chosen modified format - (YYn)
> my $Tn = substr($Year,2) . $Count;'
< if ( $String =~ /\Q$TicketHook$TicketHookDivider\E(\d{4,10}$SystemID\d{1,40})/i ) {
---
# Remove the SystemID check since we're not using it in the format we want (YYn)
> if ( $String =~ /\Q$TicketHook$TicketHookDivider\E(\d{1,40})/i ) {
The technical documention is here for OTRS 3:
http://doc.otrs.org/developer/3.0/en/ht ... tml#AEN657
Look specifically for section: 2.2.1.1.12. Ticket Number Generator Modules
OTRS 3.0.12
Ubuntu Linux 10.04
MySQL
Ubuntu Linux 10.04
MySQL