CRM-20648 Applied check exclusively to cancelled status
authorEdsel <edsel.lopez@jmaconsulting.biz>
Thu, 20 Jul 2017 12:59:42 +0000 (18:29 +0530)
committerdeb.monish <monish.deb@jmaconsulting.biz>
Thu, 20 Jul 2017 13:12:25 +0000 (18:42 +0530)
----------------------------------------
* CRM-20648: Allow registration in event with cancelled registration
  https://issues.civicrm.org/jira/browse/CRM-20648

CRM/Event/Form/Participant.php

index fe4862471e3601e2fe7a402a9266fb16442e659c..7a0fcb1b45406c85d631753ddf63cc90f2c82d21 100644 (file)
@@ -858,12 +858,11 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
 
       $eventId = CRM_Utils_Array::value('event_id', $values);
       if (!empty($contactId) && !empty($eventId)) {
-        $positiveStatus = CRM_Core_PseudoConstant::get('CRM_Event_BAO_Participant', 'status_id', array('condition' => ' is_counted = 1 '));
-        $statusClause = "status_id IN (" . implode(',', array_keys($positiveStatus)) . ")";
+        $cancelledStatusID = CRM_Core_PseudoConstant::getKey('CRM_Event_BAO_Participant', 'status_id', 'Cancelled');
         $dupeCheck = new CRM_Event_BAO_Participant();
         $dupeCheck->contact_id = $contactId;
         $dupeCheck->event_id = $eventId;
-        $dupeCheck->whereAdd("{$statusClause}");
+        $dupeCheck->whereAdd("status_id != {$cancelledStatusID} ");
         $dupeCheck->find(TRUE);
         if (!empty($dupeCheck->id)) {
           $errorMsg['event_id'] = ts("This contact has already been assigned to this event.");