Changeset 2911748
- Timestamp:
- 05/12/2023 05:52:47 PM (3 years ago)
- Location:
- woocommerce-accommodation-bookings
- Files:
-
- 26 added
- 4 deleted
- 26 edited
- 1 copied
-
tags/1.1.40 (copied) (copied from woocommerce-accommodation-bookings/trunk)
-
tags/1.1.40/assets/css/frontend.css (deleted)
-
tags/1.1.40/assets/css/frontend.scss (modified) (1 diff)
-
tags/1.1.40/assets/js/booking-form.js (added)
-
tags/1.1.40/assets/js/utils.js (added)
-
tags/1.1.40/assets/js/writepanel.js (modified) (1 diff)
-
tags/1.1.40/assets/js/writepanel.min.js (deleted)
-
tags/1.1.40/changelog.txt (modified) (1 diff)
-
tags/1.1.40/dist (added)
-
tags/1.1.40/dist/css (added)
-
tags/1.1.40/dist/css/frontend.asset.php (added)
-
tags/1.1.40/dist/css/frontend.css (added)
-
tags/1.1.40/dist/js (added)
-
tags/1.1.40/dist/js/admin (added)
-
tags/1.1.40/dist/js/admin/writepanel.asset.php (added)
-
tags/1.1.40/dist/js/admin/writepanel.js (added)
-
tags/1.1.40/dist/js/frontend (added)
-
tags/1.1.40/dist/js/frontend/booking-form.asset.php (added)
-
tags/1.1.40/dist/js/frontend/booking-form.js (added)
-
tags/1.1.40/includes/class-wc-accommodation-booking-cart-manager.php (modified) (1 diff)
-
tags/1.1.40/includes/class-wc-accommodation-booking-date-picker.php (modified) (12 diffs)
-
tags/1.1.40/includes/class-wc-accommodation-booking-order-manager.php (modified) (1 diff)
-
tags/1.1.40/includes/class-wc-accommodation-booking-product-tabs.php (modified) (4 diffs)
-
tags/1.1.40/includes/class-wc-accommodation-booking.php (modified) (3 diffs)
-
tags/1.1.40/includes/class-wc-accommodation-bookings-plugin.php (modified) (14 diffs)
-
tags/1.1.40/includes/class-wc-product-accommodation-booking.php (modified) (3 diffs)
-
tags/1.1.40/languages/woocommerce-accommodation-bookings.pot (modified) (22 diffs)
-
tags/1.1.40/readme.txt (modified) (2 diffs)
-
tags/1.1.40/woocommerce-accommodation-bookings.php (modified) (2 diffs)
-
trunk/assets/css/frontend.css (deleted)
-
trunk/assets/css/frontend.scss (modified) (1 diff)
-
trunk/assets/js/booking-form.js (added)
-
trunk/assets/js/utils.js (added)
-
trunk/assets/js/writepanel.js (modified) (1 diff)
-
trunk/assets/js/writepanel.min.js (deleted)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/dist (added)
-
trunk/dist/css (added)
-
trunk/dist/css/frontend.asset.php (added)
-
trunk/dist/css/frontend.css (added)
-
trunk/dist/js (added)
-
trunk/dist/js/admin (added)
-
trunk/dist/js/admin/writepanel.asset.php (added)
-
trunk/dist/js/admin/writepanel.js (added)
-
trunk/dist/js/frontend (added)
-
trunk/dist/js/frontend/booking-form.asset.php (added)
-
trunk/dist/js/frontend/booking-form.js (added)
-
trunk/includes/class-wc-accommodation-booking-cart-manager.php (modified) (1 diff)
-
trunk/includes/class-wc-accommodation-booking-date-picker.php (modified) (12 diffs)
-
trunk/includes/class-wc-accommodation-booking-order-manager.php (modified) (1 diff)
-
trunk/includes/class-wc-accommodation-booking-product-tabs.php (modified) (4 diffs)
-
trunk/includes/class-wc-accommodation-booking.php (modified) (3 diffs)
-
trunk/includes/class-wc-accommodation-bookings-plugin.php (modified) (14 diffs)
-
trunk/includes/class-wc-product-accommodation-booking.php (modified) (3 diffs)
-
trunk/languages/woocommerce-accommodation-bookings.pot (modified) (22 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/woocommerce-accommodation-bookings.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woocommerce-accommodation-bookings/tags/1.1.40/assets/css/frontend.scss
r2179088 r2911748 1 .wc-bookings-date-picker { 2 .ui-datepicker { 3 td.partial_booked a { 4 &:before { 5 display:none; 6 } 1 .product-type-accommodation-booking { 2 .wc-bookings-date-picker { 3 position: relative; 4 padding-top: 55px; 5 6 &::after { 7 content: attr(data-content); 8 position: absolute; 9 background: #fff; 10 margin: 10px 20px; 11 font-size: 13px; 12 left: 0; 13 right: 0; 14 top: 0; 15 text-align: center; 16 height: 35px; 17 line-height: 35px; 7 18 } 8 td.fully_booked + td.partial_booked.partial_booked a { 9 &:after { 10 border-bottom: none; 11 border-left: none; 12 border-top: 2.5em solid #C96259; 13 border-right: 2.5em solid transparent; 14 left: 0; 15 top: 0; 16 } 19 20 .picker.hasDatepicker { 21 margin: 0; 22 position: static !important; 17 23 } 18 24 } 19 25 } 26 27 .wc-bookings-date-picker { 28 fieldset { 29 position: relative; 30 } 31 32 &:not([data-selected-date-type="start"]) .ui-datepicker td.fully_booked_start_days:not(.selection-end-date), 33 &[data-selected-date-type="start"] .ui-datepicker td.fully_booked_end_days:not(.selection-start-date) { 34 opacity: 0.35; 35 } 36 37 &:not([data-selected-date-type="start"]) .ui-datepicker td.fully_booked_start_days:not(.selection-end-date), 38 &[data-selected-date-type="start"] .ui-datepicker td.fully_booked_end_days:not(.selection-start-date), 39 .ui-datepicker td.fully_booked { 40 span, a { 41 background-color: #c0392b !important; 42 background-image: none !important; 43 border-color: rgba(0, 0, 0, 0.1) !important; 44 color: #fff !important; 45 text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); 46 pointer-events: none; 47 } 48 } 49 50 .ui-datepicker { 51 td.bookable-range.ui-state-disabled { 52 opacity: 1; 53 } 54 } 55 } -
woocommerce-accommodation-bookings/tags/1.1.40/assets/js/writepanel.js
r2529660 r2911748 1 jQuery( function( $ ) { 1 /* globals jQuery */ 2 2 3 $('#rates_rows').sortable({ 4 items:'tr', 5 cursor:'move', 6 axis:'y', 7 handle: '.sort', 8 scrollSensitivity:40, 9 forcePlaceholderSize: true, 10 helper: 'clone', 11 opacity: 0.65, 12 placeholder: 'wc-metabox-sortable-placeholder', 13 start:function(event,ui){ 14 ui.item.css('background-color','#f6f6f6'); 15 }, 16 stop:function(event,ui){ 17 ui.item.removeAttr('style'); 18 } 19 }); 3 jQuery(function ($) { 4 $('#rates_rows').sortable({ 5 items: 'tr', 6 cursor: 'move', 7 axis: 'y', 8 handle: '.sort', 9 scrollSensitivity: 40, 10 forcePlaceholderSize: true, 11 helper: 'clone', 12 opacity: 0.65, 13 placeholder: 'wc-metabox-sortable-placeholder', 14 start(event, ui) { 15 ui.item.css('background-color', '#f6f6f6'); 16 }, 17 stop(event, ui) { 18 ui.item.removeAttr('style'); 19 }, 20 }); 20 21 21 function wc_accommodation_bookings_trigger_change_events() {22 $('#_wc_accommodation_booking_has_restricted_days').trigger( 'change');23 }22 function wc_accommodation_bookings_trigger_change_events() { 23 $('#_wc_accommodation_booking_has_restricted_days').trigger('change'); 24 } 24 25 25 $('#_wc_accommodation_booking_has_restricted_days').on( 'change', function() { 26 if ( $(this).is( ':checked' ) ) { 27 $( '.booking-day-restriction' ).show(); 28 } else { 29 $( '.booking-day-restriction' ).hide(); 30 } 31 }); 26 $('#_wc_accommodation_booking_has_restricted_days').on( 27 'change', 28 function () { 29 if ($(this).is(':checked')) { 30 $('.booking-day-restriction').show(); 31 } else { 32 $('.booking-day-restriction').hide(); 33 } 34 } 35 ); 32 36 33 wc_accommodation_bookings_trigger_change_events(); 34 35 } ); 37 wc_accommodation_bookings_trigger_change_events(); 38 }); -
woocommerce-accommodation-bookings/tags/1.1.40/changelog.txt
r2879445 r2911748 1 1 *** Changelog *** 2 3 = 1.1.40 - 2023-05-12 = 4 * Dev - Added a new filter, `woocommerce_accommodation_booking_get_check_times`, to change the check-in/out timings per product. 5 * Fix - Fully booked days show as partially booked - Day after booking shows partially booked. 2 6 3 7 = 1.1.39 - 2023-03-14 = -
woocommerce-accommodation-bookings/tags/1.1.40/includes/class-wc-accommodation-booking-cart-manager.php
r2815380 r2911748 34 34 public function get_item_data( $other_data, $cart_item ) { 35 35 if ( 'accommodation-booking' === $cart_item['data']->get_type() && ! empty( $other_data ) ) { 36 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );37 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );36 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $cart_item['product_id'] ); 37 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $cart_item['product_id'] ); 38 38 $end_date = date_i18n( get_option( 'date_format'), $cart_item['booking']['_end_date'] ); 39 39 -
woocommerce-accommodation-bookings/tags/1.1.40/includes/class-wc-accommodation-booking-date-picker.php
r2337392 r2911748 1 <?php 1 <?php // phpcs:disable WordPress.DateTime.RestrictedFunctions.date_date,WordPress.PHP.StrictInArray.MissingTrueStrict 2 /** 3 * This plugin handles the date picker related logic for Accommodation Bookings. 4 * 5 * @package WooCommerce Accommodation Bookings 6 * @since 1.1.40 7 */ 8 2 9 if ( ! defined( 'ABSPATH' ) ) { 3 10 exit; … … 15 22 add_filter( 'woocommerce_bookings_date_picker_start_label', array( $this, 'start_label' ) ); 16 23 add_filter( 'woocommerce_bookings_date_picker_end_label', array( $this, 'end_label' ) ); 17 add_filter( 'woocommerce_booking_form_get_posted_data', array( $this, 'add_accommodation_posted_data' ), 10 , 3 ); 18 add_filter( 'woocommerce_bookings_booked_day_blocks', array( $this, 'add_partially_booked_dates' ), 10 , 3 ); 24 add_filter( 'woocommerce_booking_form_get_posted_data', array( $this, 'add_accommodation_posted_data' ), 10, 3 ); 25 add_filter( 'woocommerce_bookings_booked_day_blocks', array( $this, 'update_fully_booked_dates' ), 10, 3 ); 26 add_filter( 'woocommerce_bookings_find_booked_day_blocks', array( $this, 'find_booked_day_blocks' ), 10, 2 ); 19 27 } 20 28 21 29 /** 22 30 * Add custom start and end dat to booking data 31 * 23 32 * @since 1.0.7 24 33 * 25 * @param $data26 * @param $product27 * @param $total_duration34 * @param array $data Posted data. 35 * @param \WC_Product_Booking $product Booking product. 36 * @param int $total_duration Total duration. 28 37 * 29 38 * @return mixed 30 39 */ 31 40 public function add_accommodation_posted_data( $data, $product, $total_duration ) { 32 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );33 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );41 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $product->get_id() ); 42 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $product->get_id() ); 34 43 35 44 if ( 'night' === $product->get_duration_unit() ) { … … 40 49 41 50 if ( $product->has_resources() && ! $product->is_resource_assignment_type( 'customer' ) ) { 42 // Assign an available resource automatically 51 // Assign an available resource automatically. 43 52 $available_bookings = wc_bookings_get_total_available_bookings_for_range( $product, $data['_start_date'], $data['_end_date'], 0, $data['_qty'] ); 44 53 if ( is_array( $available_bookings ) ) { … … 53 62 /** 54 63 * Changes the start label to "Check-in" 55 * @param string $label 64 * 65 * @param string $label Label. 56 66 * @return string 57 67 */ … … 62 72 /** 63 73 * Changes the end label to "Check-out" 74 * 75 * @param string $label Label. 64 76 */ 65 77 public function end_label( $label ) { … … 85 97 * b. test if resources are available and if yes than move fully booked day to partially booked days 86 98 * 87 * @param array $booked_data_array 88 * @param WC_Product_Accommodation_Booking $product 99 * @param array $booked_data_array Array of booked days. 100 * @param WC_Product_Accommodation_Booking $product Product. 89 101 */ 90 102 public function add_partially_booked_dates( $booked_data_array, $product ) { … … 107 119 } 108 120 121 $check_in_time = $product->get_check_times( 'in', $product->get_id() ); 122 if ( 'in' === $which ) { 123 $check_time = strtotime( '-1 day ' . $check_in_time, $time ); 124 } else { 125 $check_time = strtotime( $check_in_time, $time ); 126 } 127 $check = date( 'F j, Y, g:i a', $check_time ); 128 // Check available blocks for resource. If some are available that means that the day is not fully booked. 129 $not_fully_booked = $this->get_product_resource_available_blocks_on_time( $product, $resource_id, $check_time ); 130 if ( $not_fully_booked ) { 131 $booked_data_array = $this->move_day_from_fully_to_partially_booked( $booked_data_array, $resource_id, $day ); 132 } 133 } 134 } 135 } 136 137 return $booked_data_array; 138 } 139 140 /** 141 * Update the fully booked, fully booked start day, and fully booked end day accomodation bookings, 142 * 143 * @param array $booked_data_array Array of booked days. 144 * @param WC_Product_Accommodation_Booking $product Product. 145 */ 146 public function update_fully_booked_dates( $booked_data_array, $product ) { 147 // This function makes sense only for duration type: night. 148 if ( 'night' !== $product->get_duration_unit() ) { 149 return $booked_data_array; 150 } 151 152 // Start and the end dates of all bookings. 153 $check_in_out_times = $this->get_check_in_and_out_times( $product ); 154 $res_auto_assign = $product->is_resource_assignment_type( 'automatic' ); 155 156 // Go through each checkin and checkout days and mark them as fully booked. 157 $made_partialy = array(); 158 foreach ( array( 'in', 'out' ) as $which ) { 159 foreach ( $check_in_out_times[ $which ] as $resource_id => $times ) { 160 foreach ( $times as $time ) { 161 $day = date( 'Y-n-j', $time ); 162 109 163 $check_in_time = $product->get_check_times( 'in' ); 110 164 if ( 'in' === $which ) { 111 $check_time = strtotime( '-1 day ' . $check_in_time, $time );165 $check_time = strtotime( $check_in_time, $time ); 112 166 } else { 113 $check_time = strtotime( $check_in_time, $time );114 } 115 $check = date( "F j, Y, g:i a", $check_time );167 $check_time = strtotime( '-1 day' . $check_in_time, $time ); 168 } 169 $check = date( 'F j, Y, g:i a', $check_time ); 116 170 // Check available blocks for resource. If some are available that means that the day is not fully booked. 117 $not_fully_booked = $this->get_product_resource_available_blocks_on_time( $product, $resource_id, $check_time ); 118 if( $not_fully_booked ) { 119 $booked_data_array = $this->move_day_from_fully_to_partially_booked( $booked_data_array, $resource_id, $day ); 171 $resource_id_to_use = $res_auto_assign ? 0 : $resource_id; 172 $available_on_time = $this->get_product_resource_available_blocks_on_time( $product, $resource_id_to_use, $check_time ); 173 if ( 0 === $available_on_time ) { 174 $booked_data_array = $this->prepare_fully_booked_start_and_end_days( $booked_data_array, $resource_id, $day, $which ); 175 } else { 176 $booked_data_array = $this->move_day_from_fully_to_partially_booked( $booked_data_array, $resource_id, $day ); 177 $made_partialy[ $resource_id ] = $day; 120 178 } 121 179 } … … 123 181 } 124 182 183 // Later removing the days from `fully_booked_days` array that were moved to partially booked days. 184 // We are doing this out of the above foreach because we want a condition in 185 // `prepare_fully_booked_start_and_end_days()` to be true. 186 foreach ( $made_partialy as $resource => $partial_day ) { 187 if ( ! isset( $booked_data_array['fully_booked_days'][ $partial_day ][ $resource ] ) ) { 188 continue; 189 } 190 191 unset( $booked_data_array['fully_booked_days'][ $day ][ $resource ] ); 192 193 if ( empty( $booked_data_array['fully_booked_days'][ $day ] ) ) { 194 unset( $booked_data_array['fully_booked_days'][ $day ] ); 195 } 196 } 197 125 198 return $booked_data_array; 126 199 } 127 200 128 201 /** 202 * Should return find booked day blocks with additional data. 203 * 204 * @since 1.1.40 205 * 206 * @param array $result Array of booked days. 207 * @param array $booked_blocks Array of booked blocks. 208 */ 209 public function find_booked_day_blocks( $result, $booked_blocks ): array { 210 $result['fully_booked_start_days'] = $booked_blocks['fully_booked_start_days'] ?? array(); 211 $result['fully_booked_end_days'] = $booked_blocks['fully_booked_end_days'] ?? array(); 212 213 return $result; 214 } 215 216 /** 129 217 * Calculates array that contains the start and the end time of all bookings for given product. 130 * @param $product 218 * 219 * @param \WC_Product_Booking $product Product. 131 220 */ 132 221 private function get_check_in_and_out_times( $product ) { 133 222 134 $check_in_out_times = array(135 'in' => array(),223 $check_in_out_times = array( 224 'in' => array(), 136 225 'out' => array(), 137 226 ); … … 140 229 // Those times will be considered for switching particular day from full to partially booked days. 141 230 if ( version_compare( WC_BOOKINGS_VERSION, '1.15.0', '<' ) ) { 142 $existing_bookings = WC_Bookings_Controller::get_all_existing_bookings( $product );231 $existing_bookings = WC_Bookings_Controller::get_all_existing_bookings( $product ); 143 232 } else { 144 $existing_bookings = WC_Booking_Data_Store::get_all_existing_bookings( $product );233 $existing_bookings = WC_Booking_Data_Store::get_all_existing_bookings( $product ); 145 234 } 146 235 147 236 foreach ( $existing_bookings as $booking ) { 148 237 149 $resource = $booking->get_resource_id();238 $resource = $booking->get_resource_id(); 150 239 if ( ! array_key_exists( $resource, $check_in_out_times['in'] ) ) { 151 $check_in_out_times['in'][ $resource ] = array();240 $check_in_out_times['in'][ $resource ] = array(); 152 241 $check_in_out_times['out'][ $resource ] = array(); 153 242 } … … 167 256 /** 168 257 * Get amount of available product resoureces on a specific timestamp 169 * @param $product 170 * @param $resource 171 * @param $date 258 * 259 * @param \WC_Product_Booking $product Product. 260 * @param int $resource Resource ID. 261 * @param string $time Timestamp. 262 * 263 * @return int|mixed 172 264 */ 173 265 private function get_product_resource_available_blocks_on_time( $product, $resource, $time ) { 174 $blocks = $product->get_blocks_in_range_for_day( $time, $time, $resource, array() );175 $available_blocks = wc_bookings_get_time_slots( $product, $blocks, array(), 0, $time, $time );176 return ! empty( $available_blocks[ $time ] ) ? $available_blocks[ $time ][ 'available'] : 0;266 $blocks = $product->get_blocks_in_range_for_day( $time, $time, $resource, array() ); 267 $available_blocks = wc_bookings_get_time_slots( $product, $blocks, array(), $resource, $time, $time ); 268 return ! empty( $available_blocks[ $time ] ) ? $available_blocks[ $time ]['available'] : 0; 177 269 } 178 270 … … 180 272 * Moves day from fully booked days array to partially booked days array and if the fully booked days is 181 273 * array for that day is empty ( no assigned resources ) removes that empty day entry 182 * @param $booked_data_array 183 * @param $resource 184 * @param $day 274 * 275 * @param array $booked_data_array Array of booked days. 276 * @param int $resource Resource ID. 277 * @param string $day Day. 185 278 */ 186 279 private function move_day_from_fully_to_partially_booked( $booked_data_array, $resource, $day ) { … … 191 284 $booked_data_array['partially_booked_days'][ $day ][ $resource ] = $booked_data_array['fully_booked_days'][ $day ][ $resource ]; 192 285 193 unset( $booked_data_array['fully_booked_days'][ $day ][ $resource ] );194 195 if ( empty( $booked_data_array['fully_booked_days'][ $day ] ) ) {196 unset( $booked_data_array['fully_booked_days'][ $day ] );197 }198 199 286 return $booked_data_array; 200 287 } 201 288 289 /** 290 * Moves day from fully_booked_days array to the fully_booked_start_days or fully_booked_end_days 291 * This is required because we want to showcase days availability as per the selection. 292 * So by default, fully_booked_start_days will be colored red; not available for check-ins. 293 * When start date is selected, fully_booked_end_days will be colored red; not available for check-outs. 294 * 295 * @param array $booked_data_array Array of booked days. 296 * @param int $resource Resource ID. 297 * @param string $day A Day. 298 * @param string $which In or Out. 299 */ 300 private function prepare_fully_booked_start_and_end_days( $booked_data_array, $resource, $day, $which = 'in' ) { 301 if ( isset( $booked_data_array['fully_booked_days'][ $day ][ $resource ] ) ) { 302 if ( 'in' === $which ) { 303 $booked_data_array['fully_booked_start_days'][ $day ][ $resource ] = $booked_data_array['fully_booked_days'][ $day ][ $resource ]; 304 } else { 305 $booked_data_array['fully_booked_end_days'][ $day ][ $resource ] = $booked_data_array['fully_booked_days'][ $day ][ $resource ]; 306 } 307 unset( $booked_data_array['fully_booked_days'][ $day ][ $resource ] ); 308 309 if ( empty( $booked_data_array['fully_booked_days'][ $day ] ) ) { 310 unset( $booked_data_array['fully_booked_days'][ $day ] ); 311 } 312 } else { 313 // If the day already exists fully_booked_start_days at this point, 314 // it means it is also a fully booked end day, so reverting it 315 // back to be in fully_booked_days. 316 if ( isset( $booked_data_array['fully_booked_start_days'][ $day ][ $resource ] ) ) { 317 $booked_data_array['fully_booked_days'][ $day ][ $resource ] = $booked_data_array['fully_booked_start_days'][ $day ][ $resource ]; 318 unset( $booked_data_array['fully_booked_start_days'][ $day ][ $resource ] ); 319 320 if ( empty( $booked_data_array['fully_booked_start_days'][ $day ] ) ) { 321 unset( $booked_data_array['fully_booked_start_days'][ $day ] ); 322 } 323 } 324 } 325 326 // Also removing from partially booked array in case if it 327 // was added there in `move_day_from_fully_to_partially_booked()`. 328 if ( isset( $booked_data_array['partially_booked_days'][ $day ][ $resource ] ) ) { 329 unset( $booked_data_array['partially_booked_days'][ $day ][ $resource ] ); 330 } 331 if ( empty( $booked_data_array['partially_booked_days'][ $day ] ) ) { 332 unset( $booked_data_array['partially_booked_days'][ $day ] ); 333 } 334 335 return $booked_data_array; 336 } 202 337 } 203 338 204 new WC_Accommodation_Booking_Date_Picker ;339 new WC_Accommodation_Booking_Date_Picker(); -
woocommerce-accommodation-bookings/tags/1.1.40/includes/class-wc-accommodation-booking-order-manager.php
r2815380 r2911748 34 34 } 35 35 36 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );37 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );36 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $item['product_id'] ); 37 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $item['product_id'] ); 38 38 ?> 39 39 <p> -
woocommerce-accommodation-bookings/tags/1.1.40/includes/class-wc-accommodation-booking-product-tabs.php
r1714785 r2911748 12 12 13 13 /** 14 * Product ID. 15 */ 16 public $product_id = 0; 17 18 /** 14 19 * Hook into WooCommerce.. 15 20 */ … … 23 28 */ 24 29 public function are_time_fields_filled_out() { 25 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );26 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );30 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $this->product_id ); 31 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $this->product_id ); 27 32 28 33 if ( empty( $check_in ) ) { … … 57 62 } 58 63 64 // Set the product ID. 65 $this->product_id = $post->ID; 66 59 67 if ( ! $this->are_time_fields_filled_out() ) { 60 68 return $tabs; … … 78 86 return; 79 87 } 80 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );81 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );88 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $this->product_id ); 89 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $this->product_id ); 82 90 ?> 83 91 <h2><?php echo esc_html( apply_filters( 'woocommerce_accommodation_booking_time_tab_heading', __( 'Arriving/leaving', 'woocommerce-accommodation-bookings' ) ) ); ?></h2> -
woocommerce-accommodation-bookings/tags/1.1.40/includes/class-wc-accommodation-booking.php
r2390281 r2911748 110 110 } 111 111 112 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );113 114 112 $date_format = apply_filters( 'woocommerce_bookings_date_format', wc_date_format() ); 115 113 $time_format = apply_filters( 'woocommerce_bookings_time_format', ', ' . wc_time_format() ); 116 114 117 return date_i18n( $date_format, $booking->start ) . date_i18n( $time_format, strtotime( "Today " . $check_in ));115 return date_i18n( $date_format, $booking->start ) . date_i18n( $time_format, $booking->start ); 118 116 } 119 117 … … 124 122 } 125 123 126 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );127 124 $date_format = apply_filters( 'woocommerce_bookings_date_format', wc_date_format() ); 128 125 $time_format = apply_filters( 'woocommerce_bookings_time_format', ', ' . wc_time_format() ); 129 126 130 return date_i18n( $date_format, $booking->end ) . date_i18n( $time_format, strtotime( "Today " . $check_out ));127 return date_i18n( $date_format, $booking->end ) . date_i18n( $time_format, $booking->end ); 131 128 } 132 129 … … 182 179 } 183 180 184 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );185 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );181 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $product_id ); 182 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $product_id ); 186 183 187 184 $start = get_post_meta( $booking_id, '_booking_start', true ); -
woocommerce-accommodation-bookings/tags/1.1.40/includes/class-wc-accommodation-bookings-plugin.php
r2815380 r2911748 1 1 <?php 2 /** 3 * This class is responsible for the plugin's initialization. 4 * 5 * @since 1.0.2 6 * @package WooCommerce\AccommodationBookings 7 */ 8 2 9 if ( ! defined( 'ABSPATH' ) ) { 3 10 exit; … … 33 40 * Constructor. 34 41 * 35 * @param string $plugin_file Path to main plugin's file 36 * @param string $version Plugin's version 42 * @param string $plugin_file Path to main plugin's file. 43 * @param string $version Plugin's version. 37 44 */ 38 45 public function __construct( $plugin_file, $version ) { … … 88 95 * @return void 89 96 */ 97 // phpcs:ignore 90 98 private function _define_constants() { 91 99 define( 'WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH', untrailingslashit( plugin_dir_path( $this->plugin_file ) ) . '/includes/' ); … … 100 108 * @return void 101 109 */ 110 // phpcs:ignore 102 111 private function _register_hooks() { 103 112 register_activation_hook( $this->plugin_file, array( $this, 'check_dependencies' ) ); … … 111 120 add_action( 'plugins_loaded', array( $this, 'includes' ), 20 ); 112 121 add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 ); 113 add_action( 'wp_enqueue_scripts', array( $this, ' booking_form_styles' ) );122 add_action( 'wp_enqueue_scripts', array( $this, 'frontend_assets' ) ); 114 123 115 124 if ( is_admin() ) { … … 131 140 } 132 141 133 require_once ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-dependencies.php' );142 require_once WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-dependencies.php'; 134 143 try { 135 144 WC_Accommodation_Dependencies::check_dependencies(); … … 164 173 */ 165 174 public function load_plugin_textdomain() { 175 /** 176 * Filter locale before loading the plugin's text domain. 177 * 178 * @since 1.0.2 179 * 180 * @param string $locale The plugin's current locale. 181 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 182 */ 166 183 $locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce-accommodation-bookings' ); 167 184 $dir = trailingslashit( WP_LANG_DIR ); … … 175 192 */ 176 193 public function includes() { 177 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-product-accommodation-booking.php' );178 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-product-accommodation-booking-resource.php' );179 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking.php' );180 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-cart-manager.php' );181 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-date-picker.php' );182 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-product-tabs.php' );183 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-order-manager.php' );184 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'integrations/class-wc-accommodation-booking-addons.php' );194 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-product-accommodation-booking.php'; 195 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-product-accommodation-booking-resource.php'; 196 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking.php'; 197 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-cart-manager.php'; 198 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-date-picker.php'; 199 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-product-tabs.php'; 200 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-order-manager.php'; 201 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'integrations/class-wc-accommodation-booking-addons.php'; 185 202 } 186 203 … … 189 206 */ 190 207 public function admin_includes() { 191 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'admin/class-wc-accommodation-booking-admin-panels.php' );192 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'admin/class-wc-accommodation-booking-admin-product-settings.php' );208 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'admin/class-wc-accommodation-booking-admin-panels.php'; 209 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'admin/class-wc-accommodation-booking-admin-product-settings.php'; 193 210 } 194 211 … … 196 213 * Frontend booking form scripts 197 214 */ 198 public function booking_form_styles() { 199 wp_enqueue_style( 'wc-accommodation-bookings-styles', WC_ACCOMMODATION_BOOKINGS_PLUGIN_URL . '/assets/css/frontend.css', null, WC_ACCOMMODATION_BOOKINGS_VERSION ); 215 public function frontend_assets() { 216 $booking_style_asset_data = $this->get_asset_data( 'frontend', 'css' ); 217 $booking_script_asset_data = $this->get_asset_data( 'booking-form', 'js/frontend' ); 218 219 $booking_script_dependencies = array_merge( 220 $booking_script_asset_data['dependencies'], 221 array( 'wc-bookings-booking-form' ) 222 ); 223 224 wp_enqueue_style( 225 'wc-accommodation-bookings-styles', 226 WC_ACCOMMODATION_BOOKINGS_PLUGIN_URL . '/dist/css/frontend.css', 227 null, 228 $booking_style_asset_data['version'] 229 ); 230 231 wp_enqueue_script( 232 'wc-accommodation-bookings-form', 233 WC_ACCOMMODATION_BOOKINGS_PLUGIN_URL . '/dist/js/frontend/booking-form.js', 234 $booking_script_dependencies, 235 $booking_script_asset_data['version'], 236 true 237 ); 238 239 wp_set_script_translations( 240 'wc-accommodation-bookings-form', 241 'woocommerce-accommodation-bookings', 242 plugin_dir_path( WC_ACCOMMODATION_BOOKINGS_MAIN_FILE ) . '/languages' 243 ); 200 244 } 201 245 … … 203 247 * Show row meta on the plugin screen. 204 248 * 205 * @ access public206 * @param mixed $links Plugin Row Meta207 * @param mixed $file Plugin Base file208 * @return array249 * @param array $links Plugin Row Meta. 250 * @param string $file Plugin Base file. 251 * 252 * @return array 209 253 */ 210 254 public function plugin_row_meta( $links, $file ) { 211 if ( $file == plugin_basename( WC_ACCOMMODATION_BOOKINGS_MAIN_FILE ) ) { 255 // phpcs:ignore 256 if ( $file === plugin_basename( WC_ACCOMMODATION_BOOKINGS_MAIN_FILE ) ) { 212 257 $row_meta = array( 213 'docs' => '<a href="' . esc_url( apply_filters( 'woocommerce_accommodation_bookings_docs_url', 'https://docs.woocommerce.com/document/woocommerce-accommodation-bookings/' ) ) . '" title="' . esc_attr( __( 'View Documentation', 'woocommerce-accommodation-bookings' ) ) . '">' . __( 'Docs', 'woocommerce-accommodation-bookings' ) . '</a>',214 'support' => '<a href="' . esc_url( apply_filters( 'woocommerce_accommodation_bookings_support_url', 'https://docs.woocommerce.com/' ) ) . '" title="' . esc_attr( __( 'Visit Premium Customer Support Forum', 'woocommerce-accommodation-bookings' ) ) . '">' . __( 'Premium Support', 'woocommerce-accommodation-bookings' ) . '</a>',258 'docs' => '<a href="' . esc_url( apply_filters( 'woocommerce_accommodation_bookings_docs_url', 'https://docs.woocommerce.com/document/woocommerce-accommodation-bookings/' ) ) . '" title="' . esc_attr( __( 'View Documentation', 'woocommerce-accommodation-bookings' ) ) . '">' . __( 'Docs', 'woocommerce-accommodation-bookings' ) . '</a>', //phpcs:ignore 259 'support' => '<a href="' . esc_url( apply_filters( 'woocommerce_accommodation_bookings_support_url', 'https://docs.woocommerce.com/' ) ) . '" title="' . esc_attr( __( 'Visit Premium Customer Support Forum', 'woocommerce-accommodation-bookings' ) ) . '">' . __( 'Premium Support', 'woocommerce-accommodation-bookings' ) . '</a>', //phpcs:ignore 215 260 ); 216 261 … … 227 272 global $wpdb; 228 273 229 $force_update = false;274 $force_update = false; 230 275 $accommodation_bookings_version = get_option( 'wc_accommodation_bookings_version' ); 231 276 232 277 if ( ! $accommodation_bookings_version ) { 233 $force_update = true;278 $force_update = true; 234 279 $accommodation_bookings_version = $this->version; 235 280 } 236 281 237 // Data updates 282 // Data updates. 238 283 if ( $force_update || version_compare( $accommodation_bookings_version, '1.1.3', '<' ) ) { 239 284 $accommodation_bookings = $wpdb->get_results( "SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = '_wc_booking_pricing' AND meta_value LIKE '%override_block%';" ); … … 242 287 243 288 if ( ! is_a( $product, 'WC_Product' ) ) { 244 continue;245 }246 247 if ( 'accommodation-booking' != $product->get_type() ) {248 289 continue; 249 290 } 250 291 251 $pricing = get_post_meta( $product->get_id(), '_wc_booking_pricing', true ); 292 if ( 'accommodation-booking' !== $product->get_type() ) { 293 continue; 294 } 295 296 $pricing = get_post_meta( $product->get_id(), '_wc_booking_pricing', true ); 252 297 $original_base_cost = absint( get_post_meta( $product->get_id(), '_wc_booking_base_cost', true ) ); 253 298 254 // Convert from the old to the new structure 299 // Convert from the old to the new structure. 255 300 foreach ( $pricing as &$pricing_row ) { 256 $pricing_row['base_cost'] = $pricing_row['cost'] = 0; 257 $new_cost = $pricing_row['override_block'];301 $pricing_row['base_cost'] = $pricing_row['cost'] = 0; //phpcs:ignore 302 $new_cost = $pricing_row['override_block']; 258 303 unset( $pricing_row['override_block'] ); 259 $pricing_row['base_modifier'] = $pricing_row['modifier'] = $new_cost > $original_base_cost ? 'plus' : 'minus'; 260 $pricing_row['cost'] = absint( $new_cost - $original_base_cost );304 $pricing_row['base_modifier'] = $pricing_row['modifier'] = $new_cost > $original_base_cost ? 'plus' : 'minus'; //phpcs:ignore 305 $pricing_row['cost'] = absint( $new_cost - $original_base_cost ); 261 306 } 262 307 … … 265 310 } 266 311 267 // Update version 312 // Update version. 268 313 update_option( 'wc_accommodation_bookings_version', $this->version ); 269 314 } 315 316 /** 317 * Should return data from the asset file. 318 * 319 * @param string $script_file_name Script file name. 320 * @param string $location Script file location. 321 * 322 * @return array 323 */ 324 private function get_asset_data( $script_file_name, $location ): array { 325 $asset_path = dirname( WC_ACCOMMODATION_BOOKINGS_MAIN_FILE ) . "/dist/$location/$script_file_name.asset.php"; 326 327 return require $asset_path; 328 } 270 329 } -
woocommerce-accommodation-bookings/tags/1.1.40/includes/class-wc-product-accommodation-booking.php
r2815380 r2911748 196 196 $bookable_product = $this; 197 197 198 $transient_name = 'book_ts_' . md5( http_build_query( array( $bookable_product->get_id(), $resource_id, $from, $to ) ) ); 198 $product_id = $bookable_product->get_id(); 199 $transient_name = 'book_ts_' . md5( http_build_query( array( $product_id, $resource_id, $from, $to ) ) ); 199 200 $available_slots = get_transient( $transient_name ); 200 201 $booking_slots_transient_keys = array_filter( (array) get_transient( 'booking_slots_transient_keys' ) ); 201 202 202 if ( ! isset( $booking_slots_transient_keys[ $ bookable_product->get_id()] ) ) {203 $booking_slots_transient_keys[ $ bookable_product->get_id()] = array();204 } 205 206 $booking_slots_transient_keys[ $ bookable_product->get_id()][] = $transient_name;203 if ( ! isset( $booking_slots_transient_keys[ $product_id ] ) ) { 204 $booking_slots_transient_keys[ $product_id ] = array(); 205 } 206 207 $booking_slots_transient_keys[ $product_id ][] = $transient_name; 207 208 208 209 // Give array of keys a long ttl because if it expires we won't be able to flush the keys when needed. … … 230 231 231 232 foreach ( $blocks as $block ) { 232 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );233 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );233 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $product_id ); 234 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $product_id ); 234 235 // Blocks for accommodation products are initially calculated as days but the actuall time blocks are shifted by check in and checkout times. 235 236 $block_start_time = strtotime( "{$check_in}", $block ); … … 329 330 * Get checkin and checkout times. 330 331 * 331 * @param string $type 332 * 333 * @return string Time, either from options or default 334 */ 335 public static function get_check_times( $type ) { 336 $option = get_option( 'woocommerce_accommodation_bookings_times_settings' ); 332 * @param string $type The type, check_in or check_out. 333 * @param int $product_id The product ID. 334 * 335 * @return string The time, either from options or default or from the filtered value. 336 */ 337 public static function get_check_times( $type, $product_id = 0 ) { 338 $option = get_option( 'woocommerce_accommodation_bookings_times_settings' ); 339 $check_time = ''; 340 337 341 switch ( $type ) { 338 342 case 'in': 339 return isset( $option['check_in'] ) ? $option['check_in'] : '14:00'; 343 $check_time = $option['check_in'] ?? '14:00'; 344 break; 340 345 case 'out': 341 return isset( $option['check_out'] ) ? $option['check_out'] : '14:00'; 342 } 343 344 return ''; 346 $check_time = $option['check_out'] ?? '14:00'; 347 break; 348 } 349 350 /** 351 * Filter the check-in/out times for a specific product. 352 * 353 * @param string $check_time The check-in/out time stored in the database. 354 * @param string $type The type, check_in or check_out. 355 * @param int $product_id The product ID. 356 * 357 * @return string The filtered/original time. 358 */ 359 return apply_filters( 'woocommerce_accommodation_booking_get_check_times', $check_time, $type, (int) $product_id ); 345 360 } 346 361 -
woocommerce-accommodation-bookings/tags/1.1.40/languages/woocommerce-accommodation-bookings.pot
r2879445 r2911748 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: WooCommerce Accommodation Bookings 1.1.39\n" 6 "Report-Msgid-Bugs-To: " 7 "https://wordpress.org/support/plugin/woocommerce-accommodation-bookings\n" 8 "POT-Creation-Date: 2023-03-14 00:20:22+00:00\n" 9 "MIME-Version: 1.0\n" 10 "Content-Type: text/plain; charset=utf-8\n" 11 "Content-Transfer-Encoding: 8bit\n" 12 "PO-Revision-Date: 2023-MO-DA HO:MI+ZONE\n" 5 "Project-Id-Version: WooCommerce Accommodation Bookings 1.1.40\n" 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-accommodation-bookings\n" 13 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 14 8 "Language-Team: LANGUAGE <[email protected]>\n" 15 "X-Generator: node-wp-i18n 1.2.6\n" 9 "MIME-Version: 1.0\n" 10 "Content-Type: text/plain; charset=UTF-8\n" 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2023-05-12T17:52:26+00:00\n" 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2.7.1\n" 15 "X-Domain: woocommerce-accommodation-bookings\n" 16 17 #. Plugin Name of the plugin 18 msgid "WooCommerce Accommodation Bookings" 19 msgstr "" 20 21 #. Plugin URI of the plugin 22 msgid "https://woocommerce.com/products/woocommerce-accommodation-bookings/" 23 msgstr "" 24 25 #. Description of the plugin 26 msgid "An accommodations add-on for the WooCommerce Bookings extension." 27 msgstr "" 28 29 #. Author of the plugin 30 msgid "WooCommerce" 31 msgstr "" 32 33 #. Author URI of the plugin 34 msgid "https://woocommerce.com" 35 msgstr "" 16 36 17 37 #: includes/admin/class-wc-accommodation-booking-admin-panels.php:32 … … 19 39 msgstr "" 20 40 21 #: includes/admin/class-wc-accommodation-booking-admin-panels.php:31922 msgid "Person Type #%d"23 msgstr ""24 25 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:8426 msgid "Accommodation"27 msgstr ""28 29 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:11930 msgid "Settings saved"31 msgstr ""32 33 41 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:136 34 #: includes/class-wc-accommodation-booking-product-tabs.php: 8542 #: includes/class-wc-accommodation-booking-product-tabs.php:93 35 43 msgid "Check-in time" 36 44 msgstr "" … … 41 49 42 50 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:142 43 #: includes/class-wc-accommodation-booking-product-tabs.php: 8651 #: includes/class-wc-accommodation-booking-product-tabs.php:94 44 52 msgid "Check-out time" 45 53 msgstr "" … … 47 55 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:143 48 56 msgid "Check-out time for reservations." 49 msgstr ""50 51 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:17252 msgid "Save Changes"53 57 msgstr "" 54 58 … … 114 118 115 119 #: includes/admin/views/html-accommodation-booking-availability-fields.php:20 116 #: includes/admin/views/html-accommodation-booking-availability.php:64117 120 #: includes/admin/views/html-accommodation-booking-rates-fields.php:20 118 121 msgid "Monday" … … 120 123 121 124 #: includes/admin/views/html-accommodation-booking-availability-fields.php:21 122 #: includes/admin/views/html-accommodation-booking-availability.php:65123 125 #: includes/admin/views/html-accommodation-booking-rates-fields.php:21 124 126 msgid "Tuesday" … … 126 128 127 129 #: includes/admin/views/html-accommodation-booking-availability-fields.php:22 128 #: includes/admin/views/html-accommodation-booking-availability.php:66129 130 #: includes/admin/views/html-accommodation-booking-rates-fields.php:22 130 131 msgid "Wednesday" … … 132 133 133 134 #: includes/admin/views/html-accommodation-booking-availability-fields.php:23 134 #: includes/admin/views/html-accommodation-booking-availability.php:67135 135 #: includes/admin/views/html-accommodation-booking-rates-fields.php:23 136 136 msgid "Thursday" … … 138 138 139 139 #: includes/admin/views/html-accommodation-booking-availability-fields.php:24 140 #: includes/admin/views/html-accommodation-booking-availability.php:68141 140 #: includes/admin/views/html-accommodation-booking-rates-fields.php:24 142 141 msgid "Friday" … … 144 143 145 144 #: includes/admin/views/html-accommodation-booking-availability-fields.php:25 146 #: includes/admin/views/html-accommodation-booking-availability.php:69147 145 #: includes/admin/views/html-accommodation-booking-rates-fields.php:25 148 146 msgid "Saturday" … … 150 148 151 149 #: includes/admin/views/html-accommodation-booking-availability-fields.php:26 152 #: includes/admin/views/html-accommodation-booking-availability.php:63153 150 #: includes/admin/views/html-accommodation-booking-rates-fields.php:26 154 151 msgid "Sunday" … … 229 226 230 227 #: includes/admin/views/html-accommodation-booking-availability.php:50 231 msgid "" 232 "Restrict the days of the week that are able to be selected on the calendar; " 233 "this will not affect your availability." 228 msgid "Restrict the days of the week that are able to be selected on the calendar; this will not affect your availability." 234 229 msgstr "" 235 230 … … 260 255 261 256 #: includes/admin/views/html-accommodation-booking-availability.php:100 262 msgid "" 263 "The lower the priority number, the earlier this rule gets applied. By " 264 "default, global rules take priority over product rules which take priority " 265 "over resource rules. By using priority numbers you can execute rules in " 266 "different orders." 257 msgid "The lower the priority number, the earlier this rule gets applied. By default, global rules take priority over product rules which take priority over resource rules. By using priority numbers you can execute rules in different orders." 267 258 msgstr "" 268 259 … … 273 264 274 265 #: includes/admin/views/html-accommodation-booking-availability.php:113 275 msgid "" 276 "Rules with lower numbers will execute first. Rules further down this table " 277 "with the same priority will also execute first." 266 msgid "Rules with lower numbers will execute first. Rules further down this table with the same priority will also execute first." 278 267 msgstr "" 279 268 … … 315 304 316 305 #: includes/admin/views/html-accommodation-booking-data.php:50 317 msgid "" 318 "Check this box if the booking requires admin approval/confirmation. Payment " 319 "will not be taken during checkout." 306 msgid "Check this box if the booking requires admin approval/confirmation. Payment will not be taken during checkout." 320 307 msgstr "" 321 308 … … 325 312 326 313 #: includes/admin/views/html-accommodation-booking-data.php:57 327 msgid "" 328 "Check this box if the booking can be cancelled by the customer after it has " 329 "been purchased. A refund will not be sent automatically." 314 msgid "Check this box if the booking can be cancelled by the customer after it has been purchased. A refund will not be sent automatically." 330 315 msgstr "" 331 316 … … 367 352 368 353 #: includes/admin/views/html-accommodation-booking-rates.php:9 369 msgid "" 370 "The cost is displayed to the user on the frontend. Leave blank to have it " 371 "calculated for you. If a booking has varying costs, this will be prefixed " 372 "with the word \"from:\"." 354 msgid "The cost is displayed to the user on the frontend. Leave blank to have it calculated for you. If a booking has varying costs, this will be prefixed with the word \"from:\"." 373 355 msgstr "" 374 356 … … 402 384 403 385 #: includes/class-wc-accommodation-booking-cart-manager.php:42 404 #: includes/class-wc-accommodation-booking-date-picker.php: 59386 #: includes/class-wc-accommodation-booking-date-picker.php:69 405 387 #: includes/class-wc-accommodation-booking-order-manager.php:40 406 388 msgid "Check-in" … … 415 397 416 398 #: includes/class-wc-accommodation-booking-cart-manager.php:50 417 #: includes/class-wc-accommodation-booking-date-picker.php: 66399 #: includes/class-wc-accommodation-booking-date-picker.php:78 418 400 #: includes/class-wc-accommodation-booking-order-manager.php:57 419 401 msgid "Check-out" … … 428 410 msgstr "" 429 411 430 #: includes/class-wc-accommodation-booking-product-tabs.php: 63431 #: includes/class-wc-accommodation-booking-product-tabs.php: 83412 #: includes/class-wc-accommodation-booking-product-tabs.php:71 413 #: includes/class-wc-accommodation-booking-product-tabs.php:91 432 414 msgid "Arriving/leaving" 433 415 msgstr "" 434 416 435 #: includes/class-wc-accommodation-booking.php:20 9417 #: includes/class-wc-accommodation-booking.php:206 436 418 msgid "night" 437 419 msgstr "" 438 420 439 #: includes/class-wc-accommodation-bookings-plugin.php:2 13421 #: includes/class-wc-accommodation-bookings-plugin.php:258 440 422 msgid "View Documentation" 441 423 msgstr "" 442 424 443 #: includes/class-wc-accommodation-bookings-plugin.php:2 13425 #: includes/class-wc-accommodation-bookings-plugin.php:258 444 426 msgid "Docs" 445 427 msgstr "" 446 428 447 #: includes/class-wc-accommodation-bookings-plugin.php:2 14429 #: includes/class-wc-accommodation-bookings-plugin.php:259 448 430 msgid "Visit Premium Customer Support Forum" 449 431 msgstr "" 450 432 451 #: includes/class-wc-accommodation-bookings-plugin.php:2 14433 #: includes/class-wc-accommodation-bookings-plugin.php:259 452 434 msgid "Premium Support" 453 435 msgstr "" … … 477 459 msgstr "" 478 460 479 #: includes/integrations/class-wc-accommodation-booking-addons.php:57480 461 #: includes/integrations/class-wc-accommodation-booking-addons.php:71 481 462 msgid "Bookings: Multiply cost by person count" 482 msgstr ""483 484 #: includes/integrations/class-wc-accommodation-booking-addons.php:61485 msgid "Bookings: Multiply cost by block count"486 463 msgstr "" 487 464 … … 495 472 msgstr "" 496 473 497 # . Plugin Name of the plugin/theme498 msgid " WooCommerce Accommodation Bookings"499 msgstr "" 500 501 # . Plugin URI of the plugin/theme502 msgid " https://woocommerce.com/products/woocommerce-accommodation-bookings/"503 msgstr "" 504 505 # . Description of the plugin/theme506 msgid " An accommodations add-on for the WooCommerce Bookings extension."507 msgstr "" 508 509 # . Author of the plugin/theme510 msgid " WooCommerce"511 msgstr "" 512 513 # . Author URI of the plugin/theme514 msgid " https://woocommerce.com"515 msgstr "" 474 #: dist/js/frontend/booking-form.js:1 475 msgid "Available for check-out only." 476 msgstr "" 477 478 #: dist/js/frontend/booking-form.js:1 479 msgid "Available for check-in only." 480 msgstr "" 481 482 #: dist/js/frontend/booking-form.js:1 483 msgid "Select check-in" 484 msgstr "" 485 486 #: dist/js/frontend/booking-form.js:1 487 msgid "Selected! Re-select to change your check-in date." 488 msgstr "" 489 490 #: dist/js/frontend/booking-form.js:1 491 msgid "Select check-out" 492 msgstr "" -
woocommerce-accommodation-bookings/tags/1.1.40/readme.txt
r2879445 r2911748 4 4 Requires at least: 5.6 5 5 Tested up to: 6.1 6 Stable tag: 1.1. 396 Stable tag: 1.1.40 7 7 License: GNU General Public License v3.0 8 8 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 36 36 37 37 == Changelog == 38 39 = 1.1.40 - 2023-05-12 = 40 * Dev - Added a new filter, `woocommerce_accommodation_booking_get_check_times`, to change the check-in/out timings per product. 41 * Fix - Fully booked days show as partially booked - Day after booking shows partially booked. 38 42 39 43 = 1.1.39 - 2023-03-14 = -
woocommerce-accommodation-bookings/tags/1.1.40/woocommerce-accommodation-bookings.php
r2879445 r2911748 4 4 * Plugin URI: https://woocommerce.com/products/woocommerce-accommodation-bookings/ 5 5 * Description: An accommodations add-on for the WooCommerce Bookings extension. 6 * Version: 1.1. 396 * Version: 1.1.40 7 7 * Author: WooCommerce 8 8 * Author URI: https://woocommerce.com … … 24 24 } 25 25 26 define( 'WC_ACCOMMODATION_BOOKINGS_VERSION', '1.1. 39' ); // WRCS: DEFINED_VERSION.26 define( 'WC_ACCOMMODATION_BOOKINGS_VERSION', '1.1.40' ); // WRCS: DEFINED_VERSION. 27 27 28 28 require_once( 'includes/class-wc-accommodation-bookings-plugin.php' ); -
woocommerce-accommodation-bookings/trunk/assets/css/frontend.scss
r2179088 r2911748 1 .wc-bookings-date-picker { 2 .ui-datepicker { 3 td.partial_booked a { 4 &:before { 5 display:none; 6 } 1 .product-type-accommodation-booking { 2 .wc-bookings-date-picker { 3 position: relative; 4 padding-top: 55px; 5 6 &::after { 7 content: attr(data-content); 8 position: absolute; 9 background: #fff; 10 margin: 10px 20px; 11 font-size: 13px; 12 left: 0; 13 right: 0; 14 top: 0; 15 text-align: center; 16 height: 35px; 17 line-height: 35px; 7 18 } 8 td.fully_booked + td.partial_booked.partial_booked a { 9 &:after { 10 border-bottom: none; 11 border-left: none; 12 border-top: 2.5em solid #C96259; 13 border-right: 2.5em solid transparent; 14 left: 0; 15 top: 0; 16 } 19 20 .picker.hasDatepicker { 21 margin: 0; 22 position: static !important; 17 23 } 18 24 } 19 25 } 26 27 .wc-bookings-date-picker { 28 fieldset { 29 position: relative; 30 } 31 32 &:not([data-selected-date-type="start"]) .ui-datepicker td.fully_booked_start_days:not(.selection-end-date), 33 &[data-selected-date-type="start"] .ui-datepicker td.fully_booked_end_days:not(.selection-start-date) { 34 opacity: 0.35; 35 } 36 37 &:not([data-selected-date-type="start"]) .ui-datepicker td.fully_booked_start_days:not(.selection-end-date), 38 &[data-selected-date-type="start"] .ui-datepicker td.fully_booked_end_days:not(.selection-start-date), 39 .ui-datepicker td.fully_booked { 40 span, a { 41 background-color: #c0392b !important; 42 background-image: none !important; 43 border-color: rgba(0, 0, 0, 0.1) !important; 44 color: #fff !important; 45 text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1); 46 pointer-events: none; 47 } 48 } 49 50 .ui-datepicker { 51 td.bookable-range.ui-state-disabled { 52 opacity: 1; 53 } 54 } 55 } -
woocommerce-accommodation-bookings/trunk/assets/js/writepanel.js
r2529660 r2911748 1 jQuery( function( $ ) { 1 /* globals jQuery */ 2 2 3 $('#rates_rows').sortable({ 4 items:'tr', 5 cursor:'move', 6 axis:'y', 7 handle: '.sort', 8 scrollSensitivity:40, 9 forcePlaceholderSize: true, 10 helper: 'clone', 11 opacity: 0.65, 12 placeholder: 'wc-metabox-sortable-placeholder', 13 start:function(event,ui){ 14 ui.item.css('background-color','#f6f6f6'); 15 }, 16 stop:function(event,ui){ 17 ui.item.removeAttr('style'); 18 } 19 }); 3 jQuery(function ($) { 4 $('#rates_rows').sortable({ 5 items: 'tr', 6 cursor: 'move', 7 axis: 'y', 8 handle: '.sort', 9 scrollSensitivity: 40, 10 forcePlaceholderSize: true, 11 helper: 'clone', 12 opacity: 0.65, 13 placeholder: 'wc-metabox-sortable-placeholder', 14 start(event, ui) { 15 ui.item.css('background-color', '#f6f6f6'); 16 }, 17 stop(event, ui) { 18 ui.item.removeAttr('style'); 19 }, 20 }); 20 21 21 function wc_accommodation_bookings_trigger_change_events() {22 $('#_wc_accommodation_booking_has_restricted_days').trigger( 'change');23 }22 function wc_accommodation_bookings_trigger_change_events() { 23 $('#_wc_accommodation_booking_has_restricted_days').trigger('change'); 24 } 24 25 25 $('#_wc_accommodation_booking_has_restricted_days').on( 'change', function() { 26 if ( $(this).is( ':checked' ) ) { 27 $( '.booking-day-restriction' ).show(); 28 } else { 29 $( '.booking-day-restriction' ).hide(); 30 } 31 }); 26 $('#_wc_accommodation_booking_has_restricted_days').on( 27 'change', 28 function () { 29 if ($(this).is(':checked')) { 30 $('.booking-day-restriction').show(); 31 } else { 32 $('.booking-day-restriction').hide(); 33 } 34 } 35 ); 32 36 33 wc_accommodation_bookings_trigger_change_events(); 34 35 } ); 37 wc_accommodation_bookings_trigger_change_events(); 38 }); -
woocommerce-accommodation-bookings/trunk/changelog.txt
r2879445 r2911748 1 1 *** Changelog *** 2 3 = 1.1.40 - 2023-05-12 = 4 * Dev - Added a new filter, `woocommerce_accommodation_booking_get_check_times`, to change the check-in/out timings per product. 5 * Fix - Fully booked days show as partially booked - Day after booking shows partially booked. 2 6 3 7 = 1.1.39 - 2023-03-14 = -
woocommerce-accommodation-bookings/trunk/includes/class-wc-accommodation-booking-cart-manager.php
r2815380 r2911748 34 34 public function get_item_data( $other_data, $cart_item ) { 35 35 if ( 'accommodation-booking' === $cart_item['data']->get_type() && ! empty( $other_data ) ) { 36 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );37 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );36 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $cart_item['product_id'] ); 37 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $cart_item['product_id'] ); 38 38 $end_date = date_i18n( get_option( 'date_format'), $cart_item['booking']['_end_date'] ); 39 39 -
woocommerce-accommodation-bookings/trunk/includes/class-wc-accommodation-booking-date-picker.php
r2337392 r2911748 1 <?php 1 <?php // phpcs:disable WordPress.DateTime.RestrictedFunctions.date_date,WordPress.PHP.StrictInArray.MissingTrueStrict 2 /** 3 * This plugin handles the date picker related logic for Accommodation Bookings. 4 * 5 * @package WooCommerce Accommodation Bookings 6 * @since 1.1.40 7 */ 8 2 9 if ( ! defined( 'ABSPATH' ) ) { 3 10 exit; … … 15 22 add_filter( 'woocommerce_bookings_date_picker_start_label', array( $this, 'start_label' ) ); 16 23 add_filter( 'woocommerce_bookings_date_picker_end_label', array( $this, 'end_label' ) ); 17 add_filter( 'woocommerce_booking_form_get_posted_data', array( $this, 'add_accommodation_posted_data' ), 10 , 3 ); 18 add_filter( 'woocommerce_bookings_booked_day_blocks', array( $this, 'add_partially_booked_dates' ), 10 , 3 ); 24 add_filter( 'woocommerce_booking_form_get_posted_data', array( $this, 'add_accommodation_posted_data' ), 10, 3 ); 25 add_filter( 'woocommerce_bookings_booked_day_blocks', array( $this, 'update_fully_booked_dates' ), 10, 3 ); 26 add_filter( 'woocommerce_bookings_find_booked_day_blocks', array( $this, 'find_booked_day_blocks' ), 10, 2 ); 19 27 } 20 28 21 29 /** 22 30 * Add custom start and end dat to booking data 31 * 23 32 * @since 1.0.7 24 33 * 25 * @param $data26 * @param $product27 * @param $total_duration34 * @param array $data Posted data. 35 * @param \WC_Product_Booking $product Booking product. 36 * @param int $total_duration Total duration. 28 37 * 29 38 * @return mixed 30 39 */ 31 40 public function add_accommodation_posted_data( $data, $product, $total_duration ) { 32 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );33 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );41 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $product->get_id() ); 42 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $product->get_id() ); 34 43 35 44 if ( 'night' === $product->get_duration_unit() ) { … … 40 49 41 50 if ( $product->has_resources() && ! $product->is_resource_assignment_type( 'customer' ) ) { 42 // Assign an available resource automatically 51 // Assign an available resource automatically. 43 52 $available_bookings = wc_bookings_get_total_available_bookings_for_range( $product, $data['_start_date'], $data['_end_date'], 0, $data['_qty'] ); 44 53 if ( is_array( $available_bookings ) ) { … … 53 62 /** 54 63 * Changes the start label to "Check-in" 55 * @param string $label 64 * 65 * @param string $label Label. 56 66 * @return string 57 67 */ … … 62 72 /** 63 73 * Changes the end label to "Check-out" 74 * 75 * @param string $label Label. 64 76 */ 65 77 public function end_label( $label ) { … … 85 97 * b. test if resources are available and if yes than move fully booked day to partially booked days 86 98 * 87 * @param array $booked_data_array 88 * @param WC_Product_Accommodation_Booking $product 99 * @param array $booked_data_array Array of booked days. 100 * @param WC_Product_Accommodation_Booking $product Product. 89 101 */ 90 102 public function add_partially_booked_dates( $booked_data_array, $product ) { … … 107 119 } 108 120 121 $check_in_time = $product->get_check_times( 'in', $product->get_id() ); 122 if ( 'in' === $which ) { 123 $check_time = strtotime( '-1 day ' . $check_in_time, $time ); 124 } else { 125 $check_time = strtotime( $check_in_time, $time ); 126 } 127 $check = date( 'F j, Y, g:i a', $check_time ); 128 // Check available blocks for resource. If some are available that means that the day is not fully booked. 129 $not_fully_booked = $this->get_product_resource_available_blocks_on_time( $product, $resource_id, $check_time ); 130 if ( $not_fully_booked ) { 131 $booked_data_array = $this->move_day_from_fully_to_partially_booked( $booked_data_array, $resource_id, $day ); 132 } 133 } 134 } 135 } 136 137 return $booked_data_array; 138 } 139 140 /** 141 * Update the fully booked, fully booked start day, and fully booked end day accomodation bookings, 142 * 143 * @param array $booked_data_array Array of booked days. 144 * @param WC_Product_Accommodation_Booking $product Product. 145 */ 146 public function update_fully_booked_dates( $booked_data_array, $product ) { 147 // This function makes sense only for duration type: night. 148 if ( 'night' !== $product->get_duration_unit() ) { 149 return $booked_data_array; 150 } 151 152 // Start and the end dates of all bookings. 153 $check_in_out_times = $this->get_check_in_and_out_times( $product ); 154 $res_auto_assign = $product->is_resource_assignment_type( 'automatic' ); 155 156 // Go through each checkin and checkout days and mark them as fully booked. 157 $made_partialy = array(); 158 foreach ( array( 'in', 'out' ) as $which ) { 159 foreach ( $check_in_out_times[ $which ] as $resource_id => $times ) { 160 foreach ( $times as $time ) { 161 $day = date( 'Y-n-j', $time ); 162 109 163 $check_in_time = $product->get_check_times( 'in' ); 110 164 if ( 'in' === $which ) { 111 $check_time = strtotime( '-1 day ' . $check_in_time, $time );165 $check_time = strtotime( $check_in_time, $time ); 112 166 } else { 113 $check_time = strtotime( $check_in_time, $time );114 } 115 $check = date( "F j, Y, g:i a", $check_time );167 $check_time = strtotime( '-1 day' . $check_in_time, $time ); 168 } 169 $check = date( 'F j, Y, g:i a', $check_time ); 116 170 // Check available blocks for resource. If some are available that means that the day is not fully booked. 117 $not_fully_booked = $this->get_product_resource_available_blocks_on_time( $product, $resource_id, $check_time ); 118 if( $not_fully_booked ) { 119 $booked_data_array = $this->move_day_from_fully_to_partially_booked( $booked_data_array, $resource_id, $day ); 171 $resource_id_to_use = $res_auto_assign ? 0 : $resource_id; 172 $available_on_time = $this->get_product_resource_available_blocks_on_time( $product, $resource_id_to_use, $check_time ); 173 if ( 0 === $available_on_time ) { 174 $booked_data_array = $this->prepare_fully_booked_start_and_end_days( $booked_data_array, $resource_id, $day, $which ); 175 } else { 176 $booked_data_array = $this->move_day_from_fully_to_partially_booked( $booked_data_array, $resource_id, $day ); 177 $made_partialy[ $resource_id ] = $day; 120 178 } 121 179 } … … 123 181 } 124 182 183 // Later removing the days from `fully_booked_days` array that were moved to partially booked days. 184 // We are doing this out of the above foreach because we want a condition in 185 // `prepare_fully_booked_start_and_end_days()` to be true. 186 foreach ( $made_partialy as $resource => $partial_day ) { 187 if ( ! isset( $booked_data_array['fully_booked_days'][ $partial_day ][ $resource ] ) ) { 188 continue; 189 } 190 191 unset( $booked_data_array['fully_booked_days'][ $day ][ $resource ] ); 192 193 if ( empty( $booked_data_array['fully_booked_days'][ $day ] ) ) { 194 unset( $booked_data_array['fully_booked_days'][ $day ] ); 195 } 196 } 197 125 198 return $booked_data_array; 126 199 } 127 200 128 201 /** 202 * Should return find booked day blocks with additional data. 203 * 204 * @since 1.1.40 205 * 206 * @param array $result Array of booked days. 207 * @param array $booked_blocks Array of booked blocks. 208 */ 209 public function find_booked_day_blocks( $result, $booked_blocks ): array { 210 $result['fully_booked_start_days'] = $booked_blocks['fully_booked_start_days'] ?? array(); 211 $result['fully_booked_end_days'] = $booked_blocks['fully_booked_end_days'] ?? array(); 212 213 return $result; 214 } 215 216 /** 129 217 * Calculates array that contains the start and the end time of all bookings for given product. 130 * @param $product 218 * 219 * @param \WC_Product_Booking $product Product. 131 220 */ 132 221 private function get_check_in_and_out_times( $product ) { 133 222 134 $check_in_out_times = array(135 'in' => array(),223 $check_in_out_times = array( 224 'in' => array(), 136 225 'out' => array(), 137 226 ); … … 140 229 // Those times will be considered for switching particular day from full to partially booked days. 141 230 if ( version_compare( WC_BOOKINGS_VERSION, '1.15.0', '<' ) ) { 142 $existing_bookings = WC_Bookings_Controller::get_all_existing_bookings( $product );231 $existing_bookings = WC_Bookings_Controller::get_all_existing_bookings( $product ); 143 232 } else { 144 $existing_bookings = WC_Booking_Data_Store::get_all_existing_bookings( $product );233 $existing_bookings = WC_Booking_Data_Store::get_all_existing_bookings( $product ); 145 234 } 146 235 147 236 foreach ( $existing_bookings as $booking ) { 148 237 149 $resource = $booking->get_resource_id();238 $resource = $booking->get_resource_id(); 150 239 if ( ! array_key_exists( $resource, $check_in_out_times['in'] ) ) { 151 $check_in_out_times['in'][ $resource ] = array();240 $check_in_out_times['in'][ $resource ] = array(); 152 241 $check_in_out_times['out'][ $resource ] = array(); 153 242 } … … 167 256 /** 168 257 * Get amount of available product resoureces on a specific timestamp 169 * @param $product 170 * @param $resource 171 * @param $date 258 * 259 * @param \WC_Product_Booking $product Product. 260 * @param int $resource Resource ID. 261 * @param string $time Timestamp. 262 * 263 * @return int|mixed 172 264 */ 173 265 private function get_product_resource_available_blocks_on_time( $product, $resource, $time ) { 174 $blocks = $product->get_blocks_in_range_for_day( $time, $time, $resource, array() );175 $available_blocks = wc_bookings_get_time_slots( $product, $blocks, array(), 0, $time, $time );176 return ! empty( $available_blocks[ $time ] ) ? $available_blocks[ $time ][ 'available'] : 0;266 $blocks = $product->get_blocks_in_range_for_day( $time, $time, $resource, array() ); 267 $available_blocks = wc_bookings_get_time_slots( $product, $blocks, array(), $resource, $time, $time ); 268 return ! empty( $available_blocks[ $time ] ) ? $available_blocks[ $time ]['available'] : 0; 177 269 } 178 270 … … 180 272 * Moves day from fully booked days array to partially booked days array and if the fully booked days is 181 273 * array for that day is empty ( no assigned resources ) removes that empty day entry 182 * @param $booked_data_array 183 * @param $resource 184 * @param $day 274 * 275 * @param array $booked_data_array Array of booked days. 276 * @param int $resource Resource ID. 277 * @param string $day Day. 185 278 */ 186 279 private function move_day_from_fully_to_partially_booked( $booked_data_array, $resource, $day ) { … … 191 284 $booked_data_array['partially_booked_days'][ $day ][ $resource ] = $booked_data_array['fully_booked_days'][ $day ][ $resource ]; 192 285 193 unset( $booked_data_array['fully_booked_days'][ $day ][ $resource ] );194 195 if ( empty( $booked_data_array['fully_booked_days'][ $day ] ) ) {196 unset( $booked_data_array['fully_booked_days'][ $day ] );197 }198 199 286 return $booked_data_array; 200 287 } 201 288 289 /** 290 * Moves day from fully_booked_days array to the fully_booked_start_days or fully_booked_end_days 291 * This is required because we want to showcase days availability as per the selection. 292 * So by default, fully_booked_start_days will be colored red; not available for check-ins. 293 * When start date is selected, fully_booked_end_days will be colored red; not available for check-outs. 294 * 295 * @param array $booked_data_array Array of booked days. 296 * @param int $resource Resource ID. 297 * @param string $day A Day. 298 * @param string $which In or Out. 299 */ 300 private function prepare_fully_booked_start_and_end_days( $booked_data_array, $resource, $day, $which = 'in' ) { 301 if ( isset( $booked_data_array['fully_booked_days'][ $day ][ $resource ] ) ) { 302 if ( 'in' === $which ) { 303 $booked_data_array['fully_booked_start_days'][ $day ][ $resource ] = $booked_data_array['fully_booked_days'][ $day ][ $resource ]; 304 } else { 305 $booked_data_array['fully_booked_end_days'][ $day ][ $resource ] = $booked_data_array['fully_booked_days'][ $day ][ $resource ]; 306 } 307 unset( $booked_data_array['fully_booked_days'][ $day ][ $resource ] ); 308 309 if ( empty( $booked_data_array['fully_booked_days'][ $day ] ) ) { 310 unset( $booked_data_array['fully_booked_days'][ $day ] ); 311 } 312 } else { 313 // If the day already exists fully_booked_start_days at this point, 314 // it means it is also a fully booked end day, so reverting it 315 // back to be in fully_booked_days. 316 if ( isset( $booked_data_array['fully_booked_start_days'][ $day ][ $resource ] ) ) { 317 $booked_data_array['fully_booked_days'][ $day ][ $resource ] = $booked_data_array['fully_booked_start_days'][ $day ][ $resource ]; 318 unset( $booked_data_array['fully_booked_start_days'][ $day ][ $resource ] ); 319 320 if ( empty( $booked_data_array['fully_booked_start_days'][ $day ] ) ) { 321 unset( $booked_data_array['fully_booked_start_days'][ $day ] ); 322 } 323 } 324 } 325 326 // Also removing from partially booked array in case if it 327 // was added there in `move_day_from_fully_to_partially_booked()`. 328 if ( isset( $booked_data_array['partially_booked_days'][ $day ][ $resource ] ) ) { 329 unset( $booked_data_array['partially_booked_days'][ $day ][ $resource ] ); 330 } 331 if ( empty( $booked_data_array['partially_booked_days'][ $day ] ) ) { 332 unset( $booked_data_array['partially_booked_days'][ $day ] ); 333 } 334 335 return $booked_data_array; 336 } 202 337 } 203 338 204 new WC_Accommodation_Booking_Date_Picker ;339 new WC_Accommodation_Booking_Date_Picker(); -
woocommerce-accommodation-bookings/trunk/includes/class-wc-accommodation-booking-order-manager.php
r2815380 r2911748 34 34 } 35 35 36 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );37 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );36 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $item['product_id'] ); 37 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $item['product_id'] ); 38 38 ?> 39 39 <p> -
woocommerce-accommodation-bookings/trunk/includes/class-wc-accommodation-booking-product-tabs.php
r1714785 r2911748 12 12 13 13 /** 14 * Product ID. 15 */ 16 public $product_id = 0; 17 18 /** 14 19 * Hook into WooCommerce.. 15 20 */ … … 23 28 */ 24 29 public function are_time_fields_filled_out() { 25 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );26 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );30 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $this->product_id ); 31 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $this->product_id ); 27 32 28 33 if ( empty( $check_in ) ) { … … 57 62 } 58 63 64 // Set the product ID. 65 $this->product_id = $post->ID; 66 59 67 if ( ! $this->are_time_fields_filled_out() ) { 60 68 return $tabs; … … 78 86 return; 79 87 } 80 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );81 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );88 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $this->product_id ); 89 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $this->product_id ); 82 90 ?> 83 91 <h2><?php echo esc_html( apply_filters( 'woocommerce_accommodation_booking_time_tab_heading', __( 'Arriving/leaving', 'woocommerce-accommodation-bookings' ) ) ); ?></h2> -
woocommerce-accommodation-bookings/trunk/includes/class-wc-accommodation-booking.php
r2390281 r2911748 110 110 } 111 111 112 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );113 114 112 $date_format = apply_filters( 'woocommerce_bookings_date_format', wc_date_format() ); 115 113 $time_format = apply_filters( 'woocommerce_bookings_time_format', ', ' . wc_time_format() ); 116 114 117 return date_i18n( $date_format, $booking->start ) . date_i18n( $time_format, strtotime( "Today " . $check_in ));115 return date_i18n( $date_format, $booking->start ) . date_i18n( $time_format, $booking->start ); 118 116 } 119 117 … … 124 122 } 125 123 126 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );127 124 $date_format = apply_filters( 'woocommerce_bookings_date_format', wc_date_format() ); 128 125 $time_format = apply_filters( 'woocommerce_bookings_time_format', ', ' . wc_time_format() ); 129 126 130 return date_i18n( $date_format, $booking->end ) . date_i18n( $time_format, strtotime( "Today " . $check_out ));127 return date_i18n( $date_format, $booking->end ) . date_i18n( $time_format, $booking->end ); 131 128 } 132 129 … … 182 179 } 183 180 184 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );185 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );181 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $product_id ); 182 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $product_id ); 186 183 187 184 $start = get_post_meta( $booking_id, '_booking_start', true ); -
woocommerce-accommodation-bookings/trunk/includes/class-wc-accommodation-bookings-plugin.php
r2815380 r2911748 1 1 <?php 2 /** 3 * This class is responsible for the plugin's initialization. 4 * 5 * @since 1.0.2 6 * @package WooCommerce\AccommodationBookings 7 */ 8 2 9 if ( ! defined( 'ABSPATH' ) ) { 3 10 exit; … … 33 40 * Constructor. 34 41 * 35 * @param string $plugin_file Path to main plugin's file 36 * @param string $version Plugin's version 42 * @param string $plugin_file Path to main plugin's file. 43 * @param string $version Plugin's version. 37 44 */ 38 45 public function __construct( $plugin_file, $version ) { … … 88 95 * @return void 89 96 */ 97 // phpcs:ignore 90 98 private function _define_constants() { 91 99 define( 'WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH', untrailingslashit( plugin_dir_path( $this->plugin_file ) ) . '/includes/' ); … … 100 108 * @return void 101 109 */ 110 // phpcs:ignore 102 111 private function _register_hooks() { 103 112 register_activation_hook( $this->plugin_file, array( $this, 'check_dependencies' ) ); … … 111 120 add_action( 'plugins_loaded', array( $this, 'includes' ), 20 ); 112 121 add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 ); 113 add_action( 'wp_enqueue_scripts', array( $this, ' booking_form_styles' ) );122 add_action( 'wp_enqueue_scripts', array( $this, 'frontend_assets' ) ); 114 123 115 124 if ( is_admin() ) { … … 131 140 } 132 141 133 require_once ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-dependencies.php' );142 require_once WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-dependencies.php'; 134 143 try { 135 144 WC_Accommodation_Dependencies::check_dependencies(); … … 164 173 */ 165 174 public function load_plugin_textdomain() { 175 /** 176 * Filter locale before loading the plugin's text domain. 177 * 178 * @since 1.0.2 179 * 180 * @param string $locale The plugin's current locale. 181 * @param string $domain Text domain. Unique identifier for retrieving translated strings. 182 */ 166 183 $locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce-accommodation-bookings' ); 167 184 $dir = trailingslashit( WP_LANG_DIR ); … … 175 192 */ 176 193 public function includes() { 177 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-product-accommodation-booking.php' );178 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-product-accommodation-booking-resource.php' );179 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking.php' );180 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-cart-manager.php' );181 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-date-picker.php' );182 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-product-tabs.php' );183 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-order-manager.php' );184 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'integrations/class-wc-accommodation-booking-addons.php' );194 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-product-accommodation-booking.php'; 195 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-product-accommodation-booking-resource.php'; 196 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking.php'; 197 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-cart-manager.php'; 198 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-date-picker.php'; 199 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-product-tabs.php'; 200 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'class-wc-accommodation-booking-order-manager.php'; 201 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'integrations/class-wc-accommodation-booking-addons.php'; 185 202 } 186 203 … … 189 206 */ 190 207 public function admin_includes() { 191 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'admin/class-wc-accommodation-booking-admin-panels.php' );192 include ( WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'admin/class-wc-accommodation-booking-admin-product-settings.php' );208 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'admin/class-wc-accommodation-booking-admin-panels.php'; 209 include WC_ACCOMMODATION_BOOKINGS_INCLUDES_PATH . 'admin/class-wc-accommodation-booking-admin-product-settings.php'; 193 210 } 194 211 … … 196 213 * Frontend booking form scripts 197 214 */ 198 public function booking_form_styles() { 199 wp_enqueue_style( 'wc-accommodation-bookings-styles', WC_ACCOMMODATION_BOOKINGS_PLUGIN_URL . '/assets/css/frontend.css', null, WC_ACCOMMODATION_BOOKINGS_VERSION ); 215 public function frontend_assets() { 216 $booking_style_asset_data = $this->get_asset_data( 'frontend', 'css' ); 217 $booking_script_asset_data = $this->get_asset_data( 'booking-form', 'js/frontend' ); 218 219 $booking_script_dependencies = array_merge( 220 $booking_script_asset_data['dependencies'], 221 array( 'wc-bookings-booking-form' ) 222 ); 223 224 wp_enqueue_style( 225 'wc-accommodation-bookings-styles', 226 WC_ACCOMMODATION_BOOKINGS_PLUGIN_URL . '/dist/css/frontend.css', 227 null, 228 $booking_style_asset_data['version'] 229 ); 230 231 wp_enqueue_script( 232 'wc-accommodation-bookings-form', 233 WC_ACCOMMODATION_BOOKINGS_PLUGIN_URL . '/dist/js/frontend/booking-form.js', 234 $booking_script_dependencies, 235 $booking_script_asset_data['version'], 236 true 237 ); 238 239 wp_set_script_translations( 240 'wc-accommodation-bookings-form', 241 'woocommerce-accommodation-bookings', 242 plugin_dir_path( WC_ACCOMMODATION_BOOKINGS_MAIN_FILE ) . '/languages' 243 ); 200 244 } 201 245 … … 203 247 * Show row meta on the plugin screen. 204 248 * 205 * @ access public206 * @param mixed $links Plugin Row Meta207 * @param mixed $file Plugin Base file208 * @return array249 * @param array $links Plugin Row Meta. 250 * @param string $file Plugin Base file. 251 * 252 * @return array 209 253 */ 210 254 public function plugin_row_meta( $links, $file ) { 211 if ( $file == plugin_basename( WC_ACCOMMODATION_BOOKINGS_MAIN_FILE ) ) { 255 // phpcs:ignore 256 if ( $file === plugin_basename( WC_ACCOMMODATION_BOOKINGS_MAIN_FILE ) ) { 212 257 $row_meta = array( 213 'docs' => '<a href="' . esc_url( apply_filters( 'woocommerce_accommodation_bookings_docs_url', 'https://docs.woocommerce.com/document/woocommerce-accommodation-bookings/' ) ) . '" title="' . esc_attr( __( 'View Documentation', 'woocommerce-accommodation-bookings' ) ) . '">' . __( 'Docs', 'woocommerce-accommodation-bookings' ) . '</a>',214 'support' => '<a href="' . esc_url( apply_filters( 'woocommerce_accommodation_bookings_support_url', 'https://docs.woocommerce.com/' ) ) . '" title="' . esc_attr( __( 'Visit Premium Customer Support Forum', 'woocommerce-accommodation-bookings' ) ) . '">' . __( 'Premium Support', 'woocommerce-accommodation-bookings' ) . '</a>',258 'docs' => '<a href="' . esc_url( apply_filters( 'woocommerce_accommodation_bookings_docs_url', 'https://docs.woocommerce.com/document/woocommerce-accommodation-bookings/' ) ) . '" title="' . esc_attr( __( 'View Documentation', 'woocommerce-accommodation-bookings' ) ) . '">' . __( 'Docs', 'woocommerce-accommodation-bookings' ) . '</a>', //phpcs:ignore 259 'support' => '<a href="' . esc_url( apply_filters( 'woocommerce_accommodation_bookings_support_url', 'https://docs.woocommerce.com/' ) ) . '" title="' . esc_attr( __( 'Visit Premium Customer Support Forum', 'woocommerce-accommodation-bookings' ) ) . '">' . __( 'Premium Support', 'woocommerce-accommodation-bookings' ) . '</a>', //phpcs:ignore 215 260 ); 216 261 … … 227 272 global $wpdb; 228 273 229 $force_update = false;274 $force_update = false; 230 275 $accommodation_bookings_version = get_option( 'wc_accommodation_bookings_version' ); 231 276 232 277 if ( ! $accommodation_bookings_version ) { 233 $force_update = true;278 $force_update = true; 234 279 $accommodation_bookings_version = $this->version; 235 280 } 236 281 237 // Data updates 282 // Data updates. 238 283 if ( $force_update || version_compare( $accommodation_bookings_version, '1.1.3', '<' ) ) { 239 284 $accommodation_bookings = $wpdb->get_results( "SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = '_wc_booking_pricing' AND meta_value LIKE '%override_block%';" ); … … 242 287 243 288 if ( ! is_a( $product, 'WC_Product' ) ) { 244 continue;245 }246 247 if ( 'accommodation-booking' != $product->get_type() ) {248 289 continue; 249 290 } 250 291 251 $pricing = get_post_meta( $product->get_id(), '_wc_booking_pricing', true ); 292 if ( 'accommodation-booking' !== $product->get_type() ) { 293 continue; 294 } 295 296 $pricing = get_post_meta( $product->get_id(), '_wc_booking_pricing', true ); 252 297 $original_base_cost = absint( get_post_meta( $product->get_id(), '_wc_booking_base_cost', true ) ); 253 298 254 // Convert from the old to the new structure 299 // Convert from the old to the new structure. 255 300 foreach ( $pricing as &$pricing_row ) { 256 $pricing_row['base_cost'] = $pricing_row['cost'] = 0; 257 $new_cost = $pricing_row['override_block'];301 $pricing_row['base_cost'] = $pricing_row['cost'] = 0; //phpcs:ignore 302 $new_cost = $pricing_row['override_block']; 258 303 unset( $pricing_row['override_block'] ); 259 $pricing_row['base_modifier'] = $pricing_row['modifier'] = $new_cost > $original_base_cost ? 'plus' : 'minus'; 260 $pricing_row['cost'] = absint( $new_cost - $original_base_cost );304 $pricing_row['base_modifier'] = $pricing_row['modifier'] = $new_cost > $original_base_cost ? 'plus' : 'minus'; //phpcs:ignore 305 $pricing_row['cost'] = absint( $new_cost - $original_base_cost ); 261 306 } 262 307 … … 265 310 } 266 311 267 // Update version 312 // Update version. 268 313 update_option( 'wc_accommodation_bookings_version', $this->version ); 269 314 } 315 316 /** 317 * Should return data from the asset file. 318 * 319 * @param string $script_file_name Script file name. 320 * @param string $location Script file location. 321 * 322 * @return array 323 */ 324 private function get_asset_data( $script_file_name, $location ): array { 325 $asset_path = dirname( WC_ACCOMMODATION_BOOKINGS_MAIN_FILE ) . "/dist/$location/$script_file_name.asset.php"; 326 327 return require $asset_path; 328 } 270 329 } -
woocommerce-accommodation-bookings/trunk/includes/class-wc-product-accommodation-booking.php
r2815380 r2911748 196 196 $bookable_product = $this; 197 197 198 $transient_name = 'book_ts_' . md5( http_build_query( array( $bookable_product->get_id(), $resource_id, $from, $to ) ) ); 198 $product_id = $bookable_product->get_id(); 199 $transient_name = 'book_ts_' . md5( http_build_query( array( $product_id, $resource_id, $from, $to ) ) ); 199 200 $available_slots = get_transient( $transient_name ); 200 201 $booking_slots_transient_keys = array_filter( (array) get_transient( 'booking_slots_transient_keys' ) ); 201 202 202 if ( ! isset( $booking_slots_transient_keys[ $ bookable_product->get_id()] ) ) {203 $booking_slots_transient_keys[ $ bookable_product->get_id()] = array();204 } 205 206 $booking_slots_transient_keys[ $ bookable_product->get_id()][] = $transient_name;203 if ( ! isset( $booking_slots_transient_keys[ $product_id ] ) ) { 204 $booking_slots_transient_keys[ $product_id ] = array(); 205 } 206 207 $booking_slots_transient_keys[ $product_id ][] = $transient_name; 207 208 208 209 // Give array of keys a long ttl because if it expires we won't be able to flush the keys when needed. … … 230 231 231 232 foreach ( $blocks as $block ) { 232 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in' );233 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out' );233 $check_in = WC_Product_Accommodation_Booking::get_check_times( 'in', $product_id ); 234 $check_out = WC_Product_Accommodation_Booking::get_check_times( 'out', $product_id ); 234 235 // Blocks for accommodation products are initially calculated as days but the actuall time blocks are shifted by check in and checkout times. 235 236 $block_start_time = strtotime( "{$check_in}", $block ); … … 329 330 * Get checkin and checkout times. 330 331 * 331 * @param string $type 332 * 333 * @return string Time, either from options or default 334 */ 335 public static function get_check_times( $type ) { 336 $option = get_option( 'woocommerce_accommodation_bookings_times_settings' ); 332 * @param string $type The type, check_in or check_out. 333 * @param int $product_id The product ID. 334 * 335 * @return string The time, either from options or default or from the filtered value. 336 */ 337 public static function get_check_times( $type, $product_id = 0 ) { 338 $option = get_option( 'woocommerce_accommodation_bookings_times_settings' ); 339 $check_time = ''; 340 337 341 switch ( $type ) { 338 342 case 'in': 339 return isset( $option['check_in'] ) ? $option['check_in'] : '14:00'; 343 $check_time = $option['check_in'] ?? '14:00'; 344 break; 340 345 case 'out': 341 return isset( $option['check_out'] ) ? $option['check_out'] : '14:00'; 342 } 343 344 return ''; 346 $check_time = $option['check_out'] ?? '14:00'; 347 break; 348 } 349 350 /** 351 * Filter the check-in/out times for a specific product. 352 * 353 * @param string $check_time The check-in/out time stored in the database. 354 * @param string $type The type, check_in or check_out. 355 * @param int $product_id The product ID. 356 * 357 * @return string The filtered/original time. 358 */ 359 return apply_filters( 'woocommerce_accommodation_booking_get_check_times', $check_time, $type, (int) $product_id ); 345 360 } 346 361 -
woocommerce-accommodation-bookings/trunk/languages/woocommerce-accommodation-bookings.pot
r2879445 r2911748 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: WooCommerce Accommodation Bookings 1.1.39\n" 6 "Report-Msgid-Bugs-To: " 7 "https://wordpress.org/support/plugin/woocommerce-accommodation-bookings\n" 8 "POT-Creation-Date: 2023-03-14 00:20:22+00:00\n" 9 "MIME-Version: 1.0\n" 10 "Content-Type: text/plain; charset=utf-8\n" 11 "Content-Transfer-Encoding: 8bit\n" 12 "PO-Revision-Date: 2023-MO-DA HO:MI+ZONE\n" 5 "Project-Id-Version: WooCommerce Accommodation Bookings 1.1.40\n" 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/woocommerce-accommodation-bookings\n" 13 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 14 8 "Language-Team: LANGUAGE <[email protected]>\n" 15 "X-Generator: node-wp-i18n 1.2.6\n" 9 "MIME-Version: 1.0\n" 10 "Content-Type: text/plain; charset=UTF-8\n" 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2023-05-12T17:52:26+00:00\n" 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2.7.1\n" 15 "X-Domain: woocommerce-accommodation-bookings\n" 16 17 #. Plugin Name of the plugin 18 msgid "WooCommerce Accommodation Bookings" 19 msgstr "" 20 21 #. Plugin URI of the plugin 22 msgid "https://woocommerce.com/products/woocommerce-accommodation-bookings/" 23 msgstr "" 24 25 #. Description of the plugin 26 msgid "An accommodations add-on for the WooCommerce Bookings extension." 27 msgstr "" 28 29 #. Author of the plugin 30 msgid "WooCommerce" 31 msgstr "" 32 33 #. Author URI of the plugin 34 msgid "https://woocommerce.com" 35 msgstr "" 16 36 17 37 #: includes/admin/class-wc-accommodation-booking-admin-panels.php:32 … … 19 39 msgstr "" 20 40 21 #: includes/admin/class-wc-accommodation-booking-admin-panels.php:31922 msgid "Person Type #%d"23 msgstr ""24 25 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:8426 msgid "Accommodation"27 msgstr ""28 29 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:11930 msgid "Settings saved"31 msgstr ""32 33 41 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:136 34 #: includes/class-wc-accommodation-booking-product-tabs.php: 8542 #: includes/class-wc-accommodation-booking-product-tabs.php:93 35 43 msgid "Check-in time" 36 44 msgstr "" … … 41 49 42 50 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:142 43 #: includes/class-wc-accommodation-booking-product-tabs.php: 8651 #: includes/class-wc-accommodation-booking-product-tabs.php:94 44 52 msgid "Check-out time" 45 53 msgstr "" … … 47 55 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:143 48 56 msgid "Check-out time for reservations." 49 msgstr ""50 51 #: includes/admin/class-wc-accommodation-booking-admin-product-settings.php:17252 msgid "Save Changes"53 57 msgstr "" 54 58 … … 114 118 115 119 #: includes/admin/views/html-accommodation-booking-availability-fields.php:20 116 #: includes/admin/views/html-accommodation-booking-availability.php:64117 120 #: includes/admin/views/html-accommodation-booking-rates-fields.php:20 118 121 msgid "Monday" … … 120 123 121 124 #: includes/admin/views/html-accommodation-booking-availability-fields.php:21 122 #: includes/admin/views/html-accommodation-booking-availability.php:65123 125 #: includes/admin/views/html-accommodation-booking-rates-fields.php:21 124 126 msgid "Tuesday" … … 126 128 127 129 #: includes/admin/views/html-accommodation-booking-availability-fields.php:22 128 #: includes/admin/views/html-accommodation-booking-availability.php:66129 130 #: includes/admin/views/html-accommodation-booking-rates-fields.php:22 130 131 msgid "Wednesday" … … 132 133 133 134 #: includes/admin/views/html-accommodation-booking-availability-fields.php:23 134 #: includes/admin/views/html-accommodation-booking-availability.php:67135 135 #: includes/admin/views/html-accommodation-booking-rates-fields.php:23 136 136 msgid "Thursday" … … 138 138 139 139 #: includes/admin/views/html-accommodation-booking-availability-fields.php:24 140 #: includes/admin/views/html-accommodation-booking-availability.php:68141 140 #: includes/admin/views/html-accommodation-booking-rates-fields.php:24 142 141 msgid "Friday" … … 144 143 145 144 #: includes/admin/views/html-accommodation-booking-availability-fields.php:25 146 #: includes/admin/views/html-accommodation-booking-availability.php:69147 145 #: includes/admin/views/html-accommodation-booking-rates-fields.php:25 148 146 msgid "Saturday" … … 150 148 151 149 #: includes/admin/views/html-accommodation-booking-availability-fields.php:26 152 #: includes/admin/views/html-accommodation-booking-availability.php:63153 150 #: includes/admin/views/html-accommodation-booking-rates-fields.php:26 154 151 msgid "Sunday" … … 229 226 230 227 #: includes/admin/views/html-accommodation-booking-availability.php:50 231 msgid "" 232 "Restrict the days of the week that are able to be selected on the calendar; " 233 "this will not affect your availability." 228 msgid "Restrict the days of the week that are able to be selected on the calendar; this will not affect your availability." 234 229 msgstr "" 235 230 … … 260 255 261 256 #: includes/admin/views/html-accommodation-booking-availability.php:100 262 msgid "" 263 "The lower the priority number, the earlier this rule gets applied. By " 264 "default, global rules take priority over product rules which take priority " 265 "over resource rules. By using priority numbers you can execute rules in " 266 "different orders." 257 msgid "The lower the priority number, the earlier this rule gets applied. By default, global rules take priority over product rules which take priority over resource rules. By using priority numbers you can execute rules in different orders." 267 258 msgstr "" 268 259 … … 273 264 274 265 #: includes/admin/views/html-accommodation-booking-availability.php:113 275 msgid "" 276 "Rules with lower numbers will execute first. Rules further down this table " 277 "with the same priority will also execute first." 266 msgid "Rules with lower numbers will execute first. Rules further down this table with the same priority will also execute first." 278 267 msgstr "" 279 268 … … 315 304 316 305 #: includes/admin/views/html-accommodation-booking-data.php:50 317 msgid "" 318 "Check this box if the booking requires admin approval/confirmation. Payment " 319 "will not be taken during checkout." 306 msgid "Check this box if the booking requires admin approval/confirmation. Payment will not be taken during checkout." 320 307 msgstr "" 321 308 … … 325 312 326 313 #: includes/admin/views/html-accommodation-booking-data.php:57 327 msgid "" 328 "Check this box if the booking can be cancelled by the customer after it has " 329 "been purchased. A refund will not be sent automatically." 314 msgid "Check this box if the booking can be cancelled by the customer after it has been purchased. A refund will not be sent automatically." 330 315 msgstr "" 331 316 … … 367 352 368 353 #: includes/admin/views/html-accommodation-booking-rates.php:9 369 msgid "" 370 "The cost is displayed to the user on the frontend. Leave blank to have it " 371 "calculated for you. If a booking has varying costs, this will be prefixed " 372 "with the word \"from:\"." 354 msgid "The cost is displayed to the user on the frontend. Leave blank to have it calculated for you. If a booking has varying costs, this will be prefixed with the word \"from:\"." 373 355 msgstr "" 374 356 … … 402 384 403 385 #: includes/class-wc-accommodation-booking-cart-manager.php:42 404 #: includes/class-wc-accommodation-booking-date-picker.php: 59386 #: includes/class-wc-accommodation-booking-date-picker.php:69 405 387 #: includes/class-wc-accommodation-booking-order-manager.php:40 406 388 msgid "Check-in" … … 415 397 416 398 #: includes/class-wc-accommodation-booking-cart-manager.php:50 417 #: includes/class-wc-accommodation-booking-date-picker.php: 66399 #: includes/class-wc-accommodation-booking-date-picker.php:78 418 400 #: includes/class-wc-accommodation-booking-order-manager.php:57 419 401 msgid "Check-out" … … 428 410 msgstr "" 429 411 430 #: includes/class-wc-accommodation-booking-product-tabs.php: 63431 #: includes/class-wc-accommodation-booking-product-tabs.php: 83412 #: includes/class-wc-accommodation-booking-product-tabs.php:71 413 #: includes/class-wc-accommodation-booking-product-tabs.php:91 432 414 msgid "Arriving/leaving" 433 415 msgstr "" 434 416 435 #: includes/class-wc-accommodation-booking.php:20 9417 #: includes/class-wc-accommodation-booking.php:206 436 418 msgid "night" 437 419 msgstr "" 438 420 439 #: includes/class-wc-accommodation-bookings-plugin.php:2 13421 #: includes/class-wc-accommodation-bookings-plugin.php:258 440 422 msgid "View Documentation" 441 423 msgstr "" 442 424 443 #: includes/class-wc-accommodation-bookings-plugin.php:2 13425 #: includes/class-wc-accommodation-bookings-plugin.php:258 444 426 msgid "Docs" 445 427 msgstr "" 446 428 447 #: includes/class-wc-accommodation-bookings-plugin.php:2 14429 #: includes/class-wc-accommodation-bookings-plugin.php:259 448 430 msgid "Visit Premium Customer Support Forum" 449 431 msgstr "" 450 432 451 #: includes/class-wc-accommodation-bookings-plugin.php:2 14433 #: includes/class-wc-accommodation-bookings-plugin.php:259 452 434 msgid "Premium Support" 453 435 msgstr "" … … 477 459 msgstr "" 478 460 479 #: includes/integrations/class-wc-accommodation-booking-addons.php:57480 461 #: includes/integrations/class-wc-accommodation-booking-addons.php:71 481 462 msgid "Bookings: Multiply cost by person count" 482 msgstr ""483 484 #: includes/integrations/class-wc-accommodation-booking-addons.php:61485 msgid "Bookings: Multiply cost by block count"486 463 msgstr "" 487 464 … … 495 472 msgstr "" 496 473 497 # . Plugin Name of the plugin/theme498 msgid " WooCommerce Accommodation Bookings"499 msgstr "" 500 501 # . Plugin URI of the plugin/theme502 msgid " https://woocommerce.com/products/woocommerce-accommodation-bookings/"503 msgstr "" 504 505 # . Description of the plugin/theme506 msgid " An accommodations add-on for the WooCommerce Bookings extension."507 msgstr "" 508 509 # . Author of the plugin/theme510 msgid " WooCommerce"511 msgstr "" 512 513 # . Author URI of the plugin/theme514 msgid " https://woocommerce.com"515 msgstr "" 474 #: dist/js/frontend/booking-form.js:1 475 msgid "Available for check-out only." 476 msgstr "" 477 478 #: dist/js/frontend/booking-form.js:1 479 msgid "Available for check-in only." 480 msgstr "" 481 482 #: dist/js/frontend/booking-form.js:1 483 msgid "Select check-in" 484 msgstr "" 485 486 #: dist/js/frontend/booking-form.js:1 487 msgid "Selected! Re-select to change your check-in date." 488 msgstr "" 489 490 #: dist/js/frontend/booking-form.js:1 491 msgid "Select check-out" 492 msgstr "" -
woocommerce-accommodation-bookings/trunk/readme.txt
r2879445 r2911748 4 4 Requires at least: 5.6 5 5 Tested up to: 6.1 6 Stable tag: 1.1. 396 Stable tag: 1.1.40 7 7 License: GNU General Public License v3.0 8 8 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 36 36 37 37 == Changelog == 38 39 = 1.1.40 - 2023-05-12 = 40 * Dev - Added a new filter, `woocommerce_accommodation_booking_get_check_times`, to change the check-in/out timings per product. 41 * Fix - Fully booked days show as partially booked - Day after booking shows partially booked. 38 42 39 43 = 1.1.39 - 2023-03-14 = -
woocommerce-accommodation-bookings/trunk/woocommerce-accommodation-bookings.php
r2879445 r2911748 4 4 * Plugin URI: https://woocommerce.com/products/woocommerce-accommodation-bookings/ 5 5 * Description: An accommodations add-on for the WooCommerce Bookings extension. 6 * Version: 1.1. 396 * Version: 1.1.40 7 7 * Author: WooCommerce 8 8 * Author URI: https://woocommerce.com … … 24 24 } 25 25 26 define( 'WC_ACCOMMODATION_BOOKINGS_VERSION', '1.1. 39' ); // WRCS: DEFINED_VERSION.26 define( 'WC_ACCOMMODATION_BOOKINGS_VERSION', '1.1.40' ); // WRCS: DEFINED_VERSION. 27 27 28 28 require_once( 'includes/class-wc-accommodation-bookings-plugin.php' );
Note: See TracChangeset
for help on using the changeset viewer.