Skip to content

Commit

Permalink
BAT-style event end dates
Browse files Browse the repository at this point in the history
  • Loading branch information
acrollet committed May 4, 2016
1 parent b50016b commit 508556e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions roomify_channel_ical.module
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,15 @@ function roomify_channel_ical_update_availability($data) {
$state = bat_event_load_state_by_machine_name(NOT_AVAILABLE);
}

// Modify end date for how BAT needs it.
$event_end_date = new DateTime($event->endDate);
$event_end_date->sub(new DateInterval('PT1M'));

$bat_type = bat_type_load($data['type_id']);
$bat_event = bat_event_create(array(
'type' => 'availability',
'start_date' => $event->startDate,
'end_date' => $event->endDate,
'end_date' => $event_end_date->format('Y-m-d H:i:s'),
'uid' => $bat_type->uid,
'created' => REQUEST_TIME,
));
Expand Down Expand Up @@ -356,7 +360,6 @@ function roomify_channel_ical_update_availability($data) {
'field_summary' => array(LANGUAGE_NONE => array(0 => array('value' => $event->summary))),
'field_ical_type' => array(LANGUAGE_NONE => array(0 => array('value' => $data['ical_type']))),
);

$booking = bat_booking_create($booking);
$booking->save();

Expand Down

0 comments on commit 508556e

Please sign in to comment.