CRM-19550 - CRM_Event_Form_Participant - Fix duplicate event registrations for standa...
authorThomas Schüttler <tschuettler@oxfam.de>
Thu, 20 Oct 2016 13:09:55 +0000 (15:09 +0200)
committerThomas Schüttler <tschuettler@oxfam.de>
Thu, 20 Oct 2016 13:09:55 +0000 (15:09 +0200)
CRM/Event/Form/Participant.php

index cd783ac25149964bc39160a0c5bcf3eed3d82341..cf8fe5a4bc70ba27d67cecddd12769ce62be5e21 100644 (file)
@@ -841,9 +841,15 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
       }
     }
     // For single additions - show validation error if the contact has already been registered
-    // for this event with the same role.
+    // for this event.
     if ($self->_single && ($self->_action & CRM_Core_Action::ADD)) {
-      $contactId = $self->_contactId;
+      if ($self->_context == 'standalone') {
+        $contactId = CRM_Utils_Array::value('contact_id', $values);
+      }
+      else {
+        $contactId = $self->_contactId;
+      }
+
       $eventId = CRM_Utils_Array::value('event_id', $values);
       if (!empty($contactId) && !empty($eventId)) {
         $dupeCheck = new CRM_Event_BAO_Participant();