SortReverse parameter on SLA drop down

Moderator: crythias

Post Reply
estomagado
Znuny newbie
Posts: 44
Joined: 20 Sep 2019, 16:24
Znuny Version: 6.0.36
Real Name: Henrique Ulbrich
Company: Design for Context

SortReverse parameter on SLA drop down

Post by estomagado »

Hello everyone!

This may be interesting. If there is a solution it will save me some work hours, if there is not, I (and perhaps some others) would have learned something.

Sorry for the long post. What I want to ask is pretty simple, but the context in which it will be used requires a bit of explanation...

I am toying with the

Code: Select all

PossibleNone => 0,
variable, so an SLA is chosen automatically when tickets are created.

I saw it in many places, including this 2011 topic (as always, excellent explanations from @crythias) :
viewtopic.php?t=7286
It worked like a charm!

Apart from some special SLAs, the names of my SLA objects follow a simple naming convention:
SLA-02-04 (2h first response, 4h solution)
SLA-16-80 (16h first response, 80h solution) and so on.

Problem (for me) is, SLAs are listed in Alphabetical order. I named them (before knowing it would be a problem) in a way that the most tight ones (i.e. SLAs with a short response time) are listed first.

So, on a service with 3 associated SLAs of (say) 16 hours, 8 hours and 2 hours, my "default" SLA would be 2 hours, not 16 hours. I want the other way round.

Of course I could create another naming scheme and rename all of them, applying some sort of index to the object's name. Unfortunately, I have quite a lot of them, because my agreements with the internal clients produced many different SLAs in my IT Services Catalog. It would be time-consuming and would require further adjustments in the future if the list of SLAs changed somehow.

However, I discovered that, if my SLAs are sorted in Reverse Alphabetical Order, due to the naming scheme I would end up with the correct "default" SLA when opening a ticket. So I did my homework before asking and stumbled upon SortReverse here: https://doc.otrs.com/doc/api/otrs/6.0/P ... ut.pm.html

The thing is: I tested it on SLAStrg (in CustomerTicketMessage.pm) and it didn't work. Here's the code, the only added line is SortReverse, PossibleNone => 0 is set to zero, the other values are the defaults:

Code: Select all

 $Param{SLAStrg} = $LayoutObject->BuildSelection(
                Data       => \%SLA,
                Name       => 'SLAID',
                SelectedID => $Param{SLAID},
                Class      => 'Modernize '
                    . ( $Config->{SLAMandatory} ? 'Validate_Required ' : '' )
                    . ( $Param{Errors}->{SLAInvalid} || '' ),
                PossibleNone => 0,
                Sort         => 'AlphanumericValue',
                SortReverse  => 1,
                Translation  => 0,
                Max          => 200,
            );
No candy for me. What am I doing wrong?

Any help would be greatly appreciated! Thank you!
(Please excuse the eventual "engrish", it's not my first language...)
--
Your pal
Estomagado

Znuny 6.0.36 Vanilla (no add-ons installed, no fancy customization)
MySQL BD backend for external customer users
LDAP (AD) backend for internal customer users & agents
estomagado
Znuny newbie
Posts: 44
Joined: 20 Sep 2019, 16:24
Znuny Version: 6.0.36
Real Name: Henrique Ulbrich
Company: Design for Context

Re: SortReverse parameter on SLA drop down

Post by estomagado »

Any ideas?

I was reviewing the manual and this should work. Why is not working?
--
Your pal
Estomagado

Znuny 6.0.36 Vanilla (no add-ons installed, no fancy customization)
MySQL BD backend for external customer users
LDAP (AD) backend for internal customer users & agents
Post Reply