znuny / Znuny

Znuny/Znuny LTS is a fork of the ((OTRS)) Community Edition, one of the most flexible web-based ticketing systems used for Customer Service, Help Desk, IT Service Management.
https://www.znuny.org
GNU General Public License v3.0
335 stars 82 forks source link

Bug - List of snippets seems unsorted for agents #473

Closed sprengerdaniel closed 11 months ago

sprengerdaniel commented 11 months ago

Environment

Expected behaviour

This is not directly a bug, but more like an improvement. If you want to use a snippet and type ## in rich text editor, you get a list of available snippets. From the point of view of the agent this is unsorted. In source code, you see it is sorted by id but the agent does not see the id (he also is not interested in it). From the point of view of the agent it would be better to sort the snippets by name, because the name is also changeable (leading_numbers for example).

Actual behaviour

If you want to use a snippet and type ## in rich text editor, you get a list of available snippets. From the point of view of the agent this is unsorted. In source code, you see it is sorted by id but the agent does not see the id (he also is not interested in it).

How to reproduce

Steps to reproduce the behavior:

  1. Create three snippets with the same beginning: Anrede Prof. + Anrede allgemein + Anrede Dr. and assign them to a queue
  2. Open answer, note etc. in a ticket in the above queue
  3. Go to rich text field
  4. Type ##anr
  5. See the "unsorted" list

Additional information

Change the sorting in Kernel/System/Autocompletion/Template.pm, about line 117 to

for my $StandardTemplateID (
    sort { lc $StandardTemplates{$a} cmp lc $StandardTemplates{$b} || $a cmp $b }
    keys %StandardTemplates
) {

(Did it on my testsystem. No issues so far but also no bulletproofed tests 😉)

Screenshots

dennykorsukewitz commented 11 months ago

internal issue: 701

dennykorsukewitz commented 11 months ago

Hi @sprengerdaniel,

Thanks for the issue.

In my opinion, your fix is fine.

rel-6_5: https://github.com/znuny/Znuny/commit/3a4f5ba9e7640d13ebda4bcb0f7e1c441409d7b0 rel-7_0: https://github.com/znuny/Znuny/commit/eca392025b2681122164ca28dfd4c0662dcc2be9

🚀