diff --git a/CHANGELOG.md b/CHANGELOG.md index 27e7fc1c76..795800c7ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [UNRELEASED] + +### Added +- Add grouped actions to link consumables and related items + ## [2.12.8] - 2026-06-24 ### Added diff --git a/inc/link.class.php b/inc/link.class.php index 8209d5ae94..5468350fb4 100644 --- a/inc/link.class.php +++ b/inc/link.class.php @@ -633,7 +633,17 @@ public static function processMassiveActionsForOneItemtype( break; case 'createLink': - if (count($ids) > 1) { + // For consumables and cartridges, createLinkWithItem creates a new item + // (glpi_consumables/glpi_cartridges) for each selected detail line; + // therefore, multiple items can be linked to the same reference item at once + $first_item_data = reset($ma->POST['add_items']); + $allow_multiple_link = is_array($first_item_data) && in_array( + $first_item_data['itemtype'] ?? '', + ['ConsumableItem', 'CartridgeItem'], + true, + ); + + if (!$allow_multiple_link && count($ids) > 1) { $ma->addMessage(__s("Cannot link several items to one detail line", "order")); foreach ($ids as $id) { $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO); diff --git a/inc/order.class.php b/inc/order.class.php index c3fafe8757..15f6e1be35 100644 --- a/inc/order.class.php +++ b/inc/order.class.php @@ -1825,7 +1825,6 @@ public function generateOrder($params) $this->getFromDB($ID); if (file_exists(PLUGIN_ORDER_TEMPLATE_CUSTOM_DIR . "custom.php")) { - // @phpstan-ignore-next-line: custom.php is not a file or it does not exist. include_once(PLUGIN_ORDER_TEMPLATE_CUSTOM_DIR . "custom.php"); }