FreeText Field wrong display in Ticket Information

Moderator: crythias

Locked
IcarusNM
Znuny newbie
Posts: 21
Joined: 11 Jan 2012, 04:13
Znuny Version: 3.0.9
Real Name: Paul Caskey
Company: Interface Systems

FreeText Field wrong display in Ticket Information

Post by IcarusNM »

I have set up the FreeText1 field to be called "Visibility" with the same kind of 1-5 scale as Priority and elsewhere. I did this all in SysConfig. Here is how it ends up in ZZZAuto.pm.

Code: Select all

$Self->{'TicketFreeText1::DefaultSelection'} =  '3 normal';
$Self->{'TicketFreeText1'} =  {
  ''  => '-',
  '1' => '1 very low',
  '2' => '2 low',
  '3' => '3 normal',
  '4' => '4 high',
  '5' => '5 very high'
};
$Self->{'TicketFreeKey1'} =  {
  'Visibility' => 'Visibility'
};
This works great, but on the right hand Ticket Information pane when viewing the ticket, I would expect this:

Code: Select all

...
    CustomerID: tester@blah.com
Accounted time: 0.5
    Visibility: 3 normal 
Instead I see this:

Code: Select all

...
    CustomerID: tester@blah.com
Accounted time: 0.5
             3: 3 normal 
Help?
OTRS v3.0.9.
IcarusNM
Znuny newbie
Posts: 21
Joined: 11 Jan 2012, 04:13
Znuny Version: 3.0.9
Real Name: Paul Caskey
Company: Interface Systems

Re: FreeText Field wrong display in Ticket Information

Post by IcarusNM »

The plot thickens. If I set this FreeText1 value in a Ticket properties window (like ITSM Additional Fields where I've activated it) to the pull-down option '3 normal' then the Ticket Information display shows this, which is not what I want:

Code: Select all

Visibility: 3

However, if this FreeText1 value gets set on a new incoming ticket by the TicketFreeFieldDefault Event I have set on TicketCreate, then the Ticket Information display shows this, also not what I want, and if I then open a properties window, the value is not set.

Code: Select all

3: 3 normal
Here's that TicketCreate event:

Code: Select all

$Self->{'Ticket::TicketFreeFieldDefault'}->{'Element1'} =  {
  'Counter' => '1',
  'Event' => 'TicketCreate',
  'Key' => '3',
  'Value' => '3 normal'
};
Here's what I want to see, along with sane behavior when I edit the ticket properties.
I don't ever really want to just see '3'. That should be an internal Key only. Right?

Code: Select all

Visibility: 3 normal
In the database I can see the corresponding values which are being displayed:

Code: Select all

                freekey1: 3
               freetext1: 3 normal
Or:

Code: Select all

                freekey1: Visibility
               freetext1: 3
I'll start twiddling with these settings, but I suspect there's no winning combination. If anyone has this working, I'd love to see their code.
IcarusNM
Znuny newbie
Posts: 21
Joined: 11 Jan 2012, 04:13
Znuny Version: 3.0.9
Real Name: Paul Caskey
Company: Interface Systems

Re: FreeText Field wrong display in Ticket Information

Post by IcarusNM »

Here is the magic solution. I consider this a bug, although I don't expect it to get fixed. You can't use Keys like 1,2,3, even though that is done for Priority as well as TicketFreeText15 in ITSM. You must use Keys and Values that are the same in order for things to work right. This is like TicketFreeText16 in ITSM.

Code: Select all

$Self->{'TicketFreeText1::DefaultSelection'} =  '3 normal';
$Self->{'TicketFreeText1'} =  {
  '' => '-',
  '1 very low' => '1 very low',
  '2 low' => '2 low',
  '3 normal' => '3 normal',
  '4 high' => '4 high',
  '5 very high' => '5 very high'
};
$Self->{'TicketFreeKey1'} =  {
  'Visibility' => 'Visibility'
};
Then set up TicketFreeFieldDefault as follows, again through SysConfig, but this is the end result.

Code: Select all

$Self->{'Ticket::TicketFreeFieldDefault'}->{'Element1'} =  {
  'Counter' => '1',
  'Event' => 'TicketCreate',
  'Key' => 'Visibility',
  'Value' => '3 normal'
};
$Self->{'Ticket::EventModulePost'}->{'TicketFreeFieldDefault'} =  {
  'Module' => 'Kernel::System::Ticket::Event::TicketFreeFieldDefault',
  'Transaction' => '1'
};
This is necessary because OTRS is inconsistent of when it displays a Key versus a Value in this context. If you make them both the same, then it doesn't matter. Sloppy but works. If anyone has contrary evidence, I'm all ears.
Locked