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
388 stars 89 forks source link

Bug - Dynamic field is not displayed propertly in Dashboard if set in 1st position and metaitems are disabled #593

Open BuilderNSV opened 2 months ago

BuilderNSV commented 2 months ago

Environment

Expected behavior

If metainformation is disabled and dashboard's widget is configured to display dynamic field as 1st column, dynamic field's values should be displayed correctly.

Actual behavior

If metainformation is disabled and dashboard's widget is configured to display dynamic field as 1st column, Dynamic field's name is displayed as column name but all values from next columns are shifted to on 1 column left. Dynamic field's values are not displayed.

How to reproduce

Steps to reproduce the behavior:

  1. Create a ticket related dynamic field .
  2. Create one or more tickets with filled dynamic field.
  3. Configure, as example, 'Open Tickets' dashboard widget to display dynamic field in 1st column
  4. See on the 'Open Tickets' widget that values of dynamic field are displayed correctly (see 'Correct view' in screenshots)
  5. Go to Kernel/Output/HTML/Layout/Ticket.pm and change code so that TicketMetaItemsCount() and TicketMetaItems() functions return (). (empty array)
  6. See on the 'Open Tickets' widget that values of dynamic field are displayed incorrectly - all values from next columns are shifted left (see 'Incorrect view' in screenshots).

Screenshots

Correct view correct Incorrect view incorrect

hanneshal commented 2 months ago

Hi @BuilderNSV

the reason for that is, that the render blocks are still triggered. No Dashboard/TicketGeneric widget is able to do this by default. You need to modify code, and I think we can agree here, if you get errors / wrong behaviour after you made modifications to the code, it is not really a bug ;)

The template blocks (th and td) for this specific meta information are rendered and with your change you just reduced the data sent to the template.

This is not a bug in the framework. As long as ContentLargeTicketGenericHeaderMeta is rendered in the template, this will happen.

if you need a specific widget stlye, I suggest you create your own template for the widget and use the custom folder to deploy it.

Regards Johannes

BuilderNSV commented 2 months ago

Hi @hanneshal,

Thanks for detailed answer I have missed dependence from metainfo in template.

Best wishes, Sergey

BuilderNSV commented 2 months ago

@hanneshal,

It's me again. Please let me don't agree with you about template specific problem on my side. I've analyzed problem deeper and see that template modification is not required. Value of dynamic field is not displayed in table because someone forgot to add block initialization before output dynamic field value $LayoutObject->Block( Name => 'GeneralOverviewRow', ); see Kernel\Output\HTML\Dashboard\TicketGeneric.pm, line 2005 - in that 'else' section this block is not initialized and value is not displayed but I can't understand how value is rendered if dynamic field is not in 1st position

Best wishes, Sergey

BuilderNSV commented 2 months ago

Hi @hanneshal, What about my last comment, do you agree with me?

Best wishes, Sergey