dev/event#6 Follow the 'same email' participants config setting for backend participants
[civicrm-core.git] / CRM / Event / Form / Participant.php
index 02b6a75f2f3fa3c0306cfea893170f064d66dac8..fca8bbf34230c601a7d52672d9fecc7d789bc6df 100644 (file)
@@ -863,7 +863,12 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
       }
 
       $eventId = CRM_Utils_Array::value('event_id', $values);
-      if (!empty($contactId) && !empty($eventId)) {
+
+      $event = new CRM_Event_DAO_Event();
+      $event->id = $eventId;
+      $event->find(TRUE);
+
+      if (!$event->allow_same_participant_emails && !empty($contactId) && !empty($eventId)) {
         $cancelledStatusID = CRM_Core_PseudoConstant::getKey('CRM_Event_BAO_Participant', 'status_id', 'Cancelled');
         $dupeCheck = new CRM_Event_BAO_Participant();
         $dupeCheck->contact_id = $contactId;