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
332 stars 82 forks source link

Sector Nord AG: Bugfix: Hide empty dynamic info/dynamic field box #550

Open jsinagowitz opened 3 months ago

jsinagowitz commented 3 months ago

Proposed change

In some cases the widget "Dynamic Fields" or "Dynamic Info" are shown empty.

image

I have found two causes for the problem. Both problems should be solved by my change.

  1. The variable in the code [% IF !TicketFrontendConfig.DynamicField.empty %] is not always empty. If you configure a dynamic field in a screen as deactivated, it will occure in the variable TicketFrontendConfig.DynamicField.

image

  1. The method empty() in the code [% IF !TicketFrontendConfig.DynamicField.empty %] does not return the correct value in older versions of template toolkit.

On CentOS 7, perl v5.16.3, Template Toolkit 2.24, the method TicketFrontendConfig.DynamicField.empty returns "".

On Oracle 9.3, perl v5.32.1, Template Toolkit 3.009, under the same circumstances, the method returns "1".

I tested the following code in AgentTicketPhone.tt on both systems:

[% USE Dumper %]
[% Dumper.dump(TicketFrontendConfig.DynamicField) %]
[% Dumper.dump(TicketFrontendConfig.DynamicField.empty) %]
[% Dumper.dump(Data.DynamicFieldHTML.list.size) %]   # my suggestion

Output Template Toolkit 2.24:

$VAR1 = {}; 
$VAR1 = '';    # wrong
$VAR1 = 0;    # my suggestion

Output Template Toolkit 3.009:

$VAR1 = {}; 
$VAR1 = 1;    # correct
$VAR1 = 0;    # my suggestion

Type of change

Additional information

I also removed the condition from AgentTicketActionCommon.tt and AgentTicketNoteToLinkedTicket.tt because the dynamic fields are added to these masks through the RenderBlock methods.

I did my best to test all different masks on both systems with activated, disabled and not selected dynamic fields.

Checklist