Browse Source

** Booking Activities 1.7.3 **

* **Breaking change** - Optimization - "Expired" and "Removed" bookings will be permanently deleted 10 days after their expiration date
* Tweak - Add {user_phone} tag to display the user phone number in notifications
* Tweak - Change the error message for non logged in users trying to book a restricted event
* Fix - Events spreading over two loading intervals were not displayed (calendar editor, booked events, grouped events)
* Fix - Unselecting an occurence of a repeated event in calendar editor was unselecting all occurences
* Fix - Don't display bookings made on events belonging to a deleted calendars
* Fix - Incorrect custom actions buttons labels (cancel and refund) for booking groups
* Fix - 0 should be plural
develop 1.7.3
Yoan Cutillas 3 years ago
parent
commit
71d4d31786
  1. 20
      booking-activities.php
  2. 29
      controller/controller-forms.php
  3. 17
      controller/controller-settings.php
  4. 10
      controller/controller-templates.php
  5. 34
      controller/controller-woocommerce-bookings.php
  6. 14
      controller/controller-woocommerce-frontend.php
  7. 9
      css/backend.css
  8. 2
      css/backend.min.css
  9. 2
      css/forms.css
  10. 2
      css/forms.min.css
  11. 2
      css/global.css
  12. 2
      css/global.min.css
  13. 4
      css/templates.css
  14. 2
      css/templates.min.css
  15. 1
      css/woocommerce.css
  16. 2
      css/woocommerce.min.css
  17. 63
      functions/functions-booking-system.php
  18. 24
      functions/functions-bookings.php
  19. 3
      functions/functions-forms.php
  20. 24
      functions/functions-global.php
  21. 3
      functions/functions-notifications.php
  22. 15
      functions/functions-settings.php
  23. 30
      functions/functions-templates.php
  24. 67
      functions/functions-woocommerce.php
  25. 4
      js/booking-method-calendar.js
  26. 2
      js/booking-method-calendar.min.js
  27. 20
      js/booking-system-dialogs.js
  28. 2
      js/booking-system-dialogs.min.js
  29. 47
      js/booking-system-functions.js
  30. 2
      js/booking-system-functions.min.js
  31. 3
      js/form-editor-dialogs.js
  32. 2
      js/form-editor-dialogs.min.js
  33. 6
      js/forms.js
  34. 2
      js/forms.min.js
  35. 33
      js/templates-dialogs.js
  36. 2
      js/templates-dialogs.min.js
  37. 16
      js/templates-functions.js
  38. 2
      js/templates-functions.min.js
  39. 6
      js/templates.js
  40. 2
      js/templates.min.js
  41. 4
      js/woocommerce-frontend.js
  42. 2
      js/woocommerce-frontend.min.js
  43. 1167
      languages/booking-activities.pot
  44. 8
      model/model-booking-system.php
  45. 4
      model/model-bookings.php
  46. 99
      model/model-templates.php
  47. 176
      model/model-woocommerce.php
  48. 18
      readme.txt
  49. 2
      view/view-landing.php
  50. 11
      view/view-templates-dialogs.php

20
booking-activities.php

