Repository navigation
Fix Fields search options leaking across entity scopes - #1282
brunoCarraroGridtech wants to merge 1 commit into
Conversation
Rom1-B
left a comment
There was a problem hiding this comment.
This branch is based on GLPI 11 code (1.24.5) while main now targets GLPI 12. Could you change the base to 11.0/bugfixes and rebase onto it? It will be forward-ported to main afterwards.
Can you add a test checking that a block in a non-recursive child entity is absent from getAddSearchOptions() in a sibling entity, present in its own, and still present in cron?
CI fails on the missing CHANGELOG entry, e.g. under [Unreleased] > Fixed: "Fix search options of blocks from other entities being available in the search engine".
| echo '<td>' . __('Entity') . ' : </td>'; | ||
| echo '<td>'; | ||
| Entity::dropdown( | ||
| [ | ||
| 'name' => 'entities_id', | ||
| 'value' => $this->fields['entities_id'], | ||
| ], | ||
| ); | ||
| echo '</td>'; | ||
| echo '</tr>'; | ||
|
|
||
| echo '<tr>'; | ||
| echo '<td>' . __('Child entities') . ' : </td>'; | ||
| echo '<td>'; | ||
| Dropdown::showYesNo('is_recursive', $this->fields['is_recursive']); |
There was a problem hiding this comment.
The form header already renders the entity and a "Child entities" toggle; this duplicate overrides the header toggle on submit. Could you drop it?
| echo '<td>' . __('Entity') . ' : </td>'; | |
| echo '<td>'; | |
| Entity::dropdown( | |
| [ | |
| 'name' => 'entities_id', | |
| 'value' => $this->fields['entities_id'], | |
| ], | |
| ); | |
| echo '</td>'; | |
| echo '</tr>'; | |
| echo '<tr>'; | |
| echo '<td>' . __('Child entities') . ' : </td>'; | |
| echo '<td>'; | |
| Dropdown::showYesNo('is_recursive', $this->fields['is_recursive']); |
| } | ||
| $request['WHERE'][] = getEntitiesRestrictCriteria( | ||
| 'glpi_plugin_fields_containers', | ||
| '', | ||
| $_SESSION['glpiactiveentities'] ?? 0, | ||
| true, | ||
| true, | ||
| ); |
There was a problem hiding this comment.
Cron has no active entities, so this drops sub-entity blocks there (field history included); scope it like the profile filter.
| } | |
| $request['WHERE'][] = getEntitiesRestrictCriteria( | |
| 'glpi_plugin_fields_containers', | |
| '', | |
| $_SESSION['glpiactiveentities'] ?? 0, | |
| true, | |
| true, | |
| ); | |
| $request['WHERE'][] = getEntitiesRestrictCriteria('glpi_plugin_fields_containers', '', '', true); | |
| } |
Checklist before requesting a review
Please delete options that are not relevant.
Description
Screenshots (if appropriate):