Skip to content

Commit

Permalink
Move MainAsset classes to their own directory
Browse files Browse the repository at this point in the history
Split Printer
  • Loading branch information
trasher committed Dec 19, 2024
1 parent 3d642a8 commit 9d57526
Show file tree
Hide file tree
Showing 18 changed files with 337 additions and 278 deletions.
52 changes: 23 additions & 29 deletions .phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -2803,44 +2803,38 @@
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/InventoryAsset.php',
];
$ignoreErrors[] = [
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$main_asset \\(Glpi\\\\Inventory\\\\Asset\\\\MainAsset\\) does not accept Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\.$#',
'identifier' => 'assign.propertyType',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/InventoryAsset.php',
];
$ignoreErrors[] = [
'message' => '#^Argument of an invalid type stdClass supplied for foreach, only iterables are supported\\.$#',
'identifier' => 'foreach.nonIterable',
'count' => 2,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/MainAsset.php',
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/MainAsset.php',
];
$ignoreErrors[] = [
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$itemtype \\(string\\) does not accept null\\.$#',
'identifier' => 'assign.propertyType',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/MainAsset.php',
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/MainAsset.php',
];
$ignoreErrors[] = [
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$request_query \\(string\\) on left side of \\?\\? is not nullable\\.$#',
'identifier' => 'nullCoalesce.property',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/MainAsset.php',
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/MainAsset.php',
];
$ignoreErrors[] = [
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\MainAsset\\:\\:\\$states_id_default \\(int\\) on left side of \\?\\? is not nullable\\.$#',
'message' => '#^Property Glpi\\\\Inventory\\\\MainAsset\\\\MainAsset\\:\\:\\$states_id_default \\(int\\) on left side of \\?\\? is not nullable\\.$#',
'identifier' => 'nullCoalesce.property',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/MainAsset.php',
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/MainAsset.php',
];
$ignoreErrors[] = [
'message' => '#^Call to function method_exists\\(\\) with Glpi\\\\Inventory\\\\Asset\\\\MainAsset and \'isPartial\' will always evaluate to true\\.$#',
'message' => '#^Call to function method_exists\\(\\) with Glpi\\\\Inventory\\\\MainAsset\\\\MainAsset and \'isPartial\' will always evaluate to true\\.$#',
'identifier' => 'function.alreadyNarrowedType',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/NetworkCard.php',
];
$ignoreErrors[] = [
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$main_asset \\(Glpi\\\\Inventory\\\\Asset\\\\MainAsset\\) in isset\\(\\) is not nullable\\.$#',
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$main_asset \\(Glpi\\\\Inventory\\\\MainAsset\\\\MainAsset\\) in isset\\(\\) is not nullable\\.$#',
'identifier' => 'isset.property',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/NetworkCard.php',
Expand All @@ -2849,19 +2843,19 @@
'message' => '#^Argument of an invalid type stdClass supplied for foreach, only iterables are supported\\.$#',
'identifier' => 'foreach.nonIterable',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/NetworkEquipment.php',
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/NetworkEquipment.php',
];
$ignoreErrors[] = [
'message' => '#^Call to function method_exists\\(\\) with \\$this\\(Glpi\\\\Inventory\\\\Asset\\\\NetworkEquipment\\) and \'getManagementPorts\' will always evaluate to true\\.$#',
'message' => '#^Call to function method_exists\\(\\) with \\$this\\(Glpi\\\\Inventory\\\\MainAsset\\\\NetworkEquipment\\) and \'getManagementPorts\' will always evaluate to true\\.$#',
'identifier' => 'function.alreadyNarrowedType',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/NetworkEquipment.php',
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/NetworkEquipment.php',
];
$ignoreErrors[] = [
'message' => '#^Expression on left side of \\?\\? is not nullable\\.$#',
'identifier' => 'nullCoalesce.expr',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/NetworkEquipment.php',
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/NetworkEquipment.php',
];
$ignoreErrors[] = [
'message' => '#^Call to function is_array\\(\\) with array will always evaluate to true\\.$#',
Expand All @@ -2876,7 +2870,7 @@
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/NetworkPort.php',
];
$ignoreErrors[] = [
'message' => '#^Call to function method_exists\\(\\) with Glpi\\\\Inventory\\\\Asset\\\\MainAsset and \'isPartial\' will always evaluate to true\\.$#',
'message' => '#^Call to function method_exists\\(\\) with Glpi\\\\Inventory\\\\MainAsset\\\\MainAsset and \'isPartial\' will always evaluate to true\\.$#',
'identifier' => 'function.alreadyNarrowedType',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/NetworkPort.php',
Expand Down Expand Up @@ -2942,7 +2936,7 @@
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/NetworkPort.php',
];
$ignoreErrors[] = [
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$main_asset \\(Glpi\\\\Inventory\\\\Asset\\\\MainAsset\\) in isset\\(\\) is not nullable\\.$#',
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$main_asset \\(Glpi\\\\Inventory\\\\MainAsset\\\\MainAsset\\) in isset\\(\\) is not nullable\\.$#',
'identifier' => 'isset.property',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/NetworkPort.php',
Expand Down Expand Up @@ -3002,7 +2996,7 @@
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/Software.php',
];
$ignoreErrors[] = [
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$main_asset \\(Glpi\\\\Inventory\\\\Asset\\\\MainAsset\\) in isset\\(\\) is not nullable\\.$#',
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$main_asset \\(Glpi\\\\Inventory\\\\MainAsset\\\\MainAsset\\) in isset\\(\\) is not nullable\\.$#',
'identifier' => 'isset.property',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/Software.php',
Expand All @@ -3011,28 +3005,28 @@
'message' => '#^Argument of an invalid type stdClass supplied for foreach, only iterables are supported\\.$#',
'identifier' => 'foreach.nonIterable',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/Unmanaged.php',
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/Unmanaged.php',
];
$ignoreErrors[] = [
'message' => '#^Parameter \\#4 \\$ports_id \\(array\\) of method Glpi\\\\Inventory\\\\Asset\\\\Unmanaged\\:\\:rulepassed\\(\\) should be compatible with parameter \\$ports_id \\(int\\) of method Glpi\\\\Inventory\\\\Asset\\\\MainAsset\\:\\:rulepassed\\(\\)$#',
'message' => '#^Parameter \\#4 \\$ports_id \\(array\\) of method Glpi\\\\Inventory\\\\MainAsset\\\\Unmanaged\\:\\:rulepassed\\(\\) should be compatible with parameter \\$ports_id \\(int\\) of method Glpi\\\\Inventory\\\\MainAsset\\\\MainAsset\\:\\:rulepassed\\(\\)$#',
'identifier' => 'method.childParameterType',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/Unmanaged.php',
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/Unmanaged.php',
];
$ignoreErrors[] = [
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$request_query \\(string\\) on left side of \\?\\? is not nullable\\.$#',
'identifier' => 'nullCoalesce.property',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/Unmanaged.php',
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/Unmanaged.php',
];
$ignoreErrors[] = [
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\MainAsset\\:\\:\\$states_id_default \\(int\\) on left side of \\?\\? is not nullable\\.$#',
'message' => '#^Property Glpi\\\\Inventory\\\\MainAsset\\\\MainAsset\\:\\:\\$states_id_default \\(int\\) on left side of \\?\\? is not nullable\\.$#',
'identifier' => 'nullCoalesce.property',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/Unmanaged.php',
'path' => __DIR__ . '/src/Glpi/Inventory/MainAsset/Unmanaged.php',
];
$ignoreErrors[] = [
'message' => '#^Call to function method_exists\\(\\) with Glpi\\\\Inventory\\\\Asset\\\\MainAsset and \'isPartial\' will always evaluate to true\\.$#',
'message' => '#^Call to function method_exists\\(\\) with Glpi\\\\Inventory\\\\MainAsset\\\\MainAsset and \'isPartial\' will always evaluate to true\\.$#',
'identifier' => 'function.alreadyNarrowedType',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/VirtualMachine.php',
Expand All @@ -3050,7 +3044,7 @@
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/VirtualMachine.php',
];
$ignoreErrors[] = [
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$main_asset \\(Glpi\\\\Inventory\\\\Asset\\\\MainAsset\\) in isset\\(\\) is not nullable\\.$#',
'message' => '#^Property Glpi\\\\Inventory\\\\Asset\\\\InventoryAsset\\:\\:\\$main_asset \\(Glpi\\\\Inventory\\\\MainAsset\\\\MainAsset\\) in isset\\(\\) is not nullable\\.$#',
'identifier' => 'isset.property',
'count' => 1,
'path' => __DIR__ . '/src/Glpi/Inventory/Asset/VirtualMachine.php',
Expand Down Expand Up @@ -3128,7 +3122,7 @@
'path' => __DIR__ . '/src/Glpi/Inventory/Inventory.php',
];
$ignoreErrors[] = [
'message' => '#^Property Glpi\\\\Inventory\\\\Inventory\\:\\:\\$mainasset \\(Glpi\\\\Inventory\\\\Asset\\\\MainAsset\\) in isset\\(\\) is not nullable\\.$#',
'message' => '#^Property Glpi\\\\Inventory\\\\Inventory\\:\\:\\$mainasset \\(Glpi\\\\Inventory\\\\MainAsset\\\\MainAsset\\) in isset\\(\\) is not nullable\\.$#',
'identifier' => 'isset.property',
'count' => 2,
'path' => __DIR__ . '/src/Glpi/Inventory/Inventory.php',
Expand Down
4 changes: 2 additions & 2 deletions phpunit/functional/Glpi/Inventory/Assets/ComputerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function testPrepare($xml, $asset)
$json = json_decode($data);

$computer = getItemByTypeName('Computer', '_test_pc01');
$main = new \Glpi\Inventory\Asset\Computer($computer, $json);
$main = new \Glpi\Inventory\MainAsset\Computer($computer, $json);
$main->setExtraData((array)$json->content);
$result = $main->prepare();
$this->assertEquals(json_decode($asset), $result[0]);
Expand Down Expand Up @@ -590,7 +590,7 @@ public function testHandle()
$agent = new \Agent();
$this->assertGreaterThan(0, $agent->handleAgent($inventory->extractMetadata()));

$main = new \Glpi\Inventory\Asset\Computer($computer, $json);
$main = new \Glpi\Inventory\MainAsset\Computer($computer, $json);
$main->setAgent($agent)->setExtraData($data)->checkConf($conf);
$result = $main->prepare();
$this->assertCount(1, $result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function testPrepare($xml, $asset)
$json = json_decode($data);

$netequ = new \NetworkEquipment();
$main = new \Glpi\Inventory\Asset\NetworkEquipment($netequ, $json);
$main = new \Glpi\Inventory\MainAsset\NetworkEquipment($netequ, $json);
$main->setExtraData((array)$json->content);
$result = $main->prepare();
$this->assertEquals(json_decode($asset), $result[0]);
Expand All @@ -193,7 +193,7 @@ public function testStacked()
$agent = new \Agent();
$this->assertSame(0, $agent->handleAgent($inventory->extractMetadata()));

$main = new \Glpi\Inventory\Asset\NetworkEquipment($netequ, $json);
$main = new \Glpi\Inventory\MainAsset\NetworkEquipment($netequ, $json);
$main->setAgent($agent)->setExtraData($data);
$result = $main->prepare();
$this->assertCount(1, $result);
Expand All @@ -213,7 +213,7 @@ public function testStacked()
$agent = new \Agent();
$this->assertSame(0, $agent->handleAgent($inventory->extractMetadata()));

$main = new \Glpi\Inventory\Asset\NetworkEquipment($netequ, $json);
$main = new \Glpi\Inventory\MainAsset\NetworkEquipment($netequ, $json);
$main->setAgent($agent)->setExtraData($data);
$result = $main->prepare();
$this->assertCount(5, $result);
Expand Down Expand Up @@ -423,7 +423,7 @@ public function testHandle()
$agent = new \Agent();
$this->assertSame(0, $agent->handleAgent($inventory->extractMetadata()));

$main = new \Glpi\Inventory\Asset\NetworkEquipment($netequ, $json);
$main = new \Glpi\Inventory\MainAsset\NetworkEquipment($netequ, $json);
$main->setAgent($agent)->setExtraData($data);
$main->checkConf(new \Glpi\Inventory\Conf());
$result = $main->prepare();
Expand Down
14 changes: 7 additions & 7 deletions phpunit/functional/Glpi/Inventory/Assets/PrinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function assetProvider(): array
<DEVICEID>glpixps.teclib.infra-2018-10-03-08-42-36</DEVICEID>
<QUERY>INVENTORY</QUERY>
</REQUEST>",
'expected' => '{"driver": "HP Color LaserJet Pro MFP M476 PCL 6", "name": "HP Color LaserJet Pro MFP M476 PCL 6", "network": false, "printprocessor": "hpcpp155", "resolution": "600x600", "shared": false, "sharename": "HP Color LaserJet Pro MFP M476 PCL 6 (1)", "status": "Unknown", "have_usb": 0, "autoupdatesystems_id": "GLPI Native Inventory", "last_inventory_update": "DATE_NOW"}'
'expected' => '{"driver": "HP Color LaserJet Pro MFP M476 PCL 6", "name": "HP Color LaserJet Pro MFP M476 PCL 6", "network": false, "printprocessor": "hpcpp155", "resolution": "600x600", "shared": false, "sharename": "HP Color LaserJet Pro MFP M476 PCL 6 (1)", "status": "Unknown", "have_usb": 0, "autoupdatesystems_id": "GLPI Native Inventory", "last_inventory_update": "DATE_NOW", "is_deleted": 0}'
]
];
}
Expand Down Expand Up @@ -111,7 +111,7 @@ public function testSnmpPrinter()
$agent = new \Agent();
$this->assertSame(0, $agent->handleAgent($inventory->extractMetadata()));

$main = new \Glpi\Inventory\Asset\Printer($printer, $json);
$main = new \Glpi\Inventory\MainAsset\Printer($printer, $json);
$main->setAgent($agent)->setExtraData($data);
$main->checkConf(new \Glpi\Inventory\Conf());
$result = $main->prepare();
Expand Down Expand Up @@ -215,7 +215,7 @@ public function testSnmpPrinterManagementPortAdded()
$agent = new \Agent();
$this->assertSame(0, $agent->handleAgent($inventory->extractMetadata()));

$main = new \Glpi\Inventory\Asset\Printer($printer, $json);
$main = new \Glpi\Inventory\MainAsset\Printer($printer, $json);
$main->setAgent($agent)->setExtraData($data);
$main->checkConf(new \Glpi\Inventory\Conf());
$result = $main->prepare();
Expand Down Expand Up @@ -301,7 +301,7 @@ public function testSnmpPrinterManagementPortExcluded()
$agent = new \Agent();
$this->assertSame(0, $agent->handleAgent($inventory->extractMetadata()));

$main = new \Glpi\Inventory\Asset\Printer($printer, $json);
$main = new \Glpi\Inventory\MainAsset\Printer($printer, $json);
$main->setAgent($agent)->setExtraData($data);
$main->checkConf(new \Glpi\Inventory\Conf());
$result = $main->prepare();
Expand Down Expand Up @@ -1492,7 +1492,7 @@ public function testSnmpPrinterDiscoveryUpdateAllowed()
$agent = new \Agent();
$this->assertSame(0, $agent->handleAgent($inventory->extractMetadata()));

$main = new \Glpi\Inventory\Asset\Printer($printer, $json);
$main = new \Glpi\Inventory\MainAsset\Printer($printer, $json);
$main->setAgent($agent)->setExtraData($data);
$main->checkConf(new \Glpi\Inventory\Conf());
$main->setDiscovery(true);
Expand Down Expand Up @@ -1560,7 +1560,7 @@ public function testSnmpPrinterDiscoveryUpdateAllowed()
$agent = new \Agent();
$this->assertSame(0, $agent->handleAgent($inventory->extractMetadata()));

$main = new \Glpi\Inventory\Asset\Printer($printer, $json);
$main = new \Glpi\Inventory\MainAsset\Printer($printer, $json);
$main->setAgent($agent)->setExtraData($data);
$main->checkConf(new \Glpi\Inventory\Conf());
$main->setDiscovery(true);
Expand Down Expand Up @@ -1703,7 +1703,7 @@ public function testSnmpPrinterManagementPortCleaned()
$agent = new \Agent();
$this->assertSame(0, $agent->handleAgent($inventory->extractMetadata()));

$main = new \Glpi\Inventory\Asset\Printer($printer, $json);
$main = new \Glpi\Inventory\MainAsset\Printer($printer, $json);
$main->setAgent($agent)->setExtraData($data);
$main->checkConf(new \Glpi\Inventory\Conf());
$result = $main->prepare();
Expand Down
15 changes: 7 additions & 8 deletions src/Glpi/Inventory/Asset/InventoryAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
use Dropdown;
use Glpi\Asset\Asset_PeripheralAsset;
use Glpi\Inventory\Conf;
use Glpi\Inventory\MainAsset\MainAsset;
use Glpi\Inventory\Request;
use Lockedfield;
use Manufacturer;
Expand Down Expand Up @@ -84,8 +85,6 @@ abstract class InventoryAsset
protected array $known_links = [];
/** @var array */
protected array $raw_links = [];
/** @var array */
protected array $input_notmanaged = [];

