RotherOSS / otobo

OTOBO is one of the most flexible web-based ticketing systems used for Customer Service, Help Desk, IT Service Management. https://otobo.io/
GNU General Public License v3.0
263 stars 75 forks source link

Link to DF Database does only work in itself, not from a different DynamicField #2171

Open StefanAbel-OTOBO opened 1 year ago

StefanAbel-OTOBO commented 1 year ago

When referring to another DF in a Link, it doesn't work if that field is a DynamicField Database. It does though, in case it calls its own value.

In the link-portion of a DF configuration, you can refer a different field value, in case you use [% Data.DynamicFieldSomeFieldName | uri %] When you have a DF DB "DBFieldWithRefToIDinAText" and Link to: https://myfqdn/otobo/index.pl?Action=AdminService;Subaction=ServiceEdit;ServiceID=[% Data.DynamicFieldDBFieldWithRefToIDinAText | uri %]

image

this works fine:

image

You can see the ID being taken from the field.

When you do that in a different DynamicField called "MyIDinAText", with the same Link: https://myfqdn/otobo/index.pl?Action=AdminService;Subaction=ServiceEdit;ServiceID=[% Data.DynamicField_DBFieldWithRefToIDinAText | uri %]

image

this does not work, as hovering shows an array issue:

image

In case I would refer to a different kind field (e.g. text) this would work nicely. As in the ticket history, the proper value (whatever you select as an Identifier for the DF DB) is stored and self-calling it in the same DF works, in my opinion this should also work from a different Dynamic Field.

StefanAbel-OTOBO commented 1 year ago

ov147

stefanhaerter commented 1 year ago

The cause of this bug is a bit complicated, I will try to explain it.

TL;DR: When a field links to itself, the value handling is different, which causes a problem for fields holding values as an array.

The placeholder [% Data.DynamicField_DBField %] is filled with the value of the field which is present when rendering the template. Usually, this is the value in the %Ticket object, which is an array in case of e.g. Dynamic Field Database. When linking to itself, a special case appears: Here, the function DisplayValueRender() is called, which returns, among other data, the Dynamic Field value as a string and overrules the Dynamic Field value stored in %Ticket.

I see mainly two possible solutions, assuming that we do want to support linking to other dynamic fields:

@svenoe What do you think about this?