Skip to content

Instantly share code, notes, and snippets.

@Mulugruntz
Last active July 1, 2021 15:42
Show Gist options
  • Save Mulugruntz/878197885be7d66b37f4f80741753cf0 to your computer and use it in GitHub Desktop.
Save Mulugruntz/878197885be7d66b37f4f80741753cf0 to your computer and use it in GitHub Desktop.
Woocommerce Bookings: New feature: full month is bookable

Woocommerce Bookings: New feature: full month is bookable.

Goal

This adds a new feature to Woocommerce Bookings 1.15.41. In a product availability, there's a new checkbox: Title: Full month is bookable? Description: Enabling this option will make bookings available until the end of the month. So if the end date would be June 7 or June 28, it would become June 30 in both cases.

This is useful for all commerce that needs to open new bookings one month at a time only on the 1st of a month. Because opening 1 day at a time, every single day, may not be the business case for everybody.

Apply the patches

This is the method I suggest, which applies all patches, neatly organized into separate commits, with readable commit messsages. You can of course modify whatever you like.

Important Note that these methods will work if the target .git is located in woocommerce-bookings. This root is the directory that contains changelog.txt, docker-compose.yaml, languages, templates, vendor, woocommmerce-bookings.php, dist, includes, uninstall.php, woocommerce-bookings.php.

If the root is another directory, I'm not sure it will work. For example, if the assumed root is actually located in your root wp-content/plugins/woocommerce-bookings, then you might have to change the patches running:

( export NEWROOT=wp-content/plugins/woocommerce-bookings ; sed -i .bak -E "s:(Index\: | [ab]/)([^ ]*)\.(php|pot): \1${NEWROOT}/\2.\3:g" *.patch )

Of course, run this command in the directory where the patches are located. And change the NEWROOT=wp-content/plugins/woocommerce-bookings according to your needs.

Online

cd woocommerce-bookings

curl https://gist.github.com/Mulugruntz/878197885be7d66b37f4f80741753cf0/raw/8bbd20d8d8a34bde98afadae43101777d44d7203/max_date_full_month_p1.patch | git apply -
git -c author.name="Samuel Giffard" -c author.email="[email protected]" commit -m 'Added new `boolean`: `max_date_full_month`.'

curl https://gist.github.com/Mulugruntz/878197885be7d66b37f4f80741753cf0/raw/8bbd20d8d8a34bde98afadae43101777d44d7203/max_date_full_month_p2.patch | git apply -
git -c author.name="Samuel Giffard" -c author.email="[email protected]" commit -m 'Product has new method `get_computed_max_date`.

Until now, `max_date` was being called and then the same computation was done, over and over again.
Now, the computation is done in only **one** place: `get_computed_max_date`.

The behaviour has not changed (possibility for having removed some weird bugs, though).'

curl https://gist.github.com/Mulugruntz/878197885be7d66b37f4f80741753cf0/raw/ffef99ee95b578d0821f91f0e68e779b860663b1/max_date_full_month_p3.patch | git apply -
git -c author.name="Samuel Giffard" -c author.email="[email protected]" commit -m "Method `get_computed_max_date` now implements the full month case.

The start time of the day can also be changed by declaring a global constant:
`define('START_OF_THE_DAY', '00:00');`"

curl https://gist.github.com/Mulugruntz/878197885be7d66b37f4f80741753cf0/raw/ffef99ee95b578d0821f91f0e68e779b860663b1/max_date_full_month_p4.patch | git apply -
git -c author.name="Samuel Giffard" -c author.email="[email protected]" commit -m 'Generated the POT file for localization.'

Offline

cd woocommerce-bookings

git apply max_date_full_month_p1.patch
git -c author.name="Samuel Giffard" -c author.email="[email protected]" commit -m 'Added new `boolean`: `max_date_full_month`.'

git apply max_date_full_month_p2.patch
git -c author.name="Samuel Giffard" -c author.email="[email protected]" commit -m 'Product has new method `get_computed_max_date`.

Until now, `max_date` was being called and then the same computation was done, over and over again.
Now, the computation is done in only **one** place: `get_computed_max_date`.

The behaviour has not changed (possibility for having removed some weird bugs, though).'

git apply max_date_full_month_p3.patch
git -c author.name="Samuel Giffard" -c author.email="[email protected]" commit -m 'Method `get_computed_max_date` now implements the full month case.

The start time of the day can also be changed by declaring a global constant:
`define(\'START_OF_THE_DAY\', \'00:00\');`'

git apply max_date_full_month_p4.patch
git -c author.name="Samuel Giffard" -c author.email="[email protected]" commit -m 'Generated the POT file for localization.'

Commit messages

  1. max_date_full_month_p1.patch
  • Added new boolean: max_date_full_month.
  1. max_date_full_month_p2.patch
  • Product has new method get_computed_max_date.

    Until now, max_date was being called and then the same computation was done, over and over again. Now, the computation is done in only one place: get_computed_max_date.

    The behaviour has not changed (possibility for having removed some weird bugs, though).

  1. max_date_full_month_p3.patch
  • Method get_computed_max_date now implements the full month case.

    The start time of the day can also be changed by declaring a global constant: define('START_OF_THE_DAY', '00:00');

  1. max_date_full_month_p4.patch
  • Generated the POT file for localization.
