Skip to content

Commit

Permalink
Merge pull request #370 from jhandel/HierarchicalSecurity
Browse files Browse the repository at this point in the history
Fix to handle deactivating "older" warrants when a new one is issued.
  • Loading branch information
MFrancisca authored Mar 4, 2025
2 parents 276d900 + 14b886f commit dbd177d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 19 additions & 1 deletion app/src/Services/WarrantManager/DefaultWarrantManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,24 @@ public function approve($warrant_roster_id, $approver_id): ServiceResult
$warrantRosterTable->getConnection()->rollback();
return new ServiceResult(false, "Failed to acivate warrants in Roster");
}
//expire current warrants for the same entity_type entity_id member_id
$warrantTable->updateAll(
[
'status' => Warrant::DEACTIVATED_STATUS,
'expires_on' => $warrant->start_on,
'revoked_reason' => "New Warrant Approved",
'revoker_id' => $approver_id
],
[
'entity_type' => $warrant->entity_type,
'entity_id' => $warrant->entity_id,
'member_id' => $warrant->member_id,
'status' => Warrant::CURRENT_STATUS,
'expires_on >=' => $warrant->start_on,
'start_on <=' => $warrant->start_on,
'id !=' => $warrant->id
]
);
$vars = [
"memberScaName" => $warrant->member->sca_name,
"warrantName" => $warrant->name,
Expand Down Expand Up @@ -415,4 +433,4 @@ protected function declineWarrant($warrantTable, $warrant, $rejecter_id, $reason
}
return new ServiceResult(true);
}
}
}
2 changes: 2 additions & 0 deletions app/templates/email/text/notify_of_warrant.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@

If this warrant is for an office that extends passed this warrant date, new warrants will be issued as needed.

This new warrant supersedes any previous warrants issued for for the subjects this warrant covers.

Thank you
<?= $siteAdminSignature ?>.

0 comments on commit dbd177d

Please sign in to comment.