Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ticket.knowbaseitems gets knowbaseitems by id not knowbaseitems_id from knowbaseitem_item #17549

Closed
2 tasks done
Russell-Jones-OxPhys opened this issue Jul 18, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@Russell-Jones-OxPhys
Copy link

Russell-Jones-OxPhys commented Jul 18, 2024

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Version

10.0.15

Bug description

The wrong field is used for follow up templates, as the field is obtained from the TicketParameters object. Thus the id of the relating table's record is used to retrieve a knowbaseitem, instead of the id in the table related to. The wrong KB articles are retrieved for ticket.knowbaseitems in followup templates (and elsewhere?) because of this. See line 141 of src/ContentTemplates/Parameters/TicketParameters.php

Relevant log output

No response

Page URL

http://localhost:8181/front/ticket.form.php?id=1

Steps To reproduce

1 Create a followup template as follows

{% for kbi in ticket.knowbaseitems %} {% if kbi and kbi['name'] and kbi['name'] == 'thing I want' %}

{{ kbi['answer'] | raw}}

{% else %}

{{ kbi.name }}

 {% endif %} {% endfor %}

2 Go to http://localhost:8181/front/ticket.form.php?id=1
3 Try to use the followup template

Your GLPI setup information

GLPI 10.0.15 ( => /var/www/html/web)
Installation mode: TARBALL
Current language:en_GB

Anything else?

This was written a bit hastily, I may need to tidy it later.

@Russell-Jones-OxPhys
Copy link
Author

It looks like the issue is on the main branch too?

if ($kbi = KnowbaseItem::getById($data['id'])) {

@cconard96 cconard96 self-assigned this Jul 18, 2024
@cconard96 cconard96 added the bug label Jul 18, 2024
cconard96 added a commit to cconard96/glpi that referenced this issue Jul 18, 2024
@cedric-anne cedric-anne added this to the 10.0.17 milestone Jul 22, 2024
btry pushed a commit to btry/glpi that referenced this issue Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants