Skip to content
Snippets Groups Projects
Commit ecf69312 authored by Jared Hancock's avatar Jared Hancock
Browse files

staff: Cleanup staff-dept records on staff deletion

parent b3d09b6e
No related branches found
No related tags found
No related merge requests found
...@@ -692,6 +692,11 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { ...@@ -692,6 +692,11 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
->filter(array('staff_id'=>$this->getId())) ->filter(array('staff_id'=>$this->getId()))
->delete(); ->delete();
// Cleanup staff dept access
StaffDeptAccess::objects()
->filter(array('staff_id'=>$this->getId()))
->delete();
return true; return true;
} }
......
...@@ -419,6 +419,8 @@ $('#add_extended_access').find('button').on('click', function() { ...@@ -419,6 +419,8 @@ $('#add_extended_access').find('button').on('click', function() {
if ($dept) { if ($dept) {
$members = $dept->members->all(); $members = $dept->members->all();
foreach ($dept->extended as $x) { foreach ($dept->extended as $x) {
if (!$x->staff)
continue;
$members[] = new AnnotatedModel($x->staff, array( $members[] = new AnnotatedModel($x->staff, array(
'alerts' => $x->isAlertsEnabled(), 'alerts' => $x->isAlertsEnabled(),
'role_id' => $x->role_id, 'role_id' => $x->role_id,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment