Restaurant Reservations - Version 2.1.21

Version Description

(2020-09-01) = - Corrects issue from last update causing admins to not be able to edit bookings

Download this release

Release Info

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

Code changes from version 2.1.20 to 2.1.21

includes/Booking.class.php CHANGED
@@ -776,6 +776,9 @@ class rtbBooking {
776
 
777
  $times = array();
778
  foreach ( $query->get_bookings() as $booking ) {
 
 
 
779
  $times[] = strtotime( $booking->date );
780
  }
781
 
@@ -784,6 +787,7 @@ class rtbBooking {
784
  $accept_reservation = true;
785
  $current_times = array();
786
  foreach ( $times as $time ) {
 
787
  $current_times[] = $time;
788
 
789
  if ( reset( $current_times ) < ($time - $dining_block_seconds) ) { array_shift( $current_times ); }
@@ -834,6 +838,9 @@ class rtbBooking {
834
 
835
  $times = array();
836
  foreach ( $query->get_bookings() as $booking ) {
 
 
 
837
  $booking_time = strtotime( $booking->date );
838
  if ( isset( $times[$booking_time] ) ) { $times[$booking_time] += $booking->party; }
839
  else { $times[$booking_time] = $booking->party; }
@@ -844,6 +851,7 @@ class rtbBooking {
844
  $accept_reservation = true;
845
  $current_seats = array();
846
  foreach ( $times as $time => $seats ) {
 
847
  $current_seats[$time] = $seats;
848
 
849
  reset( $current_seats );
@@ -867,19 +875,26 @@ class rtbBooking {
867
  public function is_duplicate_booking() {
868
  global $wpdb;
869
 
870
- $booking_result = $wpdb->get_row( $wpdb->prepare(
871
- "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_date=%s AND post_title=%s",
872
  RTB_BOOKING_POST_TYPE,
873
  $this->date,
874
  $this->name
875
- ) );
 
 
 
 
 
 
 
876
 
877
  if ( $booking_result ) {
878
 
879
  $meta = get_post_meta( $booking_result->ID, 'rtb', true );
880
  $meta = is_array( $meta ) ? $meta : array();
881
 
882
- if ( $this->party = $meta['party'] and $this->email = $meta['email'] and $this->phone = $meta['phone'] ) {
883
 
884
  return true;
885
  }
776
 
777
  $times = array();
778
  foreach ( $query->get_bookings() as $booking ) {
779
+
780
+ if ( isset( $this->ID ) and $booking->ID == $this->ID ) { continue; }
781
+
782
  $times[] = strtotime( $booking->date );
783
  }
784
 
787
  $accept_reservation = true;
788
  $current_times = array();
789
  foreach ( $times as $time ) {
790
+
791
  $current_times[] = $time;
792
 
793
  if ( reset( $current_times ) < ($time - $dining_block_seconds) ) { array_shift( $current_times ); }
838
 
839
  $times = array();
840
  foreach ( $query->get_bookings() as $booking ) {
841
+
842
+ if ( isset( $this->ID ) and $booking->ID == $this->ID ) { continue; }
843
+
844
  $booking_time = strtotime( $booking->date );
845
  if ( isset( $times[$booking_time] ) ) { $times[$booking_time] += $booking->party; }
846
  else { $times[$booking_time] = $booking->party; }
851
  $accept_reservation = true;
852
  $current_seats = array();
853
  foreach ( $times as $time => $seats ) {
854
+
855
  $current_seats[$time] = $seats;
856
 
857
  reset( $current_seats );
875
  public function is_duplicate_booking() {
876
  global $wpdb;
877
 
878
+ $sql = "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_date=%s AND post_title=%s";
879
+ $args = array(
880
  RTB_BOOKING_POST_TYPE,
881
  $this->date,
882
  $this->name
883
+ );
884
+
885
+ if ( isset( $this->ID ) ) {
886
+ $sql .= ' AND ID!=%d';
887
+ $args[] = $this->ID;
888
+ }
889
+
890
+ $booking_result = $wpdb->get_row( $wpdb->prepare( $sql, $args ) );
891
 
892
  if ( $booking_result ) {
893
 
894
  $meta = get_post_meta( $booking_result->ID, 'rtb', true );
895
  $meta = is_array( $meta ) ? $meta : array();
896
 
897
+ if ( $this->party == $meta['party'] and $this->email == $meta['email'] and $this->phone == $meta['phone'] ) {
898
 
899
  return true;
900
  }
readme.txt CHANGED
@@ -196,6 +196,9 @@ Find answers to even more questions in the [FAQ](http://doc.fivestarplugins.com/
196
 
197
  == Changelog ==
198
 
 
 
 
199
  = 2.1.20 (2020-08-31) =
200
  - It now shows the section label for combined tables.
201
  - It now disallows bookings with the exact same information (date, time, party, name, email & phone), to prevent duplicate bookings when the page is refreshed.
196
 
197
  == Changelog ==
198
 
199
+ = 2.1.21 (2020-09-01) =
200
+ - Corrects issue from last update causing admins to not be able to edit bookings
201
+
202
  = 2.1.20 (2020-08-31) =
203
  - It now shows the section label for combined tables.
204
  - It now disallows bookings with the exact same information (date, time, party, name, email & phone), to prevent duplicate bookings when the page is refreshed.
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.1.20
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.1.21
7
  * Author: FiveStarPlugins
8
  * Author URI: https://profiles.wordpress.org/fivestarplugins/
9
  * Text Domain: restaurant-reservations