[SOLVED] Add customer company country to ticket zoom

Moderator: crythias

Locked
HervE
Znuny wizard
Posts: 391
Joined: 03 Jan 2011, 17:15
Znuny Version: 3.3.8
Location: France

[SOLVED] Add customer company country to ticket zoom

Post by HervE »

Hi,

How can I add the country of the customer company to the right side of the ticket zoom view?

I have checked in AgentTicketZoom.dtl, and I was about to add something like $Data{"CustomerCompanyCountry"}, but I doubt the customer company (and therefore its properties) is linked and present in $Data. Right? How could I include it then?

Alternatively, a solution could be to mass fill in the Country field of Customer User (which is currently empty) with the Country field of the Customer Company it belongs to. But I don't know how to do it either.

Can anybody help?

(By the way, I don't know why there is a list of available countries for Customer Company, but not for Customer User!?)

Regards,
HervE
Last edited by HervE on 20 Jan 2011, 17:22, edited 1 time in total.
OTRS 3.3.8 - Windows 7 - IIS7 - SQL Server - Firefox 30
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Add customer company country to ticket zoom

Post by crythias »

Customer User doesn't have country because it's not in Config.pm Map.
Are you using LDAP/AD or database?
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
HervE
Znuny wizard
Posts: 391
Joined: 03 Jan 2011, 17:15
Znuny Version: 3.3.8
Location: France

Re: Add customer company country to ticket zoom

Post by HervE »

Thanks for your answer.

No, I don't use any LDAP nor AD.

HervE
OTRS 3.3.8 - Windows 7 - IIS7 - SQL Server - Firefox 30
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Add customer company country to ticket zoom

Post by crythias »

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
HervE
Znuny wizard
Posts: 391
Joined: 03 Jan 2011, 17:15
Znuny Version: 3.3.8
Location: France

Re: Add customer company country to ticket zoom

Post by HervE »

1. I copied the CustomerUser block from Config\Defaults.pm into Config.pm, and added the default selection for the UserCountry field. In this way, agents cannot key anything in this field but only a country from the given list. Good.

2. This doesn't solve my initial problem. If I add <td>$Quote{"$Data{"CustomerCompanyCountry"}","18"}</td> in AgentTicketZoom.dtl, there is no data inisde, because I guess fields of CustomerCompany are not retrieved into $Data, unlike those of Ticket and CustomerUser, for instance.
What I want to do is make a joint between CustomerCompany and CustomerUser on CustomerID.
Is it possible? How?

(Understand me: I don't want to add a brand new field to CustomerUser.)

Regards,
HervE
OTRS 3.3.8 - Windows 7 - IIS7 - SQL Server - Firefox 30
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Add customer company country to ticket zoom

Post by crythias »

the country field already exists in the database, and in Defaults.pm so I made an error in suggesting it wasn't there.

UserCountry should work if the field is used in the User.

a sql query (should be one line) Backup! Test first!:

Code: Select all

UPDATE customer_user SET customer_user.country=customer_company.country WHERE customer_user.customer_id=customer_company.customer_id;
I haven't tried the above code. It should work, but no guarantees.
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
HervE
Znuny wizard
Posts: 391
Joined: 03 Jan 2011, 17:15
Znuny Version: 3.3.8
Location: France

Re: Add customer company country to ticket zoom

Post by HervE »

The simpler, the better.
This was the mass update of the customer country that I spoke of as an alternative.
Works fine. Thanks.

By the way, SQL code is:

Code: Select all

UPDATE customer_user, customer_company SET customer_user.country=customer_company.country WHERE customer_user.customer_id=customer_company.customer_id;
Regards,
HervE
OTRS 3.3.8 - Windows 7 - IIS7 - SQL Server - Firefox 30
HervE
Znuny wizard
Posts: 391
Joined: 03 Jan 2011, 17:15
Znuny Version: 3.3.8
Location: France

Re: [SOLVED] Add customer company country to ticket zoom

Post by HervE »

Interesting too: I found out the following feature:

Code: Select all

#        # use customer company support (reference to company, See CustomerCompany settings)
        CustomerCompanySupport => 1,
within a $Self->{CustomerUser} block that has to be copied from Default.pm into Config.pm.

This option seems to make the joint that I was looking for, between CustomerUser and CustomerCompany on CustomerID.
When you do that, CustomerCompany properties (including Country) are displayed in the right panel of ticket zoom. Exactly what I was looking for!

Also, at the creation of a CustomerUser, it prevents to enter a misspelled CustomerID.
The drawback is you cannot create your CustomerUser before your CustomerCompany, but that's OK for me.

Another advantage: it automatically adds the Company icon in the navigation bar, right after the Customer icon.

Hope that helps.

HervE
OTRS 3.3.8 - Windows 7 - IIS7 - SQL Server - Firefox 30
Locked