Skip to content

Commit

Permalink
Merge pull request #229 from Chrisincr/161---Limit-Authorization-requ…
Browse files Browse the repository at this point in the history
…ests-to-single-open-request-per-authorization

Prevents adding multiple requests for same authorization by a member
  • Loading branch information
jhandel authored Oct 22, 2024
2 parents 64f8c5b + 9608164 commit 89e4bef
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ public function request(
return false;
}
}
//Checking for existing pending requests
$existingRequests = $table
->find()
->where([
"member_id" => $requesterId,
"activity_id" => $activityId,
"status" => Authorization::PENDING_STATUS
])
->count();
if ($existingRequests > 0) {
return false;
}


$auth = $table->newEmptyEntity();
$auth->member_id = $requesterId;
$auth->activity_id = $activityId;
Expand Down Expand Up @@ -534,4 +548,4 @@ private function saveAuthorizationApproval(
}

// endregion
}
}

0 comments on commit 89e4bef

Please sign in to comment.