Customer history filtered by CustomerID

Moderator: crythias

Post Reply
gs71
Znuny newbie
Posts: 17
Joined: 26 Jan 2011, 12:57
Znuny Version: 3.0.8

Customer history filtered by CustomerID

Post by gs71 »

Hi,
I am using OTRS v3.0.8 configured so that Customers (LDAP-based) can view all other tickets under "Company tickets".
It is done by using a LDAP field, common to every customer, mapped to CustomerID.

Everything works: my only problem is that the Customer History (shown in AgentTicketCustomer, or in AgentTicketPhone after selecting a customer) seems filtered by CustomerID, and not by CustomerUserID.
So for any customer, in his history I get the full list of company tickets, which is slow, and quite useless.

How can I fix this? Is there a SysConfig setting somewhere or should I hack the code?

Thanks for your help.
gs71
Znuny newbie
Posts: 17
Joined: 26 Jan 2011, 12:57
Znuny Version: 3.0.8

Re: Customer history filtered by CustomerID

Post by gs71 »

I solved my problem by digging into the code and applying the following patch to /opt/otrs/Kernel/Output/HTML/CustomerUserGenericTicket.pm:

=========================================================================================
130c130
< $URL .= ';CustomerID=' . $Self->{LayoutObject}->LinkEncode( $Param{Data}->{UserCustomerID} );
---
> $URL .= ';CustomerUserLogin=' . $Self->{LayoutObject}->LinkEncode( $Param{Data}->{UserLogin} );
146c146
< CustomerID => $Param{Data}->{UserCustomerID},
---
> CustomerUserLogin => $Param{Data}->{UserLogin},
=========================================================================================

Now the customer history correctly shows the history of the customer, and not of all the customers sharing the same CustomerID.

Should I file this as a bug?
smsearcy
Znuny newbie
Posts: 1
Joined: 21 Jul 2011, 01:11
Znuny Version: 3.0
Real Name: Scott
Company: Rogue Federal Credit Union

Re: Customer history filtered by CustomerID

Post by smsearcy »

Thank you for posting, I was looking for a way to do that. I'm not sure it should be the default behavior, but I think it would be nice if it didn't require editing the source.

However, while that did fix the Open Ticket count under customer information when creating a new ticket, it didn't change the Customer History at the bottom of the page on my installation. All "company" tickets still show up in that list. I made the changes to a copy of the file in the Custom folder, then restarted the web server and OTRS daemons. Were there any other changes you made?

Thank you
renee
Znuny expert
Posts: 241
Joined: 06 Feb 2009, 11:15
Znuny Version: 3.0.x
Company: Perl-Services.de
Contact:

Re: Customer history filtered by CustomerID

Post by renee »

This would be great: Make it configurable (via SysConfig), create a package and upload it to OPAR (http://opar.perl-services.de) ;-)
Need a Perl/OTRS developer? You can contact me at info@perl-services.de
gs71
Znuny newbie
Posts: 17
Joined: 26 Jan 2011, 12:57
Znuny Version: 3.0.8

Re: Customer history filtered by CustomerID

Post by gs71 »

smsearcy wrote:Thank you for posting, I was looking for a way to do that. I'm not sure it should be the default behavior, but I think it would be nice if it didn't require editing the source.

However, while that did fix the Open Ticket count under customer information when creating a new ticket, it didn't change the Customer History at the bottom of the page on my installation. All "company" tickets still show up in that list. I made the changes to a copy of the file in the Custom folder, then restarted the web server and OTRS daemons. Were there any other changes you made?

Thank you
Actually I spent a lot of time looking for a solution: in the end I gave up and completely disabled the Customer History (Ticket::Frontend::ShowCustomerTickets).

It's a pity because it could be useful to see the actual customer's tickets, and not the full ticket list instead.

The current implementation of the Customer History (when UserCustomerID is used) is definitely buggy IMHO. Should we file this as a bug?
bahavar
Znuny newbie
Posts: 11
Joined: 14 Mar 2011, 15:49
Znuny Version: 3.0.4

Re: Customer history filtered by CustomerID

Post by bahavar »

Hi,
i recently came across the same issue and found another solution which fixes both problems.
in Kernel/Modules/AgentCustomerSearch.pm
around line 157
inside @ViewableTickets = $Self->{TicketObject}->TicketSearch(
add the following line:

CustomerUserLogin => $CustomerUserID,

you'r file should now look like this:
@ViewableTickets = $Self->{TicketObject}->TicketSearch(
Result => 'ARRAY',
Limit => 250,
SortBy => [$SortBy],
OrderBy => [$OrderBy],
CustomerID => \@CustomerIDs,
CustomerUserLogin => $CustomerUserID,
UserID => $Self->{UserID},
Permission => 'ro',
);
it fixes customer history results

hope this helps :)
gs71
Znuny newbie
Posts: 17
Joined: 26 Jan 2011, 12:57
Znuny Version: 3.0.8

Re: Customer history filtered by CustomerID

Post by gs71 »

bahavar wrote:Hi,
i recently came across the same issue and found another solution which fixes both problems.
in Kernel/Modules/AgentCustomerSearch.pm
around line 157
inside @ViewableTickets = $Self->{TicketObject}->TicketSearch(
add the following line:

CustomerUserLogin => $CustomerUserID,

hope this helps :)
It definitely helps: with your simple solution the bug is actually fixed now. Thanks!
Post Reply