Skip to content

Commit 6cf94f1

Browse files
committed
Check if set_solution_tech is enabled
1 parent 510bc56 commit 6cf94f1

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/Controller.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -366,19 +366,21 @@ public static function requireFieldsToClose(CommonDBTM $item, bool $is_solution
366366

367367
// Check for required technician
368368
if ($conf->fields['require_technician_to_close' . $configSuffix] == 1) {
369-
if (is_a($userClass, CommonDBTM::class, true)) {
369+
if ($is_solution && $itemtype === 'Ticket' && !empty($_SESSION['glpiset_solution_tech'])) {
370+
// GLPI will auto-assign the solution author as technician in post_addItem
371+
} elseif (is_a($userClass, CommonDBTM::class, true)) {
370372
$tech = new $userClass();
373+
$techs = $tech->find([
374+
$itemIdField => $data['id'],
375+
'type' => CommonITILActor::ASSIGN,
376+
]);
377+
if (count($techs) == 0) {
378+
$message .= '- ' . __s('Technician') . '<br>';
379+
}
371380
} else {
372381
// If the user class is not valid, skip this check
373382
return false;
374383
}
375-
$techs = $tech->find([
376-
$itemIdField => $data['id'],
377-
'type' => CommonITILActor::ASSIGN,
378-
]);
379-
if (count($techs) == 0) {
380-
$message .= '- ' . __s('Technician') . '<br>';
381-
}
382384
}
383385

384386
// Check for required technician group

0 commit comments

Comments
 (0)