Restaurant Reservations - Version 2.1.17

Version Description

(2020-07-20) = - Adding a {table} template tag for notification emails - Correcting an issue causing the selected table to not display in the edit booking window

Download this release

Release Info

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

Code changes from version 2.1.16 to 2.1.17

assets/js/admin.js CHANGED
@@ -143,6 +143,7 @@ jQuery(document).ready(function ($) {
143
  } else {
144
  rtb_booking_modal_submit.html( rtb_admin.strings.edit_booking );
145
  rtb_booking_modal.find( 'input[name=ID]' ).val( booking.ID );
 
146
  }
147
 
148
  $( 'body' ).addClass( 'rtb-hide-body-scroll' );
143
  } else {
144
  rtb_booking_modal_submit.html( rtb_admin.strings.edit_booking );
145
  rtb_booking_modal.find( 'input[name=ID]' ).val( booking.ID );
146
+ if ( rtb_pickadate.enable_tables ) { rtb_booking_form.update_possible_tables(); }
147
  }
148
 
149
  $( 'body' ).addClass( 'rtb-hide-body-scroll' );
assets/js/booking-form.js CHANGED
@@ -537,9 +537,11 @@ jQuery(document).ready(function ($) {
537
  //remove table combinations
538
  table_select.find('> option').each( function() {
539
  if ( $( this ).val().indexOf( ',' ) !== -1 ) { $( this ).remove(); }
540
- })
 
 
541
 
542
- var data = 'year=' + selected_date_year + '&month=' + selected_date_month + '&day=' + selected_date_date + '&time=' + selected_time + '&party=' + party + '&action=rtb_get_available_tables'; console.log(data);
543
  jQuery.post( ajaxurl, data, function( response ) {
544
  if ( ! response ) {
545
  return;
@@ -565,6 +567,11 @@ jQuery(document).ready(function ($) {
565
  }
566
 
567
  });
 
 
 
 
 
568
  });
569
  }
570
 
537
  //remove table combinations
538
  table_select.find('> option').each( function() {
539
  if ( $( this ).val().indexOf( ',' ) !== -1 ) { $( this ).remove(); }
540
+ });
541
+
542
+ var booking_id = $( '.rtb-booking-form form input[name="ID"]').length ? $( '.rtb-booking-form form input[name="ID"]').val() : 0;
543
 
544
+ var data = 'booking_id=' + booking_id + '&year=' + selected_date_year + '&month=' + selected_date_month + '&day=' + selected_date_date + '&time=' + selected_time + '&party=' + party + '&action=rtb_get_available_tables';
545
  jQuery.post( ajaxurl, data, function( response ) {
546
  if ( ! response ) {
547
  return;
567
  }
568
 
569
  });
570
+
571
+ if ( response.selected_table != -1 ) {
572
+ table_select.val( response.selected_table );
573
+ }
574
+
575
  });
576
  }
577
 
