Report: link to custom assets (GLPI 11+/12 asset definitions) leads to "item not found"
まだ誰も着手していません。
評価
調査の方向性
問題のリンクは src/Report.php の203行目付近で生成されており、"Connected to" 列で Toolbox::getItemTypeFormURL() が使われています。Issue によると、$item は各行ごとにすでにインスタンス化されています。そのため、行のループで $item がスコープ内にあること、およびカスタムアセットが getFormURL() をオーバーライドしていることを確認してください。IP範囲に "Network ports" の機能を持つカスタムアセットを使って再現します。完了の条件は、カスタムアセットではリンクがアセットのフォームを開き、コンピュータなどのコアのリンクは既存のフォームURLに引き続き解決されることです。
索引モデルが issue の本文から書いたものです。
説明
Version: addressing 3.3.0, GLPI 12.0.0
Steps to reproduce
- Create a custom asset definition with the "Network ports" capacity.
- Give an asset of this type a network port with an IP inside a range (e.g. via the reservation form).
- Open the range report and click the asset name in the "Connected to" column.
Expected: the asset form opens.
Actual: "The requested item has not been found".
Cause
src/Report.php (line 203) builds the link with
Toolbox::getItemTypeFormURL($line['itemtype']) . '?id=' . …, which derives a file name from the class:
| URL | |
|---|---|
| generated | /front/customasset/ip_reservierungasset.form.php?id=12 |
| correct | /front/asset/asset.form.php?class=IP_Reservierung&id=12 |
Custom assets override getFormURL(); Toolbox::getItemTypeFormURL() does not know about that.
Fix
$item is already instantiated for the row a few lines above, so:
$row['device'] = self::newCell(
$label,
$item::getFormURLWithID((int) $line['on_device']),
);
The result is the same as before for core types (e.g. /front/computer.form.php?id=12).
- 主要言語
- PHP
- スター
- 43
- フォーク
- 24
- 平均マージ
- 1時間 4分
- マージ済み PR(30日)
- 5
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pluginsGLPI/addressing のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
pluginsGLPI/addressing#126 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
pluginsGLPI/addressing#125 ·
-
Improvementsオープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
pluginsGLPI/addressing#105 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
pluginsGLPI/addressing#82 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
pluginsGLPI/addressing#77 ·
pluginsGLPI/addressing の issue をすべて見る
似ている issue
-
難易度 2/5 半日 初心者へのやさしさ 68/100
components-web-app/docs#244 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
PrestaShopCorp/ps_eventbus#501 · リアクション 2 件 ·
-
category::task maintenance priority::normal
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
e0ipso/schema-forms-php#58 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
Automattic/blocks-engine#2866 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
community-scripts/ProxmoxVE#17944 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信