Skip to content

Commit

Permalink
Merge pull request #98 from compucorp/mmb-284-remove-date-checks
Browse files Browse the repository at this point in the history
MMB-284: Remove Date Checks From Valid Membership Query
  • Loading branch information
shahrukh-compuco authored Oct 30, 2024
2 parents c7adebb + e0cbaed commit 2ece640
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions CRM/Certificate/Service/CertificateMembership.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ private function getValidMembershipsForCertificate(int $certificateId, int $cont

$query = Membership::get(FALSE)
->addSelect('start_date', 'end_date')
->addWhere('contact_id', '=', $contactId)
->addClause('OR', ['start_date', 'IS NULL'], ['start_date', '<=', 'now'])
->addClause('OR', ['end_date', 'IS NULL'], ['end_date', '>', 'now']);
->addWhere('contact_id', '=', $contactId);

if (!empty($certificates[0]['entityTypes'])) {
$query->addWhere('membership_type_id', 'IN', explode(',', $certificates[0]['entityTypes']));
Expand Down

0 comments on commit 2ece640

Please sign in to comment.