Reservation form: "Add" button does nothing on GLPI 12 (form tag not rendered)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
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
- Open an IP range report, click the reservation icon of a free address.
- 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.twigonly outputs the<form>tag whencaneditis true, falling back toitem.canEdit():
{% set canedit = params['canedit']|default(item.canEdit(item.fields['id'])) %}→{% if open_form and canedit %}<form …>components/form/buttons.html.twigdefaults 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pluginsGLPI/addressing
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pluginsGLPI/addressing#127 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
pluginsGLPI/addressing#125 ·
-
ImprovementsOpen
Difficulty 5/5 Over a week Newbie friendliness 25/100
pluginsGLPI/addressing#105 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
pluginsGLPI/addressing#82 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
pluginsGLPI/addressing#77 ·
All issues in pluginsGLPI/addressing
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Automattic/blocks-engine#2866 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
community-scripts/ProxmoxVE#17944 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
EasyCorp/EasyAdminBundle#7861 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
backend gamification P0
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
semanadeinformatica/website#461 ·