Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン 初心者向け
#126 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php
領域
backend

調査の方向性

修正は ReserveIp::showReservationForm() に入れます。ここでオプション配列が組み立てられており、issue では同所で $options['canedit'] = true を設定するよう示されています。issue で原因を読んだうえで、GLPI コアのテンプレート components/form/header.html.twig と components/form/buttons.html.twig を確認し、canedit が <form> タグをどう制御しているかを見てください。GLPI 12 で追加ボタンがフォーム内に配置され、送信が front/reserveip.form.php に届き、そこで権限チェックが引き続き行われていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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).

主要言語
PHP
スター
43
フォーク
24
平均マージ
1時間 4分
マージ済み PR(30日)
5

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pluginsGLPI/addressing のほかの issue

pluginsGLPI/addressing の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。