Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion inc/link.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,20 @@ 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
$allow_multiple_link = isset($ma->POST['add_items']) && $ma->POST['add_items'] !== [] && array_reduce(
$ma->POST['add_items'],
fn($carry, $data) => $carry && in_array(
$data['itemtype'] ?? '',
['ConsumableItem', 'CartridgeItem'],
true,
),
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);
Expand Down
1 change: 0 additions & 1 deletion inc/order.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down