Restaurant Reservations - Version 2.2.11

Version Description

(2021-06-18) = - Fixed an issue with a fringe case scenario, in which, if max people was set to 1, an already-booked time slot might still show as available even though you couldn't book it.

Download this release

Release Info

Developer Rustaurius
Plugin Icon 128x128 Restaurant Reservations
Version 2.2.11
Comparing to
See all releases

Code changes from version 2.2.10 to 2.2.11

includes/Ajax.class.php CHANGED
@@ -266,13 +266,6 @@ if ( !class_exists( 'rtbAJAX' ) ) {
266
 
267
  $max_people_setting = $rtb_controller->settings->get_setting( 'rtb-max-people-count' );
268
  $max_people = (int) substr( $max_people_setting, 0, strpos( $max_people_setting, '_' ) );
269
- /**
270
- * min_party_size = 10, max_people = 100, 6 bookings of total 91 guests
271
- * Now, if anybody wants to book for at least 10 people, it is not possible
272
- * because the total will surpass the max_epopel (100)
273
- * thus reducing min_party_size from max_people
274
- */
275
- $max_people = $max_people - $min_party_size;
276
 
277
  $all_possible_slots = [];
278
  foreach ( $hours as $pair ) {
@@ -340,14 +333,24 @@ if ( !class_exists( 'rtbAJAX' ) ) {
340
 
341
  // Go through all bookings and figure out when we're at or above the
342
  // max reservation or max people and mark that slot as blocked
343
- if ( $max_reservations != 'undefined' and $max_reservations > 0 ) {
344
  foreach ( $all_bookings_by_slots as $slot => $data ) {
345
  if( $max_reservations <= $data['total_bookings'] ) {
346
  $all_blocked_slots[] = $slot;
347
  }
348
  }
349
  }
350
- else if ( $max_people != 'undefined' and $max_people != 0 ) {
 
 
 
 
 
 
 
 
 
 
351
  foreach ( $all_bookings_by_slots as $slot => $data ) {
352
  if( $max_people < $data['total_guest'] ) {
353
  $all_blocked_slots[] = $slot;
@@ -841,7 +844,7 @@ if ( !class_exists( 'rtbAJAX' ) ) {
841
  {
842
  global $rtb_controller;
843
 
844
- $response = function ($success = false, $msg, $data = []) {
845
  echo json_encode(
846
  array_merge(
847
  [
266
 
267
  $max_people_setting = $rtb_controller->settings->get_setting( 'rtb-max-people-count' );
268
  $max_people = (int) substr( $max_people_setting, 0, strpos( $max_people_setting, '_' ) );
 
 
 
 
 
 
 
269
 
270
  $all_possible_slots = [];
271
  foreach ( $hours as $pair ) {
333
 
334
  // Go through all bookings and figure out when we're at or above the
335
  // max reservation or max people and mark that slot as blocked
336
+ if ( isset( $max_reservations ) and $max_reservations > 0 ) {
337
  foreach ( $all_bookings_by_slots as $slot => $data ) {
338
  if( $max_reservations <= $data['total_bookings'] ) {
339
  $all_blocked_slots[] = $slot;
340
  }
341
  }
342
  }
343
+ else if ( isset( $max_people ) and $max_people > 0 ) {
344
+ /**
345
+ * min_party_size = 10, max_people = 100, 6 bookings of total 91 guests
346
+ * Now, if anybody wants to book for at least 10 people, it is not possible
347
+ * because the total will surpass the max_epopel (100)
348
+ * thus reducing min_party_size from max_people
349
+ *
350
+ * $max_people can be zero when min_party_size is same as max_people
351
+ */
352
+ $max_people = $max_people - $min_party_size;
353
+
354
  foreach ( $all_bookings_by_slots as $slot => $data ) {
355
  if( $max_people < $data['total_guest'] ) {
356
  $all_blocked_slots[] = $slot;
844
  {
845
  global $rtb_controller;
846
 
847
+ $response = function ($success, $msg, $data = []) {
848
  echo json_encode(
849
  array_merge(
850
  [
includes/Booking.class.php CHANGED
@@ -830,7 +830,7 @@ class rtbBooking {
830
  if ( ! $max_reservations_enabled ) { return true; }
831
 
832
  $max_seats_setting = $rtb_controller->settings->get_setting( 'rtb-max-people-count' );
833
- $max_seats = substr( $max_seats_setting, 0, strpos( $max_seats_setting, '_' ) );
834
 
835
  if ( $max_seats == 'undefined' or ! $max_seats ) { return true; }
836
  if ( $this->party > $max_seats ) { return false; }
@@ -861,7 +861,7 @@ class rtbBooking {
861
 
862
  $booking_time = strtotime( $booking->date );
863
  if ( isset( $times[$booking_time] ) ) { $times[$booking_time] += $booking->party; }
864
- else { $times[$booking_time] = $booking->party; }
865
  }
866
 
867
  ksort( $times );
830
  if ( ! $max_reservations_enabled ) { return true; }
831
 
832
  $max_seats_setting = $rtb_controller->settings->get_setting( 'rtb-max-people-count' );
833
+ $max_seats = (int) substr( $max_seats_setting, 0, strpos( $max_seats_setting, '_' ) );
834
 
835
  if ( $max_seats == 'undefined' or ! $max_seats ) { return true; }
836
  if ( $this->party > $max_seats ) { return false; }
861
 
862
  $booking_time = strtotime( $booking->date );
863
  if ( isset( $times[$booking_time] ) ) { $times[$booking_time] += $booking->party; }
864
+ else { $times[$booking_time] = (int) $booking->party; }
865
  }
866
 
867
  ksort( $times );
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: FiveStarPlugins
3
  Requires at Least: 4.4
4
  Tested Up To: 5.7
5
  Tags: reservation, reservations, restaurant reservations, reservation form, restaurant booking, restaurant reservation form, restaurant booking form, restaurant booking system, reservation system, online reservations, online restaurant booking, dinner reservations, restaurant form, gutenberg reservations, gutenberg restaurant reservations, gutenberg restaurant booking, mobile reservations, responsive reservations, table reservations, open table, book table, reserve table, easy reservations, simple reservations, quick restaurant reservations, custom reservation form, custom restaurant reservations
6
- Stable tag: 2.2.10
7
  License: GPLv3
8
  License URI:http://www.gnu.org/licenses/gpl-3.0.html
9
  Donate Link: https://www.etoilewebdesign.com/plugin-donations/
@@ -197,6 +197,9 @@ Find answers to even more questions in the [FAQ](http://doc.fivestarplugins.com/
197
 
198
  == Changelog ==
199
 
 
 
 
200
  = 2.2.10 (2021-06-17) =
201
  - Fixed an issue causing incorrect available time slots between two full time slots when there were overlapping bookings.
202
  - Fixed an an issue in which the value for a checkbox type custom field wasn't saving if you cleared/unselected all options.
3
  Requires at Least: 4.4
4
  Tested Up To: 5.7
5
  Tags: reservation, reservations, restaurant reservations, reservation form, restaurant booking, restaurant reservation form, restaurant booking form, restaurant booking system, reservation system, online reservations, online restaurant booking, dinner reservations, restaurant form, gutenberg reservations, gutenberg restaurant reservations, gutenberg restaurant booking, mobile reservations, responsive reservations, table reservations, open table, book table, reserve table, easy reservations, simple reservations, quick restaurant reservations, custom reservation form, custom restaurant reservations
6
+ Stable tag: 2.2.11
7
  License: GPLv3
8
  License URI:http://www.gnu.org/licenses/gpl-3.0.html
9
  Donate Link: https://www.etoilewebdesign.com/plugin-donations/
197
 
198
  == Changelog ==
199
 
200
+ = 2.2.11 (2021-06-18) =
201
+ - Fixed an issue with a fringe case scenario, in which, if max people was set to 1, an already-booked time slot might still show as available even though you couldn't book it.
202
+
203
  = 2.2.10 (2021-06-17) =
204
  - Fixed an issue causing incorrect available time slots between two full time slots when there were overlapping bookings.
205
  - Fixed an an issue in which the value for a checkbox type custom field wasn't saving if you cleared/unselected all options.
restaurant-reservations.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Five Star Restaurant Reservations - WordPress Booking Plugin
4
  * Plugin URI: http://www.fivestarplugins.com/plugins/five-star-restaurant-reservations/
5
  * Description: Restaurant reservations made easy. Accept bookings online. Quickly confirm or reject reservations, send email notifications, set booking times and more.
6
- * Version: 2.2.10
7
  * Author: FiveStarPlugins
8
  * Author URI: https://profiles.wordpress.org/fivestarplugins/
9
  * Text Domain: restaurant-reservations
3
  * Plugin Name: Five Star Restaurant Reservations - WordPress Booking Plugin
4
  * Plugin URI: http://www.fivestarplugins.com/plugins/five-star-restaurant-reservations/
5
  * Description: Restaurant reservations made easy. Accept bookings online. Quickly confirm or reject reservations, send email notifications, set booking times and more.
6
+ * Version: 2.2.11
7
  * Author: FiveStarPlugins
8
  * Author URI: https://profiles.wordpress.org/fivestarplugins/
9
  * Text Domain: restaurant-reservations