You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Mods-for-HESK-Netsyms/api/BusinessLogic/Tickets/Autoassigner.php

37 lines
941 B
PHP

<?php
namespace BusinessLogic\Tickets;
use BusinessLogic\Security\UserContext;
use DataAccess\Categories\CategoryGateway;
use DataAccess\Security\UserGateway;
class Autoassigner {
/* @var $categoryGateway CategoryGateway */
private $categoryGateway;
/* @var $userGateway UserGateway */
private $userGateway;
function __construct($categoryGateway, $userGateway) {
$this->categoryGateway = $categoryGateway;
$this->userGateway = $userGateway;
}
/**
* @param $categoryId int
* @param $heskSettings array
* @return UserContext the user who is assigned, or null if no user should be assigned
*/
function getNextUserForTicket($categoryId, $heskSettings) {
if (!$heskSettings['autoassign']) {
return null;
}
$potentialUsers = $this->userGateway->getUsersByNumberOfOpenTickets($heskSettings);
return $potentialUsers[0];
}
}