Skip to content

Conversation

@cgutteridge
Copy link
Contributor

fix to AND OR logic to ensure booking-end-reminders are not sent for cancelled reservations

without the added brackets the rs.status_id <> 2 only applies to slot start reminders, not slot end.

fix to AND OR logic to ensure booking-end-reminders are not sent for
cancelled reservations

without the added brackets the rs.status_id <> 2 only applies to slot
start reminders, not slot end.

Closes: LibreBooking#768
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a logical error in the SQL query for reservation reminders to prevent sending booking-end-reminders for cancelled reservations. The issue was caused by incorrect operator precedence in the WHERE clause.

  • Fixed AND/OR operator precedence by adding parentheses to ensure cancelled reservation filter applies to both start and end reminders
Comments suppressed due to low confidence (1)

lib/Database/Commands/Queries.php:672

  • The closing parenthesis at the end of the line appears to be an extra parenthesis. The WHERE clause now has unbalanced parentheses - there are 5 opening parentheses but 6 closing parentheses.
		WHERE `rs`.`status_id` <> 2 AND ((`reminder_type` = @reminder_type AND @reminder_type=0 AND date_sub(`start_date`,INTERVAL `rr`.`minutes_prior` MINUTE) = @current_date) OR (`reminder_type` = @reminder_type AND @reminder_type=1 AND date_sub(`end_date`,INTERVAL `rr`.`minutes_prior` MINUTE) = @current_date))';

Copy link
Contributor

@JohnVillalovos JohnVillalovos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cgutteridge

LGTM (Looks Good To Me)

I did fix the commit message and rebase it to get rid of the merge commit.

@JohnVillalovos JohnVillalovos merged commit fef3233 into LibreBooking:develop Jul 31, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants