| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php /** |
| 2 | 2 | * @version 1.0 |
| 3 | 3 | * @description AJX_Bookings |
| 4 | 4 | * @category AJX_Bookings Actions |
| @@ -20,8 +20,9 @@ | ||
| 20 | 20 | * Ajax Actions - Get Listing Data and Response to JS script |
| 21 | 21 | */ |
| 22 | 22 | function wpbc_ajax_WPBC_AJX_BOOKING_ACTIONS() { |
| 23 | 23 | |
| 24 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 24 | 25 | if ( ! isset( $_POST['action_params'] ) || empty( $_POST['action_params'] ) ) { |
| 25 | 26 | exit; |
| 26 | 27 | } |
| 27 | 28 | |
| @@ -31,9 +32,9 @@ | ||
| 31 | 32 | $action_name = 'wpbc_ajx_booking_listing_ajx' . '_wpbcnonce'; |
| 32 | 33 | $nonce_post_key = 'nonce'; |
| 33 | 34 | $result_check = check_ajax_referer( $action_name, $nonce_post_key ); |
| 34 | 35 | |
| 35 | - $user_id = ( isset( $_REQUEST['wpbc_ajx_user_id'] ) ) ? intval( $_REQUEST['wpbc_ajx_user_id'] ) : wpbc_get_current_user_id(); | |
| 36 | + $user_id = ( isset( $_REQUEST['wpbc_ajx_user_id'] ) ) ? intval( $_REQUEST['wpbc_ajx_user_id'] ) : wpbc_get_current_user_id(); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 36 | 37 | |
| 37 | 38 | // Get clean Parameters for SQL --------------------------------------------------------------------------- |
| 38 | 39 | $request_rules_structure = array( |
| 39 | 40 | 'booking_action' => array( 'validate' => array( |
| @@ -264,9 +265,10 @@ | ||
| 264 | 265 | |
| 265 | 266 | $defaults = array( |
| 266 | 267 | 'new_listing_params' => false // required for Import Google Calendar bookings |
| 267 | 268 | , 'after_action_result' => false |
| 268 | - , 'after_action_message' => sprintf( __('No actions %s has been processed.', 'booking') | |
| 269 | + /* translators: 1: ... */ | |
| 270 | + , 'after_action_message' => sprintf( __( 'No actions %s has been processed.', 'booking') | |
| 269 | 271 | , ' <strong>' . $request_params['booking_action'] . '</strong> ' ) |
| 270 | 272 | ); |
| 271 | 273 | $action_result = wp_parse_args( $action_result, $defaults ); |
| 272 | 274 | |
| @@ -276,19 +278,20 @@ | ||
| 276 | 278 | $action_result['after_action_message'] .= $error_messages; |
| 277 | 279 | } |
| 278 | 280 | |
| 279 | 281 | // Hook for other integrations |
| 280 | - do_action( 'wpbc_' . $request_params['booking_action'], $request_params, $action_result ); //FixIn: 9.5.3.3 | |
| 282 | + do_action( 'wpbc_' . $request_params['booking_action'], $request_params, $action_result ); // FixIn: 9.5.3.3. | |
| 281 | 283 | |
| 282 | 284 | //------------------------------------------------------------------------------------------------------------------ |
| 283 | 285 | // Send JSON. Its will make "wp_json_encode" - so pass only array, and This function call wp_die( '', '', array( 'response' => null, ) ) Pass JS OBJ: response_data in "jQuery.post( " function on success. |
| 284 | 286 | wp_send_json( array( |
| 285 | - 'ajx_action_params' => $_REQUEST['action_params'], // Do not clean input parameters | |
| 286 | - 'ajx_cleaned_params' => $request_params, // Cleaned input parameters | |
| 287 | - 'ajx_after_action_message' => $action_result['after_action_message'], // Message to show | |
| 288 | - 'ajx_after_action_result' => (int) $action_result['after_action_result'], // Result key 0 | 1 | |
| 289 | - 'ajx_after_action_result_all_params_arr' => $action_result // All result parameters | |
| 290 | - ) ); | |
| 287 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 288 | + 'ajx_action_params' => $_REQUEST['action_params'], // Do not clean input parameters. | |
| 289 | + 'ajx_cleaned_params' => $request_params, // Cleaned input parameters. | |
| 290 | + 'ajx_after_action_message' => $action_result['after_action_message'], // Message to show. | |
| 291 | + 'ajx_after_action_result' => (int) $action_result['after_action_result'], // Result key 0 | 1. | |
| 292 | + 'ajx_after_action_result_all_params_arr' => $action_result, // All result parameters. | |
| 293 | + ) ); | |
| 291 | 294 | } |
| 292 | 295 | |
| 293 | 296 | |
| 294 | 297 | // <editor-fold defaultstate="collapsed" desc=" == Ajax Actions for bookings == " > |
| @@ -307,8 +310,9 @@ | ||
| 307 | 310 | |
| 308 | 311 | // LOG --------------------------------------------------------------------------------------------------------- |
| 309 | 312 | $curr_user = get_user_by( 'id', (int) $params['user_id'] ); |
| 310 | 313 | wpbc_db__add_log_info( $booking_id, |
| 314 | + /* translators: 1: ... */ | |
| 311 | 315 | sprintf( __( 'Booking locale changed to %s by:', 'booking' ), $booking_locale ) |
| 312 | 316 | . ' ' . $curr_user->first_name . ' ' . $curr_user->last_name . ' (' . $curr_user->user_email . ')' |
| 313 | 317 | ); |
| 314 | 318 | |
| @@ -319,9 +323,11 @@ | ||
| 319 | 323 | |
| 320 | 324 | if ( $result ) { |
| 321 | 325 | $after_action_result = true; |
| 322 | 326 | $after_action_message = ( ( false === strpos( $booking_id, ',' ) ) |
| 327 | + /* translators: 1: ... */ | |
| 323 | 328 | ? sprintf( __( 'Booking has been changed locale to %s', 'booking' ), "<strong>{$booking_locale}</strong>" ) |
| 329 | + /* translators: 1: ... */ | |
| 324 | 330 | : sprintf( __( 'Bookings have been changed locale to %s', 'booking' ), "<strong>{$booking_locale}</strong>" ) |
| 325 | 331 | ) |
| 326 | 332 | . ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_id . '</strong> )</span>'; |
| 327 | 333 | } else { |
| @@ -326,9 +332,11 @@ | ||
| 326 | 332 | . ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_id . '</strong> )</span>'; |
| 327 | 333 | } else { |
| 328 | 334 | $after_action_result = false; |
| 329 | 335 | $after_action_message = ( ( false === strpos( $booking_id, ',' ) ) |
| 336 | + /* translators: 1: ... */ | |
| 330 | 337 | ? sprintf( __( 'Booking has NOT been changed locale to %s', 'booking' ), "<strong>{$booking_locale}</strong>" ) |
| 338 | + /* translators: 1: ... */ | |
| 331 | 339 | : sprintf( __( 'Bookings have NOT been changed locale to %s', 'booking' ), "<strong>{$booking_locale}</strong>" ) |
| 332 | 340 | ) |
| 333 | 341 | . ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_id . '</strong> )</span>'; |
| 334 | 342 | } |
| @@ -365,14 +373,14 @@ | ||
| 365 | 373 | if ( ! empty( $booking_gcal_events_form_fields[ $key_name ] ) ) { |
| 366 | 374 | |
| 367 | 375 | $field_name = explode( '^', $booking_gcal_events_form_fields[ $key_name ] ); |
| 368 | 376 | |
| 369 | - $field_name = $field_name[ ( count( $field_name ) - 1 ) ]; //FixIn: 8.7.7.6 | |
| 377 | + $field_name = $field_name[ ( count( $field_name ) - 1 ) ]; // FixIn: 8.7.7.6. | |
| 370 | 378 | |
| 371 | - if ( 'description' === $key_name ) { //FixIn: 8.1.3.2 | |
| 379 | + if ( 'description' === $key_name ) { // FixIn: 8.1.3.2. | |
| 372 | 380 | |
| 373 | - if ( isset( $booking_data['form_show'] ) ) { //FixIn: 8.7.3.14 | |
| 374 | - //FixIn: 8.7.11.4 | |
| 381 | + if ( isset( $booking_data['form_show'] ) ) { // FixIn: 8.7.3.14. | |
| 382 | + // FixIn: 8.7.11.4. | |
| 375 | 383 | $fields[ $key_name ] = $booking_data['form_show']; |
| 376 | 384 | $fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES ); |
| 377 | 385 | $fields[ $key_name ] = urlencode($fields[ $key_name ]); |
| 378 | 386 | $fields[ $key_name ] = htmlentities($fields[ $key_name ] ); |
| @@ -382,9 +390,9 @@ | ||
| 382 | 390 | } else if ( ( ! empty( $field_name ) ) |
| 383 | 391 | && ( ! empty( $booking_data['form_data'] ) ) |
| 384 | 392 | && ( ! empty( $booking_data['form_data'][ $field_name ] ) ) |
| 385 | 393 | ) { |
| 386 | - //FixIn: 8.7.11.4 | |
| 394 | + // FixIn: 8.7.11.4. | |
| 387 | 395 | $fields[ $key_name ] = $booking_data['form_data'][ $field_name ]; |
| 388 | 396 | $fields[ $key_name ] = htmlspecialchars_decode($fields[ $key_name ], ENT_QUOTES ); |
| 389 | 397 | /** |
| 390 | 398 | * // Convert here from usual symbols to URL symbols https://www.url-encode-decode.com/ |
| @@ -414,21 +422,21 @@ | ||
| 414 | 422 | $check_out_timestamp = strtotime( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], current_time( 'timestamp' ) ); |
| 415 | 423 | |
| 416 | 424 | if ( trim( substr( $booking_data[ 'dates_short' ][ 0 ], 11 ) ) == '00:00:00' ) { |
| 417 | 425 | if ( trim( substr( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], 11 ) ) == '00:00:00' ) { |
| 418 | - $check_in_timestamp = date( "Ymd", $check_in_timestamp ); // All day | |
| 426 | + $check_in_timestamp = gmdate( "Ymd", $check_in_timestamp ); // All day | |
| 419 | 427 | } else { |
| 420 | - $check_in_timestamp = date( "Ymd\T000000", $check_in_timestamp ); // All day starting on 00:00:00 //FixIn: 10.0.0.28 | |
| 428 | + $check_in_timestamp = gmdate( "Ymd\T000000", $check_in_timestamp ); // All day starting on 00:00:00 // FixIn: 10.0.0.28. | |
| 421 | 429 | } |
| 422 | 430 | } else { |
| 423 | - $check_in_timestamp = date( "Ymd\THis", $check_in_timestamp ); //$check_in_timestamp = date( "Ymd\THis\Z", $check_in_timestamp ); | |
| 431 | + $check_in_timestamp = gmdate( "Ymd\THis", $check_in_timestamp ); //$check_in_timestamp = gmdate( "Ymd\THis\Z", $check_in_timestamp ); | |
| 424 | 432 | } |
| 425 | 433 | |
| 426 | 434 | if ( trim( substr( $booking_data[ 'dates_short' ][ ( count( $booking_data[ 'dates_short' ] ) - 1 ) ], 11 ) ) == '00:00:00' ) { |
| 427 | 435 | $check_out_timestamp = strtotime( '+1 day', $check_out_timestamp ); |
| 428 | - $check_out_timestamp = date( "Ymd", $check_out_timestamp ); // All day | |
| 436 | + $check_out_timestamp = gmdate( "Ymd", $check_out_timestamp ); // All day | |
| 429 | 437 | } else { |
| 430 | - $check_out_timestamp = date( "Ymd\THis", $check_out_timestamp ); //$check_out_timestamp = date( "Ymd\THis\Z", $check_out_timestamp ); | |
| 438 | + $check_out_timestamp = gmdate( "Ymd\THis", $check_out_timestamp ); //$check_out_timestamp = gmdate( "Ymd\THis\Z", $check_out_timestamp ); | |
| 431 | 439 | } |
| 432 | 440 | } |
| 433 | 441 | |
| 434 | 442 | // Link ----------------------------------------------------------------------------------------------------------- |
| @@ -437,9 +445,9 @@ | ||
| 437 | 445 | function iso_to_ts( $iso ) { |
| 438 | 446 | sscanf( $iso, "%u-%u-%uT%u:%u:%uZ", $year, $month, $day, $hour, $minute, $second ); |
| 439 | 447 | return mktime( $hour, $minute, $second, $month, $day, $year ); |
| 440 | 448 | 20140127T224000Z |
| 441 | - date("Ymd\THis\Z", time()); | |
| 449 | + gmdate("Ymd\THis\Z", time()); | |
| 442 | 450 | */ |
| 443 | 451 | |
| 444 | 452 | /** |
| 445 | 453 | * action: action=TEMPLATE |
| @@ -477,13 +485,13 @@ | ||
| 477 | 485 | */ |
| 478 | 486 | |
| 479 | 487 | //$link_add2gcal = 'http://www.google.com/calendar/event?action=TEMPLATE'; |
| 480 | 488 | //$link_add2gcal .= '&text=' . $fields['title']; |
| 481 | - $link_add2gcal = 'https://calendar.google.com/calendar/r/eventedit?'; //FixIn: 8.7.3.10 | |
| 482 | - $link_add2gcal .= 'text=' . $fields['title']; //FixIn: 8.7.11.4 | |
| 489 | + $link_add2gcal = 'https://calendar.google.com/calendar/r/eventedit?'; // FixIn: 8.7.3.10. | |
| 490 | + $link_add2gcal .= 'text=' . $fields['title']; // FixIn: 8.7.11.4. | |
| 483 | 491 | $link_add2gcal .= '&dates=' . $check_in_timestamp . '/' . $check_out_timestamp; //$link_add2gcal .= '&dates=[start-custom format='Ymd\\THi00\\Z']/[end-custom format='Ymd\\THi00\\Z']'; |
| 484 | - $link_add2gcal .= '&details=' . $fields['description']; //FixIn: 8.7.11.4 | |
| 485 | - $link_add2gcal .= '&location=' . $fields['where']; //FixIn: 8.7.11.4 | |
| 492 | + $link_add2gcal .= '&details=' . ( ( 'On' !== get_bk_option( 'booking_g_cal_export_no_data' ) ) ? $fields['description'] : '' ); //FixIn: 10.3.0.1 // FixIn: 8.7.11.4. | |
| 493 | + $link_add2gcal .= '&location=' . ( ( 'On' !== get_bk_option( 'booking_g_cal_export_no_data' ) ) ? $fields['where'] : '' ); // FixIn: 8.7.11.4. | |
| 486 | 494 | $link_add2gcal .= '&trp=false'; |
| 487 | 495 | if ( ! empty( $params['timezone'] ) ) { |
| 488 | 496 | $link_add2gcal .= '&ctz=' . str_replace( '%', '%25', $params['timezone'] ); //FixIn: 8.7.3.10 //TimeZone |
| 489 | 497 | } |
| @@ -535,33 +543,39 @@ | ||
| 535 | 543 | $after_action_result = true; |
| 536 | 544 | if ( $is_trash_or_restore == '1' ) { |
| 537 | 545 | $after_action_message = '<strong style="font-size: 1.4em;">' . count( explode( ',', $booking_is_csd ) ) .'</strong> ' |
| 538 | 546 | . ( ( false === strpos( $booking_is_csd, ',' ) ) |
| 539 | - ? sprintf( __( 'Booking has been %s trashed %s', 'booking' ), '<strong>', '</strong>' ) | |
| 540 | - : sprintf( __( 'Bookings have been %s trashed %s', 'booking' ) , '<strong>', '</strong>' ) | |
| 547 | + /* translators: 1: ... */ | |
| 548 | + ? sprintf( __( 'Booking has been %1$s trashed %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 549 | + /* translators: 1: ... */ | |
| 550 | + : sprintf( __( 'Bookings have been %1$s trashed %2$s', 'booking' ) , '<strong>', '</strong>' ) | |
| 541 | 551 | ) |
| 542 | 552 | . ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_is_csd . '</strong> )</span>'; |
| 543 | 553 | } else { |
| 544 | 554 | $after_action_message = '<strong style="font-size: 1.4em;">' . count( explode( ',', $booking_is_csd ) ) .'</strong> ' |
| 545 | 555 | . ( ( false === strpos( $booking_is_csd, ',' ) ) |
| 546 | - ? sprintf( __( 'Booking has been set as %s restored %s', 'booking' ), '<strong>', '</strong>' ) | |
| 547 | - : sprintf( __( 'Bookings have been set as %s restored %s', 'booking' ), '<strong>', '</strong>' ) | |
| 556 | + /* translators: 1: ... */ | |
| 557 | + ? sprintf( __( 'Booking has been set as %1$s restored %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 558 | + /* translators: 1: ... */ | |
| 559 | + : sprintf( __( 'Bookings have been set as %1$s restored %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 548 | 560 | ) |
| 549 | 561 | . ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_is_csd . '</strong> )</span>'; |
| 550 | 562 | } |
| 551 | 563 | // SQL --------------------------------------------------------------------------------------------------- |
| 552 | 564 | global $wpdb; |
| 553 | - $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking AS bk SET bk.trash = %s WHERE booking_id IN ({$booking_is_csd})", $is_trash_or_restore ); | |
| 565 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 566 | + $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking SET trash = %s WHERE booking_id IN ({$booking_is_csd})", $is_trash_or_restore ); // FixIn: 10.12.1.5. | |
| 554 | 567 | if ( $is_trash_or_restore == '1' ) { |
| 555 | 568 | // Trash |
| 556 | - $my_trash_date = wpbc_datetime_localized( date( 'Y-m-d H:i:s' ), 'Y-m-d H:i:s' ); | |
| 557 | - $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking AS bk SET bk.trash = %s, bk.is_trash = %s WHERE booking_id IN ({$booking_is_csd})", $is_trash_or_restore, $my_trash_date ); | |
| 569 | + $my_trash_date = wpbc_datetime_localized( gmdate( 'Y-m-d H:i:s' ), 'Y-m-d H:i:s' ); | |
| 570 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 571 | + $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking SET trash = %s, is_trash = %s WHERE booking_id IN ({$booking_is_csd})", $is_trash_or_restore, $my_trash_date ); // FixIn: 10.12.1.5. | |
| 558 | 572 | } else { |
| 559 | - // Restore | |
| 560 | - $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking AS bk SET bk.trash = %s, bk.is_trash = NULL WHERE booking_id IN ({$booking_is_csd})", $is_trash_or_restore ); | |
| 573 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 574 | + $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking SET trash = %s, is_trash = NULL WHERE booking_id IN ({$booking_is_csd})", $is_trash_or_restore ); // FixIn: 10.12.1.5. | |
| 561 | 575 | } |
| 562 | 576 | |
| 563 | - | |
| 577 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 564 | 578 | $after_action_result = $wpdb->query( $prepared_sql ); |
| 565 | 579 | if ( false === $after_action_result ) { |
| 566 | 580 | $after_action_message = 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| 567 | 581 | } else { |
| @@ -568,9 +582,9 @@ | ||
| 568 | 582 | $after_action_result = true; |
| 569 | 583 | } |
| 570 | 584 | |
| 571 | 585 | // Update the Hash and Cost of the booking |
| 572 | - $bk_id_arr = explode(',', $booking_is_csd ); //FixIn: 8.6.1.11 | |
| 586 | + $bk_id_arr = explode(',', $booking_is_csd ); // FixIn: 8.6.1.11. | |
| 573 | 587 | foreach ( $bk_id_arr as $bk_id ) { |
| 574 | 588 | wpbc_hash__update_booking_hash( $bk_id ); |
| 575 | 589 | } |
| 576 | 590 | |
| @@ -584,9 +598,9 @@ | ||
| 584 | 598 | // :: ? :: Update 'is_new' status of bookings in Database |
| 585 | 599 | // wpbc_db_update_number_new_bookings( explode( ',', $booking_is_csd ), '0', $params['user_id'] ); |
| 586 | 600 | |
| 587 | 601 | // Just action hook for some other addons |
| 588 | - do_action( 'wpbc_booking_action__trash', $booking_is_csd, $is_trash_or_restore ); //FixIn: 8.7.6.2 | |
| 602 | + do_action( 'wpbc_booking_action__trash', $booking_is_csd, $is_trash_or_restore ); // FixIn: 8.7.6.2. | |
| 589 | 603 | |
| 590 | 604 | // Emails ------------------------------------------------------------------------------------------------------ |
| 591 | 605 | if ( ! empty( $is_send_emeils ) ) { |
| 592 | 606 | |
| @@ -636,9 +650,9 @@ | ||
| 636 | 650 | /** |
| 637 | 651 | * |
| 638 | 652 | * For creation of new bookings or editing use something like this: |
| 639 | 653 | * |
| 640 | - // Be sure to make load in Booking Listing this: wp_enqueue_script( 'wpbc-main-client', wpbc_plugin_url( '/js/client.js' ), array( 'wpbc-datepick' ), WP_BK_VERSION_NUM ); | |
| 654 | + // Be sure to make load in Booking Listing this: wp_enqueue_script( 'wpbc-main-client', wpbc_plugin_url( '/js/client.js' ), array( 'wpbc-datepick' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) ); | |
| 641 | 655 | new wpdev_booking(); // Define ability to work with shortcodes |
| 642 | 656 | $return_sh = do_shortcode('[booking type=1 nummonths=2]'); |
| 643 | 657 | wp_send_json($return_sh); // Send calendar |
| 644 | 658 | */ |
| @@ -673,23 +687,30 @@ | ||
| 673 | 687 | $after_action_result = true; |
| 674 | 688 | if ( $is_approve_or_pending == '1' ) { |
| 675 | 689 | $after_action_message = '<strong style="font-size: 1.4em;">' . count( explode( ',', $booking_id_csd ) ) .'</strong> ' |
| 676 | 690 | . ( ( false === strpos( $booking_id_csd, ',' ) ) |
| 677 | - ? sprintf( __( 'Booking has been %s approved %s', 'booking' ), '<strong>', '</strong>' ) | |
| 678 | - : sprintf( __( 'Bookings have been %s approved %s', 'booking' ) , '<strong>', '</strong>' ) | |
| 691 | + /* translators: 1: ... */ | |
| 692 | + ? sprintf( __( 'Booking has been %1$s approved %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 693 | + /* translators: 1: ... */ | |
| 694 | + : sprintf( __( 'Bookings have been %1$s approved %2$s', 'booking' ) , '<strong>', '</strong>' ) | |
| 679 | 695 | ) |
| 680 | 696 | . ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_id_csd . '</strong> )</span>'; |
| 681 | 697 | } else { |
| 682 | 698 | $after_action_message = '<strong style="font-size: 1.4em;">' . count( explode( ',', $booking_id_csd ) ) .'</strong> ' |
| 683 | 699 | . ( ( false === strpos( $booking_id_csd, ',' ) ) |
| 684 | - ? sprintf( __( 'Booking has been set as %s pending %s', 'booking' ), '<strong>', '</strong>' ) | |
| 685 | - : sprintf( __( 'Bookings have been set as %s pending %s', 'booking' ), '<strong>', '</strong>' ) | |
| 700 | + /* translators: 1: ... */ | |
| 701 | + ? sprintf( __( 'Booking has been set as %1$s pending %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 702 | + /* translators: 1: ... */ | |
| 703 | + : sprintf( __( 'Bookings have been set as %1$s pending %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 686 | 704 | ) |
| 687 | 705 | . ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_id_csd . '</strong> )</span>'; |
| 688 | 706 | } |
| 689 | 707 | // SQL --------------------------------------------------------------------------------------------------- |
| 690 | 708 | global $wpdb; |
| 709 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 691 | 710 | $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}bookingdates SET approved = %s WHERE booking_id IN ({$booking_id_csd})", $is_approve_or_pending ); |
| 711 | + | |
| 712 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 692 | 713 | $after_action_result = $wpdb->query( $prepared_sql ); |
| 693 | 714 | if ( false === $after_action_result ) { |
| 694 | 715 | $after_action_message = 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| 695 | 716 | } else { |
| @@ -706,9 +727,9 @@ | ||
| 706 | 727 | // Update 'is_new' status of bookings in Database |
| 707 | 728 | wpbc_db_update_number_new_bookings( explode( ',', $booking_id_csd ), '0', $params['user_id'] ); |
| 708 | 729 | |
| 709 | 730 | // Just action hook for some other addons |
| 710 | - do_action( 'wpbc_booking_action__approved', $booking_id_csd, $is_approve_or_pending ); //FixIn: 8.7.6.1 | |
| 731 | + do_action( 'wpbc_booking_action__approved', $booking_id_csd, $is_approve_or_pending ); // FixIn: 8.7.6.1. | |
| 711 | 732 | |
| 712 | 733 | // Emails ------------------------------------------------------------------------------------------------------ |
| 713 | 734 | if ( ! empty( $is_send_emeils ) ) { |
| 714 | 735 | |
| @@ -770,10 +791,12 @@ | ||
| 770 | 791 | $after_action_result = true; |
| 771 | 792 | $bookings_count = '<strong style="font-size: 1.4em;">' . count( explode( ',', $booking_is_csd ) ) .'</strong> '; |
| 772 | 793 | $after_action_message = $bookings_count . ' ' |
| 773 | 794 | . ( ( false === strpos( $booking_is_csd, ',' ) ) |
| 774 | - ? strtolower( sprintf( __( 'Booking has been %s deleted %s', 'booking' ), '<strong>', '</strong>' ) ) | |
| 775 | - : strtolower( sprintf( __( 'Bookings have been %s deleted %s', 'booking' ) , '<strong>', '</strong>' ) ) | |
| 795 | + /* translators: 1: ... */ | |
| 796 | + ? strtolower( sprintf( __( 'Booking has been %1$s deleted %2$s', 'booking' ), '<strong>', '</strong>' ) ) | |
| 797 | + /* translators: 1: ... */ | |
| 798 | + : strtolower( sprintf( __( 'Bookings have been %1$s deleted %2$s', 'booking' ) , '<strong>', '</strong>' ) ) | |
| 776 | 799 | ) |
| 777 | 800 | . ' <span style="font-size:0.9em;">( ID = <strong>' . implode( ', ', explode( ',', $booking_is_csd ) ) . '</strong> )</span>'; |
| 778 | 801 | |
| 779 | 802 | // LOG --------------------------------------------------------------------------------------------------------- |
| @@ -783,9 +806,9 @@ | ||
| 783 | 806 | . ' ' . $curr_user->first_name . ' ' . $curr_user->last_name . ' (' . $curr_user->user_email . ')' |
| 784 | 807 | ); |
| 785 | 808 | |
| 786 | 809 | // Just action hook for some other addons |
| 787 | - do_action( 'wpbc_booking_action__delete', $booking_is_csd ); //FixIn: 8.7.6.3 | |
| 810 | + do_action( 'wpbc_booking_action__delete', $booking_is_csd ); // FixIn: 8.7.6.3. | |
| 788 | 811 | |
| 789 | 812 | // Emails ------------------------------------------------------------------------------------------------------ |
| 790 | 813 | if ( ! empty( $is_send_emeils ) ) { |
| 791 | 814 | |
| @@ -796,8 +819,9 @@ | ||
| 796 | 819 | global $wpdb; |
| 797 | 820 | |
| 798 | 821 | // Dates |
| 799 | 822 | $prepared_sql = "DELETE FROM {$wpdb->prefix}bookingdates WHERE booking_id IN ({$booking_is_csd})"; |
| 823 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 800 | 824 | $after_action_result = $wpdb->query( $prepared_sql ); |
| 801 | 825 | if ( false === $after_action_result ) { |
| 802 | 826 | $after_action_message = 'Error during deleting dates in DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| 803 | 827 | } else { |
| @@ -804,8 +828,9 @@ | ||
| 804 | 828 | $after_action_result = true; |
| 805 | 829 | } |
| 806 | 830 | // Bookings |
| 807 | 831 | $prepared_sql = "DELETE FROM {$wpdb->prefix}booking WHERE booking_id IN ({$booking_is_csd})"; |
| 832 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 808 | 833 | $after_action_result = $wpdb->query( $prepared_sql ); |
| 809 | 834 | if ( false === $after_action_result ) { |
| 810 | 835 | $after_action_message = 'Error during deleting bookings in DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| 811 | 836 | } else { |
| @@ -863,16 +888,20 @@ | ||
| 863 | 888 | } else { |
| 864 | 889 | $after_action_result = true; |
| 865 | 890 | if ( $is_new == '1' ) { |
| 866 | 891 | $after_action_message = ( ( false === strpos( $booking_id_csd, ',' ) ) |
| 867 | - ? sprintf( __( 'Booking has been set as %s new %s', 'booking' ), '<strong>', '</strong>' ) | |
| 868 | - : sprintf( __( 'Bookings have been set as %s new %s', 'booking' ) , '<strong>', '</strong>' ) | |
| 892 | + /* translators: 1: ... */ | |
| 893 | + ? sprintf( __( 'Booking has been set as %1$s new %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 894 | + /* translators: 1: ... */ | |
| 895 | + : sprintf( __( 'Bookings have been set as %1$s new %2$s', 'booking' ) , '<strong>', '</strong>' ) | |
| 869 | 896 | ) |
| 870 | 897 | . ' <span style="font-size:0.9em;">( ID = <strong>' . (( '-1' == $booking_id_csd ) ? __( 'all', 'booking' ) : $booking_id_csd) . '</strong> )</span>'; |
| 871 | 898 | } else { |
| 872 | 899 | $after_action_message = ( ( false === strpos( $booking_id_csd, ',' ) ) |
| 873 | - ? sprintf( __( 'The booking has been marked as %s read %s', 'booking' ), '<strong>', '</strong>' ) | |
| 874 | - : sprintf( __( 'Bookings have been marked as %s read %s', 'booking' ), '<strong>', '</strong>' ) | |
| 900 | + /* translators: 1: ... */ | |
| 901 | + ? sprintf( __( 'The booking has been marked as %1$s read %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 902 | + /* translators: 1: ... */ | |
| 903 | + : sprintf( __( 'Bookings have been marked as %1$s read %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 875 | 904 | ) |
| 876 | 905 | . ' <span style="font-size:0.9em;">( ID = <strong>' . (( '-1' == $booking_id_csd ) ? __( 'all', 'booking' ) : $booking_id_csd) . '</strong> )</span>'; |
| 877 | 906 | } |
| 878 | 907 | // SQL --------------------------------------------------------------------------------------------------- |
| @@ -877,15 +906,18 @@ | ||
| 877 | 906 | } |
| 878 | 907 | // SQL --------------------------------------------------------------------------------------------------- |
| 879 | 908 | global $wpdb; |
| 880 | 909 | if ('-1' == $booking_id_csd ){ |
| 881 | - $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking AS bk SET bk.is_new = %s", $is_new ); | |
| 910 | + $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking SET is_new = %s", $is_new ); // FixIn: 10.12.1.5. | |
| 882 | 911 | |
| 883 | 912 | $prepared_sql .= " WHERE ( 1 = 1 ) "; |
| 913 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 884 | 914 | $prepared_sql = apply_bk_filter('update_where_sql_for_getting_bookings_in_multiuser', $prepared_sql ); |
| 885 | 915 | } else { |
| 886 | - $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking AS bk SET bk.is_new = %s WHERE booking_id IN ({$booking_id_csd})", $is_new ); | |
| 916 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 917 | + $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking SET is_new = %s WHERE booking_id IN ({$booking_id_csd})", $is_new ); // FixIn: 10.12.1.5. | |
| 887 | 918 | } |
| 919 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 888 | 920 | $after_action_result = $wpdb->query( $prepared_sql ); |
| 889 | 921 | if ( false === $after_action_result ) { |
| 890 | 922 | $after_action_message = 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| 891 | 923 | } else { |
| @@ -899,9 +931,9 @@ | ||
| 899 | 931 | . ' ' . $curr_user->first_name . ' ' . $curr_user->last_name . ' (' . $curr_user->user_email . ')' |
| 900 | 932 | ); |
| 901 | 933 | |
| 902 | 934 | // Just action hook for some other addons |
| 903 | - do_action( 'wpbc_booking_action__changed_new_status', $booking_id_csd, $is_new ); //FixIn: 8.7.6.1 | |
| 935 | + do_action( 'wpbc_booking_action__changed_new_status', $booking_id_csd, $is_new ); // FixIn: 8.7.6.1. | |
| 904 | 936 | |
| 905 | 937 | // Emails ------------------------------------------------------------------------------------------------------ |
| 906 | 938 | if ( ! empty( $is_send_emeils ) ) { |
| 907 | 939 | |
| @@ -937,9 +969,9 @@ | ||
| 937 | 969 | |
| 938 | 970 | // Get bookings ID to delete ------------------------------------------------------------------------------- |
| 939 | 971 | global $wpdb; |
| 940 | 972 | |
| 941 | - $sql = "SELECT * FROM {$wpdb->prefix}booking as bk WHERE bk.trash = 1"; | |
| 973 | + $sql = "SELECT * FROM {$wpdb->prefix}booking as bk WHERE bk.trash = 1"; // FixIn: 10.12.1.5. | |
| 942 | 974 | |
| 943 | 975 | $sql = apply_bk_filter( 'update_where_sql_for_getting_bookings_in_multiuser', $sql, $params['user_id'] ); // Get booking resources of this user only: $user_id |
| 944 | 976 | |
| 945 | 977 | $max_bookings_to_erase = 1000; |
| @@ -944,9 +976,10 @@ | ||
| 944 | 976 | |
| 945 | 977 | $max_bookings_to_erase = 1000; |
| 946 | 978 | $sql .= " LIMIT 0, " . $max_bookings_to_erase; |
| 947 | 979 | |
| 948 | - $bookings_in_trash = $wpdb->get_results( $sql ); //Get ID of all bookings in a trash. | |
| 980 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 981 | + $bookings_in_trash = $wpdb->get_results( $sql ); | |
| 949 | 982 | |
| 950 | 983 | $bookings_id_in_trash_arr = array(); |
| 951 | 984 | |
| 952 | 985 | foreach ( $bookings_in_trash as $booking_obj ) { |
| @@ -965,8 +998,9 @@ | ||
| 965 | 998 | if ( count( $bookings_id_in_trash_arr ) < $max_bookings_to_erase ) { |
| 966 | 999 | $after_action_message = sprintf( __( 'Trash has been erased.', 'booking' ) , '<strong>', '</strong>' ) |
| 967 | 1000 | . ' <span style="font-size:0.9em;">( ID = <strong>' . substr( $booking_is_csd, 0 , 500 ) . '</strong> )</span>'; |
| 968 | 1001 | } else { |
| 1002 | + /* translators: 1: ... */ | |
| 969 | 1003 | $after_action_message = sprintf( __( 'From trash has been erased %s bookings.', 'booking' ) , '<strong> ' . count( $bookings_id_in_trash_arr ) . ' </strong> ' ) ; |
| 970 | 1004 | } |
| 971 | 1005 | |
| 972 | 1006 | // LOG ----------------------------------------------------------------------------------------------------- |
| @@ -976,9 +1010,9 @@ | ||
| 976 | 1010 | // . ' ' . $curr_user->first_name . ' ' . $curr_user->last_name . ' (' . $curr_user->user_email . ')' |
| 977 | 1011 | // ); |
| 978 | 1012 | |
| 979 | 1013 | // Just action hook for some other addons |
| 980 | - do_action( 'wpbc_booking_action__empty_trash' ); //FixIn: 8.7.6.3 | |
| 1014 | + do_action( 'wpbc_booking_action__empty_trash' ); // FixIn: 8.7.6.3. | |
| 981 | 1015 | |
| 982 | 1016 | // Emails ------------------------------------------------------------------------------------------------------ |
| 983 | 1017 | if ( ! empty( $is_send_emeils ) ) { |
| 984 | 1018 | |
| @@ -988,8 +1022,9 @@ | ||
| 988 | 1022 | // SQL --------------------------------------------------------------------------------------------------- |
| 989 | 1023 | |
| 990 | 1024 | // Dates |
| 991 | 1025 | $prepared_sql = "DELETE FROM {$wpdb->prefix}bookingdates WHERE booking_id IN ({$booking_is_csd})"; |
| 1026 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 992 | 1027 | $after_action_result = $wpdb->query( $prepared_sql ); |
| 993 | 1028 | if ( false === $after_action_result ) { |
| 994 | 1029 | $after_action_message = 'Error during deleting dates in DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| 995 | 1030 | } else { |
| @@ -996,8 +1031,9 @@ | ||
| 996 | 1031 | $after_action_result = true; |
| 997 | 1032 | } |
| 998 | 1033 | // Bookings |
| 999 | 1034 | $prepared_sql = "DELETE FROM {$wpdb->prefix}booking WHERE booking_id IN ({$booking_is_csd})"; |
| 1035 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1000 | 1036 | $after_action_result = $wpdb->query( $prepared_sql ); |
| 1001 | 1037 | if ( false === $after_action_result ) { |
| 1002 | 1038 | $after_action_message = 'Error during deleting bookings in DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| 1003 | 1039 | } else { |
| @@ -1051,9 +1087,11 @@ | ||
| 1051 | 1087 | $after_action_message = __( 'Note has been saved', 'booking' ) |
| 1052 | 1088 | . ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_id_csd . '</strong> )</span>'; |
| 1053 | 1089 | // SQL --------------------------------------------------------------------------------------------------- |
| 1054 | 1090 | global $wpdb; |
| 1091 | + // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared | |
| 1055 | 1092 | $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking SET remark = %s WHERE booking_id IN ({$booking_id_csd})", $remark_text ); |
| 1093 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1056 | 1094 | $after_action_result = $wpdb->query( $prepared_sql ); |
| 1057 | 1095 | if ( false === $after_action_result ) { |
| 1058 | 1096 | $after_action_message = 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| 1059 | 1097 | } else { |
| @@ -1123,10 +1161,12 @@ | ||
| 1123 | 1161 | } else { |
| 1124 | 1162 | $after_action_result = true; |
| 1125 | 1163 | |
| 1126 | 1164 | $after_action_message = ( ( false === strpos( $booking_id_csd, ',' ) ) |
| 1127 | - ? sprintf( __( 'Booking has been changed %s booking resource %s', 'booking' ), '<strong>', '</strong>' ) | |
| 1128 | - : sprintf( __( 'Bookings have been changed %s booking resource %s', 'booking' ), '<strong>', '</strong>' ) | |
| 1165 | + /* translators: 1: ... */ | |
| 1166 | + ? sprintf( __( 'Booking has been changed %1$s booking resource %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 1167 | + /* translators: 1: ... */ | |
| 1168 | + : sprintf( __( 'Bookings have been changed %1$s booking resource %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 1129 | 1169 | ) |
| 1130 | 1170 | . ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_id_csd . '</strong> )</span>'; |
| 1131 | 1171 | |
| 1132 | 1172 | |
| @@ -1133,8 +1173,16 @@ | ||
| 1133 | 1173 | $work_booking_id_arr = explode( ',', $booking_id_csd ); |
| 1134 | 1174 | |
| 1135 | 1175 | foreach ( $work_booking_id_arr as $selected_booking_id ) { |
| 1136 | 1176 | |
| 1177 | + if ( 'On' !== get_bk_option('booking_change_resource_skip_checking') ) { | |
| 1178 | + $resource_change_check = apply_filters( 'wpbc_booking_validate_resource_change', true, $selected_booking_id, $selected_resource_id ); | |
| 1179 | + if ( is_wp_error( $resource_change_check ) ) { | |
| 1180 | + $after_action_result = false; | |
| 1181 | + $after_action_message = $resource_change_check->get_error_message(); | |
| 1182 | + continue; | |
| 1183 | + } | |
| 1184 | + } | |
| 1137 | 1185 | // SQL --------------------------------------------------------------------------------------------------- |
| 1138 | 1186 | list( $after_action_result, $after_action_message, $formdata_new ) = wpbc__sql__change_booking_resource_for_booking( $selected_booking_id, $selected_resource_id ); |
| 1139 | 1187 | |
| 1140 | 1188 | if ( $after_action_result ) { |
| @@ -1183,14 +1231,18 @@ | ||
| 1183 | 1231 | //////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 1184 | 1232 | if ( 1 ) { |
| 1185 | 1233 | // 1.1.Get booking data of SOURCE booking |
| 1186 | 1234 | $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking as bk WHERE booking_id = %d ", $booking_id ); |
| 1187 | - $res = $wpdb->get_row( $sql ); | |
| 1235 | + | |
| 1236 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1237 | + $res = $wpdb->get_row( $sql ); | |
| 1238 | + | |
| 1188 | 1239 | $db_form_data_old = $res->form; |
| 1189 | 1240 | $resource_id_old = $res->booking_type; |
| 1190 | 1241 | |
| 1191 | 1242 | // 1.2. Get dates of SOURCE booking |
| 1192 | 1243 | $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}bookingdates as dt WHERE booking_id = %d ORDER BY booking_date ASC ", $booking_id ); |
| 1244 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1193 | 1245 | $old_resource_dates_array = $wpdb->get_results( $sql ); |
| 1194 | 1246 | } |
| 1195 | 1247 | |
| 1196 | 1248 | |
| @@ -1214,9 +1266,9 @@ | ||
| 1214 | 1266 | // // ERROR :: number of check in/dates does not equal to number of check out dates. |
| 1215 | 1267 | return $exist_dates_results; |
| 1216 | 1268 | } |
| 1217 | 1269 | |
| 1218 | - if ( get_bk_option('booking_change_resource_skip_checking') === 'On' ) { //FixIn: 8.4.5.4 | |
| 1270 | + if ( get_bk_option('booking_change_resource_skip_checking') === 'On' ) { // FixIn: 8.4.5.4. | |
| 1219 | 1271 | $is_date_time_booked = false; |
| 1220 | 1272 | } else { |
| 1221 | 1273 | $is_date_time_booked = wpbc_check_dates_intersections( $old_resource_dates_array, $exist_dates_results ); |
| 1222 | 1274 | } |
| @@ -1229,11 +1281,12 @@ | ||
| 1229 | 1281 | } else { // Possible to change |
| 1230 | 1282 | |
| 1231 | 1283 | $db_form_data_new = wpbc_update_resource_id_in_dbformatted_booking_data( $db_form_data_old, $resource_id_old, $resource_id ); |
| 1232 | 1284 | |
| 1233 | - // Update | |
| 1234 | - $update_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking AS bk SET bk.form=%s, bk.booking_type=%d WHERE bk.booking_id=%d;" | |
| 1285 | + // Update // FixIn: 10.12.1.5. | |
| 1286 | + $update_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking SET form=%s, booking_type=%d WHERE booking_id=%d;" | |
| 1235 | 1287 | , $db_form_data_new, $resource_id, $booking_id ); |
| 1288 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1236 | 1289 | if ( false === $wpdb->query( $update_sql ) ) { |
| 1237 | 1290 | $after_action_result = false; |
| 1238 | 1291 | $after_action_message = get_debuge_error( 'Error during updating booking reource type in BD', __FILE__, __LINE__ ); |
| 1239 | 1292 | |
| @@ -1242,8 +1295,9 @@ | ||
| 1242 | 1295 | |
| 1243 | 1296 | |
| 1244 | 1297 | if ( class_exists( 'wpdev_bk_biz_l' ) ) { |
| 1245 | 1298 | $update_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}bookingdates SET type_id=NULL WHERE booking_id=%d ", $booking_id ); |
| 1299 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1246 | 1300 | if ( false === $wpdb->query( $update_sql ) ) { |
| 1247 | 1301 | $after_action_result = false; |
| 1248 | 1302 | $after_action_message = get_debuge_error( 'Error during updating dates type in BD', __FILE__, __LINE__ ); |
| 1249 | 1303 | |
| @@ -1252,9 +1306,10 @@ | ||
| 1252 | 1306 | } |
| 1253 | 1307 | |
| 1254 | 1308 | $booking_resources_arr = wpbc_ajx_get_all_booking_resources_arr(); |
| 1255 | 1309 | $after_action_result = true; |
| 1256 | - $after_action_message = sprintf( __( 'Booking %s has been changed booking resource from %s to %s' ) | |
| 1310 | + /* translators: 1: ... */ | |
| 1311 | + $after_action_message = sprintf( __( 'Booking %1$s has been changed booking resource from %2$s to %3$s', 'booking' ) | |
| 1257 | 1312 | , '<strong>[ID=' . $booking_id . ']</strong>' |
| 1258 | 1313 | , '<strong>' . wpbc_lang( $booking_resources_arr[ $resource_id_old ]['title'] ) . '</strong>' |
| 1259 | 1314 | , '<strong>' . wpbc_lang( $booking_resources_arr[ $resource_id ]['title'] ) . '</strong>' |
| 1260 | 1315 | ); |
| @@ -1319,9 +1374,9 @@ | ||
| 1319 | 1374 | $temp_check_in = $old_resource_dates_array[0]->booking_date; |
| 1320 | 1375 | $temp_check_out = $old_resource_dates_array[ ( count( $old_resource_dates_array ) - 1 ) ]->booking_date; |
| 1321 | 1376 | |
| 1322 | 1377 | if ( ':02' != substr( $temp_check_out, - 3 ) ) { |
| 1323 | - $temp_check_out = date( 'Y-m-d H:i:s', strtotime( '+1 day -1 second', strtotime( $temp_check_out ) ) ); | |
| 1378 | + $temp_check_out = gmdate( 'Y-m-d H:i:s', strtotime( '+1 day -1 second', strtotime( $temp_check_out ) ) ); | |
| 1324 | 1379 | } |
| 1325 | 1380 | |
| 1326 | 1381 | $dates_sql_between .= ' dt.booking_date BETWEEN "' . $temp_check_in . '" AND "' . $temp_check_out . '" '; |
| 1327 | 1382 | } |
| @@ -1343,8 +1398,9 @@ | ||
| 1343 | 1398 | . ") "; |
| 1344 | 1399 | } |
| 1345 | 1400 | $sql .= " ORDER BY bk.booking_id DESC, dt.booking_date ASC "; |
| 1346 | 1401 | |
| 1402 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1347 | 1403 | $exist_dates_results = $wpdb->get_results( $sql ); |
| 1348 | 1404 | |
| 1349 | 1405 | // We have found only intersected dates. Now we need to get all dates from such bookings, for having correct "Start and end time times for the booking" |
| 1350 | 1406 | // and does not add some "start time at the begining of the day inside of wpbc_check_dates_intersections( ) function |
| @@ -1358,11 +1414,12 @@ | ||
| 1358 | 1414 | // Get all dates of such bookings (not only intersected! |
| 1359 | 1415 | $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking as bk |
| 1360 | 1416 | INNER JOIN {$wpdb->prefix}bookingdates as dt |
| 1361 | 1417 | ON bk.booking_id = dt.booking_id |
| 1362 | - WHERE bk.booking_id IN (" . implode( ',', $my_booking_id_arr ) . ") AND bk.trash != 1 AND bk.booking_type = %d", $resource_id ); | |
| 1418 | + WHERE bk.booking_id IN (" . implode( ',', $my_booking_id_arr ) . ") AND bk.trash != 1 AND bk.booking_type = %d", $resource_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared | |
| 1363 | 1419 | $sql .= " ORDER BY bk.booking_id DESC, dt.booking_date ASC "; |
| 1364 | 1420 | |
| 1421 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1365 | 1422 | $exist_dates_results = $wpdb->get_results( $sql ); |
| 1366 | 1423 | } |
| 1367 | 1424 | |
| 1368 | 1425 | return $exist_dates_results; |
| @@ -1437,10 +1494,12 @@ | ||
| 1437 | 1494 | } else { |
| 1438 | 1495 | $after_action_result = true; |
| 1439 | 1496 | |
| 1440 | 1497 | $after_action_message = ( ( false === strpos( $booking_id_csd, ',' ) ) |
| 1441 | - ? sprintf( __( 'Booking has been %s duplicated %s', 'booking' ), '<strong>', '</strong>' ) | |
| 1442 | - : sprintf( __( 'Bookings have been %s duplicated %s', 'booking' ), '<strong>', '</strong>' ) | |
| 1498 | + /* translators: 1: ... */ | |
| 1499 | + ? sprintf( __( 'Booking has been %1$s duplicated %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 1500 | + /* translators: 1: ... */ | |
| 1501 | + : sprintf( __( 'Bookings have been %1$s duplicated %2$s', 'booking' ), '<strong>', '</strong>' ) | |
| 1443 | 1502 | ) |
| 1444 | 1503 | . ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_id_csd . '</strong> )</span>'; |
| 1445 | 1504 | |
| 1446 | 1505 | |
| @@ -1500,14 +1559,16 @@ | ||
| 1500 | 1559 | //////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 1501 | 1560 | if ( 1 ) { |
| 1502 | 1561 | // 1.1.Get booking data of SOURCE booking |
| 1503 | 1562 | $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking as bk WHERE booking_id = %d ", $booking_id ); |
| 1504 | - $res = $wpdb->get_row( $sql ); | |
| 1563 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1564 | + $res = $wpdb->get_row( $sql ); | |
| 1505 | 1565 | $db_form_data_old = $res->form; |
| 1506 | 1566 | $resource_id_old = $res->booking_type; |
| 1507 | 1567 | |
| 1508 | 1568 | // 1.2. Get dates of SOURCE booking |
| 1509 | 1569 | $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}bookingdates as dt WHERE booking_id = %d ORDER BY booking_date ASC ", $booking_id ); |
| 1570 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1510 | 1571 | $old_resource_dates_array = $wpdb->get_results( $sql ); |
| 1511 | 1572 | } |
| 1512 | 1573 | |
| 1513 | 1574 | //////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| @@ -1519,9 +1580,9 @@ | ||
| 1519 | 1580 | // // ERROR :: number of check in/dates does not equal to number of check out dates. |
| 1520 | 1581 | return $exist_dates_results; |
| 1521 | 1582 | } |
| 1522 | 1583 | |
| 1523 | - if ( get_bk_option('booking_change_resource_skip_checking') === 'On' ) { //FixIn: 8.4.5.4 | |
| 1584 | + if ( get_bk_option('booking_change_resource_skip_checking') === 'On' ) { // FixIn: 8.4.5.4. | |
| 1524 | 1585 | $is_date_time_booked = false; |
| 1525 | 1586 | } else { |
| 1526 | 1587 | $is_date_time_booked = wpbc_check_dates_intersections( $old_resource_dates_array, $exist_dates_results ); |
| 1527 | 1588 | } |
| @@ -1528,10 +1589,11 @@ | ||
| 1528 | 1589 | |
| 1529 | 1590 | if ( $is_date_time_booked ) { |
| 1530 | 1591 | |
| 1531 | 1592 | $after_action_result = false; |
| 1532 | - $after_action_message = '<strong>' . __( 'Warning', 'booking' ) . '!</strong> ' | |
| 1533 | - . sprintf( __( 'Booking %s has not been duplicated in booking resource %s. Current dates are already booked there.' ) | |
| 1593 | + $after_action_message = '<strong>' . esc_html__( 'Warning', 'booking' ) . '!</strong> ' | |
| 1594 | + /* translators: 1: ... */ | |
| 1595 | + . sprintf( __( 'Booking %1$s has not been duplicated in booking resource %2$s. Current dates are already booked there.' , 'booking' ) | |
| 1534 | 1596 | , '<strong style="font-size:0.9em;">[ID=' . $booking_id . ']</strong>' |
| 1535 | 1597 | , '<strong>' . wpbc_lang( $booking_resources_arr[ $resource_id ]['title'] ) . '</strong>' |
| 1536 | 1598 | ); |
| 1537 | 1599 | |
| @@ -1537,12 +1599,12 @@ | ||
| 1537 | 1599 | |
| 1538 | 1600 | } else { // Possible to change |
| 1539 | 1601 | |
| 1540 | 1602 | $db_form_data_new = wpbc_update_resource_id_in_dbformatted_booking_data( $db_form_data_old, $resource_id_old, $resource_id ); |
| 1603 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Recommended | |
| 1604 | + $wpdev_active_locale = isset( $_REQUEST['wpbc_ajx_locale'] ) ? sanitize_text_field( $_REQUEST['wpbc_ajx_locale'] ) : 'en_US'; | |
| 1541 | 1605 | |
| 1542 | - $wpdev_active_locale = isset( $_REQUEST['wpbc_ajx_locale'] ) ? esc_js( $_REQUEST['wpbc_ajx_locale'] ) : 'en_US'; | |
| 1543 | 1606 | |
| 1544 | - | |
| 1545 | 1607 | // Change dates from DateObj( $selected_date->booking_date = '2015-10-17' ) to array ( '17.10.2015' ) |
| 1546 | 1608 | $my_dates_for_sql = array(); |
| 1547 | 1609 | foreach ($old_resource_dates_array as $selected_date) { |
| 1548 | 1610 | $selected_date = explode( '-', $selected_date->booking_date ); |
| @@ -1563,8 +1625,17 @@ | ||
| 1563 | 1625 | // 'user_id' => wpbc_get_current_user_id() |
| 1564 | 1626 | // 'sync_gid' => '' |
| 1565 | 1627 | // 'is_approve_booking' => 0 |
| 1566 | 1628 | ); |
| 1629 | + if ( function_exists( 'wpbc_appointment_services_get_booking_service_id' ) ) { | |
| 1630 | + $duplicated_service_id = wpbc_appointment_services_get_booking_service_id( $booking_id ); | |
| 1631 | + if ( $duplicated_service_id ) { | |
| 1632 | + $request_save_params['service_id'] = $duplicated_service_id; | |
| 1633 | + if ( function_exists( 'wpbc_booking_appointment_encode_submission_context' ) ) { | |
| 1634 | + $request_save_params['appointment_context_token'] = wpbc_booking_appointment_encode_submission_context( array(), $duplicated_service_id, $resource_id ); | |
| 1635 | + } | |
| 1636 | + } | |
| 1637 | + } | |
| 1567 | 1638 | $booking_save_arr = wpbc_booking_save( $request_save_params ); |
| 1568 | 1639 | |
| 1569 | 1640 | if ( 'ok' === $booking_save_arr['ajx_data']['status'] ) { // Everything Cool :) - booking has been duplicated |
| 1570 | 1641 | |
| @@ -1569,9 +1640,10 @@ | ||
| 1569 | 1640 | if ( 'ok' === $booking_save_arr['ajx_data']['status'] ) { // Everything Cool :) - booking has been duplicated |
| 1570 | 1641 | |
| 1571 | 1642 | $booking_id_new = $booking_save_arr['booking_id']; |
| 1572 | 1643 | $after_action_result = true; |
| 1573 | - $after_action_message = sprintf( __( 'Booking %s has been duplicated in booking resource %s. New booking %s.' ) | |
| 1644 | + /* translators: 1: ... */ | |
| 1645 | + $after_action_message = sprintf( __( 'Booking %1$s has been duplicated in booking resource %2$s. New booking %3$s.', 'booking' ) | |
| 1574 | 1646 | , '<strong style="font-size:0.9em;">[ID=' . $booking_id . ']</strong>' |
| 1575 | 1647 | , '<strong>' . wpbc_lang( $booking_resources_arr[ $resource_id ]['title'] ) . '</strong>' |
| 1576 | 1648 | , '<strong style="font-size:0.9em;">[ID=' . $booking_id_new . ']</strong>' |
| 1577 | 1649 | ); |
| @@ -1627,8 +1699,9 @@ | ||
| 1627 | 1699 | foreach ( $work_booking_id_arr as $selected_booking_id ) { |
| 1628 | 1700 | |
| 1629 | 1701 | // SQL --------------------------------------------------------------------------------------------------- |
| 1630 | 1702 | $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking as bk WHERE bk.booking_id= %d ", $selected_booking_id ); |
| 1703 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1631 | 1704 | $result_bk = $wpdb->get_results( $sql ); |
| 1632 | 1705 | |
| 1633 | 1706 | $old_pay_status = ''; |
| 1634 | 1707 | |
| @@ -1634,8 +1707,9 @@ | ||
| 1634 | 1707 | |
| 1635 | 1708 | if ( ( 0 == count( $result_bk ) ) ) { |
| 1636 | 1709 | // Error |
| 1637 | 1710 | $after_action_result = false; |
| 1711 | + /* translators: 1: ... */ | |
| 1638 | 1712 | $after_action_message .= sprintf( __( 'There is no booking %s', 'booking' ) |
| 1639 | 1713 | , ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_id_csd . '</strong> )</span>' |
| 1640 | 1714 | ); |
| 1641 | 1715 | } else { |
| @@ -1640,10 +1714,11 @@ | ||
| 1640 | 1714 | ); |
| 1641 | 1715 | } else { |
| 1642 | 1716 | $old_pay_status = $result_bk[0]->pay_status; |
| 1643 | 1717 | } |
| 1644 | - | |
| 1645 | - $update_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking AS bk SET bk.pay_status= %s WHERE bk.booking_id= %d ", $selected_payment_status, $selected_booking_id ); | |
| 1718 | + // FixIn: 10.12.1.5. | |
| 1719 | + $update_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking SET pay_status= %s WHERE booking_id= %d ", $selected_payment_status, $selected_booking_id ); | |
| 1720 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1646 | 1721 | if ( false === $wpdb->query( $update_sql ) ) { |
| 1647 | 1722 | // Error |
| 1648 | 1723 | $after_action_result = false; |
| 1649 | 1724 | $after_action_message .= 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| @@ -1648,9 +1723,10 @@ | ||
| 1648 | 1723 | $after_action_result = false; |
| 1649 | 1724 | $after_action_message .= 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| 1650 | 1725 | } else { |
| 1651 | 1726 | // Success |
| 1652 | - $after_action_message .= sprintf( __( 'Payment status for Booking %s has been updated from %s to %s', 'booking' ) | |
| 1727 | + /* translators: 1: ... */ | |
| 1728 | + $after_action_message .= sprintf( __( 'Payment status for Booking %1$s has been updated from %2$s to %3$s', 'booking' ) | |
| 1653 | 1729 | , ' <span style="font-size:0.9em;">( ID = <strong>' . $selected_booking_id . '</strong> )</span>' |
| 1654 | 1730 | , '<strong>"' . wpbc__format__get_payment_status_title( $old_pay_status ) . '"</strong>' |
| 1655 | 1731 | , '<strong>"' . wpbc__format__get_payment_status_title( $selected_payment_status ) . '"</strong>' |
| 1656 | 1732 | ) . '<br/>'; |
| @@ -1754,8 +1830,9 @@ | ||
| 1754 | 1830 | foreach ( $work_booking_id_arr as $selected_booking_id ) { |
| 1755 | 1831 | |
| 1756 | 1832 | // SQL --------------------------------------------------------------------------------------------------- |
| 1757 | 1833 | $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking as bk WHERE bk.booking_id= %d ", $selected_booking_id ); |
| 1834 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1758 | 1835 | $result_bk = $wpdb->get_results( $sql ); |
| 1759 | 1836 | |
| 1760 | 1837 | $old_booking_cost = ''; |
| 1761 | 1838 | |
| @@ -1761,8 +1838,9 @@ | ||
| 1761 | 1838 | |
| 1762 | 1839 | if ( ( 0 == count( $result_bk ) ) ) { |
| 1763 | 1840 | // Error |
| 1764 | 1841 | $after_action_result = false; |
| 1842 | + /* translators: 1: ... */ | |
| 1765 | 1843 | $after_action_message .= sprintf( __( 'There is no booking %s', 'booking' ) |
| 1766 | 1844 | , ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_id_csd . '</strong> )</span>' |
| 1767 | 1845 | ); |
| 1768 | 1846 | } else { |
| @@ -1768,9 +1846,10 @@ | ||
| 1768 | 1846 | } else { |
| 1769 | 1847 | $old_booking_cost = $result_bk[0]->cost; |
| 1770 | 1848 | } |
| 1771 | 1849 | |
| 1772 | - $update_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking AS bk SET bk.cost = %f WHERE bk.booking_id = %d ", $booking_cost, $selected_booking_id ); | |
| 1850 | + $update_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking SET cost = %f WHERE booking_id = %d ", $booking_cost, $selected_booking_id ); // FixIn: 10.12.1.5. | |
| 1851 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1773 | 1852 | if ( false === $wpdb->query( $update_sql ) ) { |
| 1774 | 1853 | // Error |
| 1775 | 1854 | $after_action_result = false; |
| 1776 | 1855 | $after_action_message .= 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| @@ -1775,9 +1854,10 @@ | ||
| 1775 | 1854 | $after_action_result = false; |
| 1776 | 1855 | $after_action_message .= 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| 1777 | 1856 | } else { |
| 1778 | 1857 | // Success |
| 1779 | - $after_action_message .= sprintf( __( 'Cost for Booking %s has been updated from %s to %s', 'booking' ) | |
| 1858 | + /* translators: 1: ... */ | |
| 1859 | + $after_action_message .= sprintf( __( 'Cost for Booking %1$s has been updated from %2$s to %3$s', 'booking' ) | |
| 1780 | 1860 | , ' <span style="font-size:0.9em;">( ID = <strong>' . $selected_booking_id . '</strong> )</span>' |
| 1781 | 1861 | , '<strong>"' . wpbc__format__get_payment_status_title( $old_booking_cost ) . '"</strong>' |
| 1782 | 1862 | , '<strong>"' . wpbc__format__get_payment_status_title( $booking_cost ) . '"</strong>' |
| 1783 | 1863 | ) . '<br/>'; |
| @@ -1798,9 +1878,9 @@ | ||
| 1798 | 1878 | |
| 1799 | 1879 | // Emails ------------------------------------------------------------------------------------------------------ |
| 1800 | 1880 | if ( ! empty( $is_send_emeils ) ) { |
| 1801 | 1881 | |
| 1802 | - if ( get_bk_option( 'booking_send_email_on_cost_change' ) == 'On' ) { //FixIn: 8.1.3.30 | |
| 1882 | + if ( get_bk_option( 'booking_send_email_on_cost_change' ) == 'On' ) { // FixIn: 8.1.3.30. | |
| 1803 | 1883 | $booking_data = apply_bk_filter( 'wpbc_get_booking_data', $selected_booking_id ); |
| 1804 | 1884 | wpbc_send_email_modified( $selected_booking_id, $booking_data['type'], $booking_data['form'] ); |
| 1805 | 1885 | } |
| 1806 | 1886 | } |
| @@ -1856,8 +1936,9 @@ | ||
| 1856 | 1936 | foreach ( $work_booking_id_arr as $selected_booking_id ) { |
| 1857 | 1937 | |
| 1858 | 1938 | // SQL --------------------------------------------------------------------------------------------------- |
| 1859 | 1939 | $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking as bk WHERE bk.booking_id= %d ", $selected_booking_id ); |
| 1940 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1860 | 1941 | $result_bk = $wpdb->get_results( $sql ); |
| 1861 | 1942 | |
| 1862 | 1943 | $old_booking_cost = ''; |
| 1863 | 1944 | |
| @@ -1863,8 +1944,9 @@ | ||
| 1863 | 1944 | |
| 1864 | 1945 | if ( ( 0 == count( $result_bk ) ) ) { |
| 1865 | 1946 | // Error |
| 1866 | 1947 | $after_action_result = false; |
| 1948 | + /* translators: 1: ... */ | |
| 1867 | 1949 | $after_action_message .= sprintf( __( 'There is no booking %s', 'booking' ) |
| 1868 | 1950 | , ' <span style="font-size:0.9em;">( ID = <strong>' . $booking_id_csd . '</strong> )</span>' |
| 1869 | 1951 | ); |
| 1870 | 1952 | } else { |
| @@ -1882,9 +1964,11 @@ | ||
| 1882 | 1964 | |
| 1883 | 1965 | if ( $is_send ) { |
| 1884 | 1966 | // Update Payment request number |
| 1885 | 1967 | $pay_request_numer = $res->pay_request + 1; |
| 1886 | - $update_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking AS bk SET bk.pay_request= %d WHERE bk.booking_id= %d ", $pay_request_numer, $res->booking_id ); | |
| 1968 | + // FixIn: 10.12.1.5. | |
| 1969 | + $update_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking SET pay_request= %d WHERE booking_id= %d ", $pay_request_numer, $res->booking_id ); | |
| 1970 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1887 | 1971 | if ( false === $wpdb->query( $update_sql ) ) { |
| 1888 | 1972 | // Error |
| 1889 | 1973 | $after_action_result = false; |
| 1890 | 1974 | $after_action_message .= 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| @@ -1889,9 +1973,10 @@ | ||
| 1889 | 1973 | $after_action_result = false; |
| 1890 | 1974 | $after_action_message .= 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__; |
| 1891 | 1975 | } else { |
| 1892 | 1976 | // Success |
| 1893 | - $after_action_message .= sprintf( __( 'Payment request for Booking %s has been sent. Cost for payment: %s', 'booking' ) | |
| 1977 | + /* translators: 1: ... */ | |
| 1978 | + $after_action_message .= sprintf( __( 'Payment request for Booking %1$s has been sent. Cost for payment: %2$s', 'booking' ) | |
| 1894 | 1979 | , ' <span style="font-size:0.9em;">( ID = <strong>' . $selected_booking_id . '</strong> )</span>' |
| 1895 | 1980 | , '<strong>"' . wpbc__format__get_payment_status_title( $old_booking_cost ) . '"</strong>' |
| 1896 | 1981 | ) . '<br/>'; |
| 1897 | 1982 | } |
| @@ -1993,9 +2078,9 @@ | ||
| 1993 | 2078 | } |
| 1994 | 2079 | } |
| 1995 | 2080 | |
| 1996 | 2081 | $my_sql = "SELECT booking_type_id, import FROM {$wpdb->prefix}bookingtypes {$where}"; |
| 1997 | - | |
| 2082 | + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter | |
| 1998 | 2083 | $types_list = $wpdb->get_results( $my_sql ); |
| 1999 | 2084 | |
| 2000 | 2085 | foreach ($types_list as $wpbc_booking_resource) { |
| 2001 | 2086 | $wpbc_booking_resource_id = $wpbc_booking_resource->booking_type_id; |
| @@ -2012,13 +2097,14 @@ | ||
| 2012 | 2097 | |
| 2013 | 2098 | |
| 2014 | 2099 | if ( ( isset( $import_result ) ) && ( false != $import_result ) ) { |
| 2015 | 2100 | $after_action_result = true; |
| 2101 | + /* translators: 1: ... */ | |
| 2016 | 2102 | $after_action_message = sprintf( __( '%s new bookings have been imported', 'booking' ) |
| 2017 | 2103 | , ' <span style="font-size:1em;"> <strong>' . count( $wpbc_Google_Calendar->events ) . '</strong> </span>' |
| 2018 | 2104 | ) ; |
| 2019 | 2105 | if ( 0 != count( $wpbc_Google_Calendar->events ) ) { |
| 2020 | - $after_action_message .= '<br/><br/>' . __( 'The filter settings have been updated to reflect these imported bookings. The page will be reloaded.', 'booking' ); | |
| 2106 | + $after_action_message .= '<br/><br/>' . esc_html__( 'The filter settings have been updated to reflect these imported bookings. The page will be reloaded.', 'booking' ); | |
| 2021 | 2107 | } |
| 2022 | 2108 | |
| 2023 | 2109 | if ( ! empty( $wpbc_Google_Calendar->getErrorMessage() ) ) { |
| 2024 | 2110 | $after_action_message .= '<div style="max-width:60rem;margin:2em 10px;">' . $wpbc_Google_Calendar->getErrorMessage() . '</div>'; |
| @@ -2029,9 +2115,9 @@ | ||
| 2029 | 2115 | $after_action_result = false; |
| 2030 | 2116 | $after_action_message = __( 'No bookings have been imported.', 'booking' ) |
| 2031 | 2117 | . '<br/><br/>' |
| 2032 | 2118 | . sprintf( __( 'Please configure settings for import Google Calendar events', 'booking' ), '<b>', ',</b>' ) |
| 2033 | - . ' <a href="' . wpbc_get_settings_url() . '&tab=sync&subtab=gcal' . '">' . __('here' ,'booking') . '.</a>' | |
| 2119 | + . ' <a href="' . esc_url( wpbc_get_settings_url() . '&tab=sync&subtab=gcal' ). '">' . esc_html__('here' ,'booking') . '.</a>' | |
| 2034 | 2120 | . '<br/><br/>' |
| 2035 | 2121 | . $wpbc_Google_Calendar->getErrorMessage(); |
| 2036 | 2122 | $return_array['after_action_result_delay'] = 100000000000000; |
| 2037 | 2123 | } |
| @@ -2067,9 +2153,9 @@ | ||
| 2067 | 2153 | "wh_cost" => "", |
| 2068 | 2154 | "wh_cost2" => "", |
| 2069 | 2155 | "wh_sort" => "booking_id__desc", |
| 2070 | 2156 | "wh_trash" => "any", |
| 2071 | - 'reload_url_params' => htmlspecialchars_decode( esc_url( wpbc_get_bookings_url() . '&view_mode=vm_booking_listing' ) ) | |
| 2157 | + 'reload_url_params' => htmlspecialchars_decode( esc_url( wpbc_get_bookings_url() . '&tab=vm_booking_listing' ) ) | |
| 2072 | 2158 | ); |
| 2073 | 2159 | } |
| 2074 | 2160 | |
| 2075 | 2161 | |
| @@ -2099,8 +2185,9 @@ | ||
| 2099 | 2185 | $is_send_emeils = wpbc_ajx__user_request_option__is_send_emails( $params['user_id'] ); |
| 2100 | 2186 | |
| 2101 | 2187 | // ----------------------------------------------------------------------------------------------------------------- |
| 2102 | 2188 | |
| 2189 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 2103 | 2190 | if ( ! isset( $_POST['search_params'] ) || empty( $_POST['search_params'] ) ) { |
| 2104 | 2191 | |
| 2105 | 2192 | $after_action_result = false; |
| 2106 | 2193 | $after_action_message = __('Error', 'booking') . '! ' . 'Search parameters for CSV generating are empty.'; |
| @@ -2126,11 +2213,11 @@ | ||
| 2126 | 2213 | $after_action_result = true; |
| 2127 | 2214 | $after_action_message = __('Processing' ,'booking') . '... '; |
| 2128 | 2215 | } |
| 2129 | 2216 | |
| 2217 | + // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Recommended | |
| 2218 | + $wpbc_ajx_locale = ( isset( $_REQUEST['wpbc_ajx_locale'] ) ) ? sanitize_text_field( $_REQUEST['wpbc_ajx_locale'] ) : 'en_US'; | |
| 2130 | 2219 | |
| 2131 | - $wpbc_ajx_locale = ( isset( $_REQUEST['wpbc_ajx_locale'] ) ) ? esc_js( $_REQUEST['wpbc_ajx_locale'] ) : 'en_US'; | |
| 2132 | - | |
| 2133 | 2220 | return array( |
| 2134 | 2221 | |
| 2135 | 2222 | 'export_csv_url' => $export_csv_url |
| 2136 | 2223 | . '&export_type=' . $export_type |
| @@ -2147,969 +2234,9 @@ | ||
| 2147 | 2234 | |
| 2148 | 2235 | |
| 2149 | 2236 | // <editor-fold defaultstate="collapsed" desc=" == Button Actions Templates for UI == " > |
| 2150 | 2237 | |
| 2151 | - | |
| 2152 | 2238 | /** |
| 2153 | - * Show Costs booking Test field | |
| 2154 | - */ | |
| 2155 | - function wpbc_for_booking_template__action_cost(){ | |
| 2156 | - | |
| 2157 | - if ( ! class_exists('wpdev_bk_biz_s') ) { | |
| 2158 | - return false; | |
| 2159 | - } | |
| 2160 | - | |
| 2161 | - $booking_action = 'set_booking_cost'; | |
| 2162 | - $el_id = 'ui_btn_' . $booking_action . '{{data.parsed_fields.booking_id}}'; | |
| 2163 | - | |
| 2164 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2165 | - return false; | |
| 2166 | - } | |
| 2167 | - | |
| 2168 | - $params_addon = array( | |
| 2169 | - 'type' => 'span' | |
| 2170 | - , 'label' => '{{{data[\'parsed_fields\'][\'currency_symbol\']}}}' | |
| 2171 | - , 'html' => '{{{data[\'parsed_fields\'][\'currency_symbol\']}}}'//''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>' | |
| 2172 | - //, 'icon' => array( 'icon_font' => 'wpbc_icn_event', 'position' => 'right', 'icon_img' => '' ) | |
| 2173 | - //, 'class' => 'wpbc_ui_button inactive' | |
| 2174 | - , 'style' => 'font-weight:600;font-size: 14px;line-height: 28px;' | |
| 2175 | - , 'attr' => array() | |
| 2176 | - ); | |
| 2177 | - | |
| 2178 | - $param_text = array( | |
| 2179 | - 'type' => 'text' | |
| 2180 | - , 'id' => $el_id . '_cost' | |
| 2181 | - , 'name' => $el_id . '_cost' | |
| 2182 | - , 'label' => '' | |
| 2183 | - , 'disabled' => false | |
| 2184 | - , 'class' => 'set_booking_cost_text_field' | |
| 2185 | - , 'style' => 'width:5em;font-weight:600;' | |
| 2186 | - , 'placeholder' => '0' | |
| 2187 | - , 'attr' => array() | |
| 2188 | - , 'is_escape_value' => false | |
| 2189 | - , 'value' => '{{data[\'parsed_fields\'][\'cost\']}}' | |
| 2190 | - , 'onfocus' => '' | |
| 2191 | - , 'onkeydown' => "jQuery('.ui__set_booking_cost__section_in_booking_{{data['parsed_fields']['booking_id']}}').show();" // JavaScript code | |
| 2192 | - ); | |
| 2193 | - | |
| 2194 | - ?><div class="ui_element ui_nowrap"><?php | |
| 2195 | - //wpbc_flex_addon( $params_addon ); | |
| 2196 | - wpbc_flex_label( $params_addon ); | |
| 2197 | - wpbc_flex_text( $param_text ); | |
| 2198 | - ?></div><?php | |
| 2199 | - | |
| 2200 | - | |
| 2201 | - $params_button_save = array( | |
| 2202 | - 'type' => 'button' , | |
| 2203 | - 'title' => __( 'Save cost', 'booking' ) . ' ', // Title of the button | |
| 2204 | - 'hint' => array( 'title' => __( 'Save Changes', 'booking' ), 'position' => 'top' ), // Hint | |
| 2205 | - 'link' => 'javascript:void(0)', // Direct link or skip it | |
| 2206 | - 'action' => "wpbc_ajx_booking__ui_click_save__set_booking_cost( {{data['parsed_fields']['booking_id']}}, this, '{$booking_action}', '{$el_id}' );" , | |
| 2207 | - 'style' => '', // Any CSS class here | |
| 2208 | - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). | |
| 2209 | - 'icon' => array( 'icon_font' => 'wpbc_icn_check _circle_outline', 'position' => 'right', 'icon_img' => '' ), | |
| 2210 | - 'class' => 'wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary' | |
| 2211 | - 'attr' => array( 'id' => $el_id . '_save' ) | |
| 2212 | - ); | |
| 2213 | - | |
| 2214 | - $params_button_cancel = array( | |
| 2215 | - 'type' => 'button' , | |
| 2216 | - 'title' => __( 'Cancel', 'booking' ) . ' ', // Title of the button | |
| 2217 | - 'hint' => array( 'title' => __('Close' ,'booking'), 'position' => 'top' ), // Hint | |
| 2218 | - 'link' => 'javascript:void(0)', // Direct link or skip it | |
| 2219 | - 'action' => "wpbc_ajx_booking__ui_click_close__set_booking_cost();" , | |
| 2220 | - 'style' => '', // Any CSS class here | |
| 2221 | - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). | |
| 2222 | - 'icon' => array( 'icon_font' => 'wpbc_icn_close _block', 'position' => 'right', 'icon_img' => '' ), | |
| 2223 | - 'class' => '', // '' | 'wpbc_ui_button_primary' | |
| 2224 | - 'attr' => array( 'id' => $el_id . '_cancel' ) | |
| 2225 | - ); | |
| 2226 | - | |
| 2227 | - ?><div class="ui_element ui_nowrap ui__set_booking_cost__section_in_booking ui__set_booking_cost__section_in_booking_{{data['parsed_fields']['booking_id']}}"><?php | |
| 2228 | - wpbc_flex_button( $params_button_save ); | |
| 2229 | - ?></div><?php | |
| 2230 | - ?><div class="ui_element ui_nowrap ui__set_booking_cost__section_in_booking ui__set_booking_cost__section_in_booking_{{data['parsed_fields']['booking_id']}}"><?php | |
| 2231 | - wpbc_flex_button( $params_button_cancel ); | |
| 2232 | - ?></div><?php | |
| 2233 | - | |
| 2234 | - } | |
| 2235 | - | |
| 2236 | - /** | |
| 2237 | - * Show Payment Request booking Button | |
| 2238 | - */ | |
| 2239 | - function wpbc_for_booking_template__action_payment_request(){ | |
| 2240 | - | |
| 2241 | - if ( ! class_exists('wpdev_bk_biz_s') ) { | |
| 2242 | - return false; | |
| 2243 | - } | |
| 2244 | - | |
| 2245 | - $booking_action = 'send_payment_request'; | |
| 2246 | - | |
| 2247 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2248 | - return false; | |
| 2249 | - } | |
| 2250 | - | |
| 2251 | - $params = array( | |
| 2252 | - 'type' => 'button', | |
| 2253 | - 'title' => '', | |
| 2254 | - 'hint' => array( | |
| 2255 | - 'title' => __( 'Send payment request to visitor', 'booking' ), | |
| 2256 | - 'position' => 'top' | |
| 2257 | - ), | |
| 2258 | - 'link' => 'javascript:void(0)', | |
| 2259 | - //'action' => "js_func( {{data['parsed_fields']['booking_id']}} );", | |
| 2260 | - | |
| 2261 | - 'action' => "if ( 'function' === typeof( jQuery('#wpbc_modal__payment_request__section').wpbc_my_modal ) ) { | |
| 2262 | - jQuery('#wpbc_modal__payment_request__booking_id').val({{data['parsed_fields']['booking_id']}}); | |
| 2263 | - jQuery('#wpbc_modal__payment_request__section').wpbc_my_modal('show'); | |
| 2264 | - } else { | |
| 2265 | - alert( 'Warning! wpbc_my_modal module has not found. Please, recheck about any conflicts by deactivating other plugins.'); | |
| 2266 | - }", | |
| 2267 | - | |
| 2268 | - 'icon' => array( | |
| 2269 | - 'icon_font' => 'wpbc_icn_forward_to_inbox', | |
| 2270 | - 'position' => 'left', | |
| 2271 | - 'icon_img' => '' | |
| 2272 | - ), | |
| 2273 | - 'class' => '', | |
| 2274 | - 'style' => '', | |
| 2275 | - 'mobile_show_text' => true, | |
| 2276 | - 'attr' => array() | |
| 2277 | - ); | |
| 2278 | - | |
| 2279 | - | |
| 2280 | - ?><div class="ui_element"><?php | |
| 2281 | - wpbc_flex_button( $params ); | |
| 2282 | - ?></div><?php | |
| 2283 | - } | |
| 2284 | - | |
| 2285 | - | |
| 2286 | - /** | |
| 2287 | - * Show Payment Status booking Button | |
| 2288 | - */ | |
| 2289 | - function wpbc_for_booking_template__action_set_payment_status(){ | |
| 2290 | - | |
| 2291 | - if ( ! class_exists('wpdev_bk_biz_s') ) { | |
| 2292 | - return false; | |
| 2293 | - } | |
| 2294 | - | |
| 2295 | - $booking_action = 'set_payment_status'; | |
| 2296 | - | |
| 2297 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2298 | - return false; | |
| 2299 | - } | |
| 2300 | - | |
| 2301 | - $params = array( | |
| 2302 | - 'type' => 'button', | |
| 2303 | - 'title' => '', | |
| 2304 | - 'hint' => array( | |
| 2305 | - 'title' => __( 'Payment status', 'booking' ), | |
| 2306 | - 'position' => 'top' | |
| 2307 | - ), | |
| 2308 | - 'link' => 'javascript:void(0)', | |
| 2309 | - 'action' => "wpbc_ajx_booking__ui_click_show__set_payment_status( {{data['parsed_fields']['booking_id']}} );", | |
| 2310 | - 'icon' => array( | |
| 2311 | - 'icon_font' => 'wpbc_icn_sell', | |
| 2312 | - 'position' => 'left', | |
| 2313 | - 'icon_img' => '' | |
| 2314 | - ), | |
| 2315 | - 'class' => '', | |
| 2316 | - 'style' => '', | |
| 2317 | - 'mobile_show_text' => true, | |
| 2318 | - 'attr' => array() | |
| 2319 | - ); | |
| 2320 | - | |
| 2321 | - | |
| 2322 | - ?><div class="ui_element"><?php | |
| 2323 | - wpbc_flex_button( $params ); | |
| 2324 | - ?></div><?php | |
| 2325 | - } | |
| 2326 | - | |
| 2327 | - /** | |
| 2328 | - * Selectbox | Save | Close buttons for "Payment status" section | |
| 2329 | - * @return false|void | |
| 2330 | - */ | |
| 2331 | - function wpbc_for_booking_template_section__set_payment_status(){ | |
| 2332 | - | |
| 2333 | - if ( ! class_exists('wpdev_bk_biz_s') ) { | |
| 2334 | - return false; | |
| 2335 | - } | |
| 2336 | - | |
| 2337 | - $booking_action = 'set_payment_status'; | |
| 2338 | - | |
| 2339 | - $el_id = 'ui_btn_' . $booking_action . '{{data.parsed_fields.booking_id}}'; | |
| 2340 | - | |
| 2341 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2342 | - return false; | |
| 2343 | - } | |
| 2344 | - | |
| 2345 | - $select_box_options = get_payment_status_titles(); | |
| 2346 | - $select_box_options = array_flip( $select_box_options ); | |
| 2347 | - $params_select = array( | |
| 2348 | - 'id' => $el_id // HTML ID of element | |
| 2349 | - , 'name' => $el_id | |
| 2350 | - , 'label' => ''//__( 'Payment status', 'booking' ) // Label (optional) | |
| 2351 | - , 'style' => '' // CSS of select element | |
| 2352 | - , 'class' => '' // CSS Class of select element | |
| 2353 | - , 'multiple' => false | |
| 2354 | - , 'attr' => array( | |
| 2355 | - 'data-placeholder' => __( 'Change status', 'booking' ), | |
| 2356 | - 'ajx-selected-value' => '{{data.parsed_fields.pay_status}}' | |
| 2357 | - ) | |
| 2358 | - , 'disabled' => false | |
| 2359 | - , 'disabled_options' => array() // If some options disabled, then it has to list here | |
| 2360 | - , 'options' => $select_box_options | |
| 2361 | - //, 'value' => "{{data['parsed_fields']['pay_status']}}"//isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default | |
| 2362 | - //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code | |
| 2363 | - //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code | |
| 2364 | - ); | |
| 2365 | - | |
| 2366 | - $params_button_save = array( | |
| 2367 | - 'type' => 'button' , | |
| 2368 | - 'title' => __( 'Change status', 'booking' ) . ' ', // Title of the button | |
| 2369 | - 'hint' => array( 'title' => __( 'Save Changes', 'booking' ), 'position' => 'top' ), // Hint | |
| 2370 | - 'link' => 'javascript:void(0)', // Direct link or skip it | |
| 2371 | - 'action' => "wpbc_ajx_booking__ui_click_save__set_payment_status( {{data['parsed_fields']['booking_id']}}, this, '{$booking_action}', '{$el_id}' );" , | |
| 2372 | - 'style' => '', // Any CSS class here | |
| 2373 | - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). | |
| 2374 | - 'icon' => array( 'icon_font' => 'wpbc_icn_check _circle_outline', 'position' => 'right', 'icon_img' => '' ), | |
| 2375 | - 'class' => 'wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary' | |
| 2376 | - 'attr' => array( 'id' => $el_id . '_save' ) | |
| 2377 | - ); | |
| 2378 | - | |
| 2379 | - $params_button_cancel = array( | |
| 2380 | - 'type' => 'button' , | |
| 2381 | - 'title' => __( 'Cancel', 'booking' ) . ' ', // Title of the button | |
| 2382 | - 'hint' => array( 'title' => __('Close' ,'booking'), 'position' => 'top' ), // Hint | |
| 2383 | - 'link' => 'javascript:void(0)', // Direct link or skip it | |
| 2384 | - 'action' => "wpbc_ajx_booking__ui_click_close__set_payment_status();" , | |
| 2385 | - 'style' => '', // Any CSS class here | |
| 2386 | - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). | |
| 2387 | - 'icon' => array( 'icon_font' => 'wpbc_icn_close _block', 'position' => 'right', 'icon_img' => '' ), | |
| 2388 | - 'class' => '', // '' | 'wpbc_ui_button_primary' | |
| 2389 | - 'attr' => array( 'id' => $el_id . '_cancel' ) | |
| 2390 | - ); | |
| 2391 | - | |
| 2392 | - | |
| 2393 | - ?><div class="ui_element" style="flex:100%;"></div> | |
| 2394 | - <div id="ui__set_payment_status__section_in_booking_{{data['parsed_fields']['booking_id']}}" | |
| 2395 | - class="ui__set_payment_status__section_in_booking ui__under_actions_row__section_in_booking" | |
| 2396 | - > | |
| 2397 | - <div class="wpbc_ajx_toolbar wpbc_buttons_row wpbc_buttons_row_for_booking highlight_action_section"> <div class="ui_container ui_container_small"> <div class="ui_group"> | |
| 2398 | - | |
| 2399 | - <div class="ui_element"> | |
| 2400 | - <?php wpbc_flex_select($params_select); ?> | |
| 2401 | - </div> | |
| 2402 | - | |
| 2403 | - <div class="ui_element" > | |
| 2404 | - <?php wpbc_flex_button($params_button_save); ?> | |
| 2405 | - </div> | |
| 2406 | - | |
| 2407 | - <div class="ui_element"> | |
| 2408 | - <?php wpbc_flex_button($params_button_cancel); ?> | |
| 2409 | - </div> | |
| 2410 | - | |
| 2411 | - </div> </div> </div> | |
| 2412 | - <div class="clear"></div> | |
| 2413 | - | |
| 2414 | - </div><?php | |
| 2415 | - | |
| 2416 | - } | |
| 2417 | - | |
| 2418 | - | |
| 2419 | - /** | |
| 2420 | - * Show Edit booking Button | |
| 2421 | - */ | |
| 2422 | - function wpbc_for_booking_template__action_edit_booking(){ | |
| 2423 | - | |
| 2424 | - //FixIn: 9.2.3.4 | |
| 2425 | -// if ( ! class_exists('wpdev_bk_personal') ) { | |
| 2426 | -// return false; | |
| 2427 | -// } | |
| 2428 | - | |
| 2429 | - $booking_action = 'edit_booking'; | |
| 2430 | - | |
| 2431 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2432 | - return false; | |
| 2433 | - } | |
| 2434 | - | |
| 2435 | - $edit_booking_url = 'admin.php?page=' . wpbc_get_new_booking_url( false, false) | |
| 2436 | - . '&booking_type={{data.parsed_fields.resource_id}}&booking_hash={{data.parsed_fields.hash}}&parent_res=1' ; | |
| 2437 | - $edit_booking_url .= ( 'Off' !== get_bk_option( 'booking_is_resource_no_update__during_editing' ) ) ? '&resource_no_update=1' : ''; //FixIn: 9.4.2.3 | |
| 2438 | - | |
| 2439 | - $edit_booking_url .= '&booking_form={{data.parsed_fields.wpbc_custom_booking_form}}'; //FixIn: 9.4.3.12 | |
| 2440 | - | |
| 2441 | - $edit_booking_url .= '&is_show_payment_form=Off'; //FixIn: 9.9.0.38 | |
| 2442 | - | |
| 2443 | - $params = array( | |
| 2444 | - 'type' => 'button', | |
| 2445 | - 'title' => '', | |
| 2446 | - 'hint' => array( | |
| 2447 | - 'title' => __( 'Edit Booking', 'booking' ), | |
| 2448 | - 'position' => 'top' | |
| 2449 | - ), | |
| 2450 | - 'link' => $edit_booking_url,//'javascript:void(0)', | |
| 2451 | - 'action' => '',//"js_func( {{data['parsed_fields']['booking_id']}} );", | |
| 2452 | - 'icon' => array( | |
| 2453 | - 'icon_font' => 'wpbc_icn_draw', | |
| 2454 | - 'position' => 'left', | |
| 2455 | - 'icon_img' => '' | |
| 2456 | - ), | |
| 2457 | - 'class' => '', | |
| 2458 | - 'style' => '', | |
| 2459 | - 'mobile_show_text' => true, | |
| 2460 | - 'attr' => array() | |
| 2461 | - ); | |
| 2462 | - | |
| 2463 | - | |
| 2464 | - ?><div class="ui_element <# if ( '' == data['parsed_fields']['hash']) { #>disabled<# } #>"><?php | |
| 2465 | - wpbc_flex_button( $params ); | |
| 2466 | - ?></div><?php | |
| 2467 | - } | |
| 2468 | - | |
| 2469 | - /** | |
| 2470 | - * Show Change booking resource for booking Button | |
| 2471 | - */ | |
| 2472 | - function wpbc_for_booking_template__action_change_resource(){ | |
| 2473 | - | |
| 2474 | - if ( ! class_exists('wpdev_bk_personal') ) { | |
| 2475 | - return false; | |
| 2476 | - } | |
| 2477 | - | |
| 2478 | - $booking_action = 'change_booking_resource'; | |
| 2479 | - | |
| 2480 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2481 | - return false; | |
| 2482 | - } | |
| 2483 | - | |
| 2484 | - $params = array( | |
| 2485 | - 'type' => 'button', | |
| 2486 | - 'title' => '', | |
| 2487 | - 'hint' => array( | |
| 2488 | - 'title' => __( 'Change Resource', 'booking' ), | |
| 2489 | - 'position' => 'top' | |
| 2490 | - ), | |
| 2491 | - 'link' => 'javascript:void(0)', | |
| 2492 | - 'action' => "wpbc_ajx_booking__ui_click_show__change_resource( {{data['parsed_fields']['booking_id']}}, {{data['parsed_fields']['resource_id']}} );", | |
| 2493 | - 'icon' => array( | |
| 2494 | - 'icon_font' => 'wpbc_icn_shuffle', | |
| 2495 | - 'position' => 'left', | |
| 2496 | - 'icon_img' => '' | |
| 2497 | - ), | |
| 2498 | - 'class' => '', | |
| 2499 | - 'style' => '', | |
| 2500 | - 'mobile_show_text' => true, | |
| 2501 | - 'attr' => array() | |
| 2502 | - ); | |
| 2503 | - | |
| 2504 | - | |
| 2505 | - ?><div class="ui_element"><?php | |
| 2506 | - wpbc_flex_button( $params ); | |
| 2507 | - ?></div><?php | |
| 2508 | - } | |
| 2509 | - | |
| 2510 | - /** | |
| 2511 | - * Selectbox | Save | Close buttons for "Change booking resources" section | |
| 2512 | - * @return false|void | |
| 2513 | - */ | |
| 2514 | - function wpbc_for_booking_template_section__change_booking_resource(){ | |
| 2515 | - | |
| 2516 | - if ( ! class_exists('wpdev_bk_personal') ) { | |
| 2517 | - return false; | |
| 2518 | - } | |
| 2519 | - | |
| 2520 | - $booking_action = 'change_booking_resource'; | |
| 2521 | - | |
| 2522 | - $el_id = 'ui_btn_' . $booking_action; | |
| 2523 | - | |
| 2524 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2525 | - return false; | |
| 2526 | - } | |
| 2527 | - | |
| 2528 | - ?><div class="ui_element" style="flex:100%;"></div> | |
| 2529 | - <div id="ui__change_booking_resource__section_in_booking_{{data['parsed_fields']['booking_id']}}" | |
| 2530 | - class="ui__change_booking_resource__section_in_booking ui__under_actions_row__section_in_booking" | |
| 2531 | - ></div><?php | |
| 2532 | - } | |
| 2533 | - | |
| 2534 | - | |
| 2535 | - /** | |
| 2536 | - * Show Duplicate booking Button | |
| 2537 | - */ | |
| 2538 | - function wpbc_for_booking_template__action_duplicate_booking_to_other_resource(){ | |
| 2539 | - | |
| 2540 | - if ( ! class_exists('wpdev_bk_personal') ) { | |
| 2541 | - return false; | |
| 2542 | - } | |
| 2543 | - | |
| 2544 | - $booking_action = 'duplicate_booking_to_other_resource'; | |
| 2545 | - | |
| 2546 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2547 | - return false; | |
| 2548 | - } | |
| 2549 | - | |
| 2550 | - $params = array( | |
| 2551 | - 'type' => 'button', | |
| 2552 | - 'title' => '', | |
| 2553 | - 'hint' => array( | |
| 2554 | - 'title' => __( 'Duplicate Booking', 'booking' ), | |
| 2555 | - 'position' => 'top' | |
| 2556 | - ), | |
| 2557 | - 'link' => 'javascript:void(0)', | |
| 2558 | - 'action' => "wpbc_ajx_booking__ui_click_show__duplicate_booking( {{data['parsed_fields']['booking_id']}}, {{data['parsed_fields']['resource_id']}} );", | |
| 2559 | - 'icon' => array( | |
| 2560 | - 'icon_font' => 'wpbc_icn_content_copy', | |
| 2561 | - 'position' => 'left', | |
| 2562 | - 'icon_img' => '' | |
| 2563 | - ), | |
| 2564 | - 'class' => '', | |
| 2565 | - 'style' => '', | |
| 2566 | - 'mobile_show_text' => true, | |
| 2567 | - 'attr' => array() | |
| 2568 | - ); | |
| 2569 | - | |
| 2570 | - | |
| 2571 | - ?><div class="ui_element"><?php | |
| 2572 | - wpbc_flex_button( $params ); | |
| 2573 | - ?></div><?php | |
| 2574 | - } | |
| 2575 | - | |
| 2576 | - /** | |
| 2577 | - * Selectbox | Save | Close buttons for "Duplicate booking" section | |
| 2578 | - * @return false|void | |
| 2579 | - */ | |
| 2580 | - function wpbc_for_booking_template_section__duplicate_booking_to_other_resource(){ | |
| 2581 | - | |
| 2582 | - if ( ! class_exists('wpdev_bk_personal') ) { | |
| 2583 | - return false; | |
| 2584 | - } | |
| 2585 | - | |
| 2586 | - $booking_action = 'duplicate_booking_to_other_resource'; | |
| 2587 | - | |
| 2588 | - $el_id = 'ui_btn_' . $booking_action; | |
| 2589 | - | |
| 2590 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2591 | - return false; | |
| 2592 | - } | |
| 2593 | - | |
| 2594 | - ?><div class="ui_element" style="flex:100%;"></div> | |
| 2595 | - <div id="ui__duplicate_booking_to_other_resource__section_in_booking_{{data['parsed_fields']['booking_id']}}" | |
| 2596 | - class="ui__duplicate_booking_to_other_resource__section_in_booking ui__under_actions_row__section_in_booking" | |
| 2597 | - ></div><?php | |
| 2598 | - } | |
| 2599 | - | |
| 2600 | - | |
| 2601 | - /** | |
| 2602 | - * Show Print booking Button | |
| 2603 | - */ | |
| 2604 | - function wpbc_for_booking_template__action_print(){ | |
| 2605 | - | |
| 2606 | - if ( ! class_exists('wpdev_bk_personal') ) { | |
| 2607 | - //return false; | |
| 2608 | - } | |
| 2609 | - | |
| 2610 | - $booking_action = 'set_print'; | |
| 2611 | - | |
| 2612 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2613 | - return false; | |
| 2614 | - } | |
| 2615 | - | |
| 2616 | - $params = array( | |
| 2617 | - 'type' => 'button', | |
| 2618 | - 'title' => '', | |
| 2619 | - 'hint' => array( | |
| 2620 | - 'title' => __( 'Print', 'booking' ), | |
| 2621 | - 'position' => 'top' | |
| 2622 | - ), | |
| 2623 | - 'link' => 'javascript:void(0)', | |
| 2624 | - 'action' => "wpbc_print_dialog__show( {{data['parsed_fields']['booking_id']}} );", | |
| 2625 | - 'icon' => array( | |
| 2626 | - 'icon_font' => 'wpbc_icn_print', | |
| 2627 | - 'position' => 'left', | |
| 2628 | - 'icon_img' => '' | |
| 2629 | - ), | |
| 2630 | - 'class' => '', | |
| 2631 | - 'style' => '', | |
| 2632 | - 'mobile_show_text' => true, | |
| 2633 | - 'attr' => array() | |
| 2634 | - ); | |
| 2635 | - | |
| 2636 | - | |
| 2637 | - ?><div class="ui_element"><?php | |
| 2638 | - wpbc_flex_button( $params ); | |
| 2639 | - ?></div><?php | |
| 2640 | - } | |
| 2641 | - | |
| 2642 | - /** | |
| 2643 | - * Show Remark booking Button | |
| 2644 | - */ | |
| 2645 | - function wpbc_for_booking_template__action_remark(){ | |
| 2646 | - | |
| 2647 | - if ( ! class_exists('wpdev_bk_personal') ) { | |
| 2648 | - return false; | |
| 2649 | - } | |
| 2650 | - | |
| 2651 | - $booking_action = 'set_booking_note'; | |
| 2652 | - | |
| 2653 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2654 | - return false; | |
| 2655 | - } | |
| 2656 | - | |
| 2657 | - $params = array( | |
| 2658 | - 'type' => 'button', | |
| 2659 | - 'title' => '', | |
| 2660 | - 'hint' => array( | |
| 2661 | - 'title' => __( 'Edit Note', 'booking' ), | |
| 2662 | - 'position' => 'top' | |
| 2663 | - ), | |
| 2664 | - 'link' => 'javascript:void(0)', | |
| 2665 | - 'action' => "wpbc_ajx_booking__ui_click__remark( jQuery( this ) );", | |
| 2666 | - 'icon' => array( | |
| 2667 | - 'icon_font' => 'wpbc_icn_mode_comment', | |
| 2668 | - 'position' => 'left', | |
| 2669 | - 'icon_img' => '' | |
| 2670 | - ), | |
| 2671 | - 'class' => "{$booking_action}_button", | |
| 2672 | - 'style' => '', | |
| 2673 | - 'mobile_show_text' => true, | |
| 2674 | - 'attr' => array( 'id' => "{$booking_action}_button{{data.parsed_fields.booking_id}}" ) | |
| 2675 | - ); | |
| 2676 | - | |
| 2677 | - ?><div class="ui_element"><?php | |
| 2678 | - wpbc_flex_button( $params ); | |
| 2679 | - ?></div><?php | |
| 2680 | - } | |
| 2681 | - | |
| 2682 | - function wpbc_for_booking_template_section__action_remark_textarea(){ | |
| 2683 | - | |
| 2684 | - if ( ! class_exists('wpdev_bk_personal') ) { | |
| 2685 | - return false; | |
| 2686 | - } | |
| 2687 | - | |
| 2688 | - $booking_action = 'set_booking_note'; | |
| 2689 | - | |
| 2690 | - $el_id = 'ui_btn_' . $booking_action; | |
| 2691 | - | |
| 2692 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2693 | - return false; | |
| 2694 | - } | |
| 2695 | - | |
| 2696 | - $params_textarea = array( | |
| 2697 | - 'id' => "{$booking_action}_text_{{data.parsed_fields.booking_id}}" // HTML ID of element | |
| 2698 | - , 'name' => "{$booking_action}_text_{{data.parsed_fields.booking_id}}" // HTML ID of element | |
| 2699 | - , 'label' => '' | |
| 2700 | - , 'style' => 'height: 8em; width: 100%;' // CSS of select element | |
| 2701 | - , 'class' => "{$booking_action}_text" // CSS Class of select element | |
| 2702 | - , 'disabled' => false | |
| 2703 | - , 'attr' => array() // Any additional attributes, if this radio | checkbox element | |
| 2704 | - , 'rows' => '3' | |
| 2705 | - , 'cols' => '50' | |
| 2706 | - , 'placeholder' => '' | |
| 2707 | - , 'value' => '{{{data.parsed_fields.remark}}}' //FixIn: 9.4.4.1 | |
| 2708 | - , 'is_escape_value' => true | |
| 2709 | - //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code | |
| 2710 | - //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code | |
| 2711 | - ); | |
| 2712 | - | |
| 2713 | - $params_button_save = array( | |
| 2714 | - 'type' => 'button' , | |
| 2715 | - 'title' => __( 'Save', 'booking' ) . ' ', // Title of the button | |
| 2716 | - 'hint' => array( 'title' => __( 'Save Changes', 'booking' ), 'position' => 'top' ), // Hint | |
| 2717 | - 'link' => 'javascript:void(0)', // Direct link or skip it | |
| 2718 | - 'action' => "wpbc_ajx_booking_ajax_action_request( { | |
| 2719 | - 'booking_action' : '{$booking_action}', | |
| 2720 | - 'booking_id' : {{data.parsed_fields.booking_id}}, | |
| 2721 | - 'remark' : jQuery( '#{$booking_action}_text_{{data.parsed_fields.booking_id}}' ).val(), | |
| 2722 | - 'ui_clicked_element_id': '{$el_id}' | |
| 2723 | - } ); | |
| 2724 | - wpbc_button_enable_loading_icon( this ); " , | |
| 2725 | - 'style' => '', // Any CSS class here | |
| 2726 | - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). | |
| 2727 | - 'icon' => array( 'icon_font' => 'wpbc_icn_check _circle_outline', 'position' => 'right', 'icon_img' => '' ), | |
| 2728 | - 'class' => 'wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary' | |
| 2729 | - 'attr' => array( 'id' => $el_id ) | |
| 2730 | - ); | |
| 2731 | - | |
| 2732 | - $params_button_cancel = array( | |
| 2733 | - 'type' => 'button' , | |
| 2734 | - 'title' => __( 'Cancel', 'booking' ) . ' ', // Title of the button | |
| 2735 | - 'hint' => array( 'title' => __('Close' ,'booking'), 'position' => 'top' ), // Hint | |
| 2736 | - 'link' => 'javascript:void(0)', // Direct link or skip it | |
| 2737 | - 'action' => "wpbc_ajx_booking__ui_click__remark( jQuery( '#{$booking_action}_button{{data.parsed_fields.booking_id}}' ) );" , | |
| 2738 | - 'style' => '', // Any CSS class here | |
| 2739 | - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). | |
| 2740 | - 'icon' => array( 'icon_font' => 'wpbc_icn_close _block', 'position' => 'right', 'icon_img' => '' ), | |
| 2741 | - 'class' => '', // '' | 'wpbc_ui_button_primary' | |
| 2742 | - 'attr' => array( 'id' => $el_id . '_cancel' ) | |
| 2743 | - ); | |
| 2744 | - | |
| 2745 | - //$user_id = ( isset( $_REQUEST['wpbc_ajx_user_id'] ) ) ? intval( $_REQUEST['wpbc_ajx_user_id'] ) : wpbc_get_current_user_id(); | |
| 2746 | - //$is_expand_remarks = wpbc_ajx__user_request_option__is_expand_remarks( $user_id ); | |
| 2747 | - | |
| 2748 | - ?><div class="ui_remark_section is_expand_remarks_<?php //echo ($is_expand_remarks) ? 'on' : 'off'; ?>" | |
| 2749 | - style="<# if ( 'Off' === wpbc_ajx_booking_listing.search_get_param('ui_usr__is_expand_remarks') ) { #>display: none;<# } #>" | |
| 2750 | - ><?php | |
| 2751 | - | |
| 2752 | - wpbc_flex_textarea( $params_textarea ); | |
| 2753 | - | |
| 2754 | - ?><div class="ui_group"><?php | |
| 2755 | - | |
| 2756 | - ?><div class="ui_element" ><?php | |
| 2757 | - wpbc_flex_button($params_button_save); | |
| 2758 | - ?></div><?php | |
| 2759 | - | |
| 2760 | - ?><div class="ui_element"><?php | |
| 2761 | - wpbc_flex_button($params_button_cancel); | |
| 2762 | - ?></div><?php | |
| 2763 | - | |
| 2764 | - ?></div><?php | |
| 2765 | - | |
| 2766 | - ?></div><?php | |
| 2767 | - } | |
| 2768 | - | |
| 2769 | - /** | |
| 2770 | - * Show Locale booking Button | |
| 2771 | - */ | |
| 2772 | - function wpbc_for_booking_template__action_locale(){ | |
| 2773 | - | |
| 2774 | - $booking_action = 'set_booking_locale'; | |
| 2775 | - | |
| 2776 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2777 | - return false; | |
| 2778 | - } | |
| 2779 | - | |
| 2780 | - ?><span class="ui_element_locale"><?php | |
| 2781 | - | |
| 2782 | - $params = array( | |
| 2783 | - 'type' => 'button', | |
| 2784 | - 'id' => "button_locale_for_booking{{data['parsed_fields']['booking_id']}}", | |
| 2785 | - 'title' => '', | |
| 2786 | - 'hint' => array( | |
| 2787 | - 'title' => __( 'Change Language', 'booking' ), | |
| 2788 | - 'position' => 'top' | |
| 2789 | - ), | |
| 2790 | - 'link' => 'javascript:void(0)', | |
| 2791 | - 'action' => "jQuery('#locale_for_booking{{data[\'parsed_fields\'][\'booking_id\']}}').toggle();jQuery(this).hide();", | |
| 2792 | - 'icon' => array( | |
| 2793 | - 'icon_font' => 'wpbc_icn_language', | |
| 2794 | - 'position' => 'left', | |
| 2795 | - 'icon_img' => '' | |
| 2796 | - ), | |
| 2797 | - 'class' => 'set_booking_locale_button', | |
| 2798 | - 'style' => '', | |
| 2799 | - 'mobile_show_text' => true, | |
| 2800 | - 'attr' => array() | |
| 2801 | - ); | |
| 2802 | - | |
| 2803 | - ?><div class="ui_element"><?php | |
| 2804 | - wpbc_flex_button( $params ); | |
| 2805 | - ?></div><?php | |
| 2806 | - | |
| 2807 | - | |
| 2808 | - $el_id = "locale_for_booking{{data.parsed_fields.booking_id}}"; | |
| 2809 | - ?><# | |
| 2810 | - var selected_locale_value = ''; | |
| 2811 | - if ( | |
| 2812 | - ( 'undefined' !== typeof( data.parsed_fields.booking_options) ) | |
| 2813 | - && ( 'undefined' !== typeof( data.parsed_fields.booking_options.booking_meta_locale ) ) | |
| 2814 | - ){ | |
| 2815 | - var selected_locale_value = data.parsed_fields.booking_options.booking_meta_locale; | |
| 2816 | - } | |
| 2817 | - #><?php | |
| 2818 | - | |
| 2819 | - $availbale_locales_in_system = get_available_languages(); | |
| 2820 | - $select_box_options = array(); | |
| 2821 | - $select_box_options[''] = __( 'Default Locale', 'booking' ); | |
| 2822 | - $select_box_options['en_US'] = 'English (United States)'; | |
| 2823 | - | |
| 2824 | - foreach ( $availbale_locales_in_system as $locale ) { | |
| 2825 | - $select_box_options[$locale] = $locale; | |
| 2826 | - } | |
| 2827 | - | |
| 2828 | - $params_select = array( | |
| 2829 | - 'id' => $el_id // HTML ID of element | |
| 2830 | - , 'name' => $el_id | |
| 2831 | - , 'label' => '' // __( 'Next Days', 'booking' ) // Label (optional) | |
| 2832 | - , 'style' => 'display: none;' // CSS of select element | |
| 2833 | - , 'class' => 'set_booking_locale_selectbox' // CSS Class of select element | |
| 2834 | - //, 'multiple' => true | |
| 2835 | - , 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element | |
| 2836 | - , 'disabled' => false | |
| 2837 | - , 'disabled_options' => array() // If some options disabled, then it has to list here | |
| 2838 | - , 'options' => $select_box_options | |
| 2839 | - //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default | |
| 2840 | - //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code | |
| 2841 | - , 'onchange' => "jQuery(this).hide(); | |
| 2842 | - var jButton = jQuery('#button_locale_for_booking{{data[\'parsed_fields\'][\'booking_id\']}}'); | |
| 2843 | - jButton.show(); | |
| 2844 | - wpbc_button_enable_loading_icon( jButton.get(0) ); " | |
| 2845 | - . " wpbc_ajx_booking_ajax_action_request( { | |
| 2846 | - 'booking_action' : '{$booking_action}', | |
| 2847 | - 'booking_id' : {{data[\'parsed_fields\'][\'booking_id\']}}, | |
| 2848 | - 'booking_meta_locale' : jQuery('#locale_for_booking{{data[\'parsed_fields\'][\'booking_id\']}} option:selected').val() | |
| 2849 | - } );" | |
| 2850 | - | |
| 2851 | - ); | |
| 2852 | - | |
| 2853 | - ?><div class="ui_element"><?php | |
| 2854 | - wpbc_flex_select( $params_select ); | |
| 2855 | - ?></div><?php | |
| 2856 | - | |
| 2857 | - ?></span><?php | |
| 2858 | - } | |
| 2859 | - | |
| 2860 | - /** | |
| 2861 | - * Show "Add to Google Calendar" booking Button | |
| 2862 | - */ | |
| 2863 | - function wpbc_for_booking_template__action_add_google_calendar(){ | |
| 2864 | - | |
| 2865 | - $booking_action = 'booking_add_google_calendar'; | |
| 2866 | - | |
| 2867 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2868 | - return false; | |
| 2869 | - } | |
| 2870 | - | |
| 2871 | - $params = array( | |
| 2872 | - 'type' => 'button', | |
| 2873 | - 'title' => '', | |
| 2874 | - 'hint' => array( | |
| 2875 | - 'title' => __( 'Add to Google Calendar', 'booking' ), | |
| 2876 | - 'position' => 'top' | |
| 2877 | - ), | |
| 2878 | - 'link' => "{{{data['parsed_fields']['google_calendar_link']}}}", // "{{{encodeURIComponent(data['parsed_fields']['google_calendar_link'])}}}", | |
| 2879 | - 'options' => array( 'link' => 'no_decode' ), | |
| 2880 | - //'link' => 'javascript:void(0)', | |
| 2881 | - //'action' => " wpbc_ajx_booking_ajax_action_request( { | |
| 2882 | - // 'booking_action' : '{$booking_action}', | |
| 2883 | - // 'booking_id' : {{data['parsed_fields']['booking_id']}} | |
| 2884 | - // } ); | |
| 2885 | - // ", | |
| 2886 | - 'icon' => array( | |
| 2887 | - 'icon_font' => 'wpbc_icn_event', | |
| 2888 | - 'position' => 'left', | |
| 2889 | - 'icon_img' => '' | |
| 2890 | - ), | |
| 2891 | - 'class' => '', | |
| 2892 | - 'style' => '', | |
| 2893 | - 'mobile_show_text' => true, | |
| 2894 | - 'attr' => array('target'=>'_blank') | |
| 2895 | - ); | |
| 2896 | - | |
| 2897 | - ?><div class="ui_element"><?php | |
| 2898 | - wpbc_flex_button( $params ); | |
| 2899 | - ?></div><?php | |
| 2900 | - } | |
| 2901 | - | |
| 2902 | - /** | |
| 2903 | - * Show Trash booking Button | |
| 2904 | - */ | |
| 2905 | - function wpbc_for_booking_template__action_trash(){ | |
| 2906 | - | |
| 2907 | - $booking_action = 'move_booking_to_trash'; | |
| 2908 | - | |
| 2909 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2910 | - return false; | |
| 2911 | - } | |
| 2912 | - | |
| 2913 | - $params = array( | |
| 2914 | - 'type' => 'button', | |
| 2915 | - 'hint' => array( 'title' => __( 'Reject - move to trash', 'booking' ), 'position' => 'top' ), | |
| 2916 | - 'title' => '', | |
| 2917 | - 'link' => 'javascript:void(0)', | |
| 2918 | - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) { | |
| 2919 | - wpbc_ajx_booking_ajax_action_request( { | |
| 2920 | - 'booking_action' : '{$booking_action}', | |
| 2921 | - 'booking_id' : {{data['parsed_fields']['booking_id']}} | |
| 2922 | - } ); | |
| 2923 | - wpbc_button_enable_loading_icon( this ); | |
| 2924 | - }", | |
| 2925 | - 'icon' => array( | |
| 2926 | - 'icon_font' => 'wpbc_icn_delete_outline', | |
| 2927 | - 'position' => 'left', | |
| 2928 | - 'icon_img' => '' | |
| 2929 | - ), | |
| 2930 | - 'class' => '', | |
| 2931 | - 'style' => '', | |
| 2932 | - 'mobile_show_text' => true, | |
| 2933 | - 'attr' => array() | |
| 2934 | - ); | |
| 2935 | - | |
| 2936 | - ?><# if ( '0' == data['parsed_fields']['trash']) { #><?php | |
| 2937 | - ?><div class="ui_element"><?php | |
| 2938 | - wpbc_flex_button( $params ); | |
| 2939 | - ?></div><?php | |
| 2940 | - ?><# } #><?php | |
| 2941 | - } | |
| 2942 | - | |
| 2943 | - /** | |
| 2944 | - * Show Restore from Trash booking Button | |
| 2945 | - */ | |
| 2946 | - function wpbc_for_booking_template__action_trash_restore(){ | |
| 2947 | - | |
| 2948 | - $booking_action = 'restore_booking_from_trash'; | |
| 2949 | - | |
| 2950 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2951 | - return false; | |
| 2952 | - } | |
| 2953 | - | |
| 2954 | - $params = array( | |
| 2955 | - 'type' => 'button', | |
| 2956 | - 'hint' => array( 'title' => __( 'Restore', 'booking' ), 'position' => 'top' ), | |
| 2957 | - 'title' => '', | |
| 2958 | - 'link' => 'javascript:void(0)', | |
| 2959 | - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) { | |
| 2960 | - wpbc_ajx_booking_ajax_action_request( { | |
| 2961 | - 'booking_action' : '{$booking_action}', | |
| 2962 | - 'booking_id' : {{data['parsed_fields']['booking_id']}} | |
| 2963 | - } ); | |
| 2964 | - wpbc_button_enable_loading_icon( this ); | |
| 2965 | - }", | |
| 2966 | - 'icon' => array( | |
| 2967 | - 'icon_font' => 'wpbc_icn_rotate_left', | |
| 2968 | - 'position' => 'left', | |
| 2969 | - 'icon_img' => '' | |
| 2970 | - ), | |
| 2971 | - 'class' => '', | |
| 2972 | - 'style' => '', | |
| 2973 | - 'mobile_show_text' => true, | |
| 2974 | - 'attr' => array() | |
| 2975 | - ); | |
| 2976 | - | |
| 2977 | - ?><# if ( '1' == data['parsed_fields']['trash']) { #><?php | |
| 2978 | - ?><div class="ui_element"><?php | |
| 2979 | - wpbc_flex_button( $params ); | |
| 2980 | - ?></div><?php | |
| 2981 | - ?><# } #><?php | |
| 2982 | - } | |
| 2983 | - | |
| 2984 | - /** | |
| 2985 | - * Show Completely Delete booking Button | |
| 2986 | - */ | |
| 2987 | - function wpbc_for_booking_template__action_delete(){ | |
| 2988 | - | |
| 2989 | - $booking_action = 'delete_booking_completely'; | |
| 2990 | - | |
| 2991 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 2992 | - return false; | |
| 2993 | - } | |
| 2994 | - | |
| 2995 | - $params = array( | |
| 2996 | - 'type' => 'button', | |
| 2997 | - 'hint' => array( 'title' => __( 'Completely Delete', 'booking' ), 'position' => 'top' ), | |
| 2998 | - 'title' => '', | |
| 2999 | - 'link' => 'javascript:void(0)', | |
| 3000 | - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to delete this booking ?', 'booking' ) ) . "') ) { | |
| 3001 | - wpbc_ajx_booking_ajax_action_request( { | |
| 3002 | - 'booking_action' : '{$booking_action}', | |
| 3003 | - 'booking_id' : {{data['parsed_fields']['booking_id']}} | |
| 3004 | - } ); | |
| 3005 | - wpbc_button_enable_loading_icon( this ); | |
| 3006 | - }", | |
| 3007 | - 'icon' => array( | |
| 3008 | - 'icon_font' => 'wpbc_icn_close', | |
| 3009 | - 'position' => 'left', | |
| 3010 | - 'icon_img' => '' | |
| 3011 | - ), | |
| 3012 | - 'class' => '', | |
| 3013 | - 'style' => '', | |
| 3014 | - 'mobile_show_text' => true, | |
| 3015 | - 'attr' => array() | |
| 3016 | - ); | |
| 3017 | - | |
| 3018 | - ?><# if ( '1' == data['parsed_fields']['trash']) { #><?php | |
| 3019 | - ?><div class="ui_element"><?php | |
| 3020 | - wpbc_flex_button( $params ); | |
| 3021 | - ?></div><?php | |
| 3022 | - ?><# } #><?php | |
| 3023 | - } | |
| 3024 | - | |
| 3025 | - /** | |
| 3026 | - * Show Approved booking Button | |
| 3027 | - */ | |
| 3028 | - function wpbc_for_booking_template__action_approved(){ | |
| 3029 | - | |
| 3030 | - $booking_action = 'set_booking_approved'; | |
| 3031 | - | |
| 3032 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 3033 | - return false; | |
| 3034 | - } | |
| 3035 | - | |
| 3036 | - $params = array( | |
| 3037 | - 'type' => 'button', | |
| 3038 | - 'title' => '', | |
| 3039 | - 'hint' => array( | |
| 3040 | - 'title' => __( 'Approve', 'booking' ), | |
| 3041 | - 'position' => 'top' | |
| 3042 | - ), | |
| 3043 | - 'link' => 'javascript:void(0)', | |
| 3044 | - 'action' => "wpbc_ajx_booking_ajax_action_request( { | |
| 3045 | - 'booking_action' : '{$booking_action}', | |
| 3046 | - 'booking_id' : {{data['parsed_fields']['booking_id']}} | |
| 3047 | - } ); | |
| 3048 | - wpbc_button_enable_loading_icon( this ); ", | |
| 3049 | - 'icon' => array( | |
| 3050 | - 'icon_font' => 'wpbc_icn_check_circle_outline', | |
| 3051 | - 'position' => 'left', | |
| 3052 | - 'icon_img' => '' | |
| 3053 | - ), | |
| 3054 | - 'class' => '', | |
| 3055 | - 'style' => '', | |
| 3056 | - 'mobile_show_text' => true, | |
| 3057 | - 'attr' => array() | |
| 3058 | - ); | |
| 3059 | - | |
| 3060 | - ?><# if ( '0' == data['approved']) { #><?php | |
| 3061 | - ?><div class="ui_element"><?php | |
| 3062 | - wpbc_flex_button( $params ); | |
| 3063 | - ?></div><?php | |
| 3064 | - ?><# } #><?php | |
| 3065 | - } | |
| 3066 | - | |
| 3067 | - /** | |
| 3068 | - * Show Pending booking Button | |
| 3069 | - */ | |
| 3070 | - function wpbc_for_booking_template__action_pending(){ | |
| 3071 | - | |
| 3072 | - $booking_action = 'set_booking_pending'; | |
| 3073 | - | |
| 3074 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 3075 | - return false; | |
| 3076 | - } | |
| 3077 | - | |
| 3078 | - $params = array( | |
| 3079 | - 'type' => 'button', | |
| 3080 | - 'title' => '', | |
| 3081 | - 'hint' => array( | |
| 3082 | - 'title' => __( 'Pending', 'booking' ), | |
| 3083 | - 'position' => 'top' | |
| 3084 | - ), | |
| 3085 | - 'link' => 'javascript:void(0)', | |
| 3086 | - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to set booking as pending ?', 'booking' ) ) . "') ) { | |
| 3087 | - wpbc_ajx_booking_ajax_action_request( { | |
| 3088 | - 'booking_action' : '{$booking_action}', | |
| 3089 | - 'booking_id' : {{data['parsed_fields']['booking_id']}} | |
| 3090 | - } ); | |
| 3091 | - wpbc_button_enable_loading_icon( this ); | |
| 3092 | - }", | |
| 3093 | - 'icon' => array( | |
| 3094 | - 'icon_font' => 'wpbc_icn_block', | |
| 3095 | - 'position' => 'left', | |
| 3096 | - 'icon_img' => '' | |
| 3097 | - ), | |
| 3098 | - 'class' => '', | |
| 3099 | - 'style' => '', | |
| 3100 | - 'mobile_show_text' => true, | |
| 3101 | - 'attr' => array() | |
| 3102 | - ); | |
| 3103 | - | |
| 3104 | - ?><# if ( '1' == data['approved']) { #><?php | |
| 3105 | - ?><div class="ui_element"><?php | |
| 3106 | - wpbc_flex_button( $params ); | |
| 3107 | - ?></div><?php | |
| 3108 | - ?><# } #><?php | |
| 3109 | - } | |
| 3110 | - | |
| 3111 | - /** | |
| 3112 | 2239 | * Show Read booking Button |
| 3113 | 2240 | */ |
| 3114 | 2241 | function wpbc_for_booking_template__action_read(){ |
| 3115 | 2242 | |
| @@ -3132,9 +2259,9 @@ | ||
| 3132 | 2259 | 'booking_id' : {{data['parsed_fields']['booking_id']}} |
| 3133 | 2260 | } ); |
| 3134 | 2261 | wpbc_button_enable_loading_icon( this ); ", |
| 3135 | 2262 | 'icon' => array( |
| 3136 | - 'icon_font' => 'wpbc_icn_visibility', | |
| 2263 | + 'icon_font' => 'wpbc_icn_fiber_manual_record',// 'wpbc_icn_visibility', | |
| 3137 | 2264 | 'position' => 'left', |
| 3138 | 2265 | 'icon_img' => '' |
| 3139 | 2266 | ), |
| 3140 | 2267 | 'class' => 'wpbc_is_new_button', |
| @@ -3150,491 +2277,9 @@ | ||
| 3150 | 2277 | |
| 3151 | 2278 | // </editor-fold> |
| 3152 | 2279 | |
| 3153 | 2280 | |
| 3154 | -// <editor-fold defaultstate="collapsed" desc=" == Hidden Templates for sub action sections == " > | |
| 3155 | 2281 | |
| 3156 | - /** | |
| 3157 | - * Hidden Templates for - Booking Actions | |
| 3158 | - * | |
| 3159 | - * @param $page | |
| 3160 | - * | |
| 3161 | - * @return void | |
| 3162 | - */ | |
| 3163 | - function wpbc_for_booking_template__hidden_templates( $page ){ | |
| 3164 | - | |
| 3165 | - // page=wpbc&view_mode=vm_booking_listing | |
| 3166 | - if ( 'wpbc-ajx_booking' === $page ) { // it's from >> do_action( 'wpbc_hook_settings_page_footer', 'wpbc-ajx_booking' ); | |
| 3167 | - ?><div class="wpbc_hidden_templates"><?php | |
| 3168 | - | |
| 3169 | - wpbc_hidden_template__change_booking_resource(); | |
| 3170 | - | |
| 3171 | - wpbc_hidden_template__duplicate_booking_to_other_resource(); | |
| 3172 | - | |
| 3173 | - ?></div><?php | |
| 3174 | - | |
| 3175 | - wpbc_hidden_template__content_for_modal_payment_request(); | |
| 3176 | - | |
| 3177 | - wpbc_hidden_template__content_for_modal_import_google_calendar(); | |
| 3178 | - | |
| 3179 | - wpbc_hidden_template__content_for_modal_export_csv(); | |
| 3180 | - | |
| 3181 | - do_action( 'wpbc_hook_booking_template__hidden_templates' ); //FixIn: 9.2.3.6 | |
| 3182 | - } | |
| 3183 | - } | |
| 3184 | - | |
| 3185 | - if ( 'vm_booking_listing' == wpbc_ajx_booking_listing__get_default_view_mode() ) { | |
| 3186 | - //if ( strpos( $_SERVER['REQUEST_URI'], 'view_mode=vm_booking_listing' ) !== false ) { // Load only at AJX_Bookings Settings Page | |
| 3187 | - add_action( 'wpbc_hook_settings_page_footer', 'wpbc_for_booking_template__hidden_templates' ); | |
| 3188 | - } | |
| 3189 | - | |
| 3190 | - | |
| 3191 | - /** | |
| 3192 | - * Hidden template -- Change booking resources | |
| 3193 | - * | |
| 3194 | - * We need to have such hidden template for generating select box for booking resource only once, while we show Listing. | |
| 3195 | - * It's called each time from wpbc_ajx_define_templates__resource_manipulation() in wpbc_ajx_booking_show_listing() | |
| 3196 | - * So we renew booking resource list with each Ajax request for Booking Listing. | |
| 3197 | - * | |
| 3198 | - * @return void | |
| 3199 | - */ | |
| 3200 | - function wpbc_hidden_template__change_booking_resource(){ | |
| 3201 | - | |
| 3202 | - // Here will be composed template with real HTML defined in "booking_listing.js" file in function wpbc_ajx_booking_show_listing( ... | |
| 3203 | - ?><div id="wpbc_hidden_template__change_booking_resource"></div><?php | |
| 3204 | - | |
| 3205 | - // Template | |
| 3206 | - ?><script type="text/html" id="tmpl-wpbc_ajx_change_booking_resource"><?php | |
| 3207 | - | |
| 3208 | - if ( ! class_exists('wpdev_bk_personal') ) { | |
| 3209 | - echo '</script>'; | |
| 3210 | - return false; | |
| 3211 | - } | |
| 3212 | - /* | |
| 3213 | - ?><# console.log( ' == TEMPLATE PARAMS "wpbc_ajx_change_booking_resource" == ', data ); #><?php | |
| 3214 | - */ | |
| 3215 | - $booking_action = 'change_booking_resource'; | |
| 3216 | - | |
| 3217 | - $el_id = 'ui_btn_' . $booking_action; | |
| 3218 | - | |
| 3219 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 3220 | - echo '</script>'; | |
| 3221 | - return false; | |
| 3222 | - } | |
| 3223 | - | |
| 3224 | - $params_button_save = array( | |
| 3225 | - 'type' => 'button' , | |
| 3226 | - 'title' => __( 'Change', 'booking' ) . ' ', // Title of the button | |
| 3227 | - 'hint' => array( 'title' => __( 'Save Changes', 'booking' ), 'position' => 'top' ), // Hint | |
| 3228 | - 'link' => 'javascript:void(0)', // Direct link or skip it | |
| 3229 | - 'action' => "wpbc_ajx_booking__ui_click_save__change_resource( this, '{$booking_action}', '{$el_id}' );" , | |
| 3230 | - 'style' => '', // Any CSS class here | |
| 3231 | - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). | |
| 3232 | - 'icon' => array( 'icon_font' => 'wpbc_icn_check _circle_outline', 'position' => 'right', 'icon_img' => '' ), | |
| 3233 | - 'class' => 'wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary' | |
| 3234 | - 'attr' => array( 'id' => $el_id ) | |
| 3235 | - ); | |
| 3236 | - | |
| 3237 | - $params_button_cancel = array( | |
| 3238 | - 'type' => 'button' , | |
| 3239 | - 'title' => __( 'Cancel', 'booking' ) . ' ', // Title of the button | |
| 3240 | - 'hint' => array( 'title' => __('Close' ,'booking'), 'position' => 'top' ), // Hint | |
| 3241 | - 'link' => 'javascript:void(0)', // Direct link or skip it | |
| 3242 | - 'action' => "wpbc_ajx_booking__ui_click_close__change_resource();" , | |
| 3243 | - 'style' => '', // Any CSS class here | |
| 3244 | - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). | |
| 3245 | - 'icon' => array( 'icon_font' => 'wpbc_icn_close _block', 'position' => 'right', 'icon_img' => '' ), | |
| 3246 | - 'class' => '', // '' | 'wpbc_ui_button_primary' | |
| 3247 | - 'attr' => array( 'id' => $el_id . '_cancel' ) | |
| 3248 | - ); | |
| 3249 | - | |
| 3250 | - ?><div id="change_booking_resource__section" class="highlight_action_section"> | |
| 3251 | - <div class="wpbc_ajx_toolbar wpbc_buttons_row wpbc_buttons_row_for_booking"> <div class="ui_container ui_container_small"> <div class="ui_group"> | |
| 3252 | - | |
| 3253 | - <input type="hidden" value="" id="change_booking_resource__booking_id" /> | |
| 3254 | - | |
| 3255 | - <div class="ui_element"> | |
| 3256 | - | |
| 3257 | - <select id="change_booking_resource__resource_select" name="change_booking_resource__resource_select" class="wpbc_ui_control wpbc_ui_select change_booking_resource_selectbox"> | |
| 3258 | - <# <?php if (0) { ?><script type="text/javascript"><?php /* Hack for showing JavaScript syntax */ } ?> | |
| 3259 | - _.each( data.ajx_booking_resources, function ( p_resource, p_resource_id, p_data ){ | |
| 3260 | - #><option value="{{p_resource.booking_type_id}}" | |
| 3261 | - style="<# | |
| 3262 | - if( undefined != p_resource.parent ) { | |
| 3263 | - if( '0' == p_resource.parent ) { | |
| 3264 | - #>font-weight:600;<# | |
| 3265 | - } else { | |
| 3266 | - #>font-size:0.95em;padding-left:20px;<# | |
| 3267 | - } | |
| 3268 | - } | |
| 3269 | - #>" | |
| 3270 | - ><# | |
| 3271 | - if( undefined != p_resource.parent ) { | |
| 3272 | - if( '0' != p_resource.parent ) { | |
| 3273 | - #> <# | |
| 3274 | - } | |
| 3275 | - } | |
| 3276 | - #>{{p_resource.title}}</option><# | |
| 3277 | - }); <?php if (0) { ?></script><?php /* Hack for showing JavaScript syntax */ } ?> | |
| 3278 | - #> | |
| 3279 | - </select> | |
| 3280 | - | |
| 3281 | - </div> | |
| 3282 | - | |
| 3283 | - <div class="ui_element" > | |
| 3284 | - <?php wpbc_flex_button($params_button_save); ?> | |
| 3285 | - </div> | |
| 3286 | - | |
| 3287 | - <div class="ui_element"> | |
| 3288 | - <?php wpbc_flex_button($params_button_cancel); ?> | |
| 3289 | - </div> | |
| 3290 | - | |
| 3291 | - </div> </div> </div> | |
| 3292 | - <div class="clear"></div> | |
| 3293 | - </div> | |
| 3294 | - | |
| 3295 | - </script><?php | |
| 3296 | - } | |
| 3297 | - | |
| 3298 | - | |
| 3299 | - /** | |
| 3300 | - * Hidden template -- Duplicate booking to other resources | |
| 3301 | - * | |
| 3302 | - * We need to have such hidden template for generating select box for booking resource only once, while we show Listing. | |
| 3303 | - * It's called each time from wpbc_ajx_define_templates__resource_manipulation() in wpbc_ajx_booking_show_listing() | |
| 3304 | - * So we renew booking resource list with each Ajax request for Booking Listing. | |
| 3305 | - * | |
| 3306 | - * @return void | |
| 3307 | - */ | |
| 3308 | - function wpbc_hidden_template__duplicate_booking_to_other_resource(){ | |
| 3309 | - | |
| 3310 | - // Here will be composed template with real HTML defined in "booking_listing.js" file in function wpbc_ajx_booking_show_listing( ... | |
| 3311 | - ?><div id="wpbc_hidden_template__duplicate_booking_to_other_resource"></div><?php | |
| 3312 | - | |
| 3313 | - // Template | |
| 3314 | - ?><script type="text/html" id="tmpl-wpbc_ajx_duplicate_booking_to_other_resource"><?php | |
| 3315 | - | |
| 3316 | - if ( ! class_exists('wpdev_bk_personal') ) { | |
| 3317 | - echo '</script>'; | |
| 3318 | - return false; | |
| 3319 | - } | |
| 3320 | - /* | |
| 3321 | - ?><# console.log( ' == TEMPLATE PARAMS "wpbc_ajx_duplicate_booking_to_other_resource" == ', data ); #><?php | |
| 3322 | - /**/ | |
| 3323 | - $booking_action = 'duplicate_booking_to_other_resource'; | |
| 3324 | - | |
| 3325 | - $el_id = 'ui_btn_' . $booking_action; | |
| 3326 | - | |
| 3327 | - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { | |
| 3328 | - echo '</script>'; | |
| 3329 | - return false; | |
| 3330 | - } | |
| 3331 | - | |
| 3332 | - $params_button_save = array( | |
| 3333 | - 'type' => 'button' , | |
| 3334 | - 'title' => __( 'Duplicate Booking', 'booking' ) . ' ', // Title of the button | |
| 3335 | - 'hint' => array( 'title' => __( 'Save Changes', 'booking' ), 'position' => 'top' ), // Hint | |
| 3336 | - 'link' => 'javascript:void(0)', // Direct link or skip it | |
| 3337 | - 'action' => "wpbc_ajx_booking__ui_click_save__duplicate_booking( this, '{$booking_action}', '{$el_id}' );" , | |
| 3338 | - 'style' => '', // Any CSS class here | |
| 3339 | - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). | |
| 3340 | - 'icon' => array( 'icon_font' => 'wpbc_icn_check _circle_outline', 'position' => 'right', 'icon_img' => '' ), | |
| 3341 | - 'class' => 'wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary' | |
| 3342 | - 'attr' => array( 'id' => $el_id ) | |
| 3343 | - ); | |
| 3344 | - | |
| 3345 | - $params_button_cancel = array( | |
| 3346 | - 'type' => 'button' , | |
| 3347 | - 'title' => __( 'Cancel', 'booking' ) . ' ', // Title of the button | |
| 3348 | - 'hint' => array( 'title' => __('Close' ,'booking'), 'position' => 'top' ), // Hint | |
| 3349 | - 'link' => 'javascript:void(0)', // Direct link or skip it | |
| 3350 | - 'action' => "wpbc_ajx_booking__ui_click_close__duplicate_booking();" , | |
| 3351 | - 'style' => '', // Any CSS class here | |
| 3352 | - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). | |
| 3353 | - 'icon' => array( 'icon_font' => 'wpbc_icn_close _block', 'position' => 'right', 'icon_img' => '' ), | |
| 3354 | - 'class' => '', // '' | 'wpbc_ui_button_primary' | |
| 3355 | - 'attr' => array( 'id' => $el_id . '_cancel' ) | |
| 3356 | - ); | |
| 3357 | - | |
| 3358 | - ?><div id="duplicate_booking_to_other_resource__section" class="highlight_action_section"> | |
| 3359 | - <div class="wpbc_ajx_toolbar wpbc_buttons_row wpbc_buttons_row_for_booking"> <div class="ui_container ui_container_small"> <div class="ui_group"> | |
| 3360 | - | |
| 3361 | - <input type="hidden" value="" id="duplicate_booking_to_other_resource__booking_id" /> | |
| 3362 | - | |
| 3363 | - <div class="ui_element"> | |
| 3364 | - | |
| 3365 | - <select id="duplicate_booking_to_other_resource__resource_select" name="duplicate_booking_to_other_resource__resource_select" class="wpbc_ui_control wpbc_ui_select duplicate_booking_to_other_resource_selectbox"> | |
| 3366 | - <# <?php if (0) { ?><script><?php /* Hack for showing JavaScript syntax */ } ?> | |
| 3367 | - _.each( data.ajx_booking_resources, function ( p_resource, p_resource_id, p_data ){ | |
| 3368 | - #><option value="{{p_resource.booking_type_id}}" | |
| 3369 | - style="<# | |
| 3370 | - if( undefined != p_resource.parent ) { | |
| 3371 | - if( '0' == p_resource.parent ) { | |
| 3372 | - #>font-weight:600;<# | |
| 3373 | - } else { | |
| 3374 | - #>font-size:0.95em;padding-left:20px;<# | |
| 3375 | - } | |
| 3376 | - } | |
| 3377 | - #>" | |
| 3378 | - ><# | |
| 3379 | - if( undefined != p_resource.parent ) { | |
| 3380 | - if( '0' != p_resource.parent ) { | |
| 3381 | - #> <# | |
| 3382 | - } | |
| 3383 | - } | |
| 3384 | - #>{{p_resource.title}}</option><# | |
| 3385 | - }); <?php if (0) { ?></script><?php /* Hack for showing JavaScript syntax */ } ?> | |
| 3386 | - #> | |
| 3387 | - </select> | |
| 3388 | - | |
| 3389 | - </div> | |
| 3390 | - | |
| 3391 | - <div class="ui_element" > | |
| 3392 | - <?php wpbc_flex_button($params_button_save); ?> | |
| 3393 | - </div> | |
| 3394 | - | |
| 3395 | - <div class="ui_element"> | |
| 3396 | - <?php wpbc_flex_button($params_button_cancel); ?> | |
| 3397 | - </div> | |
| 3398 | - | |
| 3399 | - </div> </div> </div> | |
| 3400 | - <div class="clear"></div> | |
| 3401 | - </div> | |
| 3402 | - | |
| 3403 | - </script><?php | |
| 3404 | - } | |
| 3405 | - | |
| 3406 | - | |
| 3407 | - /** Payment Request Layout - Modal Window structure */ | |
| 3408 | - function wpbc_hidden_template__content_for_modal_payment_request() { | |
| 3409 | - | |
| 3410 | - if ( ! class_exists('wpdev_bk_biz_s') ) { | |
| 3411 | - return false; | |
| 3412 | - } | |
| 3413 | - ?><span class="wpdevelop"> | |
| 3414 | - <div id="wpbc_modal__payment_request__section" class="modal wpbc_popup_modal" tabindex="-1" role="dialog"> | |
| 3415 | - <div class="modal-dialog"> | |
| 3416 | - <div class="modal-content"> | |
| 3417 | - <div class="modal-header"> | |
| 3418 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
| 3419 | - <h4 class="modal-title"><?php _e('Send payment request to customer' ,'booking'); ?></h4> | |
| 3420 | - </div> | |
| 3421 | - <div class="modal-body"> | |
| 3422 | - <textarea id="wpbc_modal__payment_request__reason_of_action" name="wpbc_modal__payment_request__reason_of_action" style="width:100%;" cols="87" rows="5"></textarea> | |
| 3423 | - <label class="help-block"><?php printf(__('Type your %sreason for payment%s request' ,'booking'),'<b>',',</b>');?></label> | |
| 3424 | - <input type="hidden" id="wpbc_modal__payment_request__booking_id" value="" /> | |
| 3425 | - </div> | |
| 3426 | - <div class="modal-footer"> | |
| 3427 | - <a id="wpbc_modal__payment_request__button_send" class="button button-primary" | |
| 3428 | - onclick="javascript: wpbc_ajx_booking__ui_click__send_payment_request();" href="javascript:void(0);" | |
| 3429 | - ><?php _e('Send Request' ,'booking'); ?></a> | |
| 3430 | - <a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal"><?php _e('Close' ,'booking'); ?></a> | |
| 3431 | - </div> | |
| 3432 | - </div><!-- /.modal-content --> | |
| 3433 | - </div><!-- /.modal-dialog --> | |
| 3434 | - </div><!-- /.modal --> | |
| 3435 | - </span><?php | |
| 3436 | - } | |
| 3437 | - | |
| 3438 | - /** Payment Request Loyout - Modal Window structure */ | |
| 3439 | - function wpbc_hidden_template__content_for_modal_import_google_calendar() { | |
| 3440 | - | |
| 3441 | - ?><span class="wpdevelop"><?php | |
| 3442 | - | |
| 3443 | - $booking_gcal_feed = get_bk_option( 'booking_gcal_feed'); | |
| 3444 | - $is_this_btn_disabled = false; | |
| 3445 | - | |
| 3446 | - if ( ( ! class_exists('wpdev_bk_personal') ) && ( $booking_gcal_feed == '' ) ) { | |
| 3447 | - | |
| 3448 | - $is_this_btn_disabled = true; | |
| 3449 | - $settigns_link = wpbc_get_settings_url() . "&tab=sync&subtab=gcal"; | |
| 3450 | - } else { | |
| 3451 | - $booking_gcal_events_from = get_bk_option( 'booking_gcal_events_from' ); | |
| 3452 | - $booking_gcal_events_from_offset = get_bk_option( 'booking_gcal_events_from_offset' ); | |
| 3453 | - $booking_gcal_events_from_offset_type = get_bk_option( 'booking_gcal_events_from_offset_type' ); | |
| 3454 | - | |
| 3455 | - $booking_gcal_events_until = get_bk_option( 'booking_gcal_events_until' ); | |
| 3456 | - $booking_gcal_events_until_offset = get_bk_option( 'booking_gcal_events_until_offset' ); | |
| 3457 | - $booking_gcal_events_until_offset_type = get_bk_option( 'booking_gcal_events_until_offset_type' ); | |
| 3458 | - | |
| 3459 | - $booking_gcal_events_max = get_bk_option( 'booking_gcal_events_max' ); | |
| 3460 | - // $booking_gcal_timezone = get_bk_option( 'booking_gcal_timezone'); | |
| 3461 | - | |
| 3462 | - | |
| 3463 | - } | |
| 3464 | - ?><div id="wpbc_modal__import_google_calendar__section" class="modal wpbc_popup_modal wpbc_modal__import_google_calendar__section" tabindex="-1" role="dialog"> | |
| 3465 | - <div class="modal-dialog modal-lg"> | |
| 3466 | - <div class="modal-content"> | |
| 3467 | - <div class="modal-header"> | |
| 3468 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
| 3469 | - <h4 class="modal-title"><?php | |
| 3470 | - if ( $is_this_btn_disabled ) _e('Warning!' ,'booking'); | |
| 3471 | - else _e('Retrieve Google Calendar Events ' ,'booking'); | |
| 3472 | - ?></h4> | |
| 3473 | - </div> | |
| 3474 | - <div class="modal-body"> | |
| 3475 | - <?php if ($is_this_btn_disabled) { ?> | |
| 3476 | - <label class="help-block" style="display:block;"> | |
| 3477 | - <?php printf(__('Please configure settings for import Google Calendar events' ,'booking'),'<b>',',</b>'); ?> | |
| 3478 | - <a href="<?php echo $settigns_link; ?>"><?php _e('here' ,'booking');?></a> | |
| 3479 | - </label> | |
| 3480 | - <?php } else { ?> | |
| 3481 | - | |
| 3482 | - <table class="visibility_gcal_feeds_settings form-table0 settings-table0 table" > | |
| 3483 | - <tbody> | |
| 3484 | - <?php | |
| 3485 | - if ( function_exists('wpbc_gcal_settings_content_field_selection_booking_resources') ) | |
| 3486 | - wpbc_gcal_settings_content_field_selection_booking_resources(); | |
| 3487 | - else { | |
| 3488 | - ?><input type="hidden" name="wpbc_booking_resource" id="wpbc_booking_resource" value="" /><?php | |
| 3489 | - } | |
| 3490 | - wpbc_gcal_settings_content_field_from( $booking_gcal_events_from, $booking_gcal_events_from_offset, $booking_gcal_events_from_offset_type ); | |
| 3491 | - wpbc_gcal_settings_content_field_until( $booking_gcal_events_until, $booking_gcal_events_until_offset, $booking_gcal_events_until_offset_type ); | |
| 3492 | - wpbc_gcal_settings_content_field_max_feeds( $booking_gcal_events_max ); | |
| 3493 | - // wpbc_gcal_settings_content_field_timezone($booking_gcal_timezone); | |
| 3494 | - | |
| 3495 | - ?> | |
| 3496 | - </tbody> | |
| 3497 | - </table> | |
| 3498 | - | |
| 3499 | - <?php } ?> | |
| 3500 | - </div> | |
| 3501 | - <div class="modal-footer" style="text-align:center;"> | |
| 3502 | - <?php if ($is_this_btn_disabled) { ?> | |
| 3503 | - <a href="<?php echo $settigns_link; ?>" | |
| 3504 | - class="button button-primary" style="float:none;" > | |
| 3505 | - <?php _e('Configure' ,'booking'); ?> | |
| 3506 | - </a> | |
| 3507 | - <?php } else { ?> | |
| 3508 | - <a href="javascript:void(0)" class="button button-primary" style="float:none;" | |
| 3509 | - id="wpbc_modal__import_google_calendar__button_send" | |
| 3510 | - onclick="javascript:wpbc_ajx_booking__ui_click__import_google_calendar();jQuery('#wpbc_modal__import_google_calendar__section').wpbc_my_modal('hide');" | |
| 3511 | - ><?php _e('Import Google Calendar Events' ,'booking'); ?></a> | |
| 3512 | - <?php } ?> | |
| 3513 | - <a href="javascript:void(0)" class="button" style="float:none;" data-dismiss="modal"><?php _e('Close' ,'booking'); ?></a> | |
| 3514 | - </div> | |
| 3515 | - </div><!-- /.modal-content --> | |
| 3516 | - </div><!-- /.modal-dialog --> | |
| 3517 | - </div><!-- /.modal --> | |
| 3518 | - <?php | |
| 3519 | - | |
| 3520 | - ?></span><?php | |
| 3521 | - } | |
| 3522 | - | |
| 3523 | - | |
| 3524 | - /** Payment Request Layout - Modal Window structure */ | |
| 3525 | - function wpbc_hidden_template__content_for_modal_export_csv() { | |
| 3526 | - | |
| 3527 | - if ( ! class_exists('wpdev_bk_personal') ) { | |
| 3528 | - return false; | |
| 3529 | - } | |
| 3530 | - | |
| 3531 | - $user_id = ( isset( $_REQUEST['wpbc_ajx_user_id'] ) ) ? intval( $_REQUEST['wpbc_ajx_user_id'] ) : wpbc_get_current_user_id(); | |
| 3532 | - $booking_csv_export_params = get_user_option( 'booking_csv_export_params', (int) $user_id ); | |
| 3533 | - $booking_csv_export_params = ( ! empty( $booking_csv_export_params ) ) ? $booking_csv_export_params : array(); | |
| 3534 | - $defaults= array( | |
| 3535 | - 'export_type' => 'csv_all', | |
| 3536 | - 'selected_id' => '', | |
| 3537 | - 'csv_export_separator' => 'semicolon', | |
| 3538 | - 'csv_export_skip_fields' => '' | |
| 3539 | - ); | |
| 3540 | - $export_params_arr = wp_parse_args( $booking_csv_export_params, $defaults ); | |
| 3541 | - | |
| 3542 | - ?><span class="wpdevelop"> | |
| 3543 | - <div id="wpbc_modal__export_csv__section" class="modal wpbc_popup_modal" tabindex="-1" role="dialog"> | |
| 3544 | - <div class="modal-dialog"> | |
| 3545 | - <div class="modal-content"> | |
| 3546 | - <div class="modal-header"> | |
| 3547 | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
| 3548 | - <h4 class="modal-title"><?php _e('CSV Export' ,'booking'); ?></h4> | |
| 3549 | - </div> | |
| 3550 | - <div class="modal-body"> | |
| 3551 | - <table class="form-table"><tbody> | |
| 3552 | - <?php | |
| 3553 | - $default_options_values = wpbc_get_default_options(); | |
| 3554 | - | |
| 3555 | - $field_options = array( | |
| 3556 | - 'semicolon' => '; - ' . __( 'semicolon', 'booking' ) | |
| 3557 | - , 'comma' => ', - ' . __( 'comma', 'booking' ) | |
| 3558 | - ); | |
| 3559 | - $fields = array( | |
| 3560 | - 'type' => 'select' | |
| 3561 | - , 'value' => $export_params_arr['csv_export_separator'] //';' | |
| 3562 | - , 'title' => __('CSV data separator', 'booking') | |
| 3563 | - , 'description' => ''//sprintf(__('Select separator of data for export bookings to CSV.' ,'booking'),'<b>','</b>') | |
| 3564 | - , 'options' => $field_options | |
| 3565 | - , 'label' => '' | |
| 3566 | - , 'disabled' => false | |
| 3567 | - , 'disabled_options' => array() | |
| 3568 | - , 'multiple' => false | |
| 3569 | - , 'description_tag' => 'p' | |
| 3570 | - , 'tr_class' => '' | |
| 3571 | - , 'class' => '' | |
| 3572 | - , 'css' => '' | |
| 3573 | - , 'only_field' => false | |
| 3574 | - , 'attr' => array() | |
| 3575 | - //, 'value' => '' | |
| 3576 | - ); | |
| 3577 | - | |
| 3578 | - WPBC_Settings_API::field_select_row_static( 'wpbc_field_booking_csv_export_separator', $fields ); | |
| 3579 | - | |
| 3580 | - | |
| 3581 | - $field_options = array( | |
| 3582 | - 'csv_page' => __( 'Current page', 'booking' ) | |
| 3583 | - , 'csv_all' => __( 'All pages', 'booking' ) | |
| 3584 | - ); | |
| 3585 | - $fields = array( | |
| 3586 | - 'type' => 'select' | |
| 3587 | - , 'value' => $export_params_arr['export_type'] | |
| 3588 | - , 'title' => __('Export pages', 'booking') | |
| 3589 | - , 'description' => ''//sprintf(__('Select exporting current page or all pages.' ,'booking'),'<b>','</b>') | |
| 3590 | - , 'options' => $field_options | |
| 3591 | - , 'label' => '' | |
| 3592 | - , 'disabled' => false | |
| 3593 | - , 'disabled_options' => array() | |
| 3594 | - , 'multiple' => false | |
| 3595 | - , 'description_tag' => 'p' | |
| 3596 | - , 'tr_class' => '' | |
| 3597 | - , 'class' => '' | |
| 3598 | - , 'css' => '' | |
| 3599 | - , 'only_field' => false | |
| 3600 | - , 'attr' => array() | |
| 3601 | - //, 'value' => '' | |
| 3602 | - ); | |
| 3603 | - | |
| 3604 | - WPBC_Settings_API::field_select_row_static( 'wpbc_field_booking_csv_export_type', $fields ); | |
| 3605 | - ?> | |
| 3606 | - </tbody></table> | |
| 3607 | - <textarea id="wpbc_field_booking_csv_export_skip_fields" | |
| 3608 | - name="wpbc_field_booking_csv_export_skip_fields" | |
| 3609 | - style="width:100%;" | |
| 3610 | - cols="87" rows="2" | |
| 3611 | - placeholder="<?php echo 'trash,is_new,secondname'; ?>" | |
| 3612 | - ><?php echo esc_textarea( $export_params_arr['csv_export_skip_fields'] ); ?></textarea> | |
| 3613 | - <label class="help-block"><?php printf(__('Enter field names separated by commas to %sskip the export%s' ,'booking'),'<b>','</b>');?></label> | |
| 3614 | - <input type="hidden" id="wpbc_modal__export_csv__booking_id" value="" /> | |
| 3615 | - </div> | |
| 3616 | - <div class="modal-footer"> | |
| 3617 | - <a id="wpbc_modal__export_csv__button_send" class="button button-primary" | |
| 3618 | - onclick="javascript: wpbc_ajx_booking__ui_click__export_csv( { | |
| 3619 | - 'booking_action' : 'export_csv', | |
| 3620 | - 'ui_clicked_element_id' : 'wpbc_modal__export_csv__button_send', | |
| 3621 | - 'export_type' : jQuery('#wpbc_field_booking_csv_export_type option:selected').val(), | |
| 3622 | - 'csv_export_separator' : jQuery('#wpbc_field_booking_csv_export_separator option:selected').val(), | |
| 3623 | - 'csv_export_skip_fields': jQuery('#wpbc_field_booking_csv_export_skip_fields').val() | |
| 3624 | - } );" href="javascript:void(0);" | |
| 3625 | - ><?php _e('Export' ,'booking'); ?></a> | |
| 3626 | - <a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal"><?php _e('Close' ,'booking'); ?></a> | |
| 3627 | - </div> | |
| 3628 | - </div><!-- /.modal-content --> | |
| 3629 | - </div><!-- /.modal-dialog --> | |
| 3630 | - </div><!-- /.modal --> | |
| 3631 | - </span><?php | |
| 3632 | - } | |
| 3633 | - | |
| 3634 | -// </editor-fold> | |
| 3635 | - | |
| 3636 | - | |
| 3637 | 2282 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 3638 | 2283 | // Support functions |
| 3639 | 2284 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 3640 | 2285 | |
| @@ -3689,9 +2334,9 @@ | ||
| 3689 | 2334 | $error_message = implode( '<br/>', $error_message ); |
| 3690 | 2335 | |
| 3691 | 2336 | if ( ! empty( $error_message ) ) { |
| 3692 | 2337 | $error_message = '<div class="wpbc_ajx_errors">' |
| 3693 | - .'<br/><strong>' . __( 'Some errors were encountered.', 'booking' ) . '</strong><br/>' | |
| 2338 | + .'<br/><strong>' . esc_html__( 'Some errors were encountered.', 'booking' ) . '</strong><br/>' | |
| 3694 | 2339 | . $error_message |
| 3695 | 2340 | . '</div>'; |
| 3696 | 2341 | } |
| 3697 | 2342 | return $error_message; |
| @@ -3765,5 +2410,5 @@ | ||
| 3765 | 2410 | // Default |
| 3766 | 2411 | } |
| 3767 | 2412 | |
| 3768 | 2413 | return true; |
| 3769 | -} | |
| 2414 | +} | |