Skip to content

Commit

Permalink
Fix bug when approving series. See GitHub Issue #3549.
Browse files Browse the repository at this point in the history
  • Loading branch information
campbell-m committed Oct 31, 2023
1 parent c632983 commit 95275e6
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions web/functions_ical.inc
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,9 @@ function create_ical_event(string $method, array $data, ?array $addresses=null,
// Type
$results[] = "X-MRBS-TYPE:" . RFC5545::escapeText(get_type_vocab($data['type']));
// Registration properties
$properties = array(
if (isset($data['allow_registration']))
{
$properties = array(
'allow_registration',
'registrant_limit',
'registrant_limit_enabled',
Expand All @@ -598,19 +600,18 @@ function create_ical_event(string $method, array $data, ?array $addresses=null,
'registration_closes',
'registration_closes_enabled'
);
foreach ($properties as $property)
{
$results[] = "X-MRBS-" . strtoupper(str_replace('_', '-', $property)) . ":" . $data[$property];
}
// Registrants (but only for individual entries)
if (!$series)
{
$registrants = get_registrants($data['id'], false);
foreach ($registrants as $registrant) {
// We can't use the ATTENDEE property because its value has to be a URI.
$results[] = "X-MRBS-REGISTRANT;X-MRBS-REGISTERED=" . $registrant['registered'] .
';' . 'X-MRBS-CREATE-BY=' . RFC5545::escapeQuotedString($registrant['create_by']) .
':' . RFC5545::escapeText($registrant['username']);
foreach ($properties as $property) {
$results[] = "X-MRBS-" . strtoupper(str_replace('_', '-', $property)) . ":" . $data[$property];
}
// Registrants (but only for individual entries)
if (!$series) {
$registrants = get_registrants($data['id'], false);
foreach ($registrants as $registrant) {
// We can't use the ATTENDEE property because its value has to be a URI.
$results[] = "X-MRBS-REGISTRANT;X-MRBS-REGISTERED=" . $registrant['registered'] .
';' . 'X-MRBS-CREATE-BY=' . RFC5545::escapeQuotedString($registrant['create_by']) .
':' . RFC5545::escapeText($registrant['username']);
}
}
}

Expand Down

0 comments on commit 95275e6

Please sign in to comment.