@ -3,7 +3,7 @@
* Plugin Name: Booking Activities
* Plugin URI: https://booking-activities.fr/en/?utm_source=plugin&utm_medium=plugin&utm_content=header
* Description: Booking system specialized in activities (sports, cultural, leisure, events...). Works great with WooCommerce.
* Version: 1.7.2
* Version: 1.7.3
* Author: Booking Activities Team
* Author URI: https://booking-activities.fr/en/?utm_source=plugin&utm_medium=plugin&utm_content=header
* Text Domain: booking-activities
@ -40,7 +40,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
// GLOBALS AND CONSTANTS
if( ! defined( 'BOOKACTI_VERSION' ) ) { define( 'BOOKACTI_VERSION', '1.7.2' ); }
if( ! defined( 'BOOKACTI_VERSION' ) ) { define( 'BOOKACTI_VERSION', '1.7.3' ); }
if( ! defined( 'BOOKACTI_PLUGIN_NAME' ) ) { define( 'BOOKACTI_PLUGIN_NAME', 'booking-activities' ); }
@ -66,7 +66,7 @@ add_action( 'plugins_loaded', 'bookacti_load_textdomain' );
// INCLUDE PHP FUNCTIONS
include_once( 'functions/functions-global.php' );
include_once( 'functions/functions-booking-system.php' );
include_once( 'functions/functions-template.php' );
include_once( 'functions/functions-templates.php' );
include_once( 'functions/functions-templates-forms-control.php' );
include_once( 'functions/functions-bookings.php' );
include_once( 'functions/functions-forms.php' );
@ -155,7 +155,7 @@ add_action( 'wp_enqueue_scripts', 'bookacti_enqueue_high_priority_global_scripts
/**
* Enqueue normal priority scripts
* @version 1.7.0
* @version 1.7.3
* @global array $bookacti_translation_array
*/
function bookacti_enqueue_global_scripts() {
@ -164,7 +164,7 @@ function bookacti_enqueue_global_scripts() {
// Include WooCommerce style and scripts
if( bookacti_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
if( ! is_admin() || bookacti_is_wc_edit_product_screen() ) {
if( ! is_admin() || bookacti_is_wc_screen( array( 'product', 'shop_order' ) ) ) {
wp_enqueue_style ( 'bookacti-css-woocommerce', plugins_url( 'css/woocommerce.min.css', __FILE__ ), array(), BOOKACTI_VERSION );
}
if( ! is_admin() ) {
@ -241,7 +241,7 @@ add_action( 'admin_enqueue_scripts','bookacti_enqueue_high_priority_backend_scri
/**
* Enqueue low priority scripts in backend only
* @version 1.7.0
* @version 1.7.3
* @global array $bookacti_translation_array
*/
function bookacti_enqueue_backend_scripts() {
@ -250,7 +250,7 @@ function bookacti_enqueue_backend_scripts() {
// Include WooCommerce scripts
if( bookacti_is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
if( bookacti_is_wc_edit_product_screen() ) {
if( bookacti_is_wc_screen( array( 'product' ) ) ) {
wp_register_script( 'bookacti-js-woocommerce-backend', plugins_url( 'js/woocommerce-backend.min.js', __FILE__ ), array( 'jquery' ), BOOKACTI_VERSION, true );
wp_localize_script( 'bookacti-js-woocommerce-backend', 'bookacti_localized', $bookacti_translation_array );
wp_enqueue_script ( 'bookacti-js-woocommerce-backend' );
@ -356,13 +356,9 @@ register_deactivation_hook( __FILE__, 'bookacti_deactivate' );
/**
* Uninstall Booking Activities
* @version 1.7.1
* @version 1.7.3
*/
function bookacti_uninstall() {
// Deregister the cron events
wp_clear_scheduled_hook( 'bookacti_hourly_event' );
wp_clear_scheduled_hook( 'bookacti_daily_event' );
// Delete notices acknowledgement
bookacti_reset_notices();

29
controller/controller-forms.php

@ -42,7 +42,7 @@ add_action( 'bookacti_display_form_field_calendar', 'bookacti_display_form_field
/**
* Display the form field 'login'
* @since 1.5.0
* @version 1.7.0
* @version 1.7.3
* @param string $html
* @param array $field
* @param string $instance_id
@ -97,7 +97,10 @@ function bookacti_display_form_field_login( $html, $field, $instance_id, $contex
</label>
</div>
<?php
} ?>
}
do_action( 'bookacti_login_field_after_login_type', $field, $instance_id, $context );
?>
</div>
<?php
}
@ -130,6 +133,7 @@ function bookacti_display_form_field_login( $html, $field, $instance_id, $contex
bookacti_display_field( $args );
?>
</div>
<?php do_action( 'bookacti_login_field_after_email', $field, $instance_id, $context ); ?>
</div>
<div class='bookacti-form-field-login-field-container bookacti-login-field-password <?php if( ! empty( $field[ 'generate_password' ] ) ) { echo 'bookacti-generated-password '; } if( ! $field[ 'required_fields' ][ 'password' ] ) { echo 'bookacti-password-not-required'; } ?>' id='<?php echo $field_id; ?>-password-container' >
<div class='bookacti-form-field-label' >
@ -200,6 +204,7 @@ function bookacti_display_form_field_login( $html, $field, $instance_id, $contex
}
?>
</div>
<?php do_action( 'bookacti_login_field_after_password', $field, $instance_id, $context ); ?>
</div>
</div>
<?php
@ -244,6 +249,7 @@ function bookacti_display_form_field_login( $html, $field, $instance_id, $contex
bookacti_display_field( $args );
?>
</div>
<?php do_action( 'bookacti_register_field_after_' . $register_field_name, $register_field, $field, $instance_id, $context ); ?>
</div>
<?php
}
@ -265,7 +271,7 @@ add_filter( 'bookacti_html_form_field_login', 'bookacti_display_form_field_login
/**
* Display the form field "Login / Registration" when the user is already logged in
* @since 1.5.0
* @version 1.5.4
* @version 1.7.3
* @param string $html
* @param array $field
* @param string $instance_id
@ -290,14 +296,15 @@ function bookacti_display_form_field_login_when_logged_in( $html, $field, $insta
?>
<div class='<?php echo $field_class; ?> bookacti-user-is-logged-in' id='<?php echo $field_id; ?>' >
<div class='bookacti-form-field-login-field-container bookacti-login-field-log-out' id='<?php echo $field_id; ?>-email-container' >
<div class='bookacti-logout-form-field-container'>
<span>
<?php echo sprintf( esc_html__( 'You are not %s?', BOOKACTI_PLUGIN_NAME ), $user->display_name . ' (' . $user->user_email . ')' ); ?>
</span>
<a href='<?php echo wp_logout_url( get_permalink() ); ?>' class='bookacti-logout-link'>
<?php esc_html_e( 'Click here to log out.', BOOKACTI_PLUGIN_NAME ); ?>
</a>
</div>
<div class='bookacti-logout-form-field-container'>
<span>
<?php echo sprintf( esc_html__( 'You are not %s?', BOOKACTI_PLUGIN_NAME ), $user->display_name . ' (' . $user->user_email . ')' ); ?>
</span>
<a href='<?php echo wp_logout_url( get_permalink() ); ?>' class='bookacti-logout-link'>
<?php esc_html_e( 'Click here to log out.', BOOKACTI_PLUGIN_NAME ); ?>
</a>
</div>
<?php do_action( 'bookacti_login_field_after_log_out', $field, $instance_id, $context ); ?>
</div>
</div>
<?php

17
controller/controller-settings.php

@ -100,7 +100,7 @@ function bookacti_init_settings() {
add_settings_field(
'default_calendar_view_threshold',
esc_html__( 'Responsive calendar view threshold', BOOKACTI_PLUGIN_NAME ),
esc_html__( 'Load the "Day" view if the calendar width is less than', BOOKACTI_PLUGIN_NAME ),
'bookacti_settings_field_default_calendar_view_threshold_callback',
'bookacti_general_settings',
'bookacti_settings_section_general'
@ -810,17 +810,17 @@ add_filter( 'plugin_action_links_' . BOOKACTI_PLUGIN_NAME . '/' . BOOKACTI_PLUGI
/**
* Add meta links in plugins list
*
* Add meta links in plugins table
* @version 1.7.3
* @param array $links
* @param string $file
* @return string
* @return array
*/
function bookacti_meta_links_in_plugins_table( $links, $file ) {
if ( $file == BOOKACTI_PLUGIN_NAME . '/' . BOOKACTI_PLUGIN_NAME . '.php' ) {
$links[ 'docs' ] = '<a href="' . esc_url( apply_filters( 'bookacti_user_docs_url', 'https://booking-activities.fr/en/documentation/user-documentation/?utm_source=plugin&utm_medium=plugin&utm_content=plugin-list' ) ) . '" title="' . esc_attr( __( 'View Booking Activities Documentation', BOOKACTI_PLUGIN_NAME ) ) . '" target="_blank" >' . esc_html__( 'Docs', BOOKACTI_PLUGIN_NAME ) . '</a>';
$links[ 'report' ] = '<a href="' . esc_url( apply_filters( 'bookacti_report_url', 'https://github.com/bookingactivities/booking-activities/issues/' ) ) . '" title="' . esc_attr( __( 'Report a bug or request a feature', BOOKACTI_PLUGIN_NAME ) ) . '" target="_blank" >' . esc_html__( 'Report & Request', BOOKACTI_PLUGIN_NAME ) . '</a>';
$links[ 'contact' ] = '<a href="' . esc_url( apply_filters( 'bookacti_contact_url', 'https://booking-activities.fr/en/#contact?utm_source=plugin&utm_medium=plugin&utm_content=plugin-list' ) ) . '" title="' . esc_attr( __( 'Contact us directly', BOOKACTI_PLUGIN_NAME ) ) . '" target="_blank" >' . esc_html__( 'Contact us', BOOKACTI_PLUGIN_NAME ) . '</a>';
$links[ 'docs' ] = '<a href="' . esc_url( 'https://booking-activities.fr/en/documentation/user-documentation/?utm_source=plugin&utm_medium=plugin&utm_content=plugin-list' ) . '" title="' . esc_attr( __( 'View Booking Activities Documentation', BOOKACTI_PLUGIN_NAME ) ) . '" target="_blank" >' . esc_html__( 'Docs', BOOKACTI_PLUGIN_NAME ) . '</a>';
$links[ 'report' ] = '<a href="' . esc_url( 'https://github.com/bookingactivities/booking-activities/issues/' ) . '" title="' . esc_attr( __( 'Report a bug or request a feature', BOOKACTI_PLUGIN_NAME ) ) . '" target="_blank" >' . esc_html__( 'Report & Request', BOOKACTI_PLUGIN_NAME ) . '</a>';
$links[ 'contact' ] = '<a href="' . esc_url( 'https://booking-activities.fr/en/?utm_source=plugin&utm_medium=plugin&utm_content=plugin-list#contact' ) . '" title="' . esc_attr( __( 'Contact us directly', BOOKACTI_PLUGIN_NAME ) ) . '" target="_blank" >' . esc_html__( 'Contact us', BOOKACTI_PLUGIN_NAME ) . '</a>';
}
return $links;
}
@ -833,9 +833,10 @@ add_filter( 'plugin_row_meta', 'bookacti_meta_links_in_plugins_table', 10, 2 );
/**
* Ask to rate the plugin 5 stars
* @version 1.5.7
* @version 1.7.3
*/
function bookacti_5stars_rating_notice() {
if( ! bookacti_is_booking_activities_screen() ) { return; }
$dismissed = get_option( 'bookacti-5stars-rating-notice-dismissed' );
if( ! $dismissed ) {
if( current_user_can( 'bookacti_manage_booking_activities' ) ) {

10
controller/controller-templates.php

@ -759,8 +759,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* AJAX Controller - Update template
*
* @version 1.4.0
* @version 1.7.3
*/
function bookacti_controller_update_template() {
@ -797,7 +796,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
}
if( $updated_template > 0 || intval( $updated_managers ) > 0 || intval( $updated_metadata ) > 0 ) {
$templates_data = bookacti_fetch_templates( $template_id, true );
$templates_data = bookacti_get_templates_data( $template_id, true );
wp_send_json( array( 'status' => 'success', 'template_data' => $templates_data[ $template_id ] ) );
} else if( $updated_template === 0 && ! $updated_managers && ! $updated_metadata ) {
wp_send_json( array( 'status' => 'nochanges' ) );
@ -844,8 +843,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* AJAX Controller - Change default template
*
* @version 1.4.0
* @version 1.7.3
*/
function bookacti_controller_switch_template() {
@ -867,7 +865,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
$groups_data = bookacti_get_groups_of_events( $template_id, array(), true );
$categories_data = bookacti_get_group_categories( $template_id );
$exceptions = bookacti_get_exceptions( $template_id );
$templates_data = bookacti_fetch_templates( $template_id, true );
$templates_data = bookacti_get_templates_data( $template_id, true );
$events_interval = bookacti_get_new_interval_of_events( $templates_data[ $template_id ], array(), false, true );
$events = $events_interval ? bookacti_fetch_events_for_calendar_editor( $template_id, null, $events_interval ) : array();

34
controller/controller-woocommerce-bookings.php

@ -8,11 +8,15 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Register an hourly event to clean expired bookings
* @since 1.7.1 (was bookacti_register_houly_clean_expired_bookings)
* @version 1.7.3
*/
function bookacti_register_cron_event_to_clean_expired_bookings() {
if( ! wp_next_scheduled ( 'bookacti_hourly_event' ) ) {
wp_schedule_event( time(), 'hourly', 'bookacti_hourly_event' );
}
if( ! wp_next_scheduled ( 'bookacti_delete_expired_bookings' ) ) {
wp_schedule_event( time(), 'daily', 'bookacti_delete_expired_bookings' );
}
}
add_action( 'woocommerce_installed', 'bookacti_register_cron_event_to_clean_expired_bookings' );
add_action( 'bookacti_activate', 'bookacti_register_cron_event_to_clean_expired_bookings' );
@ -21,10 +25,11 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Deregister the hourly event to clean expired bookings when WooCommerce is uninstalled (to be called on wp_roles_init)
* @since 1.7.1 (was bookacti_clear_houly_clean_expired_bookings_on_woocommerce_uninstall)
* @version 1.7.3
*/
function bookacti_clear_cron_event_to_clean_expired_bookings_on_woocommerce_uninstall() {
if( defined( 'WP_UNINSTALL_PLUGIN' ) && WP_UNINSTALL_PLUGIN === 'woocommerce/woocommerce.php' ) {
bookacti_cancel_in_cart_bookings();
bookacti_turn_in_cart_bookings_to_removed();
bookacti_clear_cron_event_to_clean_expired_bookings();
}
}
@ -34,11 +39,14 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Deregister the hourly event to clean expired bookings
* @since 1.7.1 (was bookacti_clear_houly_clean_expired_bookings)
* @version 1.7.3
*/
function bookacti_clear_cron_event_to_clean_expired_bookings() {
wp_clear_scheduled_hook( 'bookacti_hourly_event' );
wp_clear_scheduled_hook( 'bookacti_delete_expired_bookings' );
}
add_action( 'bookacti_deactivate', 'bookacti_clear_cron_event_to_clean_expired_bookings' );
add_action( 'bookacti_uninstall', 'bookacti_clear_cron_event_to_clean_expired_bookings' );
/**
@ -95,10 +103,9 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Deactivate expired bookings with cron (to be called with wp_schedule_event())
*
* @since 1.0.6
* @version 1.1.0
* Deactivate expired bookings with cron
* @since 1.0.6
* @version 1.1.0
*/
function bookacti_controller_deactivate_expired_bookings() {
@ -113,6 +120,23 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
add_action( 'bookacti_hourly_event', 'bookacti_controller_deactivate_expired_bookings' );
/**
* Delete expired bookings with cron
* @since 1.7.3
*/
function bookacti_controller_delete_expired_bookings() {
$delay = apply_filters( 'bookacti_delay_before_deleting_expired_bookings', 10 );
$deleted_ids = bookacti_delete_expired_bookings( $delay );
if( $deleted_ids === false ) {
/* translators: 'cron' is a robot that execute scripts every X days. Don't try to translate it. */
$log = esc_html__( 'The expired bookings were not correctly deleted by cron.', BOOKACTI_PLUGIN_NAME );
bookacti_log( $log, 'error' );
}
}
add_action( 'bookacti_delete_expired_bookings', 'bookacti_controller_delete_expired_bookings' );
/**
* Change booking state to 'removed' or 'in_cart' depending on its quantity
*

14
controller/controller-woocommerce-frontend.php

@ -357,7 +357,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Add cart item data (all sent in one array)
*
* @version 1.5.4
* @version 1.7.3
* @param array $cart_item_data
* @param int $product_id
* @param int $variation_id
@ -366,24 +366,24 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
function bookacti_add_item_data( $cart_item_data, $product_id, $variation_id ) {
if( ! isset( $_POST[ 'bookacti_booking_id' ] ) && ! isset( $_POST[ 'bookacti_booking_group_id' ] ) ) { return $cart_item_data; }
$new_value = array();
if( ! isset( $cart_item_data[ '_bookacti_options' ] ) ) { $cart_item_data[ '_bookacti_options' ] = array(); }
// Single event
if( isset( $_POST[ 'bookacti_booking_id' ] ) ) {
$booking_id = intval( $_POST[ 'bookacti_booking_id' ] );
$event = bookacti_get_booking_event_data( $booking_id );
$new_value[ '_bookacti_options' ][ 'bookacti_booking_id' ] = $booking_id;
$new_value[ '_bookacti_options' ][ 'bookacti_booked_events' ] = json_encode( array( $event ) );
$cart_item_data[ '_bookacti_options' ][ 'bookacti_booking_id' ] = $booking_id;
$cart_item_data[ '_bookacti_options' ][ 'bookacti_booked_events' ] = json_encode( array( $event ) );
// Group of events
} else {
$booking_group_id = intval( $_POST[ 'bookacti_booking_group_id' ] );
$events = bookacti_get_booking_group_events_data( $booking_group_id );
$new_value[ '_bookacti_options' ][ 'bookacti_booking_group_id' ]= $booking_group_id;
$new_value[ '_bookacti_options' ][ 'bookacti_booked_events' ] = json_encode( $events );
$cart_item_data[ '_bookacti_options' ][ 'bookacti_booking_group_id' ]= $booking_group_id;
$cart_item_data[ '_bookacti_options' ][ 'bookacti_booked_events' ] = json_encode( $events );
}
return array_merge( $cart_item_data, $new_value );
return $cart_item_data;
}
add_filter( 'woocommerce_add_cart_item_data', 'bookacti_add_item_data', 10, 3 );

9
css/backend.css

@ -103,7 +103,7 @@
.bookacti-message-setting { margin-bottom: 20px; }
.bookacti-message-setting input { margin-top: 6px; }
.bookacti_checkbox { display: inline-block; margin-right: 20px; min-width: 100px; max-width: 100px; box-sizing: border-box; overflow: hidden; white-space: nowrap; }
.bookacti_checkbox { display: inline-block; margin-right: 20px; line-height: 1.5em; min-width: 100px; max-width: 100px; box-sizing: border-box; overflow: hidden; white-space: nowrap; }
#bookacti_refund_actions .bookacti_checkbox { max-width: none; overflow: visible; }
/** DIALOGS **/
@ -141,10 +141,11 @@
.bookacti-backend-dialog .bookacti_export_button { display: table-cell; vertical-align: middle; padding-left: 10px; }
.bookacti-backend-dialog .bookacti_export_url_field input:not([type='submit']):not([type='checkbox']):not([type='file']):not([type='radio']):not([type='button']):not([type='time']):not([type='number']):not([type='color']):not(.button) { padding: 10px; max-width: none; width: 100%; }
.bookacti-backend-dialog div > label:not(.bookacti-onoffswitch-label) { display: inline-block; width: 150px; font-weight: bold; }
.bookacti-backend-dialog div > label.bookacti-fullwidth-label { display: block; width: 100%; cursor: auto; }
.bookacti-backend-dialog div > input:not([type="hidden"]) + label:not(.bookacti-onoffswitch-label) { display: inline; width: auto; font-weight: normal; }
/* Tabs */
.bookacti-tabs .bookacti-tab-content div > label:not(.bookacti-onoffswitch-label) { display: inline-block; width: 150px; font-weight: bold; }
.bookacti-tabs .bookacti-tab-content div > label.bookacti-fullwidth-label { display: block; width: 100%; cursor: auto; }
.bookacti-tabs .bookacti-tab-content div > input:not([type="hidden"]) + label:not(.bookacti-onoffswitch-label) { display: inline; width: auto; font-weight: normal; }
.bookacti-tabs .bookacti-tab-content > div { margin-bottom: 10px; }
.bookacti-tabs .bookacti-tab-content > div:last-child { margin-bottom: 0; }
.bookacti-tabs .bookacti-tab-content .bookacti-display-inline-block { display: inline-block; }

2
css/backend.min.css vendored

File diff suppressed because one or more lines are too long

2
css/forms.css

@ -62,7 +62,7 @@ body.booking-activities_page_bookacti_forms label[for='bookacti_form_publish-hid
.bookacti-form-dialog form div > fieldset > label:not(.bookacti-onoffswitch-label) { width: 130px; }
.bookacti-form-dialog form div > input[type='checkbox'] + label,
.bookacti-form-dialog form div > fieldset > input[type='checkbox'] + label,
.bookacti-form-dialog form div > label.bookacti-fullwidth-label { width: auto; max-width: none; }
.bookacti-form-dialog form div > label.bookacti-fullwidth-label { display: block; width: auto; max-width: none; }
.bookacti-form-dialog form fieldset > div,
.bookacti-form-dialog form > div { margin-bottom: 10px; }
.bookacti-form-dialog form fieldset > div:last-child,

2
css/forms.min.css vendored

File diff suppressed because one or more lines are too long

2
css/global.css

@ -134,7 +134,7 @@
position: absolute;
bottom: 0;
right: -2px;
z-index: 2;
z-index: 5;
overflow: hidden;
}
.bookacti-availability-container .bookacti-available-places {

2
css/global.min.css vendored

File diff suppressed because one or more lines are too long

4
css/templates.css

@ -63,10 +63,10 @@
#bookacti-update-template { display: table-cell; vertical-align: middle; padding-left: 10px; cursor: pointer; }
.activity-row { width: 100%; height: 24px; }
.activity-container { display: table-cell; width: 100%; vertical-align: middle; overflow: hidden; }
.activity-container { display: table-cell; width: 100%; max-width: 120px; vertical-align: middle; overflow: hidden; }
.activity-show-hide { display: table-cell; vertical-align: middle; padding-right: 10px; cursor: pointer; }
.activity-gear { display: table-cell; vertical-align: middle; padding-left: 10px; cursor: pointer; }
#bookacti-template-activities-container .fc-event { cursor: move; max-height: 16px; padding-left: 5px; width: 100%; overflow: hidden; }
#bookacti-template-activities-container .fc-event { cursor: move; max-height: 16px; padding: 0 5px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bookacti-template-activities-container,
#bookacti-template-groups-of-events-container { padding-right: 6px; }

2
css/templates.min.css vendored

File diff suppressed because one or more lines are too long

1
css/woocommerce.css

@ -22,6 +22,7 @@ table.woocommerce_order_items ul.bookacti-booking-events-list { margin: 0; }
.bookacti-deprecated-hidden { display: none; }
.woocommerce_options_panel .bookacti-wc-deprecated-note p.form-field { padding-left: 12px !important; }
.woocommerce_order_items .display_meta .bookacti-booking-events-list { margin: 0; }
/***** FRONTEND WOOCOMMERCE *****/

2
css/woocommerce.min.css vendored

@ -1 +1 @@
#woocommerce-product-data .bookacti-loading-alt{display:inline-block;margin:10px;max-width:120px}#woocommerce-product-data ul.product_data_tabs li.activity_tab a::before{font-family:dashicons;content:'\f508'}.bookacti-woo-title{padding:1em 0 .5em 0}p.form-field._bookacti_groups_field{margin-bottom:0}.bookacti-groups-options{margin-top:0}.bookacti-groups-options label,.form-row.bookacti-groups-options label{float:none;width:auto;margin:0 0 0 7px;font-size:12px}.bookacti-groups-options>span,.form-row.bookacti-groups-options>span{display:block;clear:both}.bookacti-groups-options>span>*,.form-row.bookacti-groups-options>span>*{display:table-cell;padding-right:8px}.bookacti-groups-options .woocommerce-help-tip,.form-row.bookacti-groups-options .woocommerce-help-tip{float:none}.woocommerce_options_panel .bookacti-multiple-select-container{white-space:nowrap;display:inline-block}.woocommerce_options_panel .bookacti-multiple-select-container label{float:none;width:auto;margin:0;display:inline-block}table.woocommerce_order_items ul.bookacti-booking-events-list{margin:0}.bookacti-deprecated-hidden{display:none}.woocommerce_options_panel .bookacti-wc-deprecated-note p.form-field{padding-left:12px!important}.woocommerce div.product form.cart table td.fc-axis{padding-left:4px}.bookacti-order-item-activity td.product-name .wc-item-meta .wc-item-meta-bookacti_booked_events,.bookacti-cart-item-activity td.product-name dl.variation dt{float:none}.woocommerce a.button.bookacti-booking-group-action,.woocommerce a.button.bookacti-booking-action{margin:5px}
#woocommerce-product-data .bookacti-loading-alt{display:inline-block;margin:10px;max-width:120px}#woocommerce-product-data ul.product_data_tabs li.activity_tab a::before{font-family:dashicons;content:'\f508'}.bookacti-woo-title{padding:1em 0 .5em 0}p.form-field._bookacti_groups_field{margin-bottom:0}.bookacti-groups-options{margin-top:0}.bookacti-groups-options label,.form-row.bookacti-groups-options label{float:none;width:auto;margin:0 0 0 7px;font-size:12px}.bookacti-groups-options>span,.form-row.bookacti-groups-options>span{display:block;clear:both}.bookacti-groups-options>span>*,.form-row.bookacti-groups-options>span>*{display:table-cell;padding-right:8px}.bookacti-groups-options .woocommerce-help-tip,.form-row.bookacti-groups-options .woocommerce-help-tip{float:none}.woocommerce_options_panel .bookacti-multiple-select-container{white-space:nowrap;display:inline-block}.woocommerce_options_panel .bookacti-multiple-select-container label{float:none;width:auto;margin:0;display:inline-block}table.woocommerce_order_items ul.bookacti-booking-events-list{margin:0}.bookacti-deprecated-hidden{display:none}.woocommerce_options_panel .bookacti-wc-deprecated-note p.form-field{padding-left:12px!important}.woocommerce_order_items .display_meta .bookacti-booking-events-list{margin:0}.woocommerce div.product form.cart table td.fc-axis{padding-left:4px}.bookacti-order-item-activity td.product-name .wc-item-meta .wc-item-meta-bookacti_booked_events,.bookacti-cart-item-activity td.product-name dl.variation dt{float:none}.woocommerce a.button.bookacti-booking-group-action,.woocommerce a.button.bookacti-booking-action{margin:5px}

63
functions/functions-booking-system.php

@ -290,7 +290,7 @@ function bookacti_get_booking_system_default_attributes() {
/**
* Check booking system attributes and format them to be correct
* @version 1.7.0
* @version 1.7.3
* @param array $atts
* @return type
*/
@ -351,22 +351,18 @@ function bookacti_format_booking_system_attributes( $atts = array() ) {
$atts[ 'calendars' ] = array_unique( $atts[ 'calendars' ] );
$atts[ 'activities' ] = array_unique( $atts[ 'activities' ] );
// Check if desired templates exist
// Check if the desired templates are active and allowed
$available_template_ids = array_keys( bookacti_fetch_templates( array(), true ) );
foreach( $atts[ 'calendars' ] as $i => $template_id ) {
$is_existing = false;
foreach( $available_template_ids as $available_template_id ) {
if( $available_template_id == intval( $template_id ) ) {
$is_existing = true;
break;
}
}
if( ! $is_existing ) {
unset( $atts[ 'calendars' ][ $i ] );
if( empty( $atts[ 'calendars' ] ) ) {
$bypass_template_managers_check = apply_filters( 'bookacti_bypass_template_managers_check', false );
if( ! $bypass_template_managers_check && ! is_super_admin() ) {
$atts[ 'calendars' ] = $available_template_ids;
}
} else {
$atts[ 'calendars' ] = array_intersect( $atts[ 'calendars' ], $available_template_ids );
}
// Check if desired activities exist and are allowed according to current user role
// Check if desired activities are active and allowed according to current user role
$available_activity_ids = bookacti_get_activity_ids_by_template( $atts[ 'calendars' ], false, $atts[ 'check_roles' ] );
foreach( $atts[ 'activities' ] as $i => $activity_id ) {
if( ! in_array( intval( $activity_id ), $available_activity_ids, true ) ) {
@ -805,7 +801,7 @@ function bookacti_get_booking_system_fields_default_data( $fields = array() ) {
/**
* Check the selected event / group of events data before booking
* @version 1.6.0
* @version 1.7.3
* @param int $group_id
* @param int $event_id
* @param string $event_start Start datetime of the event to check (format 2017-12-31T23:59:59)
@ -962,59 +958,64 @@ function bookacti_validate_booking_form( $group_id, $event_id, $event_start, $ev
$validated['status'] = 'failed';
if( ! $is_event ) {
$validated['error'] = 'no_event_selected';
$validated['message'] = __( 'You haven\'t picked any event. Please pick an event first.', BOOKACTI_PLUGIN_NAME );
$validated['message'] = esc_html__( 'You haven\'t picked any event. Please pick an event first.', BOOKACTI_PLUGIN_NAME );
} else if( ! $is_qty_sup_to_0 ) {
$validated['error'] = 'qty_inf_to_0';
$validated['message'] = __( 'The amount of desired bookings is less than or equal to 0. Please increase the quantity.', BOOKACTI_PLUGIN_NAME );
$validated['message'] = esc_html__( 'The amount of desired bookings is less than or equal to 0. Please increase the quantity.', BOOKACTI_PLUGIN_NAME );
} else if( ! $is_qty_sup_to_min ) {
$validated['error'] = 'qty_inf_to_min';
/* translators: %1$s is a variable number of bookings, %2$s is the event title. This sentence is followed by two others : 'but the minimum number of reservations required per user is %1$s.' and 'Please choose another event or increase the quantity.' */
$validated['message'] = sprintf( _n( 'You want to make %1$s booking of "%2$s"', 'You want to make %1$s bookings of "%2$s"', $quantity, BOOKACTI_PLUGIN_NAME ), $quantity, $title );
$validated['message'] = sprintf( esc_html( _n( 'You want to make %1$s booking of "%2$s"', 'You want to make %1$s bookings of "%2$s"', $quantity, BOOKACTI_PLUGIN_NAME ) ), $quantity, $title );
if( $quantity_already_booked ) {
/* translators: %1$s and %2$s are variable numbers of bookings, always >= 1. This sentence is preceded by : 'You want to make %1$s booking of "%2$s"' and followed by 'Please choose another event or increase the quantity.' */
$validated['message'] .= ' ' . sprintf( _n( 'and you have already booked %1$s place, but the minimum number of reservations required per user is %2$s.', 'and you have already booked %1$s places, but the minimum number of reservations required per user is %2$s.', $quantity_already_booked, BOOKACTI_PLUGIN_NAME ), $quantity_already_booked, $min_quantity );
$validated['message'] .= ' ' . sprintf( esc_html( _n( 'and you have already booked %1$s place, but the minimum number of reservations required per user is %2$s.', 'and you have already booked %1$s places, but the minimum number of reservations required per user is %2$s.', $quantity_already_booked, BOOKACTI_PLUGIN_NAME ) ), $quantity_already_booked, $min_quantity );
} else {
/* translators: %1$s is a variable number of bookings. This sentence is preceded by : 'You want to make %1$s booking of "%2$s"' and followed by 'Please choose another event or increase the quantity.' */
$validated['message'] .= ' ' . sprintf( __( 'but the minimum number of reservations required per user is %1$s.', BOOKACTI_PLUGIN_NAME ), $min_quantity );
$validated['message'] .= ' ' . sprintf( esc_html__( 'but the minimum number of reservations required per user is %1$s.', BOOKACTI_PLUGIN_NAME ), $min_quantity );
}
/* translators: %1$s is a variable quantity. This sentence is preceded by two others : 'You want to make %1$s booking of "%2$s"' and 'but the minimum number of reservations required per user is %1$s.' */
$validated['message'] .= $min_quantity - $quantity_already_booked > 0 ? ' ' . sprintf( __( 'Please choose another event or increase the quantity to %1$s.', BOOKACTI_PLUGIN_NAME ), $min_quantity - $quantity_already_booked ) : ' ' . __( 'Please choose another event', BOOKACTI_PLUGIN_NAME );
$validated['message'] .= $min_quantity - $quantity_already_booked > 0 ? ' ' . sprintf( esc_html__( 'Please choose another event or increase the quantity to %1$s.', BOOKACTI_PLUGIN_NAME ), $min_quantity - $quantity_already_booked ) : ' ' . esc_html__( 'Please choose another event', BOOKACTI_PLUGIN_NAME );
} else if( ! $is_qty_inf_to_max ) {
$validated['error'] = 'qty_sup_to_max';
/* translators: %1$s is a variable number of bookings, %2$s is the event title. This sentence is followed by two others : 'but the maximum number of reservations allowed per user is %1$s.' and 'Please choose another event or decrease the quantity.' */
$validated['message'] = sprintf( _n( 'You want to make %1$s booking of "%2$s"', 'You want to make %1$s bookings of "%2$s"', $quantity, BOOKACTI_PLUGIN_NAME ), $quantity, $title );
$validated['message'] = sprintf( esc_html( _n( 'You want to make %1$s booking of "%2$s"', 'You want to make %1$s bookings of "%2$s"', $quantity, BOOKACTI_PLUGIN_NAME ) ), $quantity, $title );
if( $quantity_already_booked ) {
/* translators: %1$s and %2$s are variable numbers of bookings, always >= 1. This sentence is preceded by : 'You want to make %1$s booking of "%2$s"' and followed by 'Please choose another event or decrease the quantity.' */
$validated['message'] .= ' ' . sprintf( _n( 'but you have already booked %1$s place and the maximum number of reservations allowed per user is %2$s.', 'but you have already booked %1$s places and the maximum number of reservations allowed per user is %2$s.', $quantity_already_booked, BOOKACTI_PLUGIN_NAME ), $quantity_already_booked, $max_quantity );
$validated['message'] .= ' ' . sprintf( esc_html( _n( 'but you have already booked %1$s place and the maximum number of reservations allowed per user is %2$s.', 'but you have already booked %1$s places and the maximum number of reservations allowed per user is %2$s.', $quantity_already_booked, BOOKACTI_PLUGIN_NAME ) ), $quantity_already_booked, $max_quantity );
} else {
/* translators: %1$s is a variable number of bookings. This sentence is preceded by : 'You want to make %1$s booking of "%2$s"' and followed by 'Please choose another event or decrease the quantity.' */
$validated['message'] .= ' ' . sprintf( __( 'but the maximum number of reservations allowed per user is %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity );
$validated['message'] .= ' ' . sprintf( esc_html__( 'but the maximum number of reservations allowed per user is %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity );
}
/* translators: %1$s is a variable quantity. This sentence is preceded by two others : 'You want to make %1$s booking of "%2$s"' and 'but the maximum number of reservations allowed per user is %1$s.' */
$validated['message'] .= $max_quantity - $quantity_already_booked > 0 ? ' ' . sprintf( __( 'Please choose another event or decrease the quantity to %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity - $quantity_already_booked ) : ' ' . __( 'Please choose another event', BOOKACTI_PLUGIN_NAME );
$validated['message'] .= $max_quantity - $quantity_already_booked > 0 ? ' ' . sprintf( esc_html__( 'Please choose another event or decrease the quantity to %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity - $quantity_already_booked ) : ' ' . esc_html__( 'Please choose another event', BOOKACTI_PLUGIN_NAME );
} else if( ! $is_users_inf_to_max ) {
$validated['error'] = 'users_sup_to_max';
$validated['message'] = __( 'This event has reached the maximum number of users allowed. Bookings from other users are no longer accepted. Please choose another event.', BOOKACTI_PLUGIN_NAME );
$validated['message'] = esc_html__( 'This event has reached the maximum number of users allowed. Bookings from other users are no longer accepted. Please choose another event.', BOOKACTI_PLUGIN_NAME );
} else if( $availability === 0 ) {
$validated['error'] = 'no_availability';
$validated['availability'] = $availability;
/* translators: %1$s is the event title. */
$validated['message'] = sprintf( __( 'The event "%1$s" is no longer available on this time slot. Please choose another event.', BOOKACTI_PLUGIN_NAME ), $title );
$validated['message'] = sprintf( esc_html__( 'The event "%1$s" is no longer available on this time slot. Please choose another event.', BOOKACTI_PLUGIN_NAME ), $title );
} else if( ! $is_qty_inf_to_avail ) {
$validated['error'] = 'qty_sup_to_avail';
$validated['availability'] = $availability;
$validated['message'] = /* translators: %1$s is a variable number of bookings, %2$s is the event title. This sentence is followed by two others : 'but only %1$s is available on this time slot.' and 'Please choose another event or decrease the quantity.' */
sprintf( _n( 'You want to make %1$s booking of "%2$s"', 'You want to make %1$s bookings of "%2$s"', $quantity, BOOKACTI_PLUGIN_NAME ), $quantity, $title )
sprintf( esc_html( _n( 'You want to make %1$s booking of "%2$s"', 'You want to make %1$s bookings of "%2$s"', $quantity, BOOKACTI_PLUGIN_NAME ) ), $quantity, $title )
/* translators: %1$s is a variable number of bookings. This sentence is preceded by : 'You want to make %1$s booking of "%2$s"' and followed by 'Please choose another event or decrease the quantity.' */
. ' ' . sprintf( _n( 'but only %1$s is available on this time slot.', 'but only %1$s are available on this time slot. ', $availability, BOOKACTI_PLUGIN_NAME ), $availability )
. ' ' . sprintf( esc_html( _n( 'but only %1$s is available on this time slot.', 'but only %1$s are available on this time slot. ', $availability, BOOKACTI_PLUGIN_NAME ) ), $availability )
/* translators: This sentence is preceded by two others : 'You want to make %1$s booking of "%2$s"' and 'but only %1$s is available on this time slot.' */
. ' ' . __( 'Please choose another event or decrease the quantity.', BOOKACTI_PLUGIN_NAME );
. ' ' . esc_html__( 'Please choose another event or decrease the quantity.', BOOKACTI_PLUGIN_NAME );
} else if( ! $has_allowed_roles ) {
$validated['error'] = 'role_not_allowed';
$validated['message'] = __( 'This event is not available in your user category. Please choose another event.', BOOKACTI_PLUGIN_NAME );
if( is_user_logged_in() ) {
$validated['message'] = esc_html__( 'This event is not available in your user category. Please choose another event.', BOOKACTI_PLUGIN_NAME );
} else {
$validated['message'] = esc_html__( 'This event is restricted to certain categories of users. Please log in first.', BOOKACTI_PLUGIN_NAME );
}
} else {
$validated['error'] = 'failed';
$validated['message'] = __( 'An error occurred, please try again.', BOOKACTI_PLUGIN_NAME );
$validated['message'] = esc_html__( 'An error occurred, please try again.', BOOKACTI_PLUGIN_NAME );
}
}

24
functions/functions-bookings.php

@ -7,12 +7,11 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Check if a booking is whithin the athorized delay as of now
* @since 1.1.0
* @version 1.7.0
* @version 1.7.3
* @param object|int $booking
* @return boolean
*/
function bookacti_is_booking_in_delay( $booking ) {
if( is_numeric( $booking ) ) {
$booking = bookacti_get_booking_by_id( $booking );
}
@ -47,10 +46,11 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
// Choose the most specific defined value
$delay = $delay_specific !== false ? $delay_specific : $delay_global;
$event_datetime = DateTime::createFromFormat( 'Y-m-d H:i:s', $booking->event_start );
$delay_datetime = $event_datetime->sub( new DateInterval( 'P' . $delay . 'D' ) );
$date_interval = apply_filters( 'bookacti_booking_changes_deadline_date_interval', 'P' . $delay . 'D', $booking, $delay );
$delay_datetime = DateTime::createFromFormat( 'Y-m-d H:i:s', $booking->event_start, new DateTimeZone( $timezone ) );
$delay_datetime->sub( new DateInterval( $date_interval ) );
$current_datetime = new DateTime( 'now', new DateTimeZone( $timezone ) );
if( $current_datetime < $delay_datetime ) { $is_in_delay = true; }
return apply_filters( 'bookacti_is_booking_in_delay', $is_in_delay, $booking );
@ -342,7 +342,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Check if a booking can be cancelled
* @version 1.6.0
* @version 1.7.3
* @param object|int $booking_id
* @return boolean
*/
@ -360,8 +360,9 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
$is_in_delay = apply_filters( 'bookacti_bypass_delay', false, $booking ) ? true : bookacti_is_booking_in_delay( $booking );
// Final check and return the actions array without invalid entries
if( ! $is_cancel_allowed || ! $booking->active || ! $is_in_delay || $is_grouped ) { $is_allowed = false; }
if( ! $is_cancel_allowed || $is_grouped || ! $is_in_delay ) { $is_allowed = false; }
}
if( ! $booking->active ) { $is_allowed = false; }
return apply_filters( 'bookacti_booking_can_be_cancelled', $is_allowed, $booking );
}
@ -531,7 +532,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Check if a booking group can be cancelled
* @since 1.1.0
* @version 1.6.0
* @version 1.7.3
* @param object $booking_group
* @return boolean
*/
@ -552,6 +553,8 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
}
}
}
if( ! $booking_group->active ) { $true = false; }
return apply_filters( 'bookacti_booking_group_can_be_cancelled', $true, $booking_group );
}
@ -765,6 +768,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Get booking group actions array
* @since 1.6.0 (replace bookacti_get_booking_group_actions_array)
* @version 1.7.3
* @param string $admin_or_front Can be "both", "admin", "front. Default "both".
* @return array
*/
@ -784,13 +788,13 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
'admin_or_front'=> 'admin' ),
'cancel' => array(
'class' => 'bookacti-cancel-booking-group',
'label' => esc_html__( 'Cancel', BOOKACTI_PLUGIN_NAME ),
'label' => bookacti_get_message( 'cancel_booking_open_dialog_button' ),
'description' => esc_html__( 'Cancel the booking group.', BOOKACTI_PLUGIN_NAME ),
'link' => '',
'admin_or_front'=> 'front' ),
'refund' => array(
'class' => 'bookacti-refund-booking-group',
'label' => esc_html_x( 'Refund', 'Button label to trigger the refund action', BOOKACTI_PLUGIN_NAME ),
'label' => $admin_or_front === 'both' || $admin_or_front === 'admin' ? esc_html_x( 'Refund', 'Button label to trigger the refund action', BOOKACTI_PLUGIN_NAME ) : bookacti_get_message( 'refund_dialog_button' ),
'description' => esc_html__( 'Refund the booking group with one of the available refund method.', BOOKACTI_PLUGIN_NAME ),
'link' => '',
'admin_or_front'=> 'both' ),

3
functions/functions-forms.php

@ -1498,6 +1498,7 @@ function bookacti_format_form_filters( $filters = array() ) {
/**
* Display 'managers' metabox content for forms
* @since 1.5.0
* @version 1.7.3
*/
function bookacti_display_form_managers_meta_box( $form ) {
@ -1520,7 +1521,7 @@ function bookacti_display_form_managers_meta_box( $form ) {
// Get available form managers option list
$in_roles = apply_filters( 'bookacti_managers_roles', array() );
$not_in_roles = apply_filters( 'bookacti_managers_roles_exceptions', array( 'administrator' ) );
$not_in_roles = apply_filters( 'bookacti_managers_roles_exceptions', is_multisite() ? array() : array( 'administrator' ) );
$user_query = new WP_User_Query( array( 'role__in' => $in_roles, 'role__not_in' => $not_in_roles ) );
$users = $user_query->get_results();
$available_managers_options_list = '';

24
functions/functions-global.php

@ -1140,10 +1140,12 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Convert an array to string recursively
* @since 1.6.0
* @version 1.7.3
* @param array $array
* @return array
* @param boolean $display_keys
* @return string
*/
function bookacti_format_array_for_export( $array ) {
function bookacti_format_array_for_export( $array, $display_keys = false ) {
if( ! is_array( $array ) ) { return $array; }
if( empty( $array ) ) { return ''; }
@ -1152,13 +1154,17 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
foreach( $array as $key => $value ) {
if( $i !== 0 ) { $string .= ';'; }
$value = bookacti_maybe_decode_json( maybe_unserialize( $value ) );
if( is_array( $value ) ) { $string_value = bookacti_format_array_for_export( $value ); }
else { $string_value = str_replace( array( '[', ']', ';' ), '', $value ); }
if( is_array( $value ) ) { $string_value = bookacti_format_array_for_export( $value, $display_keys ); }
else {
if( $display_keys ) { $value = $key . ': ' . $value; }
$string_value = str_replace( array( '[', ']', ';' ), '', $value );
}
$string .= $string_value;
++$i;
}
$string .= ']';
return $string;
return apply_filters( 'bookacti_format_array_for_export', $string, $array, $display_keys );
}
@ -1300,6 +1306,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Sanitize the values of an array
* @since 1.5.0
* @version 1.7.3
* @param array $default_data
* @param array $raw_data
* @param array $keys_by_type
@ -1308,7 +1315,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
*/
function bookacti_sanitize_values( $default_data, $raw_data, $keys_by_type, $sanitized_data = array() ) {
// Sanitize the keys-by-type array
$allowed_types = array( 'int', 'bool', 'str', 'str_id', 'array', 'datetime' );
$allowed_types = array( 'int', 'bool', 'str', 'str_id', 'str_html', 'array', 'datetime' );
foreach( $allowed_types as $allowed_type ) {
if( ! isset( $keys_by_type[ $allowed_type ] ) ) { $keys_by_type[ $allowed_type ] = array(); }
}
@ -1347,6 +1354,11 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
$sanitized_data[ $key ] = is_string( $raw_data[ $key ] ) ? sanitize_text_field( stripslashes( $raw_data[ $key ] ) ) : $default_value;
}
// Sanitize text with html
else if( in_array( $key, $keys_by_type[ 'str_html' ], true ) ) {
$sanitized_data[ $key ] = is_string( $raw_data[ $key ] ) ? wp_kses_post( stripslashes( $raw_data[ $key ] ) ) : $default_value;
}
// Sanitize array
else if( in_array( $key, $keys_by_type[ 'array' ], true ) ) {
$sanitized_data[ $key ] = is_array( $raw_data[ $key ] ) ? $raw_data[ $key ] : $default_value;

3
functions/functions-notifications.php

@ -284,7 +284,7 @@ function bookacti_sanitize_notification_settings( $args, $notification_id = '' )
/**
* Get notifications tags
* @since 1.2.0
* @version 1.7.0
* @version 1.7.3
* @param string $notification_id Optional.
* @return array
*/
@ -303,6 +303,7 @@ function bookacti_get_notifications_tags( $notification_id = '' ) {
'{user_firstname}' => esc_html__( 'The user first name', BOOKACTI_PLUGIN_NAME ),
'{user_lastname}' => esc_html__( 'The user last name', BOOKACTI_PLUGIN_NAME ),
'{user_email}' => esc_html__( 'The user email address', BOOKACTI_PLUGIN_NAME ),
'{user_phone}' => esc_html__( 'The user phone number', BOOKACTI_PLUGIN_NAME ),
'{user_id}' => esc_html__( 'The user ID. If the user has booked without account, this will display his email address.', BOOKACTI_PLUGIN_NAME ),
'{user_ical_url}' => esc_html__( 'URL to export the user list of bookings in ical format. If the user doesn\'t have an account, only the current booking is exported.', BOOKACTI_PLUGIN_NAME ),
'{user_ical_key}' => esc_html__( 'User ical export secret key. Useful to create a custom ical export URL.', BOOKACTI_PLUGIN_NAME )

15
functions/functions-settings.php

@ -6,7 +6,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
* Get default settings values
*
* @since 1.3.0 (was bookacti_define_default_settings_constants)
* @version 1.6.0
* @version 1.7.3
*/
function bookacti_get_default_settings() {
$date = new DateTime();
@ -14,7 +14,7 @@ function bookacti_get_default_settings() {
$default = array(
'booking_method' => 'calendar',
'when_events_load' => 'on_page_load',
'when_events_load' => 'after_page_load',
'event_load_interval' => 92,
'started_events_bookable' => false,
'started_groups_bookable' => false,
@ -190,7 +190,7 @@ function bookacti_settings_section_bookings_callback() { }
* Display "When to load the events?" setting
*
* @since 1.1.0
* @version 1.2.0
* @version 1.7.3
*/
function bookacti_settings_field_when_events_load_callback() {
$args = array(
@ -198,11 +198,11 @@ function bookacti_settings_section_bookings_callback() { }
'name' => 'bookacti_general_settings[when_events_load]',
'id' => 'when_events_load',
'options' => array(
'on_page_load' => __( 'On page load', BOOKACTI_PLUGIN_NAME ),
'after_page_load' => __( 'After page load', BOOKACTI_PLUGIN_NAME )
'on_page_load' => esc_html__( 'On page load', BOOKACTI_PLUGIN_NAME ),
'after_page_load' => esc_html__( 'After page load', BOOKACTI_PLUGIN_NAME )
),
'value' => bookacti_get_setting_value( 'bookacti_general_settings', 'when_events_load' ),
'tip' => apply_filters( 'bookacti_when_events_load_tip', __( 'Choose whether you want to load events when the page is loaded (faster) or after.', BOOKACTI_PLUGIN_NAME ) )
'tip' => apply_filters( 'bookacti_when_events_load_tip', esc_html__( 'Choose whether you want to load events when the page is loaded or after. You must choose "After page load" if you are using a caching plugin or a CDN.', BOOKACTI_PLUGIN_NAME ) )
);
bookacti_display_field( $args );
}
@ -1359,6 +1359,7 @@ function bookacti_settings_section_bookings_callback() { }
/**
* Display a promotional area for Notification Pack add-on
* @since 1.2.0
* @version 1.7.3
*/
function bookacti_display_banp_promo() {
$is_plugin_active = bookacti_is_plugin_active( 'ba-notification-pack/ba-notification-pack.php' );
@ -1377,7 +1378,7 @@ function bookacti_settings_section_bookings_callback() { }
<?php esc_html_e( "It seems you didn't activate your license yet. Please follow these instructions to activate your license:", BOOKACTI_PLUGIN_NAME ); ?>
</p><p>
<strong>
<a href='https://booking-activities.fr/en/docs/user-documentation/notification-pack/prerequisite-installation-license-activation-notification-pack-add-on/?utm_source=plugin&utm_medium=plugin&utm_content=encart-promo-settings' target='_blank' >
<a href='https://booking-activities.fr/en/docs/user-documentation/get-started-with-notification-pack-add-on/prerequisite-installation-license-activation-notification-pack-add-on/?utm_source=plugin&utm_medium=plugin&utm_content=encart-promo-settings' target='_blank' >
<?php
/* translators: %s = add-on name */
echo sprintf( __( 'How to activate %s license?', BOOKACTI_PLUGIN_NAME ), 'Notification Pack' );

30
functions/functions-template.php → functions/functions-templates.php

@ -128,6 +128,32 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
// TEMPLATE SETTINGS
/**
* Get templates data
* @since 1.7.3 (was bookacti_fetch_templates)
* @global wpdb $wpdb
* @param array $template_ids
* @param boolean $ignore_permissions
* @param int $user_id
* @return array
*/
function bookacti_get_templates_data( $template_ids = array(), $ignore_permissions = false, $user_id = 0 ) {
$templates = bookacti_fetch_templates( $template_ids, $ignore_permissions, $user_id );
$retrieved_template_ids = array_keys( $templates );
$templates_meta = bookacti_get_metadata( 'template', $retrieved_template_ids );
$templates_managers = bookacti_get_managers( 'template', $retrieved_template_ids );
foreach( $templates as $template_id => $template ) {
$templates[ $template_id ][ 'settings' ] = isset( $templates_meta[ $template_id ] ) ? $templates_meta[ $template_id ] : array();
$templates[ $template_id ][ 'admin' ] = isset( $templates_managers[ $template_id ] ) ? $templates_managers[ $template_id ] : array();
}
return $templates;
}
/**
* Get additionnal calendar fields default data
* @since 1.5.0
@ -170,14 +196,14 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
* Get a unique template setting made from a combination of multiple template settings
*
* @since 1.2.2 (was bookacti_get_mixed_template_settings)
* @version 1.5.0
* @version 1.7.3
* @param array|int $template_ids Array of template ids or single template id
* @param boolean $past_events Whether to allow past events
* @return array
*/
function bookacti_get_mixed_template_data( $template_ids, $past_events = false ) {
$templates_data = bookacti_fetch_templates( $template_ids, true );
$templates_data = bookacti_get_templates_data( $template_ids, true );
$mixed_settings = array();

67
functions/functions-woocommerce.php

@ -163,8 +163,8 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Update quantity, control the results ans display feedback accordingly
* @version 1.5.7
* Update quantity, control the results and display feedback accordingly
* @version 1.7.3
* @global woocommerce $woocommerce
* @param int $booking_id
* @param int $new_quantity
@ -308,8 +308,11 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/* translators: %1$s is a variable number of bookings. This sentence is preceded by : 'You want to make %1$s booking of "%2$s"' and followed by 'Please choose another event or decrease the quantity.' */
$message .= ' ' . sprintf( __( 'but the maximum number of reservations allowed per user is %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity );
}
/* translators: %1$s is a variable quantity. This sentence is preceded by two others : 'You want to make %1$s booking of "%2$s"' and 'but the maximum number of reservations allowed per user is %1$s.' */
$message .= $max_quantity - $current_quantity > 0 ? ' ' . sprintf( __( 'Please choose another event or decrease the quantity to %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity - $current_quantity ) : ' ' . __( 'Please choose another event', BOOKACTI_PLUGIN_NAME );
if( empty( $_POST[ 'update_cart' ] ) ) {
/* translators: %1$s is a variable quantity. This sentence is preceded by two others : 'You want to make %1$s booking of "%2$s"' and 'but the maximum number of reservations allowed per user is %1$s.' */
$message .= $max_quantity - $current_quantity > 0 ? ' ' . sprintf( __( 'Please choose another event or decrease the quantity to %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity - $current_quantity ) : ' ' . __( 'Please choose another event', BOOKACTI_PLUGIN_NAME );
}
} else if( $response[ 'error' ] === 'users_sup_to_max' ) {
$message = __( 'This event has reached the maximum number of users allowed. Bookings from other users are no longer accepted. Please choose another event.', BOOKACTI_PLUGIN_NAME );
@ -331,9 +334,9 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/**
* Update booking group quantity, control the results ans display feedback accordingly
* Update booking group quantity, control the results and display feedback accordingly
* @since 1.1.0
* @version 1.5.8
* @version 1.7.3
* @param int $booking_group_id
* @param int $quantity
* @param boolean $add_quantity
@ -341,7 +344,6 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
* @return boolean
*/
function bookacti_controller_update_booking_group_quantity( $booking_group_id, $quantity, $add_quantity = false, $context = 'frontend' ) {
// Sanitize
$quantity = intval( $quantity );
$add_quantity = $add_quantity ? true : false;
@ -447,8 +449,10 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
/* translators: %1$s is a variable number of bookings. This sentence is preceded by : 'You want to make %1$s booking of "%2$s"' and followed by 'Please choose another event or decrease the quantity.' */
$message .= ' ' . sprintf( __( 'but the maximum number of reservations allowed per user is %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity );
}
/* translators: %1$s is a variable quantity. This sentence is preceded by two others : 'You want to make %1$s booking of "%2$s"' and 'but the maximum number of reservations allowed per user is %1$s.' */
$message .= $max_quantity - $quantity_already_booked > 0 ? ' ' . sprintf( __( 'Please choose another event or decrease the quantity to %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity - $quantity_already_booked ) : ' ' . __( 'Please choose another event', BOOKACTI_PLUGIN_NAME );
if( empty( $_POST[ 'update_cart' ] ) ) {
/* translators: %1$s is a variable quantity. This sentence is preceded by two others : 'You want to make %1$s booking of "%2$s"' and 'but the maximum number of reservations allowed per user is %1$s.' */
$message .= $max_quantity - $quantity_already_booked > 0 ? ' ' . sprintf( __( 'Please choose another event or decrease the quantity to %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity - $quantity_already_booked ) : ' ' . __( 'Please choose another event', BOOKACTI_PLUGIN_NAME );
}
}
if( $max_users !== 0 && $current_quantity === 0 && $number_of_users >= $max_users ) {
@ -865,12 +869,12 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
* Change cart item quantity to make them respect the booking restrictions (min booking per user, max...)
*
* @since 1.4.0
* @version 1.7.3
* @global woocommerce $woocommerce
* @param int $user_id
* @return void|int
*/
function bookacti_update_cart_item_quantity_according_to_booking_restrictions( $user_id = 0 ) {
global $woocommerce;
if( ! $woocommerce ) { return; }
if( ! $woocommerce->cart ) { return; }
@ -956,32 +960,32 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
$restricted_quantity = $min_quantity - $quantity_already_booked;
/* translators: %1$s is a variable number of bookings, %2$s is the event title. This sentence is followed by two others : 'but the minimum number of reservations required per user is %1$s.' and 'The quantity has been automatically increased to %1$s.' */
$message = sprintf( _n( 'You want to make %1$s booking of "%2$s"', 'You want to make %1$s bookings of "%2$s"', $quantity, BOOKACTI_PLUGIN_NAME ), $quantity, $title );
$message = sprintf( esc_html( _n( 'You want to make %1$s booking of "%2$s"', 'You want to make %1$s bookings of "%2$s"', $quantity, BOOKACTI_PLUGIN_NAME ) ), $quantity, $title );
if( $quantity_already_booked ) {
/* translators: %1$s and %2$s are variable numbers of bookings, always >= 1. This sentence is preceded by : 'You want to make %1$s bookings of "%2$s"' and followed by 'The quantity has been automatically increased to %1$s.' */
$message .= ' ' . sprintf( _n( 'and you have already booked %1$s place, but the minimum number of reservations required per user is %2$s.', 'and you have already booked %1$s places, but the minimum number of reservations required per user is %2$s.', $quantity_already_booked, BOOKACTI_PLUGIN_NAME ), $quantity_already_booked, $min_quantity );
$message .= ' ' . sprintf( esc_html( _n( 'and you have already booked %1$s place, but the minimum number of reservations required per user is %2$s.', 'and you have already booked %1$s places, but the minimum number of reservations required per user is %2$s.', $quantity_already_booked, BOOKACTI_PLUGIN_NAME ) ), $quantity_already_booked, $min_quantity );
} else {
/* translators: %1$s is a variable number of bookings. This sentence is preceded by : 'You want to make %1$s bookings of "%2$s"' and followed by 'The quantity has been automatically increased to %1$s.' */
$message .= ' ' . sprintf( __( 'but the minimum number of reservations required per user is %1$s.', BOOKACTI_PLUGIN_NAME ), $min_quantity );
$message .= ' ' . sprintf( esc_html__( 'but the minimum number of reservations required per user is %1$s.', BOOKACTI_PLUGIN_NAME ), $min_quantity );
}
/* translators: %1$s is a variable number of bookings. This sentence is preceded by two others : 'You want to make %1$s bookings of "%2$s"' and 'but the minimum number of reservations required per user is %1$s.' */
$message .= ' ' . sprintf( __( 'The quantity has been automatically increased to %1$s.', BOOKACTI_PLUGIN_NAME ), $restricted_quantity );
$message .= ' ' . sprintf( esc_html__( 'The quantity has been automatically increased to %1$s.', BOOKACTI_PLUGIN_NAME ), $restricted_quantity );
}
if( $max_quantity !== 0 && $quantity > ( $max_quantity - $quantity_already_booked ) ) {
$restricted_quantity = $max_quantity - $quantity_already_booked;
/* translators: %1$s is a variable number of bookings, %2$s is the event title. This sentence is followed by two others : 'but the maximum number of reservations allowed per user is %1$s.' and 'The quantity has been automatically decreased to %1$s.' */
$message = sprintf( _n( 'You want to make %1$s booking of "%2$s"', 'You want to make %1$s bookings of "%2$s"', $quantity, BOOKACTI_PLUGIN_NAME ), $quantity, $title );
$message = sprintf( esc_html( _n( 'You want to make %1$s booking of "%2$s"', 'You want to make %1$s bookings of "%2$s"', $quantity, BOOKACTI_PLUGIN_NAME ) ), $quantity, $title );
if( $quantity_already_booked ) {
/* translators: %1$s and %2$s are variable numbers of bookings, always >= 1. This sentence is preceded by : 'You want to make %1$s bookings of "%2$s"' and followed by 'The quantity has been automatically decreased to %1$s.' */
$message .= ' ' . sprintf( _n( 'but you have already booked %1$s place and the maximum number of reservations allowed per user is %2$s.', 'but you have already booked %1$s places and the maximum number of reservations allowed per user is %2$s.', $quantity_already_booked, BOOKACTI_PLUGIN_NAME ), $quantity_already_booked, $max_quantity );
$message .= ' ' . sprintf( esc_html( _n( 'but you have already booked %1$s place and the maximum number of reservations allowed per user is %2$s.', 'but you have already booked %1$s places and the maximum number of reservations allowed per user is %2$s.', $quantity_already_booked, BOOKACTI_PLUGIN_NAME ) ), $quantity_already_booked, $max_quantity );
} else {
/* translators: %1$s is a variable number of bookings. This sentence is preceded by : 'You want to make %1$s bookings of "%2$s"' and followed by 'The quantity has been automatically decreased to %1$s.' */
$message .= ' ' . sprintf( __( 'but the maximum number of reservations allowed per user is %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity );
$message .= ' ' . sprintf( esc_html__( 'but the maximum number of reservations allowed per user is %1$s.', BOOKACTI_PLUGIN_NAME ), $max_quantity );
}
/* translators: %1$s is a variable quantity of bookings. This sentence is preceded by two others : 'You want to make %1$s bookings of "%2$s"' and 'but the maximum number of reservations allowed per user is %1$s.' */
$message .= ' ' . sprintf( __( 'The quantity has been automatically decreased to %1$s.', BOOKACTI_PLUGIN_NAME ), $restricted_quantity );
$message .= ' ' . sprintf( esc_html__( 'The quantity has been automatically decreased to %1$s.', BOOKACTI_PLUGIN_NAME ), $restricted_quantity );
}
// Check if the product has to be removed
@ -994,9 +998,15 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
}
if( ! $is_allowed ) {
$restricted_quantity = 0;
/* translators: %1$s is the event title. This sentence is followed by: 'This event has been automatically removed from your cart.' */
$message = ' ' . sprintf( __( 'The event "%1$s" is not available in your user category.', BOOKACTI_PLUGIN_NAME ), $title );
$message .= ' ' . __( 'This event has been automatically removed from your cart.', BOOKACTI_PLUGIN_NAME );
$message = '';
if( is_user_logged_in() ) {
/* translators: %1$s is the event title. This sentence is followed by: 'This event has been automatically removed from your cart.' */
$message .= ' ' . sprintf( esc_html__( 'The event "%1$s" is not available in your user category.', BOOKACTI_PLUGIN_NAME ), $title );
} else {
/* translators: %1$s is the event title. This sentence is followed by: 'This event has been automatically removed from your cart.' */
$message .= ' ' . sprintf( esc_html__( 'The event "%1$s" is restricted to certain categories of users. Please log in first.', BOOKACTI_PLUGIN_NAME ), $title );
}
$message .= ' ' . esc_html__( 'This event has been automatically removed from your cart.', BOOKACTI_PLUGIN_NAME );
}
}
@ -2460,9 +2470,24 @@ if ( ! defined( 'ABSPATH' ) ) { exit; }
}
/**
* Check if the current page is a WooCommerce screen
* @since 1.7.3 (was bookacti_is_wc_edit_product_screen)
* @return boolean
*/
function bookacti_is_wc_screen( $screen_ids = array() ) {
$current_screen = get_current_screen();
if( empty( $current_screen ) ) { return false; }
if( ! $screen_ids || ! is_array( $screen_ids ) ) { $screen_ids = wc_get_screen_ids(); }
if( isset( $current_screen->id ) && in_array( $current_screen->id, $screen_ids, true ) ) { return true; }
return false;
}
/**
* Check if the current page is a WooCommerce screen
* @since 1.7.0
* @deprecated since 1.7.3 (use bookacti_is_wc_screen instead)
* @return boolean
*/
function bookacti_is_wc_edit_product_screen() {

4
js/booking-method-calendar.js

@ -87,6 +87,10 @@ function bookacti_set_calendar_up( booking_system, reload_events ) {
// Display start and end time in spans
var time_format = 'LT';
// Remove trailing AM/PM in agenda views
if( view.name.indexOf( 'agenda' ) > -1 ){
time_format = calendar.fullCalendar( 'option', 'noMeridiemTimeFormat' );
}
element.find( '.fc-time' ).html( '<span class="bookacti-event-time-start">' + event.start.format( time_format ) + '</span><span class="bookacti-event-time-separator"> - </span><span class="bookacti-event-time-end">' + event.end.format( time_format ) + '</span>' );
// Add availability div

2
js/booking-method-calendar.min.js vendored

File diff suppressed because one or more lines are too long

20
js/booking-system-dialogs.js

@ -54,7 +54,7 @@ function bookacti_init_booking_system_dialogs() {
/**
* Choose a group of events dialog
* @version 1.5.9
* @version 1.7.3
* @param {dom_element} booking_system
* @param {array} group_ids
* @param {object} event
@ -84,11 +84,11 @@ function bookacti_dialog_choose_group_of_events( booking_system, group_ids, even
var avail_html = '';
if( bookings_only ) {
var bookings = bookacti_get_bookings_number_for_a_single_grouped_event( booking_system, event, group_ids );
var booking_html = bookings > 1 ? bookacti_localized.bookings : bookacti_localized.booking;
var booking_html = bookings === 1 ? bookacti_localized.booking : bookacti_localized.bookings;
avail_html = bookings + ' ' + booking_html;
} else {
var availability = bookacti_get_event_availability( booking_system, event );
var avail = availability > 1 ? bookacti_localized.avails : bookacti_localized.avail;
var avail = availability === 1 ? bookacti_localized.avail : bookacti_localized.avails;
avail_html = availability + ' ' + avail;
}
@ -156,11 +156,15 @@ function bookacti_dialog_choose_group_of_events( booking_system, group_ids, even
'disabled': ! bookings_only && ! is_available,
});
var label = $j( '<label />', {
var single_label = {
'html': bookacti_localized.single_event + ' <span class="bookacti-group-availability" >(' + avail_html + ')</span>',
'for': 'bookacti-group-of-events-' + group_id
});
};
// Allow third party to edit single label
booking_system.trigger( 'bookacti_choose_group_dialog_group_label', [ single_label, 'single', event ] );
var label = $j( '<label />', single_label );
var event_list = $j( '<ul />', {
'class': 'bookacti-group-of-events-list bookacti-custom-scrollbar',
'data-group-id': group_id
@ -273,10 +277,10 @@ function bookacti_dialog_choose_group_of_events( booking_system, group_ids, even
bookings = grouped_event.group_bookings;
}
});
var booking_html = bookings > 1 ? bookacti_localized.bookings : bookacti_localized.booking;;
var booking_html = bookings === 1 ? bookacti_localized.booking : bookacti_localized.bookings;
avail_html = bookings + ' ' + booking_html;
} else {
var avail = availability > 1 ? bookacti_localized.avails : bookacti_localized.avail;
var avail = availability === 1 ? bookacti_localized.avail : bookacti_localized.avails;
avail_html = availability + ' ' + avail;
}

2
js/booking-system-dialogs.min.js vendored

File diff suppressed because one or more lines are too long

47
js/booking-system-functions.js

@ -66,7 +66,7 @@ function bookacti_fetch_events( booking_system, interval ) {
/**
* Reload a booking system
* @version 1.7.0
* @version 1.7.3
* @param {dom_element} booking_system
* @param {boolean} keep_picked_events
*/
@ -109,6 +109,9 @@ function bookacti_reload_booking_system( booking_system, keep_picked_events ) {
// Fill the booking method elements
booking_system.append( response.html_elements );
// Trigger action for plugins
booking_system.trigger( 'bookacti_booking_system_reloaded' );
// Load the booking method
bookacti_booking_method_set_up( booking_system );
@ -656,7 +659,11 @@ function bookacti_unpick_all_events( booking_system ) {
}
// Display a list of picked events
/**
* Display a list of picked events
* @version 1.7.3
* @param {html_element} booking_system
*/
function bookacti_fill_picked_events_list( booking_system ) {
var booking_system_id = booking_system.attr( 'id' );
@ -689,14 +696,7 @@ function bookacti_fill_picked_events_list( booking_system ) {
booking_system.trigger( 'bookacti_picked_events_list_data', [ event_data, event ] );
var activity_id = 0;
if( event.group_id && typeof bookacti.booking_system[ booking_system_id ][ 'groups_events' ][ event.group_id ] !== 'undefined' ) {
$j.each( bookacti.booking_system[ booking_system_id ][ 'groups_events' ][ event.group_id ], function( i, grouped_event ) {
if( grouped_event.id === event.id ) {
activity_id = grouped_event.activity_id;
return false; // Break the loop
}
});
} else if( typeof bookacti.booking_system[ booking_system_id ][ 'events_data' ][ event.id ] !== 'undefined' ) {
if( typeof bookacti.booking_system[ booking_system_id ][ 'events_data' ][ event.id ] !== 'undefined' ) {
activity_id = bookacti.booking_system[ booking_system_id ][ 'events_data' ][ event.id ][ 'activity_id' ];
}
@ -818,7 +818,14 @@ function bookacti_format_event_duration( start, end ) {
}