Skip to content

Commit

Permalink
Leaf 4486 - include national disabled employees
Browse files Browse the repository at this point in the history
  • Loading branch information
jampaul3 committed Dec 18, 2024
1 parent 46f913e commit 47bd952
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions LEAF_Nexus/sources/Employee.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,12 @@ private function updateEmployeeDataBatch(array $local_employees): array

$this->prepareArrays($national_employee_uids, $local_array, $national_employees_list, $local_employee_array);

$users = $this->updateDisabledEmployees();

$local_deleted_employees = array_diff(array_column($local_employees_uid, 'userName'), array_column($national_employees_list, 'userName'));

$local_deleted_employees = array_merge($local_deleted_employees, $users);

if (!empty($local_deleted_employees)) {
$results[] = $this->disableEmployees($local_deleted_employees);

Expand All @@ -284,6 +288,25 @@ private function updateEmployeeDataBatch(array $local_employees): array
return $results;
}

private function updateDisabledEmployees(): array
{
$vars = array();
$sql = 'SELECT `userName`
FROM `employee`
WHERE `deleted` > 0
AND LEFT(`userName`, 9) <> "disabled_"';

$res = $this->db->prepared_query($sql, $vars);

$userNames = array();

foreach ($res as $user) {
$userNames[] = $user['userName'];
}

return $userNames;
}

private function disablePortalTables(): void
{
$portals = $this->getPortals();
Expand Down

0 comments on commit 47bd952

Please sign in to comment.