Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Reservation form: "Add" button does nothing on GLPI 12 (form tag not rendered)

Open Beginner friendly
#126 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
backend

Research direction

The fix is meant to go in ReserveIp::showReservationForm(), where the options array is built; the issue says to set $options['canedit'] = true there. Read the cause in the issue, then check the core GLPI templates components/form/header.html.twig and components/form/buttons.html.twig to see how canedit controls the <form> tag. Done when the Add button sits inside the form on GLPI 12 and submitting reaches front/reserveip.form.php, with rights still enforced there.

Written by the indexing model from the issue text.

Description

Version: addressing 3.3.0 + fix for #123 (master ba0d1c3), GLPI 12.0.0

Steps to reproduce

  1. Open an IP range report, click the reservation icon of a free address.
  2. The modal opens (with the #123 fix applied), enter a name, click "Add".

Expected: the reservation is submitted to front/reserveip.form.php.
Actual: nothing happens, no request is sent, no message.

Cause
ReserveIp::canCreate()/canUpdate()/canPurge() now return false on purpose (ea5b0a5).
reserveip.html.twig extends generic_show_form.html.twig, whose two core sub-templates decide differently:

  • components/form/header.html.twig only outputs the <form> tag when canedit is true, falling back to item.canEdit():
    {% set canedit = params['canedit']|default(item.canEdit(item.fields['id'])) %} → {% if open_form and canedit %}<form …>
  • components/form/buttons.html.twig defaults to true: {% set canedit = params['canedit'] ?? true %}

canEdit() is false for ReserveIp, so the "Add" button is rendered outside of any form.

Fix
Pass canedit explicitly in ReserveIp::showReservationForm():

$options['colspan'] = 2;
$options['no_header'] = true;
$options['canedit'] = true;   // added
$options['id_addressing'] = $id_addressing;

This only affects rendering; rights are still enforced on submission
(front/reserveip.form.php checks plugin_addressing CREATE, reserveip() checks CREATE/UPDATE on the target item).

Dominant language
PHP
Stars
43
Forks
24
Avg merge
1h 4m
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pluginsGLPI/addressing

All issues in pluginsGLPI/addressing

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.