From 65f50b2d41e38c1525d566b92d64b56db2222374 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 8 Jun 2016 10:51:24 -0400 Subject: [PATCH] Adding to end date for recurring events If the event has $recurring_event set to true and the from and to dates are the same then adjust the end date to 2 years out. --- models/admin/management/events.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/models/admin/management/events.php b/models/admin/management/events.php index 1f54ae4..8670b0b 100644 --- a/models/admin/management/events.php +++ b/models/admin/management/events.php @@ -1352,7 +1352,7 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement }else if ( preg_match( ';BYday=(.*);', $rule, $matches ) ) { - echo '
$matches: ' . print_r($matches, true) . '
'; + echo '
1354 $matches: ' . print_r($matches, true) . '
'; // check if the selection is the nth week with a selected day, if not parse the input as a list if selected days if(strpos($matches[1], ",") == false){ @@ -1402,6 +1402,12 @@ class GlmMembersAdmin_management_events extends GlmDataEventsManagement $serialized_custom_times = serialize($stamp); } } + if ($recurring_event && $from_date == $to_date ) { + // Add two years to the recurring event if dates match + $starting_datetime = new DateTime( $from_date ); + $ending_date = $starting_datetime->modify('2 years'); + $to_date = $ending_date->format( 'Y-m-d' ); + } $all_day = $event_data['allday']; // for the recurrences part $recur_data = array( -- 2.17.1