includes/Ajax.class.php CHANGED
@@ -548,11 +548,12 @@ if ( !class_exists( 'rtbAJAX' ) ) {
548
 
549
  $tables = $rtb_controller->settings->get_sorted_tables();
550
 
551
- $this->year = isset( $_POST['year'] ) ? sanitize_text_field( $_POST['year'] ) : false;
552
- $this->month = isset( $_POST['month'] ) ? sanitize_text_field( $_POST['month'] ) : false;
553
- $this->day = isset( $_POST['day'] ) ? sanitize_text_field( $_POST['day'] ) : false;
554
- $this->time = isset( $_POST['time'] ) ? sanitize_text_field( $_POST['time'] ) : false;
555
- $this->party = isset( $_POST['party'] ) ? sanitize_text_field( $_POST['party'] ) : false;
 
556
 
557
  /*$this->year = 2020;
558
  $this->month = 06;
@@ -566,6 +567,16 @@ if ( !class_exists( 'rtbAJAX' ) ) {
566
 
567
  $valid_tables = rtb_get_valid_tables( $datetime );
568
 
 
 
 
 
 
 
 
 
 
 
569
  if ( isset( $this->party ) ) {
570
 
571
  $possible_combinations = array();
@@ -591,7 +602,9 @@ if ( !class_exists( 'rtbAJAX' ) ) {
591
  $return_tables = $this->format_tables( $valid_tables );
592
  }
593
 
594
- $response = (object) array( 'available_tables' => $return_tables);
 
 
595
 
596
  echo json_encode($response);
597
 
548
 
549
  $tables = $rtb_controller->settings->get_sorted_tables();
550
 
551
+ $this->booking_id = isset( $_POST['booking_id'] ) ? intval( $_POST['booking_id'] ) : 0;
552
+ $this->year = isset( $_POST['year'] ) ? sanitize_text_field( $_POST['year'] ) : false;
553
+ $this->month = isset( $_POST['month'] ) ? sanitize_text_field( $_POST['month'] ) : false;
554
+ $this->day = isset( $_POST['day'] ) ? sanitize_text_field( $_POST['day'] ) : false;
555
+ $this->time = isset( $_POST['time'] ) ? sanitize_text_field( $_POST['time'] ) : false;
556
+ $this->party = isset( $_POST['party'] ) ? sanitize_text_field( $_POST['party'] ) : false;
557
 
558
  /*$this->year = 2020;
559
  $this->month = 06;
567
 
568
  $valid_tables = rtb_get_valid_tables( $datetime );
569
 
570
+ if ( $this->booking_id ) {
571
+
572
+ require_once( RTB_PLUGIN_DIR . '/includes/Booking.class.php' );
573
+
574
+ $current_booking = new rtbBooking();
575
+ $current_booking->load_post( $this->booking_id );
576
+
577
+ if ( $current_booking->table ) { $valid_tables = array_merge( $valid_tables, $current_booking->table ); }
578
+ }
579
+
580
  if ( isset( $this->party ) ) {
581
 
582
  $possible_combinations = array();
602
  $return_tables = $this->format_tables( $valid_tables );
603
  }
604
 
605
+ $selected_table = ( isset( $current_booking ) and $current_booking->table ) ? implode(',', $current_booking->table ) : -1;
606
+
607
+ $response = (object) array( 'available_tables' => $return_tables, 'selected_table' => $selected_table );
608
 
609
  echo json_encode($response);
610
 
includes/Booking.class.php CHANGED
@@ -83,7 +83,7 @@ class rtbBooking {
83
  'ip' => '',
84
  'consent_acquired' => '',
85
  'deposit' => '0',
86
- 'table' => '',
87
  'payment_failure_message' => '',
88
  'receipt_id' => '',
89
  'reminder_sent' => false,
83
  'ip' => '',
84
  'consent_acquired' => '',
85
  'deposit' => '0',
86
+ 'table' => array(),
87
  'payment_failure_message' => '',
88
  'receipt_id' => '',
89
  'reminder_sent' => false,
includes/Notification.class.php CHANGED
@@ -95,6 +95,7 @@ abstract class rtbNotification {
95
  '{user_email}' => $this->booking->email,
96
  '{user_name}' => $this->booking->name,
97
  '{party}' => $this->booking->party,
 
98
  '{date}' => $this->booking->format_date( $this->booking->date ),
99
  '{phone}' => $this->booking->phone,
100
  '{message}' => $this->booking->message,
95
  '{user_email}' => $this->booking->email,
96
  '{user_name}' => $this->booking->name,
97
  '{party}' => $this->booking->party,
98
+ '{table}' => implode(',', $this->booking->table ),
99
  '{date}' => $this->booking->format_date( $this->booking->date ),
100
  '{phone}' => $this->booking->phone,
101
  '{message}' => $this->booking->message,
readme.txt CHANGED
@@ -196,6 +196,10 @@ Find answers to even more questions in the [FAQ](http://doc.fivestarplugins.com/
196
 
197
  == Changelog ==
198
 
 
 
 
 
199
  = 2.1.16 (2020-07-09) =
200
  - Correcting an issue, just with Safari, in which full tables were still showing as available for selection
201
 
196
 
197
  == Changelog ==
198
 
199
+ = 2.1.17 (2020-07-20) =
200
+ - Adding a {table} template tag for notification emails
201
+ - Correcting an issue causing the selected table to not display in the edit booking window
202
+
203
  = 2.1.16 (2020-07-09) =
204
  - Correcting an issue, just with Safari, in which full tables were still showing as available for selection
205
 
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.16
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.17
7
  * Author: FiveStarPlugins
8
  * Author URI: https://profiles.wordpress.org/fivestarplugins/
9
  * Text Domain: restaurant-reservations