Add support for fetching self-serve status in departments and include it in guest route responses

This commit is contained in:
Jeppe Bundgaard
2026-03-02 13:13:55 +01:00
parent 3d4f9d9973
commit 24842ceaee
2 changed files with 15 additions and 0 deletions
@@ -75,6 +75,19 @@ class departments_o extends db
redis->clear_departments();
}
/**
* @throws Exception
* @return bool true if self-serve is enabled, false if it is disabled
*/
public function getSelfServeEnabled(): bool
{
self::requireSelected();
// Get the department variable
$department_variables = (new department_variables_o())->selectDepartment($this->id);
$enabled = $department_variables->getVariable('selfserve_enabled');
return $enabled === true;
}
/**
* Get the object properties of the department
* @throws Exception If the object is not selected
+2
View File
@@ -63,6 +63,8 @@ class guestRoute
// If including lane status, fetch it
if ($include_lane_status) {
$department = $departments->select((int)$department_array['id']);
// Include the status of self-serve in the department (disabled, when staffed hours)
$additional_data['self_serve_enabled'] = (bool)$department->getSelfServeEnabled();
$additional_data['lanes'] = array_map(
/**
* @param department_lanes_o $lane