-
Notifications
You must be signed in to change notification settings - Fork 71
Hiding fields depending on category does not work #847
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
Comments
Still having this issue... |
I was having the same issue. And I, so called "fixed" it.
This will fix the alignment issue. Next, I edited showForTab function like so
There, if we don't have type in $item or we don't have itilcategories_id- we got them from $params options. This will fix all issues with containers, and you will be able to show or hide them according to your conditions. |
can you propose a PR ? |
Hi! I've tried the code, but it didn’t work as expected in my case. I had to move a few lines of your code further down in public static function showForTab($params)
{
$item = $params['item'];
$functions = array_column(debug_backtrace(), 'function');
...
$display_condition = new PluginFieldsContainerDisplayCondition();
// @akstis-typer code starts here ------
if($item->fields['type'] == "")
{
$item->fields['type'] = $params['options']['type'];
}
if($item->fields['itilcategories_id'] == "")
{
$item->fields['itilcategories_id'] = $params['options']['itilcategories_id'];
}
// @akstis-typer code ends here ------
if ($display_condition->computeDisplayContainer($item, $c_id)) {
... The issue seemed to be related to this part of the code: if ($item->isEntityAssign()) {
$current_entity = $item->getEntityID();
if (!in_array($current_entity, $entities)) {
return;
}
} I’m not entirely sure what this block was doing, but in my case it was preventing the code from working as expected — the values assigned by @akstis-typer snippet were overriden once again to empty values. Hope this helps! |
There has been no activity on this issue for some time and therefore it is considered stale and will be closed automatically in 10 days. If this issue is related to a bug, please try to reproduce on latest release. If the problem persist, feel free to add a comment to revive this issue. You may also consider taking a subscription to get professionnal support or contact GLPI editor team directly. |
Code of Conduct
Is there an existing issue for this?
GLPI Version
10.0.15
Plugin version
1.21.15
Bug description
When I setup a block to be hidden depending on ticket category, block is not hidden in simplified interface. Haven't tried in standard interface since it does not meet our requirements.
Block configuration:
Block fields:
Block hiding condition:
When a user begins to create a ticket, block is shown (which is expected to happen)
But when the user sets the category by which the block has to be hidden, some erratic movement happens and the field is still shown with broken CSS, a.k.a. moved rightwards and wider.
I've tried setting the condition to the ticket's title and this works correctly, block is successfully hidden and works like a charm.
Relevant log output
No response
Page URL
No response
Steps To reproduce
3
and block is still present.Your GLPI setup information
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: