Skip to content

Fix Update source for Monitor and Peripheral#23018

Closed
Lainow wants to merge 3 commits intoglpi-project:11.0/bugfixesfrom
Lainow:fix-update-source-for-monitor-and-peripherals
Closed

Fix Update source for Monitor and Peripheral#23018
Lainow wants to merge 3 commits intoglpi-project:11.0/bugfixesfrom
Lainow:fix-update-source-for-monitor-and-peripherals

Conversation

@Lainow
Copy link
Contributor

@Lainow Lainow commented Feb 4, 2026

Checklist before requesting a review

Please delete options that are not relevant.

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

  • It fixes !41896
  • Here is a brief description of what this PR does
    Fixed the Update Source field not updating for monitors and peripherals when inventorying a computer.

Screenshots (if appropriate):

}

$val->is_dynamic = 1;
$val->autoupdatesystems_id = AutoUpdateSystem::NATIVE_INVENTORY;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m wondering if it might be worth applying this change in the parent class to ensure that all objects synchronized through GLPI’s native inventory have this value set.

In InventoryAsset.php:

public function __construct(CommonDBTM $item, ?array $data = null)
{
    $this->item = $item;
    if ($data !== null) {
        $this->data = $data;
        $this->data['autoupdatesystems_id'] = AutoUpdateSystem::NATIVE_INVENTORY;
    }
}

to ensure we never have to apply this kind of fix again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think @trasher

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I guess it would be a better way to go, if that does not break. Also; the id should be properly set already on the MainAsset; it's probably better to get this one rather than hardcoding a default one.
And finally, I'm pretty sure this issue also exists on v10.

@Lainow Lainow self-assigned this Feb 6, 2026
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't add new entries in phpstan baseline. Either issues must be fixed (seems to be the case here) or an specific ignore comment must be added (if there is a real reason it cannot get fixed).

}

$val->is_dynamic = 1;
$val->autoupdatesystems_id = AutoUpdateSystem::NATIVE_INVENTORY;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I guess it would be a better way to go, if that does not break. Also; the id should be properly set already on the MainAsset; it's probably better to get this one rather than hardcoding a default one.
And finally, I'm pretty sure this issue also exists on v10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants