diff --git a/src/Glpi/Asset/Asset_PeripheralAsset.php b/src/Glpi/Asset/Asset_PeripheralAsset.php index 50f8f30ad23..6012a28a81a 100644 --- a/src/Glpi/Asset/Asset_PeripheralAsset.php +++ b/src/Glpi/Asset/Asset_PeripheralAsset.php @@ -346,19 +346,17 @@ private static function showForAsset(CommonDBTM $asset, $withtemplate = 0): void 'asset' => $asset, 'label' => __('Connect an item'), 'btn_label' => _sx('button', 'Connect'), - 'withtemplate' => $withtemplate, + 'withtemplate' => (int) $withtemplate === 1 ? 1 : 0, ]; // language=Twig echo TemplateRenderer::getInstance()->renderFromStringTemplate(<<
- - - - {% if withtemplate %} - - {% endif %} + {{ fields.hiddenField('items_id_asset', asset.getID()) }} + {{ fields.hiddenField('itemtype_asset', asset.getType()) }} + {{ fields.hiddenField('_glpi_csrf_token', csrf_token()) }} + {{ withtemplate ? fields.hiddenField('_no_history', 1) }} {{ fields.dropdownItemTypes('itemtype_peripheral', 0, label, { types: config('directconnect_types'), checkright: true, @@ -512,7 +510,6 @@ private static function showForPeripheral(CommonDBTM $peripheral, $withtemplate 'items_id_name' => 'items_id_asset', 'itemtype_name' => 'itemtype_asset', 'itemtypes' => $itemtypes, - 'onlyglobal' => $withtemplate, 'checkright' => true, 'entity_restrict' => $entities, 'used' => $used, @@ -523,6 +520,7 @@ private static function showForPeripheral(CommonDBTM $peripheral, $withtemplate 'peripheral' => $peripheral, 'dropdown_params' => $dropdown_params, 'btn_label' => _sx('button', 'Connect'), + 'withtemplate' => (int) $withtemplate === 1 ? 1 : 0, ]; // language=Twig echo TemplateRenderer::getInstance()->renderFromStringTemplate(<< {{ fields.dropdownItemsFromItemtypes('', label, dropdown_params) }} - - - - {% if withtemplate %} - {{ fields.hidden('', '_no_history', 1) }} - {% endif %} + {{ fields.hiddenField('items_id_peripheral', peripheral.getID()) }} + {{ fields.hiddenField('itemtype_peripheral', peripheral.getType()) }} + {{ fields.hiddenField('_glpi_csrf_token', csrf_token()) }} + {{ withtemplate ? fields.hiddenField('_no_history', 1) }}