Skip to content

Bug: Error exporting Computer to PDF when OCS Inventory NG is enabled (GLPI 11 #399

Description

@jairo9904-prog

Description

When trying to export a Computer to PDF using the PDF plugin, an error occurs:

"Unexpected error occurred"

This only happens when the OCS Inventory NG plugin is enabled.

If the plugin is disabled, PDF export works correctly.


Environment

  • GLPI version: 11.0.5
  • PDF plugin: 4.1.2
  • OCS Inventory NG plugin: (your version here)
  • PHP: >= 8.2

Steps to reproduce

  1. Enable OCS Inventory NG plugin
  2. Go to Assets → Computers
  3. Open any computer (even a newly created one)
  4. Click "Print to PDF"

Expected behavior

PDF should be generated correctly.


Actual behavior

Error message:

"Unexpected error occurred"


Logs

[2026-03-18] glpi.CRITICAL: Uncaught PHP Exception:
Attempted to call an undefined method named "getID"
of class "PluginPdfComputer"
at Ocslink.php line 1015
Backtrace:
./marketplace/ocsinventoryng/src/Ocslink.php:1015
./marketplace/ocsinventoryng/src/Ocslink.php:885
./marketplace/pdf/inc/common.class.php:54
./marketplace/pdf/inc/computer.class.php:44


Additional information

  • The issue only affects Computers
  • Monitors and Tickets export correctly
  • Happens even with newly created computers
  • Disabling OCS plugin resolves the issue

Possible cause

OCS plugin assumes that the item object has method getID(), but when exporting PDF, the object is PluginPdfComputer, which does not implement that method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions