Restaurant Reservations - Version 2.4.3

Version Description

(2021-10-19) = - Changes the type of a few settings, to use the 'select' type instead of the 'count' type - Fix for a settings formatting issue

Download this release

Release Info

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

Code changes from version 2.4.2 to 2.4.3

assets/js/admin-rtb-welcome-screen.js CHANGED
@@ -42,7 +42,11 @@ jQuery(document).ready(function() {
42
  });
43
 
44
  var data = 'schedule_open=' + JSON.stringify(schedule_open) + '&action=rtb_welcome_set_schedule';
45
- jQuery.post(ajaxurl, data, function(response) {});
 
 
 
 
46
  });
47
 
48
  jQuery('.rtb-welcome-screen-save-options-button').on('click', function() {
@@ -53,7 +57,11 @@ jQuery(document).ready(function() {
53
  var time_interval = jQuery('select[name="time-interval"]').val();
54
 
55
  var data = 'party_size_min=' + party_size_min + '&party_size=' + party_size + '&early_bookings=' + early_bookings + '&late_bookings=' + late_bookings + '&time_interval=' + time_interval + '&action=rtb_welcome_set_options';
56
- jQuery.post(ajaxurl, data, function(response) {});
 
 
 
 
57
  });
58
  });
59
 
42
  });
43
 
44
  var data = 'schedule_open=' + JSON.stringify(schedule_open) + '&action=rtb_welcome_set_schedule';
45
+ jQuery.post(ajaxurl, data, function(response) {
46
+
47
+ jQuery( '.rtb-welcome-screen-save-schedule-open-button' ).after( '<div class="rtb-save-message"><div class="rtb-save-message-inside">Schedule has been saved.</div></div>' );
48
+ jQuery( '.rtb-save-message' ).delay( 2000 ).fadeOut( 400, function() { jQuery( '.rtb-save-message' ).remove(); } );
49
+ });
50
  });
51
 
52
  jQuery('.rtb-welcome-screen-save-options-button').on('click', function() {
57
  var time_interval = jQuery('select[name="time-interval"]').val();
58
 
59
  var data = 'party_size_min=' + party_size_min + '&party_size=' + party_size + '&early_bookings=' + early_bookings + '&late_bookings=' + late_bookings + '&time_interval=' + time_interval + '&action=rtb_welcome_set_options';
60
+ jQuery.post(ajaxurl, data, function(response) {
61
+
62
+ jQuery( '.rtb-welcome-screen-save-options-button' ).after( '<div class="rtb-save-message"><div class="rtb-save-message-inside">Options have been saved.</div></div>' );
63
+ jQuery( '.rtb-save-message' ).delay( 2000 ).fadeOut( 400, function() { jQuery( '.rtb-save-message' ).remove(); } );
64
+ });
65
  });
66
  });
67
 
includes/Ajax.class.php CHANGED
@@ -263,17 +263,13 @@ if ( !class_exists( 'rtbAJAX' ) ) {
263
 
264
  $interval = $rtb_controller->settings->get_setting( 'time-interval' ) * 60;
265
 
266
- $dining_block_setting = $rtb_controller->settings->get_setting( 'rtb-dining-block-length' );
267
- $dining_block = (int) substr( $dining_block_setting, 0, strpos( $dining_block_setting, '_' ) );
268
- $dining_block_seconds = $dining_block * 60;
269
 
270
  $min_party_size = (int) $rtb_controller->settings->get_setting( 'party-size-min' );
271
 
272
- $max_reservations_setting = $rtb_controller->settings->get_setting( 'rtb-max-tables-count', $location_slug );
273
- $max_reservations = (int) substr( $max_reservations_setting, 0, strpos( $max_reservations_setting, '_' ) );
274
 
275
- $max_people_setting = $rtb_controller->settings->get_setting( 'rtb-max-people-count', $location_slug );
276
- $max_people = (int) substr( $max_people_setting, 0, strpos( $max_people_setting, '_' ) );
277
 
278
  $all_possible_slots = [];
279
  foreach ( $hours as $pair ) {
@@ -618,12 +614,9 @@ if ( !class_exists( 'rtbAJAX' ) ) {
618
 
619
  $location_slug = ! empty( $this->location ) ? $this->location->slug : false;
620
 
621
- $max_people_setting = $rtb_controller->settings->get_setting( 'rtb-max-people-count', $location_slug );
622
- $max_people = substr( $max_people_setting, 0, strpos( $max_people_setting, '_' ) );
623
 
624
- $dining_block_setting = $rtb_controller->settings->get_setting( 'rtb-dining-block-length' );
625
- $dining_block = substr( $dining_block_setting, 0, strpos( $dining_block_setting, '_' ) );
626
- $dining_block_seconds = ( $dining_block * 60 - 1 ); // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
627
 
628
  // Get opening/closing times for this particular day
629
  $hours = $this->get_opening_hours();
263
 
264
  $interval = $rtb_controller->settings->get_setting( 'time-interval' ) * 60;
265
 
266
+ $dining_block_seconds = (int) $rtb_controller->settings->get_setting( 'rtb-dining-block-length' ) * 60;
 
 
267
 
268
  $min_party_size = (int) $rtb_controller->settings->get_setting( 'party-size-min' );
269
 
270
+ $max_reservations = (int) $rtb_controller->settings->get_setting( 'rtb-max-tables-count', $location_slug );
 
271
 
272
+ $max_people = (int) $rtb_controller->settings->get_setting( 'rtb-max-people-count', $location_slug );
 
273
 
274
  $all_possible_slots = [];
275
  foreach ( $hours as $pair ) {
614
 
615
  $location_slug = ! empty( $this->location ) ? $this->location->slug : false;
616
 
617
+ $max_people = (int) $rtb_controller->settings->get_setting( 'rtb-max-people-count', $location_slug );
 
618
 
619
+ $dining_block_seconds = (int) $rtb_controller->settings->get_setting( 'rtb-dining-block-length' )* 60 - 1; // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
 
 
620
 
621
  // Get opening/closing times for this particular day
622
  $hours = $this->get_opening_hours();
includes/Booking.class.php CHANGED
@@ -826,14 +826,11 @@ class rtbBooking {
826
 
827
  if ( ! $max_reservations_enabled ) { return true; }
828
 
829
- $max_reservations_setting = $rtb_controller->settings->get_setting( 'rtb-max-tables-count', $location_slug );
830
- $max_reservations = substr( $max_reservations_setting, 0, strpos( $max_reservations_setting, '_' ) );
831
 
832
  if ( $max_reservations == 'undefined' or ! $max_reservations ) { return true; }
833
 
834
- $dining_block_setting = $rtb_controller->settings->get_setting( 'rtb-dining-block-length' );
835
- $dining_block = substr( $dining_block_setting, 0, strpos( $dining_block_setting, '_' ) );
836
- $dining_block_seconds = ( $dining_block * 60 - 1 ); // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
837
 
838
  $after_time = strtotime($this->date) - $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
839
  $before_time = strtotime($this->date) + $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
@@ -906,15 +903,12 @@ class rtbBooking {
906
 
907
  if ( ! $max_reservations_enabled ) { return true; }
908
 
909
- $max_seats_setting = $rtb_controller->settings->get_setting( 'rtb-max-people-count', $location_slug );
910
- $max_seats = (int) substr( $max_seats_setting, 0, strpos( $max_seats_setting, '_' ) );
911
 
912
  if ( $max_seats == 'undefined' or ! $max_seats ) { return true; }
913
  if ( $this->party > $max_seats ) { return false; }
914
 
915
- $dining_block_setting = $rtb_controller->settings->get_setting( 'rtb-dining-block-length' );
916
- $dining_block = substr( $dining_block_setting, 0, strpos( $dining_block_setting, '_' ) );
917
- $dining_block_seconds = ( $dining_block * 60 - 1 ); // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
918
 
919
  $after_time = strtotime($this->date) - $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
920
  $before_time = strtotime($this->date) + $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
@@ -1107,14 +1101,11 @@ class rtbBooking {
1107
  public function under_max_confirm_reservations() {
1108
  global $rtb_controller;
1109
 
1110
- $max_reservations_setting = $rtb_controller->settings->get_setting( 'auto-confirm-max-reservations' );
1111
- $max_reservations = substr( $max_reservations_setting, 0, strpos( $max_reservations_setting, '_' ) );
1112
 
1113
  if ( $max_reservations == 'undefined' or $max_reservations <= 1 ) { return false; }
1114
 
1115
- $dining_block_setting = $rtb_controller->settings->get_setting( 'rtb-dining-block-length' );
1116
- $dining_block = substr( $dining_block_setting, 0, strpos( $dining_block_setting, '_' ) );
1117
- $dining_block_seconds = ( $dining_block * 60 - 1 ); // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
1118
 
1119
  $after_time = strtotime($this->date) - $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
1120
  $before_time = strtotime($this->date) + $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
@@ -1162,14 +1153,11 @@ class rtbBooking {
1162
  public function under_max_confirm_seats() {
1163
  global $rtb_controller;
1164
 
1165
- $max_seats_setting = $rtb_controller->settings->get_setting( 'auto-confirm-max-seats' );
1166
- $max_seats = substr( $max_seats_setting, 0, strpos( $max_seats_setting, '_' ) );
1167
 
1168
  if ( $max_seats == 'undefined' or $max_seats < 2 or $this->party >= $max_seats ) { return false; }
1169
 
1170
- $dining_block_setting = $rtb_controller->settings->get_setting( 'rtb-dining-block-length' );
1171
- $dining_block = substr( $dining_block_setting, 0, strpos( $dining_block_setting, '_' ) );
1172
- $dining_block_seconds = ( $dining_block * 60 - 1 ); // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
1173
 
1174
  $after_time = strtotime($this->date) - $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
1175
  $before_time = strtotime($this->date) + $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
826
 
827
  if ( ! $max_reservations_enabled ) { return true; }
828
 
829
+ $max_reservations = (int) $rtb_controller->settings->get_setting( 'rtb-max-tables-count', $location_slug );
 
830
 
831
  if ( $max_reservations == 'undefined' or ! $max_reservations ) { return true; }
832
 
833
+ $dining_block_seconds = (int) $rtb_controller->settings->get_setting( 'rtb-dining-block-length' ) * 60 - 1; // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
 
 
834
 
835
  $after_time = strtotime($this->date) - $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
836
  $before_time = strtotime($this->date) + $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
903
 
904
  if ( ! $max_reservations_enabled ) { return true; }
905
 
906
+ $max_seats = (int) $rtb_controller->settings->get_setting( 'rtb-max-people-count', $location_slug );
 
907
 
908
  if ( $max_seats == 'undefined' or ! $max_seats ) { return true; }
909
  if ( $this->party > $max_seats ) { return false; }
910
 
911
+ $dining_block_seconds = (int) $rtb_controller->settings->get_setting( 'rtb-dining-block-length' ) * 60 - 1; // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
 
 
912
 
913
  $after_time = strtotime($this->date) - $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
914
  $before_time = strtotime($this->date) + $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
1101
  public function under_max_confirm_reservations() {
1102
  global $rtb_controller;
1103
 
1104
+ $max_reservations = (int) $rtb_controller->settings->get_setting( 'auto-confirm-max-reservations' );
 
1105
 
1106
  if ( $max_reservations == 'undefined' or $max_reservations <= 1 ) { return false; }
1107
 
1108
+ $dining_block_seconds = (int) $rtb_controller->settings->get_setting( 'rtb-dining-block-length' ) * 60 - 1; // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
 
 
1109
 
1110
  $after_time = strtotime($this->date) - $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
1111
  $before_time = strtotime($this->date) + $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
1153
  public function under_max_confirm_seats() {
1154
  global $rtb_controller;
1155
 
1156
+ $max_seats = (int) $rtb_controller->settings->get_setting( 'auto-confirm-max-seats' );
 
1157
 
1158
  if ( $max_seats == 'undefined' or $max_seats < 2 or $this->party >= $max_seats ) { return false; }
1159
 
1160
+ $dining_block_seconds = (int) $rtb_controller->settings->get_setting( 'rtb-dining-block-length' ) * 60 - 1; // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
 
 
1161
 
1162
  $after_time = strtotime($this->date) - $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
1163
  $before_time = strtotime($this->date) + $dining_block_seconds - (3600 * get_option( 'gmt_offset' ) );
includes/Migration.class.php CHANGED
@@ -16,6 +16,8 @@ class rtbMigrationManager {
16
  $this->convert_payment_gateway_setting();
17
 
18
  $this->update_invalid_setting_values();
 
 
19
  }
20
 
21
 
@@ -52,6 +54,8 @@ class rtbMigrationManager {
52
  * Previously this setting was a radio, now it is a checkbox.
53
  *
54
  * @since 2.3.0
 
 
55
  */
56
  public function convert_payment_gateway_setting()
57
  {
@@ -61,7 +65,7 @@ class rtbMigrationManager {
61
  if( is_array( $options ) && ! is_array( $options['rtb-payment-gateway'] ) && version_compare( RTB_VERSION, '2.2.11', '>' ) ) {
62
  $options['rtb-payment-gateway'] = [ $options['rtb-payment-gateway'] ];
63
 
64
- update_option( $settings_page, $options, true);
65
  }
66
  }
67
 
@@ -71,6 +75,8 @@ class rtbMigrationManager {
71
  * at least. Whereas, its expected to be empty
72
  *
73
  * @since 2.3.1
 
 
74
  */
75
  public function update_invalid_setting_values() {
76
  $settings_page = 'rtb-settings';
@@ -102,7 +108,31 @@ class rtbMigrationManager {
102
  $options['time-late-user'] = '';
103
  }
104
 
105
- update_option( $settings_page, $options, true);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  }
107
  }
108
 
16
  $this->convert_payment_gateway_setting();
17
 
18
  $this->update_invalid_setting_values();
19
+
20
+ $this->update_setting_value_types();
21
  }
22
 
23
 
54
  * Previously this setting was a radio, now it is a checkbox.
55
  *
56
  * @since 2.3.0
57
+ *
58
+ * @removal 2022-04-01
59
  */
60
  public function convert_payment_gateway_setting()
61
  {
65
  if( is_array( $options ) && ! is_array( $options['rtb-payment-gateway'] ) && version_compare( RTB_VERSION, '2.2.11', '>' ) ) {
66
  $options['rtb-payment-gateway'] = [ $options['rtb-payment-gateway'] ];
67
 
68
+ update_option( $settings_page, $options );
69
  }
70
  }
71
 
75
  * at least. Whereas, its expected to be empty
76
  *
77
  * @since 2.3.1
78
+ *
79
+ * @removal 2022-04-01
80
  */
81
  public function update_invalid_setting_values() {
82
  $settings_page = 'rtb-settings';
108
  $options['time-late-user'] = '';
109
  }
110
 
111
+ update_option( $settings_page, $options );
112
+ }
113
+
114
+ /**
115
+ * Updates a number of settings, which now are using the "select" type instead of the "count"
116
+ * type, since they have no units to select
117
+ *
118
+ * @since 2.3.0
119
+ *
120
+ * @removal 2022-07-01
121
+ */
122
+ public function update_setting_value_types() {
123
+
124
+ $options = get_option( 'rtb-settings' );
125
+
126
+ if ( is_array( $options ) ) {
127
+
128
+ $options['rtb-dining-block-length'] = ! empty( $options['rtb-dining-block-length'] ) ? intval( $options['rtb-dining-block-length'] ) : '';
129
+ $options['rtb-max-tables-count'] = ! empty( $options['rtb-max-tables-count'] ) ? intval( $options['rtb-max-tables-count'] ) : '';
130
+ $options['rtb-max-people-count'] = ! empty( $options['rtb-max-people-count'] ) ? intval( $options['rtb-max-people-count'] ) : '';
131
+ $options['auto-confirm-max-reservations'] = ! empty( $options['auto-confirm-max-reservations'] ) ? intval( $options['auto-confirm-max-reservations'] ) : '';
132
+ $options['auto-confirm-max-seats'] = ! empty( $options['auto-confirm-max-seats'] ) ? intval( $options['auto-confirm-max-seats'] ) : '';
133
+
134
+ update_option( 'rtb-settings', $options );
135
+ }
136
  }
137
  }
138
 
includes/MultipleLocations.class.php CHANGED
@@ -925,19 +925,33 @@ if ( ! class_exists( 'rtbMultipleLocations', false ) ) {
925
  )
926
  );
927
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
928
  foreach ( $terms as $term ) {
929
 
930
  $sap->add_setting(
931
  'rtb-settings',
932
  'rtb-seat-assignments',
933
- 'count',
934
  array(
935
  'id' => $term->slug . '-rtb-max-tables-count',
936
  'title' => __( 'Max Reservations', 'restaurant-reservations' ),
937
  'description' => __( 'How many reservations, if enabled, should be allowed at the same time at this location? Set dining block length to change how long a meal typically lasts.', 'restaurant-reservations' ),
938
- 'min_value' => 1,
939
- 'max_value' => apply_filters( 'rtb-max-reservations-upper-limit', 100 ),
940
- 'increment' => 1,
941
  'conditional_on' => 'location-select',
942
  'conditional_on_value' => $term->slug,
943
  )
@@ -946,14 +960,12 @@ if ( ! class_exists( 'rtbMultipleLocations', false ) ) {
946
  $sap->add_setting(
947
  'rtb-settings',
948
  'rtb-seat-assignments',
949
- 'count',
950
  array(
951
  'id' => $term->slug . '-rtb-max-people-count',
952
  'title' => __( 'Max People', 'restaurant-reservations' ),
953
  'description' => __( 'How many people, if enabled, should be allowed to be present at this restaurant location at the same time? Set dining block length to change how long a meal typically lasts. May not work correctly if max reservations is set.', 'restaurant-reservations' ),
954
- 'min_value' => 1,
955
- 'max_value' => apply_filters( 'rtb-max-people-upper-limit', 100 ),
956
- 'increment' => 1,
957
  'conditional_on' => 'location-select',
958
  'conditional_on_value' => $term->slug,
959
  )
925
  )
926
  );
927
 
928
+ $max_reservation_options = array();
929
+ $max_reservations_upper_limit = apply_filters( 'rtb-max-reservations-upper-limit', 100 );
930
+
931
+ for ( $i = 1; $i <= $max_reservations_upper_limit; $i++ ) {
932
+
933
+ $max_reservation_options[$i] = $i;
934
+ }
935
+
936
+ $max_people_options = array();
937
+ $max_people_upper_limit = apply_filters( 'rtb-max-people-upper-limit', 400 );
938
+
939
+ for ( $i = 1; $i <= $max_people_upper_limit; $i++ ) {
940
+
941
+ $max_people_options[$i] = $i;
942
+ }
943
+
944
  foreach ( $terms as $term ) {
945
 
946
  $sap->add_setting(
947
  'rtb-settings',
948
  'rtb-seat-assignments',
949
+ 'select',
950
  array(
951
  'id' => $term->slug . '-rtb-max-tables-count',
952
  'title' => __( 'Max Reservations', 'restaurant-reservations' ),
953
  'description' => __( 'How many reservations, if enabled, should be allowed at the same time at this location? Set dining block length to change how long a meal typically lasts.', 'restaurant-reservations' ),
954
+ 'options' => $max_reservation_options,
 
 
955
  'conditional_on' => 'location-select',
956
  'conditional_on_value' => $term->slug,
957
  )
960
  $sap->add_setting(
961
  'rtb-settings',
962
  'rtb-seat-assignments',
963
+ 'select',
964
  array(
965
  'id' => $term->slug . '-rtb-max-people-count',
966
  'title' => __( 'Max People', 'restaurant-reservations' ),
967
  'description' => __( 'How many people, if enabled, should be allowed to be present at this restaurant location at the same time? Set dining block length to change how long a meal typically lasts. May not work correctly if max reservations is set.', 'restaurant-reservations' ),
968
+ 'options' => $max_people_options,
 
 
969
  'conditional_on' => 'location-select',
970
  'conditional_on_value' => $term->slug,
971
  )
includes/Settings.class.php CHANGED
@@ -1321,20 +1321,25 @@ If you were not the one to cancel this booking, please contact us.
1321
  $this->premium_permissions['seat_restrictions']
1322
  )
1323
  );
 
 
 
 
 
 
 
 
1324
  $sap->add_setting(
1325
  'rtb-settings',
1326
  'rtb-seat-assignments',
1327
- 'count',
1328
  array(
1329
  'id' => 'rtb-dining-block-length',
1330
  'title' => __( 'Dining Block Length', 'restaurant-reservations' ),
1331
- 'description' => __( 'How long does a meal generally last? This setting affects a how long a slot and/or seat unavailable for after someone makes a reservation.', 'restaurant-reservations' ),
1332
  'default' => $this->defaults['rtb-dining-block-length'],
1333
  'blank_option' => false,
1334
- 'min_value' => 10,
1335
- 'max_value' => 240,
1336
- 'increment' => 5,
1337
- 'units' => array( 'minutes' => 'Minutes' )
1338
  )
1339
  );
1340
 
@@ -1349,59 +1354,83 @@ If you were not the one to cancel this booking, please contact us.
1349
  )
1350
  );
1351
 
 
 
 
 
 
 
 
 
1352
  $sap->add_setting(
1353
  'rtb-settings',
1354
  'rtb-seat-assignments',
1355
- 'count',
1356
  array(
1357
  'id' => 'rtb-max-tables-count',
1358
  'title' => __( 'Max Reservations', 'restaurant-reservations' ),
1359
  'description' => __( 'How many reservations, if enabled above, should be allowed at the same time? Set dining block length setting above to change how long a meal typically lasts.', 'restaurant-reservations' ),
1360
- 'min_value' => 1,
1361
- 'max_value' => apply_filters( 'rtb-max-reservations-upper-limit', 100 ),
1362
- 'increment' => 1
1363
  )
1364
  );
1365
 
 
 
 
 
 
 
 
 
1366
  $sap->add_setting(
1367
  'rtb-settings',
1368
  'rtb-seat-assignments',
1369
- 'count',
1370
  array(
1371
- 'id' => 'rtb-max-people-count',
1372
- 'title' => __( 'Max People', 'restaurant-reservations' ),
1373
- 'description' => __( 'How many people, if enabled above, should be allowed to be present in the restaurant at the same time? Set dining block length setting above to change how long a meal typically lasts. May not work correctly if max reservations is set.', 'restaurant-reservations' ),
1374
- 'min_value' => 1,
1375
- 'max_value' => apply_filters( 'rtb-max-people-upper-limit', 100 ),
1376
- 'increment' => 1
1377
  )
1378
  );
1379
 
 
 
 
 
 
 
 
 
1380
  $sap->add_setting(
1381
  'rtb-settings',
1382
  'rtb-seat-assignments',
1383
- 'count',
1384
  array(
1385
  'id' => 'auto-confirm-max-reservations',
1386
  'title' => __( 'Automatically Confirm Below Reservation Number', 'restaurant-reservations' ),
1387
  'description' => __( 'Set a maximum number of reservations at one time below which all bookings will be automatically confirmed.', 'restaurant-reservations' ),
1388
- 'min_value' => 1,
1389
- 'max_value' => apply_filters( 'rtb-auto-confirm-reservations-upper-limit', 100 ),
1390
- 'increment' => 1
1391
  )
1392
  );
1393
 
 
 
 
 
 
 
 
 
1394
  $sap->add_setting(
1395
  'rtb-settings',
1396
  'rtb-seat-assignments',
1397
- 'count',
1398
  array(
1399
  'id' => 'auto-confirm-max-seats',
1400
  'title' => __( 'Automatically Confirm Below Seats Number', 'restaurant-reservations' ),
1401
  'description' => __( 'Set a maximum number of seats at one time below which all bookings will be automatically confirmed.', 'restaurant-reservations' ),
1402
- 'min_value' => 1,
1403
- 'max_value' => apply_filters( 'rtb-auto-confirm-seats-upper-limit', 400 ),
1404
- 'increment' => 1
1405
  )
1406
  );
1407
 
@@ -2864,11 +2893,24 @@ If you were not the one to cancel this booking, please contact us.
2864
 
2865
  foreach ( $tables as $table ) {
2866
 
 
 
 
2867
  foreach ( $table_sections as $table_section ) {
2868
- if ( $table_section->section_id == $table->section ) { $table_section_name = $table_section->name; }
 
 
 
2869
  }
2870
 
2871
- $options[ $table->number ] = $table->number . ' - ' . $table_section_name . ' (min. ' . $table->min_people . '/max. ' . $table->max_people . ')';
 
 
 
 
 
 
 
2872
  }
2873
 
2874
  return $options;
1321
  $this->premium_permissions['seat_restrictions']
1322
  )
1323
  );
1324
+
1325
+ $dining_block_length_options = array();
1326
+
1327
+ for ( $i = 10; $i <= 240; $i = $i +5 ) {
1328
+
1329
+ $dining_block_length_options[$i] = $i;
1330
+ }
1331
+
1332
  $sap->add_setting(
1333
  'rtb-settings',
1334
  'rtb-seat-assignments',
1335
+ 'select',
1336
  array(
1337
  'id' => 'rtb-dining-block-length',
1338
  'title' => __( 'Dining Block Length', 'restaurant-reservations' ),
1339
+ 'description' => __( 'How long, in minutes, does a meal generally last? This setting affects a how long a slot and/or seat unavailable for after someone makes a reservation.', 'restaurant-reservations' ),
1340
  'default' => $this->defaults['rtb-dining-block-length'],
1341
  'blank_option' => false,
1342
+ 'options' => $dining_block_length_options
 
 
 
1343
  )
1344
  );
1345
 
1354
  )
1355
  );
1356
 
1357
+ $max_reservation_options = array();
1358
+ $max_reservations_upper_limit = apply_filters( 'rtb-max-reservations-upper-limit', 100 );
1359
+
1360
+ for ( $i = 1; $i <= $max_reservations_upper_limit; $i++ ) {
1361
+
1362
+ $max_reservation_options[$i] = $i;
1363
+ }
1364
+
1365
  $sap->add_setting(
1366
  'rtb-settings',
1367
  'rtb-seat-assignments',
1368
+ 'select',
1369
  array(
1370
  'id' => 'rtb-max-tables-count',
1371
  'title' => __( 'Max Reservations', 'restaurant-reservations' ),
1372
  'description' => __( 'How many reservations, if enabled above, should be allowed at the same time? Set dining block length setting above to change how long a meal typically lasts.', 'restaurant-reservations' ),
1373
+ 'options' => $max_reservation_options
 
 
1374
  )
1375
  );
1376
 
1377
+ $max_people_options = array();
1378
+ $max_people_upper_limit = apply_filters( 'rtb-max-people-upper-limit', 400 );
1379
+
1380
+ for ( $i = 1; $i <= $max_people_upper_limit; $i++ ) {
1381
+
1382
+ $max_people_options[$i] = $i;
1383
+ }
1384
+
1385
  $sap->add_setting(
1386
  'rtb-settings',
1387
  'rtb-seat-assignments',
1388
+ 'select',
1389
  array(
1390
+ 'id' => 'rtb-max-people-count',
1391
+ 'title' => __( 'Max People', 'restaurant-reservations' ),
1392
+ 'description' => __( 'How many people, if enabled above, should be allowed to be present in the restaurant at the same time? Set dining block length setting above to change how long a meal typically lasts. May not work correctly if max reservations is set.', 'restaurant-reservations' ),
1393
+ 'options' => $max_people_options
 
 
1394
  )
1395
  );
1396
 
1397
+ $max_auto_confirm_reservation_options = array();
1398
+ $max_auto_confirm_reservations_upper_limit = apply_filters( 'rtb-auto-confirm-reservations-upper-limit', 100 );
1399
+
1400
+ for ( $i = 1; $i <= $max_auto_confirm_reservations_upper_limit; $i++ ) {
1401
+
1402
+ $max_auto_confirm_reservation_options[$i] = $i;
1403
+ }
1404
+
1405
  $sap->add_setting(
1406
  'rtb-settings',
1407
  'rtb-seat-assignments',
1408
+ 'select',
1409
  array(
1410
  'id' => 'auto-confirm-max-reservations',
1411
  'title' => __( 'Automatically Confirm Below Reservation Number', 'restaurant-reservations' ),
1412
  'description' => __( 'Set a maximum number of reservations at one time below which all bookings will be automatically confirmed.', 'restaurant-reservations' ),
1413
+ 'options' => $max_auto_confirm_reservation_options
 
 
1414
  )
1415
  );
1416
 
1417
+ $max_auto_confirm_seats_options = array();
1418
+ $max_auto_confirm_seats_upper_limit = apply_filters( 'rtb-auto-confirm-seats-upper-limit', 400 );
1419
+
1420
+ for ( $i = 1; $i <= $max_auto_confirm_seats_upper_limit; $i++ ) {
1421
+
1422
+ $max_auto_confirm_seats_options[$i] = $i;
1423
+ }
1424
+
1425
  $sap->add_setting(
1426
  'rtb-settings',
1427
  'rtb-seat-assignments',
1428
+ 'select',
1429
  array(
1430
  'id' => 'auto-confirm-max-seats',
1431
  'title' => __( 'Automatically Confirm Below Seats Number', 'restaurant-reservations' ),
1432
  'description' => __( 'Set a maximum number of seats at one time below which all bookings will be automatically confirmed.', 'restaurant-reservations' ),
1433
+ 'options' => $max_auto_confirm_seats_options
 
 
1434
  )
1435
  );
1436
 
2893
 
2894
  foreach ( $tables as $table ) {
2895
 
2896
+ $option = '';
2897
+ $table_section_name = '';
2898
+
2899
  foreach ( $table_sections as $table_section ) {
2900
+ if ( $table_section->section_id == $table->section ) {
2901
+ $table_section_name = $table_section->name;
2902
+ break;
2903
+ }
2904
  }
2905
 
2906
+ if( ! empty( $table_section_name ) ) {
2907
+ $option = $table->number . ' - ' . $table_section_name . ' (min. ' . $table->min_people . '/max. ' . $table->max_people . ')';
2908
+ }
2909
+ else {
2910
+ $option = $table->number . ' (min. ' . $table->min_people . '/max. ' . $table->max_people . ')';
2911
+ }
2912
+
2913
+ $options[ $table->number ] = $option;
2914
  }
2915
 
2916
  return $options;
includes/template-functions.php CHANGED
@@ -943,9 +943,7 @@ if ( ! function_exists( 'rtb_get_valid_tables') ) {
943
 
944
  if ( empty( $table_numbers ) ) { return $table_numbers; }
945
 
946
- $dining_block_setting = $rtb_controller->settings->get_setting( 'rtb-dining-block-length' );
947
- $dining_block = substr( $dining_block_setting, 0, strpos( $dining_block_setting, '_' ) );
948
- $dining_block_seconds = ( $dining_block * 60 - 1 ); // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
949
 
950
  $args = array(
951
  'posts_per_page' => -1,
943
 
944
  if ( empty( $table_numbers ) ) { return $table_numbers; }
945
 
946
+ $dining_block_seconds = (int) $rtb_controller->settings->get_setting( 'rtb-dining-block-length' ) * 60 - 1; // Take 1 second off, to avoid bookings that start or end exactly at the beginning of a booking block
 
 
947
 
948
  $args = array(
949
  'posts_per_page' => -1,
lib/simple-admin-pages/classes/AdminPage.class.php CHANGED
@@ -278,7 +278,7 @@ class sapAdminPage_2_6_0 {
278
  }
279
 
280
  foreach( $this->sections as $id => $section ) {
281
- if ( ! isset( $section->is_tab ) && $section->is_tab != true ) {
282
  if( property_exists( $section, 'rank' ) && count( $non_tab_list ) > $section->rank ) {
283
  // array start from 0, rank start from 1
284
  unset( $non_tab_list[$id]);
278
  }
279
 
280
  foreach( $this->sections as $id => $section ) {
281
+ if ( empty( $section->is_tab ) ) {
282
  if( property_exists( $section, 'rank' ) && count( $non_tab_list ) > $section->rank ) {
283
  // array start from 0, rank start from 1
284
  unset( $non_tab_list[$id]);
readme.txt CHANGED
@@ -197,6 +197,10 @@ Find answers to even more questions in the [FAQ](http://doc.fivestarplugins.com/
197
 
198
  == Changelog ==
199
 
 
 
 
 
200
  = 2.4.2 (2021-10-18) =
201
  - Minor fix for the reply-to header for some notifications
202
 
197
 
198
  == Changelog ==
199
 
200
+ = 2.4.3 (2021-10-19) =
201
+ - Changes the type of a few settings, to use the 'select' type instead of the 'count' type
202
+ - Fix for a settings formatting issue
203
+
204
  = 2.4.2 (2021-10-18) =
205
  - Minor fix for the reply-to header for some notifications
206
 
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.4.2
7
  * Author: FiveStarPlugins
8
  * Author URI: https://profiles.wordpress.org/fivestarplugins/
9
  * Text Domain: restaurant-reservations
@@ -39,7 +39,7 @@ class rtbInit {
39
  public function __construct() {
40
 
41
  // Common strings
42
- define( 'RTB_VERSION', '2.4.2' );
43
  define( 'RTB_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
44
  define( 'RTB_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
45
  define( 'RTB_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
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.4.3
7
  * Author: FiveStarPlugins
8
  * Author URI: https://profiles.wordpress.org/fivestarplugins/
9
  * Text Domain: restaurant-reservations
39
  public function __construct() {
40
 
41
  // Common strings
42
+ define( 'RTB_VERSION', '2.4.3' );
43
  define( 'RTB_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
44
  define( 'RTB_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
45
  define( 'RTB_PLUGIN_FNAME', plugin_basename( __FILE__ ) );