Skip to content

Commit

Permalink
Fix bug when an admin user makes a booking and bookings are forced to…
Browse files Browse the repository at this point in the history
… be private. See GitHub Issue #3770.
  • Loading branch information
campbell-m committed Oct 31, 2024
1 parent cd0a916 commit c0c000e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions web/edit_entry_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,19 @@ function invalid_booking(string $message) : void
$month_relative = $month_relative_ord . $month_relative_day;
}

// Handle private booking
// Enforce config file settings if needed
if ($private_mandatory && !is_book_admin())
// Handle private bookings.
// If the area settings allow users to make private bookings then use the value from
// the form, unless the privacy status is forced and the user is not an admin (admins
// are allowed to make public bookings if they want, even if the status is forced).
// Otherwise the booking is not private, unless the status is forced, in which case
// the default applies, whether or not the user is an admin.
if ($private_enabled)
{
$isprivate = $private_default;
$isprivate = (!is_book_admin() && $private_mandatory) ? $private_default : (bool) $private;
}
else
{
$isprivate = (bool) $private;
$isprivate = ($private_mandatory) ? $private_default : false;
}

// Make sure the area corresponds to the room that is being booked
Expand Down

0 comments on commit c0c000e

Please sign in to comment.