Skip to content

fix: display linked socket in network ports list - #25223

Open
iPaulis wants to merge 1 commit into
glpi-project:11.0/bugfixesfrom
iPaulis:fix/11258-network-port-socket-column
Open

fix: display linked socket in network ports list#25223
iPaulis wants to merge 1 commit into
glpi-project:11.0/bugfixesfrom
iPaulis:fix/11258-network-port-socket-column

Conversation

@iPaulis

@iPaulis iPaulis commented Aug 23, 2026

Copy link
Copy Markdown

Fixes #11258

Problem

Since GLPI 10, the Network sockets column no longer appears in the network ports list and in the tab shown on asset pages (Computer, NetworkEquipment, Phone, ...). In 9.5 the socket of each port was visible in this list; from 10.0 onward the column vanished entirely even though ports can still be linked to a socket (the socket model moved to glpi_sockets, linked through glpi_sockets.networkports_id). I can reproduce it on a current 11.0.x instance: a port that has a socket linked shows nothing about it in the ports table, and the socket option is not even offered in the "Select default items to show" display preferences.

This is the regression reported in #11258 (closed without a fix).

Root cause

In NetworkPort::rawSearchOptions() the socket search option (id 9) is declared behind this guard:

if ($this->isField('sockets_id')) {
    $tab[] = [
        'id'                 => '9',
        'table'              => 'glpi_sockets',
        'field'              => 'name',
        ...
    ];
}

isField() checks the columns of glpi_networkports, and glpi_networkports has never had a sockets_id column. In 9.5 the equivalent option was guarded by netpoints_id and the socket lived on the main table; in 10 the data model moved the link to glpi_sockets.networkports_id, but the guard was ported over as-is and always evaluates to false. The option therefore never makes it into the list, and even when the port does have a socket attached nothing is rendered.

Change

src/NetworkPort.php:

  • Always add search option 9, with a proper child join on glpi_sockets.networkports_id (same join pattern the instantiation search options already use for sockets).
  • Add a case 9 in NetworkPort::showPort() so the linked socket name is rendered in the table when the column is selected. Ports without a linked socket simply show an empty cell.

tests/functional/NetworkPortTest.php:

  • New testShowForItemDisplaysLinkedSocket: creates a computer, an Ethernet port, a socket, links the socket to the port, enables display preference 9, and checks that both the column header and the socket value are rendered by showForItem()/displayTabContentForItem().

Verification

  • php -l clean on both files.
  • Reproduced the regression on a live 11.0.8 instance (fresh port with a linked socket shows no socket information, option 9 absent from display preferences).
  • With the patch applied on the same instance: the Network socket column is available in the display preferences picker, appears in the ports tab, and shows the linked socket. Verified through both showForItem() and displayTabContentForItem().
  • No behavior change when no socket is linked (empty cell).

The socket search option (id 9) was gated behind a check on a
sockets_id field that does not exist on the networkports table, so
the column was never offered in the list/display preferences. Always
provide the option with a child join on glpi_sockets.networkports_id
and render the linked socket in the ports table.

Fixes glpi-project#11258
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.

[GLPIP 10.R3] : Network sockets are no longer displayed in the preview

1 participant