Add support for fetching self-serve status in departments and include it in guest route responses
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user