Skip to content

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

Open
jsinagowitz wants to merge 1 commit intoznuny:devfrom
SectorNordAG:EmptyDynamicFieldWidget
Open

Sector Nord AG: Bugfix: Hide empty dynamic info/dynamic field box#550
jsinagowitz wants to merge 1 commit intoznuny:devfrom
SectorNordAG:EmptyDynamicFieldWidget

Conversation

@jsinagowitz
Copy link
Copy Markdown
Contributor

@jsinagowitz jsinagowitz commented Mar 27, 2024

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

  • '1 - 🐞 bug 🐞'

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

  • The code change is tested and works locally.(❗)
  • There is no commented out code in this PR.(❕)
  • You improved or added new unit tests.(❕)
  • Local ZnunyCodePolicy passed.(❕)
  • Local UnitTests / Selenium passed.(❕)
  • GitHub workflow CI (UnitTests / Selenium) passed.(❗)

@jsinagowitz jsinagowitz changed the title Bugfix: Hide empty dynamic info/dynamic field box Sector Nord AG: Bugfix: Hide empty dynamic info/dynamic field box Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant