How to add new field in stats report

Moderator: crythias

Locked
lelikflegma
Znuny newbie
Posts: 18
Joined: 24 Feb 2012, 18:53
Znuny Version: OTRS3011

How to add new field in stats report

Post by lelikflegma »

Hi.
When we creating new statistic report, we have some parameters in multiselect menu "Attributes to be printed".
One of parameters is "Customer User", which contains login of the customer.
How can I add new parameter: Email address of this customer?
For example, I want make report for closed tikets for some period and I want to have CSV file with 3 columns:
ticket#;Customer User;Customer User Email

Maybe solution is to make changes in some .pm file which do report, like: if is set parameter Customer User Email, make select on DB from table customer_user where login=Customer User ? In this case, in which file I should make changes?
lelikflegma
Znuny newbie
Posts: 18
Joined: 24 Feb 2012, 18:53
Znuny Version: OTRS3011

Re: How to add new field in stats report

Post by lelikflegma »

I found solution:

###################################################################################################
/opt/otrs/Kernel/System/Stats/Dynamic/TicketList.pm

line 867 add after "#TicketID => 'TicketID',"
Email => 'Customer Email',

line 997 add after "TicketNumber"
Email

line 1100 add after "CustomerID => 'CustomerID',"
Email => 'Customer Email',


###################################################################################################
/opt/otrs/Kernel/System/Ticket.pm

from line 1039:
before:
. ' st.escalation_solution_time, st.escalation_time, st.archive_flag'
. ' FROM ticket_priority sp, queue sq, ticket st'
. ' WHERE sp.id = st.ticket_priority_id AND sq.id = st.queue_id AND st.id = ?',
after:
. ' st.escalation_solution_time, st.escalation_time, st.archive_flag,'
. ' cu.email'
. ' FROM ticket_priority sp, queue sq, ticket st'
. ' LEFT JOIN customer_user cu ON st.customer_user_id=cu.login'
. ' WHERE sp.id = st.ticket_priority_id AND sq.id = st.queue_id AND st.id = ?',

line 1117 add after " $Ticket{TicketFreeTime6} = defined $Row[53] ? $Row[53] : '';"
$Ticket{Email} = $Row[65];
Locked