Report: link to custom assets (GLPI 11+/12 asset definitions) leads to "item not found"
还没有人认领这个 Issue。
评估
调研方向
错误链接在 src/Report.php 第 203 行附近构建,"Connected to" 列在这里使用了 Toolbox::getItemTypeFormURL()。问题描述称每行都已实例化 $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 分钟
- 30 天内合并 PR
- 5
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 一周以上 新手友好度 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 1-3 小时 新手友好度 66/100
Automattic/blocks-engine#2866 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
community-scripts/ProxmoxVE#17944 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement good first issue help wanted
难度 2/5 1-3 小时 新手友好度 82/100
-
backend gamification P0
难度 2/5 1-3 小时 新手友好度 66/100
semanadeinformatica/website#461 ·
-
HttpRequestTrait fatals on WordPress 7.2: $blocked_http_requests clashes with WP_UnitTestCase_Base未关闭
难度 2/5 1-3 小时 新手友好度 72/100