Report: link to custom assets (GLPI 11+/12 asset definitions) leads to "item not found"
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
The bad link is built in src/Report.php around line 203, where Toolbox::getItemTypeFormURL() is used for the "Connected to" column. The issue says $item is already instantiated for each row, so check that the row loop has it in scope and that custom assets override getFormURL(). Reproduce with a custom asset that has the "Network ports" capacity on an IP range. Done when the link opens the asset form for custom assets and core links such as computers still resolve to their existing form URLs.
Written by the indexing model from the issue text.
Description
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).
- 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 72/100
pluginsGLPI/addressing#126 ·
-
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
-
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 ·
-
HttpRequestTrait fatals on WordPress 7.2: $blocked_http_requests clashes with WP_UnitTestCase_BaseOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100