Index: includes/admin/class-wc-bookings-admin.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/admin/class-wc-bookings-admin.php b/includes/admin/class-wc-bookings-admin.php
--- a/includes/admin/class-wc-bookings-admin.php (revision fa7d93f8475783a4f19b9e85706f4993cff72bbb)
+++ b/includes/admin/class-wc-bookings-admin.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
@@ -306,6 +306,7 @@
'has_persons' => isset( $_POST['_wc_booking_has_persons'] ),
'has_resources' => isset( $_POST['_wc_booking_has_resources'] ),
'has_restricted_days' => isset( $_POST['_wc_booking_has_restricted_days'] ),
+ 'max_date_full_month' => isset( $_POST['_wc_booking_max_date_full_month'] ),
'max_date_unit' => wc_clean( $_POST['_wc_booking_max_date_unit'] ),
'max_date_value' => wc_clean( $_POST['_wc_booking_max_date'] ),
'max_duration' => wc_clean( $_POST['_wc_booking_max_duration'] ),
Index: includes/admin/class-wc-bookings-products-export.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/admin/class-wc-bookings-products-export.php b/includes/admin/class-wc-bookings-products-export.php
--- a/includes/admin/class-wc-bookings-products-export.php (revision fa7d93f8475783a4f19b9e85706f4993cff72bbb)
+++ b/includes/admin/class-wc-bookings-products-export.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
@@ -50,6 +50,7 @@
'has_persons' => __( 'Has_persons', 'woocommerce-bookings' ),
'has_resources' => __( 'Has_resources', 'woocommerce-bookings' ),
'has_restricted_days' => __( 'Has_restricted_days', 'woocommerce-bookings' ),
+ 'max_date_full_month' => __( 'Max_date_full_month', 'woocommerce-bookings'),
'max_date_unit' => __( 'Max_date_unit', 'woocommerce-bookings' ),
'max_date_value' => __( 'Max_date_value', 'woocommerce-bookings' ),
'max_duration' => __( 'Max_duration', 'woocommerce-bookings' ),
Index: includes/admin/class-wc-bookings-products-import.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/admin/class-wc-bookings-products-import.php b/includes/admin/class-wc-bookings-products-import.php
--- a/includes/admin/class-wc-bookings-products-import.php (revision fa7d93f8475783a4f19b9e85706f4993cff72bbb)
+++ b/includes/admin/class-wc-bookings-products-import.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
@@ -51,6 +51,7 @@
'has_persons' => __( 'Has_persons', 'woocommerce-bookings' ),
'has_resources' => __( 'Has_resources', 'woocommerce-bookings' ),
'has_restricted_days' => __( 'Has_restricted_days', 'woocommerce-bookings' ),
+ 'max_date_full_month' => __( 'Max_date_full_month', 'woocommerce-bookings'),
'max_date_unit' => __( 'Max_date_unit', 'woocommerce-bookings' ),
'max_date_value' => __( 'Max_date_value', 'woocommerce-bookings' ),
'max_duration' => __( 'Max_duration', 'woocommerce-bookings' ),
Index: includes/admin/views/html-booking-availability.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/admin/views/html-booking-availability.php b/includes/admin/views/html-booking-availability.php
--- a/includes/admin/views/html-booking-availability.php (revision fa7d93f8475783a4f19b9e85706f4993cff72bbb)
+++ b/includes/admin/views/html-booking-availability.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
@@ -62,6 +62,15 @@
)
);
+ woocommerce_wp_checkbox(
+ array(
+ 'id' => '_wc_booking_max_date_full_month',
+ 'value' => $bookable_product->get_max_date_full_month( 'edit' ) ? 'yes' : 'no',
+ 'label' => __( 'Full month is bookable?', 'woocommerce-bookings' ),
+ 'description' => __( 'Enabling this option will make bookings available until the end of the month. So if the end date would be June 7 or June 28, it would become June 30 in both cases.', 'woocommerce-bookings' ),
+ )
+ );
+
woocommerce_wp_select(
array(
'id' => '_wc_booking_default_date_availability',
Index: includes/api/class-wc-bookings-rest-products-controller.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/api/class-wc-bookings-rest-products-controller.php b/includes/api/class-wc-bookings-rest-products-controller.php
--- a/includes/api/class-wc-bookings-rest-products-controller.php (revision fa7d93f8475783a4f19b9e85706f4993cff72bbb)
+++ b/includes/api/class-wc-bookings-rest-products-controller.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
@@ -120,6 +120,7 @@
'has_persons' => $product->get_has_persons( $context ),
'has_resources' => $product->get_has_resources( $context ),
'has_restricted_days' => $product->get_has_restricted_days( $context ),
+ 'max_date_full_month' => $product->get_max_date_full_month( $context ),
'max_date' => $product->get_max_date(),
'max_date_value' => $product->get_max_date_value( $context ),
'max_date_unit' => $product->get_max_date_unit( $context ),
@@ -364,6 +365,11 @@
'type' => 'string',
'context' => array( 'view' ),
),
+ 'max_date_full_month' => array(
+ 'description' => __( 'Full month is bookable?', 'woocommerce-bookings' ),
+ 'type' => 'boolean',
+ 'context' => array( 'view', 'edit' ),
+ ),
'max_date_value' => array(
'description' => __( 'Max amount af max_date_units into the future a block is bookable.', 'woocommerce-bookings' ),
'type' => 'integer',
Index: includes/data-objects/class-wc-product-booking.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/data-objects/class-wc-product-booking.php b/includes/data-objects/class-wc-product-booking.php
--- a/includes/data-objects/class-wc-product-booking.php (revision fa7d93f8475783a4f19b9e85706f4993cff72bbb)
+++ b/includes/data-objects/class-wc-product-booking.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
@@ -38,6 +38,7 @@
'has_persons' => false,
'has_resources' => false,
'has_restricted_days' => false,
+ 'max_date_full_month' => false,
'max_date_unit' => 'month',
'max_date_value' => 12,
'max_duration' => 1,
@@ -850,6 +851,25 @@
$this->set_prop( 'resource_label', $value );
}
+ /**
+ * Get max_date_full_month.
+ *
+ * @param string $context
+ * @return bool
+ */
+ public function get_max_date_full_month( $context = 'view' ) {
+ return $this->get_prop( 'max_date_full_month', $context );
+ }
+
+ /**
+ * Set max_date_full_month.
+ *
+ * @param bool $value
+ */
+ public function set_max_date_full_month( $value ) {
+ $this->set_prop( 'max_date_full_month', wc_bookings_string_to_bool( $value ) );
+ }
+
/**
* Get apply_adjacent_buffer.
*
Index: includes/data-stores/class-wc-product-booking-data-store-cpt.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/data-stores/class-wc-product-booking-data-store-cpt.php b/includes/data-stores/class-wc-product-booking-data-store-cpt.php
--- a/includes/data-stores/class-wc-product-booking-data-store-cpt.php (revision fa7d93f8475783a4f19b9e85706f4993cff72bbb)
+++ b/includes/data-stores/class-wc-product-booking-data-store-cpt.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
@@ -33,6 +33,7 @@
'_wc_booking_has_persons' => 'has_persons',
'_wc_booking_has_resources' => 'has_resources',
'_wc_booking_has_restricted_days' => 'has_restricted_days',
+ '_wc_booking_max_date_full_month' => 'max_date_full_month',
'_wc_booking_max_date_unit' => 'max_date_unit',
'_wc_booking_max_date' => 'max_date_value',
'_wc_booking_max_duration' => 'max_duration',
Index: includes/admin/class-wc-bookings-details-meta-box.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/admin/class-wc-bookings-details-meta-box.php b/includes/admin/class-wc-bookings-details-meta-box.php
--- a/includes/admin/class-wc-bookings-details-meta-box.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
+++ b/includes/admin/class-wc-bookings-details-meta-box.php (revision ecd4ca2e00ccec027f237991073a2861f6ff7493)
@@ -66,9 +66,8 @@
echo '<div class="notice notice-warning"><p>' . esc_html__( 'This booking is scheduled over 2 years into the future. Please ensure this is correct.', 'woocommerce-bookings' ) . '</p></div>';
}
- if ( $product && is_callable( array( $product, 'get_max_date' ) ) ) {
- $max = $product->get_max_date();
- $max_date = strtotime( "+{$max['value']} {$max['unit']}", current_time( 'timestamp' ) );
+ if ( $product && is_callable( array( $product, 'get_computed_max_date' ) ) ) {
+ $max_date = $product->get_computed_max_date(current_time( 'timestamp' ));
if ( $booking->get_start() > $max_date || $booking->get_end() > $max_date ) {
/* translators: 1: maximum bookable date */
echo '<div class="notice notice-warning"><p>' . sprintf( esc_html__( 'This booking is scheduled over the product\'s allowed max booking date (%s). Please ensure this is correct.', 'woocommerce-bookings' ), esc_html( date_i18n( wc_bookings_date_format(), $max_date ) ) ) . '</p></div>';
Index: includes/api/class-wc-bookings-rest-products-controller.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/api/class-wc-bookings-rest-products-controller.php b/includes/api/class-wc-bookings-rest-products-controller.php
--- a/includes/api/class-wc-bookings-rest-products-controller.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
+++ b/includes/api/class-wc-bookings-rest-products-controller.php (revision ecd4ca2e00ccec027f237991073a2861f6ff7493)
@@ -106,6 +106,7 @@
'cancel_limit_unit' => $product->get_cancel_limit_unit( $context ),
'cancel_limit' => $product->get_cancel_limit( $context ),
'check_start_block_only' => $product->get_check_start_block_only( $context ),
+ 'computed_max_date' => $product->get_computed_max_date(),
'cost' => $product->get_cost( $context ),
'default_date_availability' => $product->get_default_date_availability( $context ),
'display_cost' => $product->get_display_cost( $context ),
Index: includes/booking-form/class-wc-booking-form-date-picker.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/booking-form/class-wc-booking-form-date-picker.php b/includes/booking-form/class-wc-booking-form-date-picker.php
--- a/includes/booking-form/class-wc-booking-form-date-picker.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
+++ b/includes/booking-form/class-wc-booking-form-date-picker.php (revision ecd4ca2e00ccec027f237991073a2861f6ff7493)
@@ -11,6 +11,8 @@
private $field_type = 'date-picker';
private $field_name = 'start_date';
+ const SECONDS_IN_ONE_MONTH = 60*60*24*30;
+
/**
* Constructor
* @param WC_Booking_Form $booking_form The booking form which called this picker
@@ -21,11 +23,11 @@
$this->args['type'] = $this->field_type;
$this->args['name'] = $this->field_name;
$this->args['min_date'] = $this->booking_form->product->get_min_date();
- $this->args['max_date'] = $this->booking_form->product->get_max_date();
- $this->args['default_availability'] = $this->booking_form->product->get_default_availability();
+ $this->args['computed_max_date'] = $this->booking_form->product->get_computed_max_date();
+ $this->args['default_availability'] = $this->booking_form->product->get_default_availability();
$this->args['min_date_js'] = $this->get_min_date();
- $this->args['max_date_js'] = $this->get_max_date();
- $this->args['duration_type'] = $this->booking_form->product->get_duration_type();
+ $this->args['max_date_js'] = $this->get_Ymd_max_date();
+ $this->args['duration_type'] = $this->booking_form->product->get_duration_type();
$this->args['duration_unit'] = $this->booking_form->product->get_duration_unit();
$this->args['is_range_picker_enabled'] = $this->booking_form->product->is_range_picker_enabled();
$this->args['display'] = $this->booking_form->product->get_calendar_display_mode();
@@ -75,7 +77,7 @@
$now = strtotime( 'midnight', current_time( 'timestamp' ) );
$min = $this->booking_form->product->get_min_date();
- $max = $this->booking_form->product->get_max_date();
+ $max_computed = $this->booking_form->product->get_computed_max_date($now);
$min_date = strtotime( 'midnight' );
if ( ! empty( $min ) ) {
@@ -87,13 +89,12 @@
* months batches to ensure we can exit when we find the first one without going
* through all 12 months.
*/
- for ( $i = 1; $i <= $max['value']; $i += 3 ) {
+ for ( $max_date = strtotime( "+ 1 month", $now ); $max_date <= $max_computed; $max_date = strtotime( "+ 3 month", $max_date ) ) {
/*
* $min_date calculated above first.
* Only add months up to the max value.
*/
- $range_end_increment = ( $i + 3 ) > $max['value'] ? $max['value'] : ( $i + 3 );
- $max_date = strtotime( "+ $range_end_increment month", $now );
+ $max_date = min( $max_date, $max_computed );
$blocks_in_range = $this->booking_form->product->get_blocks_in_range( $min_date, $max_date );
$last_element = end( $blocks_in_range );
@@ -117,8 +118,9 @@
$default_date = $available_blocks[0];
break;
} // else continue with loop until we get a default date where the calendar can start at.
-
- $min_date = strtotime( '+' . $i . ' month', $now );
+ $seconds_since_now = $max_date - $now;
+ $months_since_now = round( $seconds_since_now / self::SECONDS_IN_ONE_MONTH );
+ $min_date = strtotime( '+' . $months_since_now . ' month', $now );
}
}
Index: includes/booking-form/class-wc-booking-form-datetime-picker.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/booking-form/class-wc-booking-form-datetime-picker.php b/includes/booking-form/class-wc-booking-form-datetime-picker.php
--- a/includes/booking-form/class-wc-booking-form-datetime-picker.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
+++ b/includes/booking-form/class-wc-booking-form-datetime-picker.php (revision ecd4ca2e00ccec027f237991073a2861f6ff7493)
@@ -21,11 +21,11 @@
$this->args['type'] = $this->field_type;
$this->args['name'] = $this->field_name;
$this->args['min_date'] = $this->booking_form->product->get_min_date();
- $this->args['max_date'] = $this->booking_form->product->get_max_date();
- $this->args['default_availability'] = $this->booking_form->product->get_default_availability();
+ $this->args['computed_max_date'] = $this->booking_form->product->get_computed_max_date();
+ $this->args['default_availability'] = $this->booking_form->product->get_default_availability();
$this->args['first_block_time'] = $this->booking_form->product->get_first_block_time();
$this->args['min_date_js'] = $this->get_min_date();
- $this->args['max_date_js'] = $this->get_max_date();
+ $this->args['max_date_js'] = $this->get_Ymd_max_date();
$this->args['duration_type'] = $this->booking_form->product->get_duration_type();
$this->args['is_range_picker_enabled'] = false; // Datetime has no end date field
$this->args['interval'] = $this->booking_form->product->get_duration();
Index: includes/booking-form/class-wc-booking-form-month-picker.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/booking-form/class-wc-booking-form-month-picker.php b/includes/booking-form/class-wc-booking-form-month-picker.php
--- a/includes/booking-form/class-wc-booking-form-month-picker.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
+++ b/includes/booking-form/class-wc-booking-form-month-picker.php (revision ecd4ca2e00ccec027f237991073a2861f6ff7493)
@@ -21,7 +21,7 @@
$this->args['type'] = $this->field_type;
$this->args['name'] = $this->field_name;
$this->args['min_date'] = $this->booking_form->product->get_min_date();
- $this->args['max_date'] = $this->booking_form->product->get_max_date();
+ $this->args['computed_max_date'] = $this->booking_form->product->get_computed_max_date();
$this->args['default_availability'] = $this->booking_form->product->get_default_availability();
$this->args['display'] = $this->booking_form->product->get_calendar_display_mode();
$this->args['is_range_picker_enabled'] = $this->booking_form->product->is_range_picker_enabled();
@@ -48,7 +48,7 @@
*/
public function get_booking_blocks() {
$min_date = $this->args['min_date'];
- $max_date = $this->args['max_date'];
+ $max_computed_date = $this->args['max_computed_date'];
// Generate a range of blocks for months
if ( $min_date ) {
@@ -59,7 +59,7 @@
} else {
$from = strtotime( date( 'Y-m-01', strtotime( '+28 days' ) ) );
}
- $to = strtotime( date( 'Y-m-t', strtotime( "+{$max_date['value']} {$max_date['unit']}" ) ) );
+ $to = strtotime( date( 'Y-m-t', $max_computed_date ) );
return $this->booking_form->product->get_blocks_in_range( $from, $to );
}
Index: includes/booking-form/class-wc-booking-form-picker.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/booking-form/class-wc-booking-form-picker.php b/includes/booking-form/class-wc-booking-form-picker.php
--- a/includes/booking-form/class-wc-booking-form-picker.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
+++ b/includes/booking-form/class-wc-booking-form-picker.php (revision ecd4ca2e00ccec027f237991073a2861f6ff7493)
@@ -53,6 +53,15 @@
return $js_string;
}
+ /**
+ * Get the max date in YYYY-mm-dd format. Datepicker accepts that natively.
+ * @return string
+ */
+ protected function get_Ymd_max_date(): string {
+ $max_date = $this->booking_form->product->get_computed_max_date(current_time( 'timestamp' ));
+ return empty($max_date) ? "" : date("Y-m-d", $max_date );
+ }
+
/**
* Get the max date in date picker format
* @return string
Index: includes/class-wc-bookings-wc-ajax.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/class-wc-bookings-wc-ajax.php b/includes/class-wc-bookings-wc-ajax.php
--- a/includes/class-wc-bookings-wc-ajax.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
+++ b/includes/class-wc-bookings-wc-ajax.php (revision ecd4ca2e00ccec027f237991073a2861f6ff7493)
@@ -169,11 +169,11 @@
$args['availability_rules'] = array();
$args['availability_rules'][0] = $product->get_availability_rules();
$args['min_date'] = isset( $_GET['min_date'] ) ? strtotime( $_GET['min_date'] ) : $product->get_min_date();
- $args['max_date'] = isset( $_GET['max_date'] ) ? strtotime( $_GET['max_date'] ) : $product->get_max_date();
+ $args['computed_max_date'] = isset( $_GET['max_date']) ? strtotime( $_GET['max_date']) : $product->get_computed_max_date(current_time( 'timestamp' ));
$min_date = ( ! isset( $_GET['min_date'] ) ) ? strtotime( "+{$args['min_date']['value']} {$args['min_date']['unit']}", current_time( 'timestamp' ) ) : $args['min_date'];
- $max_date = ( ! isset( $_GET['max_date'] ) ) ? strtotime( "+{$args['max_date']['value']} {$args['max_date']['unit']}", current_time( 'timestamp' ) ) : $args['max_date'];
- $timezone_offset = isset( $_GET['timezone_offset'] ) ? $_GET['timezone_offset'] : 0;
+ $max_date = $args['computed_max_date'];
+ $timezone_offset = isset( $_GET['timezone_offset'] ) ? $_GET['timezone_offset'] : 0;
if ( $product->has_resources() ) {
foreach ( $product->get_resources() as $resource ) {
Index: includes/data-objects/class-wc-product-booking.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/data-objects/class-wc-product-booking.php b/includes/data-objects/class-wc-product-booking.php
--- a/includes/data-objects/class-wc-product-booking.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
+++ b/includes/data-objects/class-wc-product-booking.php (revision ecd4ca2e00ccec027f237991073a2861f6ff7493)
@@ -1290,17 +1290,51 @@
return $min_date;
}
- /**
- * Get max date.
- *
- * @return array
- */
- public function get_max_date() {
- $max_date['value'] = $this->get_max_date_value() ? apply_filters( 'woocommerce_bookings_max_date_value', $this->get_max_date_value(), $this->get_id() ) : 1;
- $max_date['unit'] = $this->get_max_date_unit() ? apply_filters( 'woocommerce_bookings_max_date_unit', $this->get_max_date_unit(), $this->get_id() ) : 'month';
- return $max_date;
- }
+ /**
+ * Get max date.
+ *
+ * @return array
+ */
+ public function get_max_date() {
+ $max_date['value'] = $this->get_max_date_value() ? apply_filters( 'woocommerce_bookings_max_date_value', $this->get_max_date_value(), $this->get_id() ) : 1;
+ $max_date['unit'] = $this->get_max_date_unit() ? apply_filters( 'woocommerce_bookings_max_date_unit', $this->get_max_date_unit(), $this->get_id() ) : 'month';
+ return $max_date;
+ }
+ /**
+ * Get computed max date, given a current time. If there is no max_date, propagates the null.
+ *
+ * @param date $current_time The current time, used as a starting point in time.
+ * @param array $fallback_max_time Used if max_date is empty.
+ * @return date
+ */
+ public function get_computed_max_date_or_null( $current_time = null, array &$fallback_max_time = array() ) {
+ if ( $current_time === null ) {
+ $current_time = current_time( 'timestamp' );
+ }
+ $max_date = $this->get_max_date();
+ $max_date = empty( $max_date ) ? $fallback_max_time : $max_date;
+ if (empty($max_date)) {
+ return null;
+ }
+ return strtotime( "+{$max_date['value']} {$max_date['unit']}", $current_time );
+ }
+
+ /**
+ * Get computed max date, given a current time.
+ *
+ * @param date $current_time The current time, used as a starting point in time.
+ * @param array $fallback_max_time Used if max_date is empty.
+ * @return date
+ */
+ public function get_computed_max_date( $current_time = null, array &$fallback_max_time = array() ) {
+ if ( $current_time === null ) {
+ $current_time = current_time( 'timestamp' );
+ }
+ $max_date_or_null = $this->get_computed_max_date_or_null($current_time, $fallback_max_time);
+ return $max_date_or_null === null ? $current_time : $max_date_or_null;
+ }
+
/**
* Get the Product buffer period setting.
*
@@ -1905,10 +1939,9 @@
// get a time stamp to check from
// and get a time stamp to check to
$product_min_date = $this->get_min_date();
- $product_max_date = $this->get_max_date();
$min_check_from = strtotime( "+{$product_min_date['value']} {$product_min_date['unit']}", current_time( 'timestamp' ) );
- $max_check_to = strtotime( "+{$product_max_date['value']} {$product_max_date['unit']}", current_time( 'timestamp' ) );
+ $max_check_to = $this->get_computed_max_date(current_time( 'timestamp' ));
$min_date = wc_bookings_get_min_timestamp_for_day( $start_date, $product_min_date['value'], $product_min_date['unit'] );
$available_qty = $this->get_available_quantity( $resource_id );
@@ -2335,13 +2368,12 @@
return new WP_Error( 'Error', sprintf( __( 'The earliest booking possible is currently %s.', 'woocommerce-bookings' ), date_i18n( wc_bookings_date_format() . ' ' . wc_bookings_time_format(), $min_date ) ) );
}
}
- $max = $this->get_max_date();
+ $computed_max_date = $this->get_computed_max_date_or_null($now);
- if ( $max ) {
- $max_date = strtotime( "+{$max['value']} {$max['unit']}", $now );
- if ( strtotime( $data['_date'] . ' ' . $data['_time'] ) > $max_date ) {
+ if ( $computed_max_date ) {
+ if ( strtotime( $data['_date'] . ' ' . $data['_time'] ) > $computed_max_date ) {
/* translators: 1: maximum date */
- return new WP_Error( 'Error', sprintf( __( 'The latest booking possible is currently %s.', 'woocommerce-bookings' ), date_i18n( wc_bookings_date_format() . ' ' . wc_bookings_time_format(), $max_date ) ) );
+ return new WP_Error( 'Error', sprintf( __( 'The latest booking possible is currently %s.', 'woocommerce-bookings' ), date_i18n( wc_bookings_date_format() . ' ' . wc_bookings_time_format(), $computed_max_date ) ) );
}
}
@@ -2413,14 +2445,13 @@
* @return date
*/
private function get_max_allowed_date_into_the_future( $end_date ) {
- $product_max_date = $this->get_max_date();
+ $product_max_date = $this->get_computed_max_date_or_null(current_time( 'timestamp' ));
- if ( $product_max_date ) {
+ if ( $product_max_date === null ) {
return $end_date;
}
- $max_end_date = strtotime( "+{$product_max_date['value']} {$product_max_date['unit']}", current_time( 'timestamp' ) );
- return $end_date > $max_end_date ? $max_end_date : $end_date;
+ return min( $end_date, $product_max_date );
}
}
Index: includes/data-stores/class-wc-booking-data-store.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/data-stores/class-wc-booking-data-store.php b/includes/data-stores/class-wc-booking-data-store.php
--- a/includes/data-stores/class-wc-booking-data-store.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
+++ b/includes/data-stores/class-wc-booking-data-store.php (revision ecd4ca2e00ccec027f237991073a2861f6ff7493)
@@ -500,12 +500,11 @@
}
if ( empty( $max_date ) ) {
- $max_date = $bookable_product->get_max_date();
- $max_date = empty( $max_date ) ? array(
- 'unit' => 'month',
- 'value' => 12,
- ) : $max_date;
- $max_date = strtotime( "+{$max_date['value']} {$max_date['unit']}", current_time( 'timestamp' ) );
+ $default_max_time = array(
+ 'unit' => 'month',
+ 'value' => 12,
+ );
+ $max_date = $bookable_product->get_computed_max_date(current_time( 'timestamp' ), $default_max_time);
}
return self::get_bookings_for_objects( $find_bookings_for, get_wc_booking_statuses( 'fully_booked' ), $min_date, $max_date );
Index: includes/wc-bookings-functions.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/wc-bookings-functions.php b/includes/wc-bookings-functions.php
--- a/includes/wc-bookings-functions.php (revision 5fb0415e507bcdb423ed83bed1c6ae0cd3e14177)
+++ b/includes/wc-bookings-functions.php (revision ecd4ca2e00ccec027f237991073a2861f6ff7493)
@@ -182,7 +182,7 @@
$product = wc_get_product( $product_id );
$start_date = $new_booking_data['start_date'];
$end_date = $new_booking_data['end_date'];
- $max_date = $product->get_max_date();
+ $computed_max_date = $product->get_computed_max_date(current_time( 'timestamp' ));
$all_day = isset( $new_booking_data['all_day'] ) && $new_booking_data['all_day'] ? true : false;
$qty = 1;
@@ -229,7 +229,7 @@
$start_date += $date_diff;
$end_date += $date_diff;
- if ( $end_date > strtotime( "+{$max_date['value']} {$max_date['unit']}" ) ) {
+ if ( $end_date > $computed_max_date ) {
return false;
}
}
@@ -476,9 +476,9 @@
return false;
}
$min_date = $bookable_product->get_min_date();
- $max_date = $bookable_product->get_max_date();
- $check_from = strtotime( "midnight +{$min_date['value']} {$min_date['unit']}", current_time( 'timestamp' ) );
- $check_to = strtotime( "+{$max_date['value']} {$max_date['unit']}", current_time( 'timestamp' ) );
+ $computed_max_date = $bookable_product->get_computed_max_date(current_time( 'timestamp' ));
+ $check_from = strtotime( "midnight +{$min_date['value']} {$min_date['unit']}", current_time( 'timestamp' ) );
+ $check_to = $computed_max_date;
// Min max checks
if ( 'month' === $bookable_product->get_duration_unit() ) {
$check_to = strtotime( 'midnight', strtotime( date( 'Y-m-t', $check_to ) ) );
Index: includes/data-objects/class-wc-product-booking.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/includes/data-objects/class-wc-product-booking.php b/includes/data-objects/class-wc-product-booking.php
--- a/includes/data-objects/class-wc-product-booking.php (revision ecd4ca2e00ccec027f237991073a2861f6ff7493)
+++ b/includes/data-objects/class-wc-product-booking.php (revision 47856139122aa21afb8d7b268c30c659a6cc7515)
@@ -10,6 +10,37 @@
* Class for the booking product type.
*/
class WC_Product_Booking extends WC_Product_Booking_Compatibility {
+ /**
+ * The default value for the start of the day.
+ */
+ const DEFAULT_START_OF_THE_DAY = '10:00';
+
+ /**
+ * @return string The start of the day. It can be used for setting
+ * working hours (in an office), for example.
+ * This is used to determine whether we have started the "new day" or
+ * if we're still considered the "previous day".
+ *
+ * To override the default `self::DEFAULT_START_WORKING_HOURS`, write
+ * the following (i.e. to set it at midnight) in your functions.php:
+ *
+ * ```php
+ * define('START_OF_THE_DAY', '00:00');
+ * ```
+ *
+ * @return string
+ */
+ public static function getStartOfTheDay(): string
+ {
+ defined('START_OF_THE_DAY') or define('START_OF_THE_DAY', self::DEFAULT_START_OF_THE_DAY);
+ $start_of_the_day = START_OF_THE_DAY;
+ $test_format = strtotime(date($start_of_the_day));
+ if ($test_format === false) { // will be boolean false if strtotime() failed.
+ return self::DEFAULT_START_OF_THE_DAY;
+ }
+ return $start_of_the_day;
+ }
+
/**
* Stores product data.
*
@@ -1301,6 +1332,32 @@
return $max_date;
}
+ /**
+ * Gives the official start of the given month.
+ *
+ * @param date $current_time The current time.
+ * @return date
+ */
+ public function get_month_first_start_working_hour( $current_time ) {
+ return strtotime(date('Y-m-01 '. self::getStartOfTheDay(), $current_time));
+ }
+
+ /**
+ * Gives the last day of a given `$date`, from the observing point of view of `$current_time`.
+ *
+ * @param date $current_time The current time
+ * @param date $date The date from which we want the last day of the month.
+ * @return date
+ */
+ protected function get_last_day_of_month( $current_time, $date ) {
+ // if we haven't "officially" started this month yet, we still consider ourselves the previous month.
+ $last_day = strtotime(date('Y-m-t', $date));
+ if ($current_time < $this->get_month_first_start_working_hour($current_time)) {
+ $last_day = strtotime("-1 month", $last_day);
+ }
+ return $last_day;
+ }
+
/**
* Get computed max date, given a current time. If there is no max_date, propagates the null.
*
@@ -1317,7 +1374,12 @@
if (empty($max_date)) {
return null;
}
- return strtotime( "+{$max_date['value']} {$max_date['unit']}", $current_time );
+
+ $computed_max_date = strtotime( "+{$max_date['value']} {$max_date['unit']}", $current_time );
+ if ( $this->get_max_date_full_month() ) {
+ return $this->get_last_day_of_month($current_time, $computed_max_date);
+ }
+ return $computed_max_date;
}
/**
Index: languages/woocommerce-bookings.pot
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/languages/woocommerce-bookings.pot b/languages/woocommerce-bookings.pot
--- a/languages/woocommerce-bookings.pot (revision 47856139122aa21afb8d7b268c30c659a6cc7515)
+++ b/languages/woocommerce-bookings.pot (revision c0564c286d01a85b676d2a41df0d75976983c6b3)
@@ -9,9 +9,9 @@
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"POT-Creation-Date: 2021-06-15T14:09:50+00:00\n"
+"POT-Creation-Date: 2021-06-18T19:12:57+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"X-Generator: WP-CLI 2.4.0\n"
+"X-Generator: WP-CLI 2.5.0\n"
"X-Domain: woocommerce-bookings\n"
#. Plugin Name of the plugin
@@ -55,9 +55,9 @@
#: includes/admin/class-wc-bookable-resource-cpt.php:91
#: includes/admin/class-wc-bookings-cpt.php:227
#: includes/admin/class-wc-bookings-customer-meta-box.php:115
-#: includes/admin/class-wc-bookings-details-meta-box.php:117
-#: includes/admin/class-wc-bookings-details-meta-box.php:163
-#: includes/admin/class-wc-bookings-details-meta-box.php:165
+#: includes/admin/class-wc-bookings-details-meta-box.php:116
+#: includes/admin/class-wc-bookings-details-meta-box.php:162
+#: includes/admin/class-wc-bookings-details-meta-box.php:164
#: includes/emails/class-wc-email-booking-cancelled.php:93
#: includes/emails/class-wc-email-booking-confirmed.php:91
#: includes/emails/class-wc-email-booking-notification.php:99
@@ -89,39 +89,39 @@
msgstr ""
#: includes/admin/class-wc-bookable-resource-details-meta-box.php:98
-#: includes/admin/views/html-booking-availability.php:149
+#: includes/admin/views/html-booking-availability.php:158
#: includes/admin/views/html-booking-pricing.php:61
#: includes/admin/views/html-classic-availability-settings.php:144
msgid "Range type"
msgstr ""
#: includes/admin/class-wc-bookable-resource-details-meta-box.php:99
-#: includes/admin/views/html-booking-availability.php:150
+#: includes/admin/views/html-booking-availability.php:159
#: includes/admin/views/html-booking-pricing.php:62
#: includes/admin/views/html-classic-availability-settings.php:145
msgid "Range"
msgstr ""
#: includes/admin/class-wc-bookable-resource-details-meta-box.php:102
-#: includes/admin/views/html-booking-availability.php:153
+#: includes/admin/views/html-booking-availability.php:162
#: includes/admin/views/html-classic-availability-settings.php:148
msgid "Bookable"
msgstr ""
#: includes/admin/class-wc-bookable-resource-details-meta-box.php:102
-#: includes/admin/views/html-booking-availability.php:153
+#: includes/admin/views/html-booking-availability.php:162
#: includes/admin/views/html-classic-availability-settings.php:148
msgid "If not bookable, users won't be able to choose this block for their booking."
msgstr ""
#: includes/admin/class-wc-bookable-resource-details-meta-box.php:103
-#: includes/admin/views/html-booking-availability.php:154
+#: includes/admin/views/html-booking-availability.php:163
#: includes/admin/views/html-classic-availability-settings.php:150
msgid "Priority"
msgstr ""
#: includes/admin/class-wc-bookable-resource-details-meta-box.php:115
-#: includes/admin/views/html-booking-availability.php:166
+#: includes/admin/views/html-booking-availability.php:175
#: includes/admin/views/html-booking-pricing.php:78
#: includes/admin/views/html-classic-availability-settings.php:166
msgid "Add Range"
@@ -159,7 +159,7 @@
msgid "This tool will clear all expired In Cart bookings."
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:352
+#: includes/admin/class-wc-bookings-admin.php:353
#: includes/admin/views/html-booking-resources.php:36
#: includes/admin/views/html-booking-tab.php:1
#: includes/class-wc-bookings-init.php:46
@@ -167,20 +167,20 @@
msgid "Resources"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:359
+#: includes/admin/class-wc-bookings-admin.php:360
#: includes/admin/class-wc-bookings-products-export.php:32
#: includes/admin/class-wc-bookings-products-import.php:33
#: includes/admin/views/html-booking-tab.php:2
msgid "Availability"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:366
+#: includes/admin/class-wc-bookings-admin.php:367
#: includes/admin/views/html-booking-tab.php:3
msgid "Costs"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:373
-#: includes/admin/class-wc-bookings-admin.php:650
+#: includes/admin/class-wc-bookings-admin.php:374
+#: includes/admin/class-wc-bookings-admin.php:651
#: includes/admin/views/html-booking-tab.php:4
#: includes/booking-form/class-wc-booking-form.php:256
#: includes/class-wc-bookings-google-calendar-connection.php:1272
@@ -188,83 +188,83 @@
msgid "Persons"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:447
-#: includes/admin/class-wc-bookings-admin.php:450
-#: includes/admin/class-wc-bookings-admin.php:452
+#: includes/admin/class-wc-bookings-admin.php:448
+#: includes/admin/class-wc-bookings-admin.php:451
+#: includes/admin/class-wc-bookings-admin.php:453
msgid "Booking updated."
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:448
+#: includes/admin/class-wc-bookings-admin.php:449
msgid "Custom field updated."
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:449
+#: includes/admin/class-wc-bookings-admin.php:450
msgid "Custom field deleted."
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:453
+#: includes/admin/class-wc-bookings-admin.php:454
msgid "Booking saved."
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:454
+#: includes/admin/class-wc-bookings-admin.php:455
msgid "Booking submitted."
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:540
+#: includes/admin/class-wc-bookings-admin.php:541
#: includes/class-wc-booking-privacy.php:78
msgid "Bookable product"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:633
+#: includes/admin/class-wc-bookings-admin.php:634
msgid "Are you sure you want to remove this person type?"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:636
+#: includes/admin/class-wc-bookings-admin.php:637
msgid "Are you sure you want to remove this resource?"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:639
+#: includes/admin/class-wc-bookings-admin.php:640
msgid "minutes"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:640
+#: includes/admin/class-wc-bookings-admin.php:641
msgid "hours"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:641
+#: includes/admin/class-wc-bookings-admin.php:642
msgid "days"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:642
+#: includes/admin/class-wc-bookings-admin.php:643
msgid "Enter a name for the new resource"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:647
+#: includes/admin/class-wc-bookings-admin.php:648
msgid "View details"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:648
+#: includes/admin/class-wc-bookings-admin.php:649
#: includes/admin/views/html-create-booking-page.php:18
msgid "Customer"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:649
+#: includes/admin/class-wc-bookings-admin.php:650
msgid "Resource"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:678
+#: includes/admin/class-wc-bookings-admin.php:679
msgid "Has persons"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:679
+#: includes/admin/class-wc-bookings-admin.php:680
msgid "Enable this if this bookable product can be booked by a customer defined number of persons."
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:685
+#: includes/admin/class-wc-bookings-admin.php:686
msgid "Has resources"
msgstr ""
-#: includes/admin/class-wc-bookings-admin.php:686
+#: includes/admin/class-wc-bookings-admin.php:687
msgid "Enable this if this bookable product has multiple bookable resources, for example room types or instructors."
msgstr ""
@@ -330,7 +330,7 @@
msgstr ""
#: includes/admin/class-wc-bookings-calendar.php:583
-#: includes/admin/class-wc-bookings-details-meta-box.php:267
+#: includes/admin/class-wc-bookings-details-meta-box.php:266
#: includes/class-wc-bookings-ics-exporter.php:185
#: includes/wc-bookings-functions.php:72
#: templates/emails/admin-booking-cancelled.php:72
@@ -449,14 +449,14 @@
#: includes/admin/class-wc-bookings-cpt.php:175
#: templates/myaccount/bookings.php:41
#: templates/myaccount/my-bookings.php:33
-#: assets/js/components/store-availability-popover/index.js:41
+#: dist/admin-store-availability.js:1
msgid "Start Date"
msgstr ""
#: includes/admin/class-wc-bookings-cpt.php:176
#: templates/myaccount/bookings.php:42
#: templates/myaccount/my-bookings.php:34
-#: assets/js/components/store-availability-popover/index.js:45
+#: dist/admin-store-availability.js:1
msgid "End Date"
msgstr ""
@@ -533,132 +533,132 @@
msgstr ""
#. translators: 1: maximum bookable date
-#: includes/admin/class-wc-bookings-details-meta-box.php:74
+#: includes/admin/class-wc-bookings-details-meta-box.php:73
msgid "This booking is scheduled over the product's allowed max booking date (%s). Please ensure this is correct."
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:79
+#: includes/admin/class-wc-bookings-details-meta-box.php:78
msgid "This booking has an end date set before the start date."
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:83
+#: includes/admin/class-wc-bookings-details-meta-box.php:82
msgid "It appears the booking product associated with this booking has been removed."
msgstr ""
#. translators: 1: product type
-#: includes/admin/class-wc-bookings-details-meta-box.php:89
+#: includes/admin/class-wc-bookings-details-meta-box.php:88
msgid "This booking is missing a required add-on (product type: %s). Some information is shown below but might be incomplete. Please install the missing add-on through the plugins screen."
msgstr ""
#. translators: 1: booking id
-#: includes/admin/class-wc-bookings-details-meta-box.php:139
+#: includes/admin/class-wc-bookings-details-meta-box.php:138
msgid "Booking #%s details"
msgstr ""
#. translators: 1: href to order id
-#: includes/admin/class-wc-bookings-details-meta-box.php:146
+#: includes/admin/class-wc-bookings-details-meta-box.php:145
msgid "Linked to order %s."
msgstr ""
#. translators: 1: bookings addon title
-#: includes/admin/class-wc-bookings-details-meta-box.php:151
+#: includes/admin/class-wc-bookings-details-meta-box.php:150
msgid "Booking type: %s"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:158
+#: includes/admin/class-wc-bookings-details-meta-box.php:157
msgid "General details"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:161
+#: includes/admin/class-wc-bookings-details-meta-box.php:160
msgid "Order ID:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:173
+#: includes/admin/class-wc-bookings-details-meta-box.php:172
msgid "Date created:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:174
+#: includes/admin/class-wc-bookings-details-meta-box.php:173
msgid "h"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:174
+#: includes/admin/class-wc-bookings-details-meta-box.php:173
msgid "m"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:178
+#: includes/admin/class-wc-bookings-details-meta-box.php:177
msgid "Booking status:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:190
+#: includes/admin/class-wc-bookings-details-meta-box.php:189
msgid "Customer:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:193
+#: includes/admin/class-wc-bookings-details-meta-box.php:192
#: includes/admin/views/html-create-booking-page.php:22
#: includes/admin/views/html-create-booking-page.php:24
msgid "Guest"
msgstr ""
#. translators: 1: guest name
-#: includes/admin/class-wc-bookings-details-meta-box.php:196
+#: includes/admin/class-wc-bookings-details-meta-box.php:195
msgctxt "Admin booking guest placeholder"
msgid "Guest (%s)"
msgstr ""
#. translators: 1: full name 2: user id 3: email
-#: includes/admin/class-wc-bookings-details-meta-box.php:203
+#: includes/admin/class-wc-bookings-details-meta-box.php:202
msgid "%1$s (#%2$s &ndash; %3$s)"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:224
+#: includes/admin/class-wc-bookings-details-meta-box.php:223
msgid "Metadata:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:243
+#: includes/admin/class-wc-bookings-details-meta-box.php:242
msgid "Booking specification"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:250
+#: includes/admin/class-wc-bookings-details-meta-box.php:249
msgid "Booked product:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:257
+#: includes/admin/class-wc-bookings-details-meta-box.php:256
msgid "Parent booking ID:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:331
+#: includes/admin/class-wc-bookings-details-meta-box.php:330
msgid "Booking date &amp; time"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:335
+#: includes/admin/class-wc-bookings-details-meta-box.php:334
msgid "Start date:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:343
+#: includes/admin/class-wc-bookings-details-meta-box.php:342
msgid "End date:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:351
+#: includes/admin/class-wc-bookings-details-meta-box.php:350
msgid "All day booking:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:352
+#: includes/admin/class-wc-bookings-details-meta-box.php:351
msgid "Check this box if the booking is for all day."
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:358
+#: includes/admin/class-wc-bookings-details-meta-box.php:357
msgid "Start time:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:366
+#: includes/admin/class-wc-bookings-details-meta-box.php:365
msgid "End time:"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:375
+#: includes/admin/class-wc-bookings-details-meta-box.php:374
msgid "Start time (local timezone):"
msgstr ""
-#: includes/admin/class-wc-bookings-details-meta-box.php:384
+#: includes/admin/class-wc-bookings-details-meta-box.php:383
msgid "End time (local timezone):"
msgstr ""
@@ -844,96 +844,101 @@
#: includes/admin/class-wc-bookings-products-export.php:53
#: includes/admin/class-wc-bookings-products-import.php:54
-msgid "Max_date_unit"
+msgid "Max_date_full_month"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:54
#: includes/admin/class-wc-bookings-products-import.php:55
-msgid "Max_date_value"
+msgid "Max_date_unit"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:55
#: includes/admin/class-wc-bookings-products-import.php:56
-msgid "Max_duration"
+msgid "Max_date_value"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:56
#: includes/admin/class-wc-bookings-products-import.php:57
-msgid "Max_persons"
+msgid "Max_duration"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:57
#: includes/admin/class-wc-bookings-products-import.php:58
-msgid "Min_date_unit"
+msgid "Max_persons"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:58
#: includes/admin/class-wc-bookings-products-import.php:59
-msgid "Min_date_value"
+msgid "Min_date_unit"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:59
#: includes/admin/class-wc-bookings-products-import.php:60
-msgid "Min_duration"
+msgid "Min_date_value"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:60
#: includes/admin/class-wc-bookings-products-import.php:61
-msgid "Min_persons"
+msgid "Min_duration"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:61
#: includes/admin/class-wc-bookings-products-import.php:62
-msgid "Person_types"
+msgid "Min_persons"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:62
#: includes/admin/class-wc-bookings-products-import.php:63
-msgid "Pricing"
+msgid "Person_types"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:63
#: includes/admin/class-wc-bookings-products-import.php:64
-msgid "Qty"
+msgid "Pricing"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:64
#: includes/admin/class-wc-bookings-products-import.php:65
-msgid "Requires_confirmation"
+msgid "Qty"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:65
#: includes/admin/class-wc-bookings-products-import.php:66
-msgid "Resource_label"
+msgid "Requires_confirmation"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:66
#: includes/admin/class-wc-bookings-products-import.php:67
-msgid "Resource_base_costs"
+msgid "Resource_label"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:67
#: includes/admin/class-wc-bookings-products-import.php:68
-msgid "Resource_block_costs"
+msgid "Resource_base_costs"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:68
#: includes/admin/class-wc-bookings-products-import.php:69
-msgid "Resource_ids"
+msgid "Resource_block_costs"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:69
#: includes/admin/class-wc-bookings-products-import.php:70
-msgid "Resources_assignment"
+msgid "Resource_ids"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:70
#: includes/admin/class-wc-bookings-products-import.php:71
-msgid "Restricted_days"
+msgid "Resources_assignment"
msgstr ""
#: includes/admin/class-wc-bookings-products-export.php:71
#: includes/admin/class-wc-bookings-products-import.php:72
+msgid "Restricted_days"
+msgstr ""
+
+#: includes/admin/class-wc-bookings-products-export.php:72
+#: includes/admin/class-wc-bookings-products-import.php:73
msgid "User_can_cancel"
msgstr ""
@@ -1041,43 +1046,43 @@
msgstr ""
#: includes/admin/views/html-booking-availability-fields.php:27
-#: includes/admin/views/html-booking-availability.php:119
+#: includes/admin/views/html-booking-availability.php:128
#: includes/admin/views/html-booking-pricing-fields.php:24
msgid "Monday"
msgstr ""
#: includes/admin/views/html-booking-availability-fields.php:28
-#: includes/admin/views/html-booking-availability.php:120
+#: includes/admin/views/html-booking-availability.php:129
#: includes/admin/views/html-booking-pricing-fields.php:25
msgid "Tuesday"
msgstr ""
#: includes/admin/views/html-booking-availability-fields.php:29
-#: includes/admin/views/html-booking-availability.php:121
+#: includes/admin/views/html-booking-availability.php:130
#: includes/admin/views/html-booking-pricing-fields.php:26
msgid "Wednesday"
msgstr ""
#: includes/admin/views/html-booking-availability-fields.php:30
-#: includes/admin/views/html-booking-availability.php:122
+#: includes/admin/views/html-booking-availability.php:131
#: includes/admin/views/html-booking-pricing-fields.php:27
msgid "Thursday"
msgstr ""
#: includes/admin/views/html-booking-availability-fields.php:31
-#: includes/admin/views/html-booking-availability.php:123
+#: includes/admin/views/html-booking-availability.php:132
#: includes/admin/views/html-booking-pricing-fields.php:28
msgid "Friday"
msgstr ""
#: includes/admin/views/html-booking-availability-fields.php:32
-#: includes/admin/views/html-booking-availability.php:124
+#: includes/admin/views/html-booking-availability.php:133
#: includes/admin/views/html-booking-pricing-fields.php:29
msgid "Saturday"
msgstr ""
#: includes/admin/views/html-booking-availability-fields.php:33
-#: includes/admin/views/html-booking-availability.php:118
+#: includes/admin/views/html-booking-availability.php:127
#: includes/admin/views/html-booking-pricing-fields.php:30
msgid "Sunday"
msgstr ""
@@ -1231,51 +1236,60 @@
msgid "By default buffer period applies forward into the future of a booking. Enabling this option will apply adjacently (before and after Bookings)."
msgstr ""
-#: includes/admin/views/html-booking-availability.php:68
+#: includes/admin/views/html-booking-availability.php:69
+#: includes/api/class-wc-bookings-rest-products-controller.php:370
+msgid "Full month is bookable?"
+msgstr ""
+
+#: includes/admin/views/html-booking-availability.php:70
+msgid "Enabling this option will make bookings available until the end of the month. So if the end date would be June 7 or June 28, it would become June 30 in both cases."
+msgstr ""
+
+#: includes/admin/views/html-booking-availability.php:77
msgid "All dates are..."
msgstr ""
-#: includes/admin/views/html-booking-availability.php:72
+#: includes/admin/views/html-booking-availability.php:81
msgid "available by default"
msgstr ""
-#: includes/admin/views/html-booking-availability.php:73
+#: includes/admin/views/html-booking-availability.php:82
msgid "not-available by default"
msgstr ""
-#: includes/admin/views/html-booking-availability.php:75
+#: includes/admin/views/html-booking-availability.php:84
msgid "This option affects how you use the rules below."
msgstr ""
-#: includes/admin/views/html-booking-availability.php:82
+#: includes/admin/views/html-booking-availability.php:91
msgid "Check rules against..."
msgstr ""
-#: includes/admin/views/html-booking-availability.php:86
+#: includes/admin/views/html-booking-availability.php:95
msgid "All blocks being booked"
msgstr ""
-#: includes/admin/views/html-booking-availability.php:87
+#: includes/admin/views/html-booking-availability.php:96
msgid "The starting block only"
msgstr ""
-#: includes/admin/views/html-booking-availability.php:89
+#: includes/admin/views/html-booking-availability.php:98
msgid "This option affects how bookings are checked for availability."
msgstr ""
-#: includes/admin/views/html-booking-availability.php:94
+#: includes/admin/views/html-booking-availability.php:103
msgid "First block starts at..."
msgstr ""
-#: includes/admin/views/html-booking-availability.php:99
+#: includes/admin/views/html-booking-availability.php:108
msgid "view our documentation here."
msgstr ""
-#: includes/admin/views/html-booking-availability.php:104
+#: includes/admin/views/html-booking-availability.php:113
msgid "Restrict selectable days?"
msgstr ""
-#: includes/admin/views/html-booking-availability.php:105
+#: includes/admin/views/html-booking-availability.php:114
msgid "Restrict the days of the week that are able to be selected on the calendar; this will not affect your availability. For more information on restricting start and end days you can"
msgstr ""
@@ -1745,213 +1759,213 @@
msgstr ""
#: includes/api/class-wc-bookings-rest-products-controller.php:95
-#: includes/api/class-wc-bookings-rest-products-controller.php:188
+#: includes/api/class-wc-bookings-rest-products-controller.php:190
#: includes/api/class-wc-bookings-rest-products-slots-controller.php:133
msgid "Not a bookable product"
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:160
+#: includes/api/class-wc-bookings-rest-products-controller.php:162
msgid "Limit result set to products assigned a specific resource ID."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:208
+#: includes/api/class-wc-bookings-rest-products-controller.php:210
msgid "Apply adjacent buffers."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:213
+#: includes/api/class-wc-bookings-rest-products-controller.php:215
msgid "Availability rules defined on product level."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:220
+#: includes/api/class-wc-bookings-rest-products-controller.php:222
msgid "Availability type."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:225
-#: includes/api/class-wc-bookings-rest-products-controller.php:427
+#: includes/api/class-wc-bookings-rest-products-controller.php:227
+#: includes/api/class-wc-bookings-rest-products-controller.php:434
msgid "Starting month/day/week inclusive."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:230
-#: includes/api/class-wc-bookings-rest-products-controller.php:432
+#: includes/api/class-wc-bookings-rest-products-controller.php:232
+#: includes/api/class-wc-bookings-rest-products-controller.php:439
msgid "Ending month/day/week inclusive."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:235
-#: includes/api/class-wc-bookings-rest-products-controller.php:437
+#: includes/api/class-wc-bookings-rest-products-controller.php:237
+#: includes/api/class-wc-bookings-rest-products-controller.php:444
msgid "Starting day if 'from' is a time.,"
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:240
-#: includes/api/class-wc-bookings-rest-products-controller.php:442
+#: includes/api/class-wc-bookings-rest-products-controller.php:242
+#: includes/api/class-wc-bookings-rest-products-controller.php:449
msgid "Ending day if 'to' is a time."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:245
+#: includes/api/class-wc-bookings-rest-products-controller.php:247
msgid "Rule marks things as bookable or not, 'yes' or 'no'."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:250
-#: includes/api/class-wc-bookings-rest-products-controller.php:469
+#: includes/api/class-wc-bookings-rest-products-controller.php:252
+#: includes/api/class-wc-bookings-rest-products-controller.php:476
msgid "Priority of rule."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:258
+#: includes/api/class-wc-bookings-rest-products-controller.php:260
msgid "Base cost of each block."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:263
+#: includes/api/class-wc-bookings-rest-products-controller.php:265
msgid "Required buffer Period between bookings."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:268
+#: includes/api/class-wc-bookings-rest-products-controller.php:270
msgid "How the calendar will display on the product page. Valid values are 'always_visible' or ''."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:274
+#: includes/api/class-wc-bookings-rest-products-controller.php:276
msgid "The unit limit is defined in. Valid values are 'month', 'day', 'hour', and 'minute'."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:280
+#: includes/api/class-wc-bookings-rest-products-controller.php:282
msgid "How many limit units in advance users are allowed to cancel bookings."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:285
+#: includes/api/class-wc-bookings-rest-products-controller.php:287
msgid "If true only the first block in checked for availability."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:290
+#: includes/api/class-wc-bookings-rest-products-controller.php:292
msgid "Product cost."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:295
+#: includes/api/class-wc-bookings-rest-products-controller.php:297
msgid "If 'available' product is bookable unless made unbookable by availability rules."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:301
+#: includes/api/class-wc-bookings-rest-products-controller.php:303
msgid "Product cost displayed."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:306
+#: includes/api/class-wc-bookings-rest-products-controller.php:308
msgid "How duration is defined."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:312
+#: includes/api/class-wc-bookings-rest-products-controller.php:314
msgid "Unit duration is defined in."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:318
+#: includes/api/class-wc-bookings-rest-products-controller.php:320
msgid "Size in duration units of each block."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:323
+#: includes/api/class-wc-bookings-rest-products-controller.php:325
msgid "Customer can pick a range of days on calendar."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:328
+#: includes/api/class-wc-bookings-rest-products-controller.php:330
msgid "Time of day first block starts."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:333
+#: includes/api/class-wc-bookings-rest-products-controller.php:335
msgid "Will multiply cost by number of persons."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:338
+#: includes/api/class-wc-bookings-rest-products-controller.php:340
msgid "Each person counts as a booking."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:343
+#: includes/api/class-wc-bookings-rest-products-controller.php:345
msgid "Product has different types of persons."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:348
+#: includes/api/class-wc-bookings-rest-products-controller.php:350
msgid "Product has persons defined."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:353
+#: includes/api/class-wc-bookings-rest-products-controller.php:355
msgid "Product has resources defined."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:358
+#: includes/api/class-wc-bookings-rest-products-controller.php:360
msgid "Product has restricted days."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:363
+#: includes/api/class-wc-bookings-rest-products-controller.php:365
msgid "Max date value combined with max date unit."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:368
+#: includes/api/class-wc-bookings-rest-products-controller.php:375
msgid "Max amount af max_date_units into the future a block is bookable."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:373
+#: includes/api/class-wc-bookings-rest-products-controller.php:380
msgid "Units for max_date_value."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:379
+#: includes/api/class-wc-bookings-rest-products-controller.php:386
msgid "Min date value combined with min date unit."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:384
+#: includes/api/class-wc-bookings-rest-products-controller.php:391
msgid "Min amount af min_date_units into the future a block is bookable."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:389
+#: includes/api/class-wc-bookings-rest-products-controller.php:396
msgid "Units for min_date_value."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:395
+#: includes/api/class-wc-bookings-rest-products-controller.php:402
msgid "Max duration of units a booking can be."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:400
+#: includes/api/class-wc-bookings-rest-products-controller.php:407
msgid "Min duration of units a booking can be."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:405
+#: includes/api/class-wc-bookings-rest-products-controller.php:412
msgid "Max persons which can be booked per booking."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:410
+#: includes/api/class-wc-bookings-rest-products-controller.php:417
msgid "Min persons which can be booked per booking."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:415
+#: includes/api/class-wc-bookings-rest-products-controller.php:422
msgid "Pricing rules."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:422
+#: includes/api/class-wc-bookings-rest-products-controller.php:429
msgid "Date range type."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:447
+#: includes/api/class-wc-bookings-rest-products-controller.php:454
msgid "How the block cost should be modified."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:453
+#: includes/api/class-wc-bookings-rest-products-controller.php:460
msgid "Block cost."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:458
+#: includes/api/class-wc-bookings-rest-products-controller.php:465
msgid "How the base cost should be modified."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:464
+#: includes/api/class-wc-bookings-rest-products-controller.php:471
msgid "Base cost."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:477
+#: includes/api/class-wc-bookings-rest-products-controller.php:484
msgid "Max bookings per block."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:482
+#: includes/api/class-wc-bookings-rest-products-controller.php:489
msgid "Booking require confirmation."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:487
+#: includes/api/class-wc-bookings-rest-products-controller.php:494
msgid "Days days of week bookings cannot start. Array of numeric day indexes with 0 being Sunday."
msgstr ""
-#: includes/api/class-wc-bookings-rest-products-controller.php:496
+#: includes/api/class-wc-bookings-rest-products-controller.php:503
msgid "Booking can be cancelled by customer."
msgstr ""
@@ -2007,7 +2021,7 @@
msgid "Sorting order."
msgstr ""
-#: includes/booking-form/class-wc-booking-form-date-picker.php:32
+#: includes/booking-form/class-wc-booking-form-date-picker.php:34
#: includes/booking-form/class-wc-booking-form-datetime-picker.php:33
msgid "Date"
msgstr ""
@@ -2679,7 +2693,7 @@
msgstr ""
#: includes/compatibility/class-wc-product-data-store-cpt.php:78
-#: includes/data-stores/class-wc-product-booking-data-store-cpt.php:101
+#: includes/data-stores/class-wc-product-booking-data-store-cpt.php:102
#: templates/emails/customer-booking-confirmed.php:127
msgid "Product"
msgstr ""
@@ -2704,108 +2718,108 @@
msgid "%s (Guest)"
msgstr ""
-#: includes/data-objects/class-wc-product-booking.php:85
+#: includes/data-objects/class-wc-product-booking.php:117
msgid "Check Availability"
msgstr ""
-#: includes/data-objects/class-wc-product-booking.php:85
+#: includes/data-objects/class-wc-product-booking.php:117
msgid "Book now"
msgstr ""
#. translators: 1: display price
-#: includes/data-objects/class-wc-product-booking.php:137
+#: includes/data-objects/class-wc-product-booking.php:169
msgid "From: %s"
msgstr ""
-#: includes/data-objects/class-wc-product-booking.php:142
+#: includes/data-objects/class-wc-product-booking.php:174
msgid "Free"
msgstr ""
#. translators: 1: available quantity
-#: includes/data-objects/class-wc-product-booking.php:1546
+#: includes/data-objects/class-wc-product-booking.php:1661
msgid "There is a maximum of %d place remaining"
msgid_plural "There are a maximum of %d places remaining"
msgstr[0] ""
msgstr[1] ""
#. translators: 1: available quantity 2: booking block date
-#: includes/data-objects/class-wc-product-booking.php:1552
-#: includes/data-objects/class-wc-product-booking.php:1559
+#: includes/data-objects/class-wc-product-booking.php:1667
+#: includes/data-objects/class-wc-product-booking.php:1674
msgid "There is a maximum of %1$d place remaining on %2$s"
msgid_plural "There are a maximum of %1$d places remaining on %2$s"
msgstr[0] ""
msgstr[1] ""
-#: includes/data-objects/class-wc-product-booking.php:2141
+#: includes/data-objects/class-wc-product-booking.php:2255
msgid "This block cannot be booked."
msgstr ""
-#: includes/data-objects/class-wc-product-booking.php:2263
+#: includes/data-objects/class-wc-product-booking.php:2377
msgid "Please choose a resource type"
msgstr ""
-#: includes/data-objects/class-wc-product-booking.php:2274
+#: includes/data-objects/class-wc-product-booking.php:2388
msgid "Duration is required - please enter a duration greater than zero"
msgstr ""
#. translators: 1: maximum duration
-#: includes/data-objects/class-wc-product-booking.php:2278
+#: includes/data-objects/class-wc-product-booking.php:2392
msgid "The maximum duration is %d"
msgstr ""
#. translators: 1: minimum duration
-#: includes/data-objects/class-wc-product-booking.php:2282
+#: includes/data-objects/class-wc-product-booking.php:2396
msgid "The minimum duration is %d"
msgstr ""
-#: includes/data-objects/class-wc-product-booking.php:2288
+#: includes/data-objects/class-wc-product-booking.php:2402
msgid "Date is required - please choose one above"
msgstr ""
-#: includes/data-objects/class-wc-product-booking.php:2291
+#: includes/data-objects/class-wc-product-booking.php:2405
msgid "Time is required - please choose one above"
msgstr ""
-#: includes/data-objects/class-wc-product-booking.php:2294
-#: includes/data-objects/class-wc-product-booking.php:2297
+#: includes/data-objects/class-wc-product-booking.php:2408
+#: includes/data-objects/class-wc-product-booking.php:2411
msgid "You must choose a future date and time."
msgstr ""
#. translators: 1: minimum date
-#: includes/data-objects/class-wc-product-booking.php:2315
+#: includes/data-objects/class-wc-product-booking.php:2429
msgid "The earliest booking possible is currently %s."
msgstr ""
#. translators: 1: maximum date
-#: includes/data-objects/class-wc-product-booking.php:2324
+#: includes/data-objects/class-wc-product-booking.php:2437
msgid "The latest booking possible is currently %s."
msgstr ""
-#: includes/data-objects/class-wc-product-booking.php:2333
+#: includes/data-objects/class-wc-product-booking.php:2446
msgid "Sorry, bookings cannot start on this day."
msgstr ""
#. translators: 1: maximum persons
-#: includes/data-objects/class-wc-product-booking.php:2343
+#: includes/data-objects/class-wc-product-booking.php:2456
msgid "The maximum persons per group is %d"
msgstr ""
#. translators: 1: minimum persons
-#: includes/data-objects/class-wc-product-booking.php:2347
+#: includes/data-objects/class-wc-product-booking.php:2460
msgid "The minimum persons per group is %d"
msgstr ""
#. translators: 1: person name 2: maximum persons
-#: includes/data-objects/class-wc-product-booking.php:2356
+#: includes/data-objects/class-wc-product-booking.php:2469
msgid "The maximum %1$s per group is %2$d"
msgstr ""
#. translators: 1: person name 2: minimum persons
-#: includes/data-objects/class-wc-product-booking.php:2362
+#: includes/data-objects/class-wc-product-booking.php:2475
msgid "The minimum %1$s per group is %2$d"
msgstr ""
-#: includes/data-objects/class-wc-product-booking.php:2381
+#: includes/data-objects/class-wc-product-booking.php:2494
msgid "Sorry, the selected block is not available"
msgstr ""
@@ -3466,7 +3480,7 @@
#: templates/myaccount/bookings.php:71
#: templates/myaccount/my-bookings.php:62
-#: assets/js/components/store-availability-popover/index.js:79
+#: dist/admin-store-availability.js:1
msgid "Cancel"
msgstr ""
@@ -3553,60 +3567,58 @@
msgid "<a href=\"%1$s\">Add or edit a product</a> to manage bookings in the Product Data section for individual products and then go to the <a href=\"%2$s\" target=\"_blank\">Bookings page</a> to manage them individually."
msgstr ""
-#: assets/js/components/store-availability-popover/index.js:39
+#: dist/admin-store-availability.js:1
msgid "Edit Availability"
msgstr ""
-#: assets/js/components/store-availability-popover/index.js:43
+#: dist/admin-store-availability.js:1
msgid "Add end date"
msgstr ""
-#: assets/js/components/store-availability-popover/index.js:49
+#: dist/admin-store-availability.js:1
msgid "Time"
msgstr ""
-#: assets/js/components/store-availability-popover/index.js:51
+#: dist/admin-store-availability.js:1
msgid "Available all day"
msgstr ""
-#: assets/js/components/store-availability-popover/index.js:52
+#: dist/admin-store-availability.js:1
msgid "Available at specific hours"
msgstr ""
-#: assets/js/components/store-availability-popover/index.js:58
+#: dist/admin-store-availability.js:1
+msgid "Add more times"
+msgstr ""
+
+#: dist/admin-store-availability.js:1
msgid "Frequency"
msgstr ""
-#: assets/js/components/store-availability-popover/index.js:60
+#: dist/admin-store-availability.js:1
msgid "Does not repeat"
msgstr ""
-#. translators: %s: day of week
-#: assets/js/components/store-availability-popover/index.js:62
+#: dist/admin-store-availability.js:1
msgid "Every %s"
msgstr ""
-#. translators: %s: day of year
-#: assets/js/components/store-availability-popover/index.js:64
+#: dist/admin-store-availability.js:1
msgid "Anually on %s"
msgstr ""
-#: assets/js/components/store-availability-popover/index.js:65
+#: dist/admin-store-availability.js:1
msgid "On specific days of the week"
msgstr ""
-#: assets/js/components/store-availability-popover/index.js:66
+#: dist/admin-store-availability.js:1
msgid "On specific dates"
msgstr ""
-#: assets/js/components/store-availability-popover/index.js:71
+#: dist/admin-store-availability.js:1
msgid "Repeats on:"
msgstr ""
-#: assets/js/components/store-availability-popover/index.js:80
+#: dist/admin-store-availability.js:1
msgid "Apply"
msgstr ""
-
-#: assets/js/components/store-availability-popover/index.js:186
-msgid "Add more times"
-msgstr ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment