Hello, developers, i would like to pick some data from my otrs DB and display it in my reports i.e display the value as an attribute in stats.
example;
1st- lets say i've altered my otrs database and added a column 'X' to the existing table 'ticket',
2ndly - lets say i want to add a field (MyField) under the "Attributes to be printed:" section in stats such that when selected, the value of X is printed under a column "MyField" in the resulting CSV or PDF or whatever format is available.
Where and how would i have to include the sql statement to pick the value, How would i go about displaying the attribute so that it can be selected and how would i ensure that it is included in the resulting print (csv, pdf etc)?
Please break it down step by step to the simplest bits cause I'm really, really really , reeeeeally ... new to perl and OTRS (however i am not new to programing).
any help with this otrs hack would be greatly appreciated!!!!! cheers.
Add Custom attribute in stat [SOLVED]
-
- Znuny newbie
- Posts: 33
- Joined: 23 Oct 2012, 16:36
- Znuny Version: 3.1.6
- Real Name: patrick
- Company: muk
Add Custom attribute in stat [SOLVED]
Last edited by pluwum on 01 Mar 2013, 08:17, edited 1 time in total.
-
- Znuny newbie
- Posts: 33
- Joined: 23 Oct 2012, 16:36
- Znuny Version: 3.1.6
- Real Name: patrick
- Company: muk
Re: Add Custom attribute in stat
anyone there????????!!!!
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Add Custom attribute in stat
Look at Kernel/System/Ticket.pm
look at
sub TicketGet
look for a SQL statement
modify it by appending your field(s) after st.change_by
look below there.
add a line (perhaps after $Ticket{ChangeBy})
like
$Ticket{MyField} = $Row[26];
(if that makes sense).
You have now enabled your field to be obtained from TicketGet.
You also need to add this to
Kernel/System/Stats/Dynamic/TicketList.pm
sub _TicketAttributes
MyField => 'MyField',
look at
sub TicketGet
look for a SQL statement
modify it by appending your field(s) after st.change_by
look below there.
add a line (perhaps after $Ticket{ChangeBy})
like
$Ticket{MyField} = $Row[26];
(if that makes sense).
You have now enabled your field to be obtained from TicketGet.
You also need to add this to
Kernel/System/Stats/Dynamic/TicketList.pm
sub _TicketAttributes
MyField => 'MyField',
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
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
-
- Znuny newbie
- Posts: 33
- Joined: 23 Oct 2012, 16:36
- Znuny Version: 3.1.6
- Real Name: patrick
- Company: muk
Re: Add Custom attribute in stat
Thanks soo much. It works.
crythias wrote:Look at Kernel/System/Ticket.pm
look at
sub TicketGet
look for a SQL statement
modify it by appending your field(s) after st.change_by
look below there.
add a line (perhaps after $Ticket{ChangeBy})
like
$Ticket{MyField} = $Row[26];
(if that makes sense).
You have now enabled your field to be obtained from TicketGet.
You also need to add this to
Kernel/System/Stats/Dynamic/TicketList.pm
sub _TicketAttributes
MyField => 'MyField',
-
- Znuny newbie
- Posts: 33
- Joined: 23 Oct 2012, 16:36
- Znuny Version: 3.1.6
- Real Name: patrick
- Company: muk
Re: Add Custom attribute in stat [SOLVED]
ooh and i had to add the 'MyField' under the sub _SortedAttributes section in Kernel/System/Stats/Dynamic/TicketList.pm before it showed up on the csv
-
- Znuny newbie
- Posts: 2
- Joined: 21 Jun 2018, 22:48
- Znuny Version: 6.0.7
Re: Add Custom attribute in stat
Hi, i am using OTRS 6.0.7 with Apache/2.4.6 and i couldn't find the "sub TicketGet" in Kernel/System/Ticket.pm and "sub _TicketAttributes" in Kernel/System/Stats/Dynamic/TicketList.pm.crythias wrote: ↑28 Feb 2013, 02:14 Look at Kernel/System/Ticket.pm
look at
sub TicketGet
look for a SQL statement
modify it by appending your field(s) after st.change_by
look below there.
add a line (perhaps after $Ticket{ChangeBy})
like
$Ticket{MyField} = $Row[26];
(if that makes sense).
You have now enabled your field to be obtained from TicketGet.
You also need to add this to
Kernel/System/Stats/Dynamic/TicketList.pm
sub _TicketAttributes
MyField => 'MyField',
As i have similar requirement to add new Attribute Column in Statistics, using new Row created on Database table "ticket_state_type" with value "Resolved" and created new State "Restored" using State type.
Now, i would like keep the column with State Type "Resolved", in Statistics and want to keep Timestamp of Tickets updated with State Type "Resolved" on Statistics.
Please help me.
Regards,
Chaitanya.
Chaitanya.
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Add Custom attribute in stat [SOLVED]
Please don't resurrect old topics. Rather, create a new one and link back to this one.
https://github.com/OTRS/otrs/blob/40dab ... t.pm#L1180
https://github.com/OTRS/otrs/blob/40dab ... t.pm#L1629
Your request is sufficiently different from this topic.
https://github.com/OTRS/otrs/blob/40dab ... t.pm#L1180
https://github.com/OTRS/otrs/blob/40dab ... t.pm#L1629
Your request is sufficiently different from this topic.
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
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
-
- Moderator
- Posts: 10169
- Joined: 04 May 2010, 18:38
- Znuny Version: 5.0.x
- Location: SouthWest Florida, USA
- Contact:
Re: Add Custom attribute in stat [SOLVED]
Please don't resurrect old topics. Rather, create a new one and link back to this one.
https://github.com/OTRS/otrs/blob/40dab ... t.pm#L1180
https://github.com/OTRS/otrs/blob/40dab ... t.pm#L1629
Your request is sufficiently different from this topic.
https://github.com/OTRS/otrs/blob/40dab ... t.pm#L1180
https://github.com/OTRS/otrs/blob/40dab ... t.pm#L1629
Your request is sufficiently different from this topic.
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
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