/**
* Constructor
Expand Down Expand Up @@ -391,11 +390,11 @@ protected function setItem(CommonDBTM $item): self
/**
* Set inventory item
*
* @param InventoryAsset $mainasset Main inventory asset instance
* @param MainAsset $mainasset Main inventory asset instance
*
* @return InventoryAsset
*/
public function setMainAsset(InventoryAsset $mainasset): self
public function setMainAsset(MainAsset $mainasset): self
{
$this->main_asset = $mainasset;
return $this;
Expand All @@ -404,16 +403,16 @@ public function setMainAsset(InventoryAsset $mainasset): self
/**
* Get main inventory asset
*
* @return InventoryAsset
* @return MainAsset
*/
public function getMainAsset(): InventoryAsset
public function getMainAsset(): MainAsset
{
return $this->main_asset;
}

/**
* Add or move a peripheral asset.
* If the peripheral asset is already linked to another maina sset, existing link will be replaced by new link.
* If the peripheral asset is already linked to another main asset, existing link will be replaced by new link.
*
* @param array $input
*
Expand All @@ -440,7 +439,7 @@ protected function addOrMoveItem(array $input): void
}

$relation = new Asset_PeripheralAsset();
$relation->add($input, [], !$this->item->isNewItem()); //log only if mainitem is not new
$relation->add($input, [], !$this->item->isNewItem()); //log only if main item is not new
}

protected function setNew(): self
Expand Down
1 change: 1 addition & 0 deletions src/Glpi/Inventory/Asset/InventoryNetworkPort.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

use DBmysqlIterator;
use Glpi\Inventory\Conf;
use Glpi\Inventory\MainAsset\MainAsset;
use IPAddress;
use IPNetwork;
use Item_DeviceNetworkCard;
Expand Down
8 changes: 4 additions & 4 deletions src/Glpi/Inventory/Asset/NetworkPort.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function prepare(): array
$this->aggregates = [];
$this->vlans = [];

$this->extra_data['\Glpi\Inventory\Asset\\' . $this->item->getType()] = null;
$this->extra_data['\Glpi\Inventory\MainAsset\\' . $this->item->getType()] = null;
$mapping = [
'ifname' => 'name',
'ifnumber' => 'logical_number',
Expand Down Expand Up @@ -624,7 +624,7 @@ private function handleConnections(\stdClass $port, int $netports_id)

public function handle()
{
$this->ports += $this->extra_data['\Glpi\Inventory\Asset\\' . $this->item->getType()]->getManagementPorts();
$this->ports += $this->extra_data['\Glpi\Inventory\MainAsset\\' . $this->item->getType()]->getManagementPorts();
$this->handlePorts();
}

Expand Down Expand Up @@ -788,12 +788,12 @@ protected function isLLDP($port): bool

public function handlePorts($itemtype = null, $items_id = null)
{
$mainasset = $this->extra_data['\Glpi\Inventory\Asset\\' . $this->item->getType()];
$mainasset = $this->extra_data['\Glpi\Inventory\MainAsset\\' . $this->item->getType()];

//remove management port for Printer on netinventory
//to prevent twice IP (NetworkPortAggregate / NetworkPortEthernet)
if ($mainasset instanceof Printer && !$this->item->isNewItem()) {
if (empty($this->extra_data['\Glpi\Inventory\Asset\\' . $this->item->getType()]->getManagementPorts())) {
if (empty($this->extra_data['\Glpi\Inventory\MainAsset\\' . $this->item->getType()]->getManagementPorts())) {
//remove all port management ports
$networkport = new GlobalNetworkPort();
$networkport->deleteByCriteria([
Expand Down
Loading

0 comments on commit 9d57526

Please sign in to comment.