Creating search template for all agents

Moderator: crythias

Locked
asima
Znuny newbie
Posts: 15
Joined: 02 Aug 2010, 14:11
Znuny Version: 3.0.11

Creating search template for all agents

Post by asima »

Hi

Is there a way to create a search template that can be seen by all agents?

Thanks
OTRS 3.0.4 on Linux with MySQL database connected to an Active Directory for Agents
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Creating search template for all agents

Post by crythias »

Unfortunately, it doesn't look like you would be able to do that natively via code. Kernel/System/SearchProfile.pm stores search criteria specifically via login.

There are about 3 ways to work around this:
1) The nicest way would be include a checkbox that says, "This is a public search", that extends the search_profile schema by adding a "public" 1/0 column and the code in SearchProfile.pm changed to say "OR public=1" (This doesn't protect you from duplicate profile_names.)

2) The second way is to remove the WHERE clauses in SearchProfile.pm related to LOWER(login) = LOWER('$Login'). This is the quickest, easiest, dirtiest way to do it, but it makes ALL queries public (and there is the problem of duplicate profile_names).

3) The third option is not fun, not recommended, ... it could break things, and won't be there when you add users, but if you're game enough, here it is, but don't do it.:
Essentially, populate the search_profile table with the users that need a specific search or searches.
SELECT * FROM search_profile where login='TicketSearch::usernameofthepersonwhocreatedthepublicsearch' and profile_name='publicsearchstoredname';

Now use a global search/replace for the new username and then import the records back in.
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
Blang
Znuny newbie
Posts: 10
Joined: 06 Sep 2010, 12:12
Znuny Version: 3.1.x

Re: Creating search template for all agents

Post by Blang »

I have created a template-User to solve this problem. Every user uses his own searchprofiles AND the template profiles.
If you need a new template-searchprofile for every user, you simply have to login in with the template-User and save
a new search-profile. Users can't change the template-profiles because they are not the owner.

I've attached the patchfile for SearchProfile.pm with the necessary modifications.
You do not have the required permissions to view the files attached to this post.
"Produktiv": OTRS: 3.1.x
OS: SUSE Linux Enterprise Server 11
Apache2/MySQL 5.5
aaronflying
Znuny newbie
Posts: 2
Joined: 05 Aug 2014, 09:21
Znuny Version: 3.3.8

Re: Creating search template for all agents

Post by aaronflying »

Hi crythias,

I am implementing a new feature for our team, we are using otrs 3.3.8 on Centos Linux 6.5, Apache 2.2.15.

I am trying your first work around, add a new check box and store that flag into db. But I could not pass the check box variable to the back end.

The following is what I have tried:

1. add a new check box into otrs/Kernel/Output/HTML/Standard/AgentTicketSearch.dtl

2. try to get the value of the variable from otrs/Kernel/Modules/AgentTicketSearch.pm, but seems to be failed.

3. try to get the value from otrs/Kernel/System/SearchProfile.pm, failed again.

I am pretty new to the framework, and have gone through the basic docos, but didn't find anything helpful. Can you please advise what steps should I follow to get it done?

Thank you!
crythias wrote:Unfortunately, it doesn't look like you would be able to do that natively via code. Kernel/System/SearchProfile.pm stores search criteria specifically via login.

There are about 3 ways to work around this:
1) The nicest way would be include a checkbox that says, "This is a public search", that extends the search_profile schema by adding a "public" 1/0 column and the code in SearchProfile.pm changed to say "OR public=1" (This doesn't protect you from duplicate profile_names.)

2) The second way is to remove the WHERE clauses in SearchProfile.pm related to LOWER(login) = LOWER('$Login'). This is the quickest, easiest, dirtiest way to do it, but it makes ALL queries public (and there is the problem of duplicate profile_names).

3) The third option is not fun, not recommended, ... it could break things, and won't be there when you add users, but if you're game enough, here it is, but don't do it.:
Essentially, populate the search_profile table with the users that need a specific search or searches.
SELECT * FROM search_profile where login='TicketSearch::usernameofthepersonwhocreatedthepublicsearch' and profile_name='publicsearchstoredname';

Now use a global search/replace for the new username and then import the records back in.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Creating search template for all agents

Post by crythias »

This is a 4 year old post. It has no real possibility of applying to current versions of OTRS. Please create a new 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
Locked