Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Report: link to custom assets (GLPI 11+/12 asset definitions) leads to "item not found"

未关闭 适合新手
#127 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php
领域
backend

调研方向

错误链接在 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

  1. Create a custom asset definition with the "Network ports" capacity.
  2. Give an asset of this type a network port with an IP inside a range (e.g. via the reservation form).
  3. 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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pluginsGLPI/addressing 的其他 Issue

查看 pluginsGLPI/addressing 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。