| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php /** |
| 2 | 2 | * @version 1.0 |
| 3 | 3 | * @description AJX_Bookings |
| 4 | 4 | * @category AJX_Bookings Actions |
| @@ -1173,8 +1173,16 @@ | ||
| 1173 | 1173 | $work_booking_id_arr = explode( ',', $booking_id_csd ); |
| 1174 | 1174 | |
| 1175 | 1175 | foreach ( $work_booking_id_arr as $selected_booking_id ) { |
| 1176 | 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 | + } | |
| 1177 | 1185 | // SQL --------------------------------------------------------------------------------------------------- |
| 1178 | 1186 | list( $after_action_result, $after_action_message, $formdata_new ) = wpbc__sql__change_booking_resource_for_booking( $selected_booking_id, $selected_resource_id ); |
| 1179 | 1187 | |
| 1180 | 1188 | if ( $after_action_result ) { |
| @@ -1617,8 +1625,17 @@ | ||
| 1617 | 1625 | // 'user_id' => wpbc_get_current_user_id() |
| 1618 | 1626 | // 'sync_gid' => '' |
| 1619 | 1627 | // 'is_approve_booking' => 0 |
| 1620 | 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 | + } | |
| 1621 | 1638 | $booking_save_arr = wpbc_booking_save( $request_save_params ); |
| 1622 | 1639 | |
| 1623 | 1640 | if ( 'ok' === $booking_save_arr['ajx_data']['status'] ) { // Everything Cool :) - booking has been duplicated |
| 1624 | 1641 | |
| @@ -2393,5 +2410,5 @@ | ||
| 2393 | 2410 | // Default |
| 2394 | 2411 | } |
| 2395 | 2412 | |
| 2396 | 2413 | return true; |
| 2397 | -} | |
| 2414 | +} | |