From ce5694b5ae5511baab9c309fe9d55b249963cffd Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Wed, 12 Aug 2015 18:41:15 +0530 Subject: [PATCH] CRM-17009 -- event registration doesn't respect reg end date --- CRM/Event/Form/Registration.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index ff49b532fe..1576d668f7 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -1511,12 +1511,16 @@ WHERE v.option_group_id = g.id CRM_Core_Error::statusBounce(ts('Registration for this event begins on %1', array(1 => CRM_Utils_Date::customFormat(CRM_Utils_Array::value('registration_start_date', $this->_values['event'])))), $redirect); } - $endDate = CRM_Utils_Date::processDate(CRM_Utils_Array::value('registration_end_date', + $regEndDate = CRM_Utils_Date::processDate(CRM_Utils_Array::value('registration_end_date', $this->_values['event'] )); $eventEndDate = CRM_Utils_Date::processDate(CRM_Utils_Array::value('event_end_date', $this->_values['event'])); - if ($endDate && ($endDate < $now) && !empty($eventEndDate) && ($eventEndDate < $now)) { - CRM_Core_Error::statusBounce(ts('Registration for this event ended on %1', array(1 => CRM_Utils_Date::customFormat(CRM_Utils_Array::value('registration_end_date', $this->_values['event'])))), $redirect); + if (($regEndDate && ($regEndDate < $now)) || (empty($regEndDate) && ($eventEndDate < $now))) { + $endDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('registration_end_date', $this->_values['event'])); + if (empty($regEndDate)) { + $endDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('event_end_date', $this->_values['event'])); + } + CRM_Core_Error::statusBounce(ts('Registration for this event ended on %1', array(1 => $endDate)), $redirect); } } -- 2.25.1