You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The approve and refuse buttons on the holiday validation form are rendered as <i> icons with jQuery click handlers. When clicked, the JS handler attempts to inject hidden inputs into a form selected by the hardcoded ID #formvalidation and then submit it:
In GLPI 11 the form does not have a static id="formvalidation" — the form ID is generated dynamically. The selector $('#formvalidation') returns an empty jQuery object, so .append() and .submit() are no-ops. The page appears to do nothing when the buttons are clicked.
Steps to reproduce
Log in as a user with plugin_activity_can_validate right.
Open a holiday validation form that is in "Waiting" status.
Click the green checkmark (Accept) or red X (Refuse) icon.
Observe: the page does not submit, no status change occurs.
Expected behavior
Clicking Accept or Refuse should submit the form with the appropriate hidden field, triggering the status update.
Proposed fix
Traverse the DOM from the clicked element up to its parent <form> instead of relying on a hardcoded ID:
// HolidayValidation.php — replace the scriptBlock contentecho Html::scriptBlock(' $("#accept_holiday").on("click", function () { var $form = $(this).closest("form"); $form.append("<input type=\"hidden\" name=\"accept_holiday\" value=\"1\">"); $form.append("<input type=\"hidden\" name=\"update\" value=\"1\">"); $form.trigger("submit"); }); $("#refuse_holiday").on("click", function () { var $form = $(this).closest("form"); $form.append("<input type=\"hidden\" name=\"refuse_holiday\" value=\"1\">"); $form.append("<input type=\"hidden\" name=\"update\" value=\"1\">"); $form.trigger("submit"); });');
Or alternatively, replace the <i> icon approach with proper <button type="submit"> elements inside the form, which is the standard GLPI 11 pattern and requires no JavaScript at all:
Plugin version: 3.2.6
GLPI version: 11.x
Severity: Critical
File:
src/HolidayValidation.phplines 522–530Related issue: #27
Description
The approve and refuse buttons on the holiday validation form are rendered as
<i>icons with jQuery click handlers. When clicked, the JS handler attempts to inject hidden inputs into a form selected by the hardcoded ID#formvalidationand then submit it:In GLPI 11 the form does not have a static
id="formvalidation"— the form ID is generated dynamically. The selector$('#formvalidation')returns an empty jQuery object, so.append()and.submit()are no-ops. The page appears to do nothing when the buttons are clicked.Steps to reproduce
plugin_activity_can_validateright.Expected behavior
Clicking Accept or Refuse should submit the form with the appropriate hidden field, triggering the status update.
Proposed fix
Traverse the DOM from the clicked element up to its parent
<form>instead of relying on a hardcoded ID:Or alternatively, replace the
<i>icon approach with proper<button type="submit">elements inside the form, which is the standard GLPI 11 pattern and requires no JavaScript at all:Using native submit buttons eliminates the JavaScript dependency entirely and is fully GLPI 11 compliant.
Additional context
#formvalidation) was used in GLPI 9/10 where the form had that ID by convention. GLPI 11 changed the form rendering.