PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 All 205 releases
← All changes | includes/page-bookings/bookings__actions.php +57 -1485 10.10 → 11.9 View file →
@@ -1,4 +1,4 @@
1 1 <?php /**
2 2 * @version 1.0
3 3 * @description AJX_Bookings
4 4 * @category AJX_Bookings Actions
@@ -562,20 +562,20 @@
562 562 }
563 563 // SQL ---------------------------------------------------------------------------------------------------
564 564 global $wpdb;
565 565 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
566 - $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 );
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.
567 567 if ( $is_trash_or_restore == '1' ) {
568 568 // Trash
569 569 $my_trash_date = wpbc_datetime_localized( gmdate( 'Y-m-d H:i:s' ), 'Y-m-d H:i:s' );
570 570 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
571 - $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 );
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.
572 572 } else {
573 573 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
574 - $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 );
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.
575 575 }
576 576
577 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
577 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
578 578 $after_action_result = $wpdb->query( $prepared_sql );
579 579 if ( false === $after_action_result ) {
580 580 $after_action_message = 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__;
581 581 } else {
@@ -708,9 +708,9 @@
708 708 global $wpdb;
709 709 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
710 710 $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}bookingdates SET approved = %s WHERE booking_id IN ({$booking_id_csd})", $is_approve_or_pending );
711 711
712 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
712 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
713 713 $after_action_result = $wpdb->query( $prepared_sql );
714 714 if ( false === $after_action_result ) {
715 715 $after_action_message = 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__;
716 716 } else {
@@ -819,9 +819,9 @@
819 819 global $wpdb;
820 820
821 821 // Dates
822 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
823 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
824 824 $after_action_result = $wpdb->query( $prepared_sql );
825 825 if ( false === $after_action_result ) {
826 826 $after_action_message = 'Error during deleting dates in DB. File:' . __FILE__ . ' on line: ' . __LINE__;
827 827 } else {
@@ -828,9 +828,9 @@
828 828 $after_action_result = true;
829 829 }
830 830 // Bookings
831 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
832 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
833 833 $after_action_result = $wpdb->query( $prepared_sql );
834 834 if ( false === $after_action_result ) {
835 835 $after_action_message = 'Error during deleting bookings in DB. File:' . __FILE__ . ' on line: ' . __LINE__;
836 836 } else {
@@ -906,9 +906,9 @@
906 906 }
907 907 // SQL ---------------------------------------------------------------------------------------------------
908 908 global $wpdb;
909 909 if ('-1' == $booking_id_csd ){
910 - $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.
911 911
912 912 $prepared_sql .= " WHERE ( 1 = 1 ) ";
913 913 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
914 914 $prepared_sql = apply_bk_filter('update_where_sql_for_getting_bookings_in_multiuser', $prepared_sql );
@@ -913,11 +913,11 @@
913 913 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
914 914 $prepared_sql = apply_bk_filter('update_where_sql_for_getting_bookings_in_multiuser', $prepared_sql );
915 915 } else {
916 916 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
917 - $prepared_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking AS bk SET bk.is_new = %s WHERE booking_id IN ({$booking_id_csd})", $is_new );
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.
918 918 }
919 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
919 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
920 920 $after_action_result = $wpdb->query( $prepared_sql );
921 921 if ( false === $after_action_result ) {
922 922 $after_action_message = 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__;
923 923 } else {
@@ -969,9 +969,9 @@
969 969
970 970 // Get bookings ID to delete -------------------------------------------------------------------------------
971 971 global $wpdb;
972 972
973 - $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.
974 974
975 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
976 976
977 977 $max_bookings_to_erase = 1000;
@@ -976,9 +976,9 @@
976 976
977 977 $max_bookings_to_erase = 1000;
978 978 $sql .= " LIMIT 0, " . $max_bookings_to_erase;
979 979
980 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
980 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
981 981 $bookings_in_trash = $wpdb->get_results( $sql );
982 982
983 983 $bookings_id_in_trash_arr = array();
984 984
@@ -1022,9 +1022,9 @@
1022 1022 // SQL ---------------------------------------------------------------------------------------------------
1023 1023
1024 1024 // Dates
1025 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
1026 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1027 1027 $after_action_result = $wpdb->query( $prepared_sql );
1028 1028 if ( false === $after_action_result ) {
1029 1029 $after_action_message = 'Error during deleting dates in DB. File:' . __FILE__ . ' on line: ' . __LINE__;
1030 1030 } else {
@@ -1031,9 +1031,9 @@
1031 1031 $after_action_result = true;
1032 1032 }
1033 1033 // Bookings
1034 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
1035 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1036 1036 $after_action_result = $wpdb->query( $prepared_sql );
1037 1037 if ( false === $after_action_result ) {
1038 1038 $after_action_message = 'Error during deleting bookings in DB. File:' . __FILE__ . ' on line: ' . __LINE__;
1039 1039 } else {
@@ -1089,9 +1089,9 @@
1089 1089 // SQL ---------------------------------------------------------------------------------------------------
1090 1090 global $wpdb;
1091 1091 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
1092 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
1093 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1094 1094 $after_action_result = $wpdb->query( $prepared_sql );
1095 1095 if ( false === $after_action_result ) {
1096 1096 $after_action_message = 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__;
1097 1097 } else {
@@ -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 ) {
@@ -1224,9 +1232,9 @@
1224 1232 if ( 1 ) {
1225 1233 // 1.1.Get booking data of SOURCE booking
1226 1234 $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking as bk WHERE booking_id = %d ", $booking_id );
1227 1235
1228 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1236 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1229 1237 $res = $wpdb->get_row( $sql );
1230 1238
1231 1239 $db_form_data_old = $res->form;
1232 1240 $resource_id_old = $res->booking_type;
@@ -1232,9 +1240,9 @@
1232 1240 $resource_id_old = $res->booking_type;
1233 1241
1234 1242 // 1.2. Get dates of SOURCE booking
1235 1243 $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}bookingdates as dt WHERE booking_id = %d ORDER BY booking_date ASC ", $booking_id );
1236 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1244 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1237 1245 $old_resource_dates_array = $wpdb->get_results( $sql );
1238 1246 }
1239 1247
1240 1248
@@ -1273,12 +1281,12 @@
1273 1281 } else { // Possible to change
1274 1282
1275 1283 $db_form_data_new = wpbc_update_resource_id_in_dbformatted_booking_data( $db_form_data_old, $resource_id_old, $resource_id );
1276 1284
1277 - // Update
1278 - $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;"
1279 1287 , $db_form_data_new, $resource_id, $booking_id );
1280 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1288 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1281 1289 if ( false === $wpdb->query( $update_sql ) ) {
1282 1290 $after_action_result = false;
1283 1291 $after_action_message = get_debuge_error( 'Error during updating booking reource type in BD', __FILE__, __LINE__ );
1284 1292
@@ -1287,9 +1295,9 @@
1287 1295
1288 1296
1289 1297 if ( class_exists( 'wpdev_bk_biz_l' ) ) {
1290 1298 $update_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}bookingdates SET type_id=NULL WHERE booking_id=%d ", $booking_id );
1291 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1299 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1292 1300 if ( false === $wpdb->query( $update_sql ) ) {
1293 1301 $after_action_result = false;
1294 1302 $after_action_message = get_debuge_error( 'Error during updating dates type in BD', __FILE__, __LINE__ );
1295 1303
@@ -1390,9 +1398,9 @@
1390 1398 . ") ";
1391 1399 }
1392 1400 $sql .= " ORDER BY bk.booking_id DESC, dt.booking_date ASC ";
1393 1401
1394 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1402 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1395 1403 $exist_dates_results = $wpdb->get_results( $sql );
1396 1404
1397 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"
1398 1406 // and does not add some "start time at the begining of the day inside of wpbc_check_dates_intersections( ) function
@@ -1409,9 +1417,9 @@
1409 1417 ON bk.booking_id = dt.booking_id
1410 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
1411 1419 $sql .= " ORDER BY bk.booking_id DESC, dt.booking_date ASC ";
1412 1420
1413 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1421 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1414 1422 $exist_dates_results = $wpdb->get_results( $sql );
1415 1423 }
1416 1424
1417 1425 return $exist_dates_results;
@@ -1551,9 +1559,9 @@
1551 1559 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
1552 1560 if ( 1 ) {
1553 1561 // 1.1.Get booking data of SOURCE booking
1554 1562 $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking as bk WHERE booking_id = %d ", $booking_id );
1555 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1563 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1556 1564 $res = $wpdb->get_row( $sql );
1557 1565 $db_form_data_old = $res->form;
1558 1566 $resource_id_old = $res->booking_type;
1559 1567
@@ -1558,9 +1566,9 @@
1558 1566 $resource_id_old = $res->booking_type;
1559 1567
1560 1568 // 1.2. Get dates of SOURCE booking
1561 1569 $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}bookingdates as dt WHERE booking_id = %d ORDER BY booking_date ASC ", $booking_id );
1562 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1570 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1563 1571 $old_resource_dates_array = $wpdb->get_results( $sql );
1564 1572 }
1565 1573
1566 1574 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -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
@@ -1682,9 +1699,9 @@
1682 1699 foreach ( $work_booking_id_arr as $selected_booking_id ) {
1683 1700
1684 1701 // SQL ---------------------------------------------------------------------------------------------------
1685 1702 $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking as bk WHERE bk.booking_id= %d ", $selected_booking_id );
1686 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1703 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1687 1704 $result_bk = $wpdb->get_results( $sql );
1688 1705
1689 1706 $old_pay_status = '';
1690 1707
@@ -1697,11 +1714,11 @@
1697 1714 );
1698 1715 } else {
1699 1716 $old_pay_status = $result_bk[0]->pay_status;
1700 1717 }
1701 -
1702 - $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 );
1703 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
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
1704 1721 if ( false === $wpdb->query( $update_sql ) ) {
1705 1722 // Error
1706 1723 $after_action_result = false;
1707 1724 $after_action_message .= 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__;
@@ -1813,9 +1830,9 @@
1813 1830 foreach ( $work_booking_id_arr as $selected_booking_id ) {
1814 1831
1815 1832 // SQL ---------------------------------------------------------------------------------------------------
1816 1833 $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking as bk WHERE bk.booking_id= %d ", $selected_booking_id );
1817 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1834 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1818 1835 $result_bk = $wpdb->get_results( $sql );
1819 1836
1820 1837 $old_booking_cost = '';
1821 1838
@@ -1829,10 +1846,10 @@
1829 1846 } else {
1830 1847 $old_booking_cost = $result_bk[0]->cost;
1831 1848 }
1832 1849
1833 - $update_sql = $wpdb->prepare( "UPDATE {$wpdb->prefix}booking AS bk SET bk.cost = %f WHERE bk.booking_id = %d ", $booking_cost, $selected_booking_id );
1834 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
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
1835 1852 if ( false === $wpdb->query( $update_sql ) ) {
1836 1853 // Error
1837 1854 $after_action_result = false;
1838 1855 $after_action_message .= 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__;
@@ -1919,9 +1936,9 @@
1919 1936 foreach ( $work_booking_id_arr as $selected_booking_id ) {
1920 1937
1921 1938 // SQL ---------------------------------------------------------------------------------------------------
1922 1939 $sql = $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}booking as bk WHERE bk.booking_id= %d ", $selected_booking_id );
1923 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
1940 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
1924 1941 $result_bk = $wpdb->get_results( $sql );
1925 1942
1926 1943 $old_booking_cost = '';
1927 1944
@@ -1947,10 +1964,11 @@
1947 1964
1948 1965 if ( $is_send ) {
1949 1966 // Update Payment request number
1950 1967 $pay_request_numer = $res->pay_request + 1;
1951 - $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 );
1952 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
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
1953 1971 if ( false === $wpdb->query( $update_sql ) ) {
1954 1972 // Error
1955 1973 $after_action_result = false;
1956 1974 $after_action_message .= 'Error during updating to DB. File:' . __FILE__ . ' on line: ' . __LINE__;
@@ -2060,9 +2078,9 @@
2060 2078 }
2061 2079 }
2062 2080
2063 2081 $my_sql = "SELECT booking_type_id, import FROM {$wpdb->prefix}bookingtypes {$where}";
2064 - // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
2082 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
2065 2083 $types_list = $wpdb->get_results( $my_sql );
2066 2084
2067 2085 foreach ($types_list as $wpbc_booking_resource) {
2068 2086 $wpbc_booking_resource_id = $wpbc_booking_resource->booking_type_id;
@@ -2135,9 +2153,9 @@
2135 2153 "wh_cost" => "",
2136 2154 "wh_cost2" => "",
2137 2155 "wh_sort" => "booking_id__desc",
2138 2156 "wh_trash" => "any",
2139 - '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' ) )
2140 2158 );
2141 2159 }
2142 2160
2143 2161
@@ -2216,969 +2234,9 @@
2216 2234
2217 2235
2218 2236 // <editor-fold defaultstate="collapsed" desc=" == Button Actions Templates for UI == " >
2219 2237
2220 -
2221 2238 /**
2222 - * Show Costs booking Test field
2223 - */
2224 - function wpbc_for_booking_template__action_cost(){
2225 -
2226 - if ( ! class_exists('wpdev_bk_biz_s') ) {
2227 - return false;
2228 - }
2229 -
2230 - $booking_action = 'set_booking_cost';
2231 - $el_id = 'ui_btn_' . $booking_action . '{{data.parsed_fields.booking_id}}';
2232 -
2233 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2234 - return false;
2235 - }
2236 -
2237 - $params_addon = array(
2238 - 'type' => 'span'
2239 - , 'label' => '{{{data[\'parsed_fields\'][\'currency_symbol\']}}}'
2240 - , 'html' => '{{{data[\'parsed_fields\'][\'currency_symbol\']}}}'//''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
2241 - //, 'icon' => array( 'icon_font' => 'wpbc_icn_event', 'position' => 'right', 'icon_img' => '' )
2242 - //, 'class' => 'wpbc_ui_button inactive'
2243 - , 'style' => 'font-weight:600;font-size: 14px;line-height: 28px;'
2244 - , 'attr' => array()
2245 - );
2246 -
2247 - $param_text = array(
2248 - 'type' => 'text'
2249 - , 'id' => $el_id . '_cost'
2250 - , 'name' => $el_id . '_cost'
2251 - , 'label' => ''
2252 - , 'disabled' => false
2253 - , 'class' => 'set_booking_cost_text_field'
2254 - , 'style' => 'width:5em;font-weight:600;'
2255 - , 'placeholder' => '0'
2256 - , 'attr' => array()
2257 - , 'is_escape_value' => false
2258 - , 'value' => '{{data[\'parsed_fields\'][\'cost\']}}'
2259 - , 'onfocus' => ''
2260 - , 'onkeydown' => "jQuery('.ui__set_booking_cost__section_in_booking_{{data['parsed_fields']['booking_id']}}').show();" // JavaScript code
2261 - );
2262 -
2263 - ?><div class="ui_element ui_nowrap"><?php
2264 - //wpbc_flex_addon( $params_addon );
2265 - wpbc_flex_label( $params_addon );
2266 - wpbc_flex_text( $param_text );
2267 - ?></div><?php
2268 -
2269 -
2270 - $params_button_save = array(
2271 - 'type' => 'button' ,
2272 - 'title' => __( 'Save cost', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
2273 - 'hint' => array( 'title' => __( 'Save Changes', 'booking' ), 'position' => 'top' ), // Hint
2274 - 'link' => 'javascript:void(0)', // Direct link or skip it
2275 - 'action' => "wpbc_ajx_booking__ui_click_save__set_booking_cost( {{data['parsed_fields']['booking_id']}}, this, '{$booking_action}', '{$el_id}' );" ,
2276 - 'style' => '', // Any CSS class here
2277 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
2278 - 'icon' => array( 'icon_font' => 'wpbc_icn_check _circle_outline', 'position' => 'right', 'icon_img' => '' ),
2279 - 'class' => 'wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary'
2280 - 'attr' => array( 'id' => $el_id . '_save' )
2281 - );
2282 -
2283 - $params_button_cancel = array(
2284 - 'type' => 'button' ,
2285 - 'title' => __( 'Cancel', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
2286 - 'hint' => array( 'title' => __('Close' ,'booking'), 'position' => 'top' ), // Hint
2287 - 'link' => 'javascript:void(0)', // Direct link or skip it
2288 - 'action' => "wpbc_ajx_booking__ui_click_close__set_booking_cost();" ,
2289 - 'style' => '', // Any CSS class here
2290 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
2291 - 'icon' => array( 'icon_font' => 'wpbc_icn_close _block', 'position' => 'right', 'icon_img' => '' ),
2292 - 'class' => '', // '' | 'wpbc_ui_button_primary'
2293 - 'attr' => array( 'id' => $el_id . '_cancel' )
2294 - );
2295 -
2296 - ?><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
2297 - wpbc_flex_button( $params_button_save );
2298 - ?></div><?php
2299 - ?><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
2300 - wpbc_flex_button( $params_button_cancel );
2301 - ?></div><?php
2302 -
2303 - }
2304 -
2305 - /**
2306 - * Show Payment Request booking Button
2307 - */
2308 - function wpbc_for_booking_template__action_payment_request(){
2309 -
2310 - if ( ! class_exists('wpdev_bk_biz_s') ) {
2311 - return false;
2312 - }
2313 -
2314 - $booking_action = 'send_payment_request';
2315 -
2316 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2317 - return false;
2318 - }
2319 -
2320 - $params = array(
2321 - 'type' => 'button',
2322 - 'title' => '',
2323 - 'hint' => array(
2324 - 'title' => __( 'Send payment request to visitor', 'booking' ),
2325 - 'position' => 'top'
2326 - ),
2327 - 'link' => 'javascript:void(0)',
2328 - //'action' => "js_func( {{data['parsed_fields']['booking_id']}} );",
2329 -
2330 - 'action' => "if ( 'function' === typeof( jQuery('#wpbc_modal__payment_request__section').wpbc_my_modal ) ) {
2331 - jQuery('#wpbc_modal__payment_request__booking_id').val({{data['parsed_fields']['booking_id']}});
2332 - jQuery('#wpbc_modal__payment_request__section').wpbc_my_modal('show');
2333 - } else {
2334 - alert( 'Warning! wpbc_my_modal module has not found. Please, recheck about any conflicts by deactivating other plugins.');
2335 - }",
2336 -
2337 - 'icon' => array(
2338 - 'icon_font' => 'wpbc_icn_forward_to_inbox',
2339 - 'position' => 'left',
2340 - 'icon_img' => ''
2341 - ),
2342 - 'class' => '',
2343 - 'style' => '',
2344 - 'mobile_show_text' => true,
2345 - 'attr' => array()
2346 - );
2347 -
2348 -
2349 - ?><div class="ui_element"><?php
2350 - wpbc_flex_button( $params );
2351 - ?></div><?php
2352 - }
2353 -
2354 -
2355 - /**
2356 - * Show Payment Status booking Button
2357 - */
2358 - function wpbc_for_booking_template__action_set_payment_status(){
2359 -
2360 - if ( ! class_exists('wpdev_bk_biz_s') ) {
2361 - return false;
2362 - }
2363 -
2364 - $booking_action = 'set_payment_status';
2365 -
2366 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2367 - return false;
2368 - }
2369 -
2370 - $params = array(
2371 - 'type' => 'button',
2372 - 'title' => '',
2373 - 'hint' => array(
2374 - 'title' => __( 'Payment status', 'booking' ),
2375 - 'position' => 'top'
2376 - ),
2377 - 'link' => 'javascript:void(0)',
2378 - 'action' => "wpbc_ajx_booking__ui_click_show__set_payment_status( {{data['parsed_fields']['booking_id']}} );",
2379 - 'icon' => array(
2380 - 'icon_font' => 'wpbc_icn_sell',
2381 - 'position' => 'left',
2382 - 'icon_img' => ''
2383 - ),
2384 - 'class' => '',
2385 - 'style' => '',
2386 - 'mobile_show_text' => true,
2387 - 'attr' => array()
2388 - );
2389 -
2390 -
2391 - ?><div class="ui_element"><?php
2392 - wpbc_flex_button( $params );
2393 - ?></div><?php
2394 - }
2395 -
2396 - /**
2397 - * Selectbox | Save | Close buttons for "Payment status" section
2398 - * @return false|void
2399 - */
2400 - function wpbc_for_booking_template_section__set_payment_status(){
2401 -
2402 - if ( ! class_exists('wpdev_bk_biz_s') ) {
2403 - return false;
2404 - }
2405 -
2406 - $booking_action = 'set_payment_status';
2407 -
2408 - $el_id = 'ui_btn_' . $booking_action . '{{data.parsed_fields.booking_id}}';
2409 -
2410 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2411 - return false;
2412 - }
2413 -
2414 - $select_box_options = get_payment_status_titles();
2415 - $select_box_options = array_flip( $select_box_options );
2416 - $params_select = array(
2417 - 'id' => $el_id // HTML ID of element
2418 - , 'name' => $el_id
2419 - , 'label' => ''//__( 'Payment status', 'booking' ) // Label (optional)
2420 - , 'style' => '' // CSS of select element
2421 - , 'class' => '' // CSS Class of select element
2422 - , 'multiple' => false
2423 - , 'attr' => array(
2424 - 'data-placeholder' => __( 'Change status', 'booking' ),
2425 - 'ajx-selected-value' => '{{data.parsed_fields.pay_status}}'
2426 - )
2427 - , 'disabled' => false
2428 - , 'disabled_options' => array() // If some options disabled, then it has to list here
2429 - , 'options' => $select_box_options
2430 - //, '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
2431 - //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
2432 - //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
2433 - );
2434 -
2435 - $params_button_save = array(
2436 - 'type' => 'button' ,
2437 - 'title' => __( 'Change status', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
2438 - 'hint' => array( 'title' => __( 'Save Changes', 'booking' ), 'position' => 'top' ), // Hint
2439 - 'link' => 'javascript:void(0)', // Direct link or skip it
2440 - 'action' => "wpbc_ajx_booking__ui_click_save__set_payment_status( {{data['parsed_fields']['booking_id']}}, this, '{$booking_action}', '{$el_id}' );" ,
2441 - 'style' => '', // Any CSS class here
2442 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
2443 - 'icon' => array( 'icon_font' => 'wpbc_icn_check _circle_outline', 'position' => 'right', 'icon_img' => '' ),
2444 - 'class' => 'wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary'
2445 - 'attr' => array( 'id' => $el_id . '_save' )
2446 - );
2447 -
2448 - $params_button_cancel = array(
2449 - 'type' => 'button' ,
2450 - 'title' => __( 'Cancel', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
2451 - 'hint' => array( 'title' => __('Close' ,'booking'), 'position' => 'top' ), // Hint
2452 - 'link' => 'javascript:void(0)', // Direct link or skip it
2453 - 'action' => "wpbc_ajx_booking__ui_click_close__set_payment_status();" ,
2454 - 'style' => '', // Any CSS class here
2455 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
2456 - 'icon' => array( 'icon_font' => 'wpbc_icn_close _block', 'position' => 'right', 'icon_img' => '' ),
2457 - 'class' => '', // '' | 'wpbc_ui_button_primary'
2458 - 'attr' => array( 'id' => $el_id . '_cancel' )
2459 - );
2460 -
2461 -
2462 - ?><div class="ui_element" style="flex:100%;"></div>
2463 - <div id="ui__set_payment_status__section_in_booking_{{data['parsed_fields']['booking_id']}}"
2464 - class="ui__set_payment_status__section_in_booking ui__under_actions_row__section_in_booking"
2465 - >
2466 - <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">
2467 -
2468 - <div class="ui_element">
2469 - <?php wpbc_flex_select($params_select); ?>
2470 - </div>
2471 -
2472 - <div class="ui_element" >
2473 - <?php wpbc_flex_button($params_button_save); ?>
2474 - </div>
2475 -
2476 - <div class="ui_element">
2477 - <?php wpbc_flex_button($params_button_cancel); ?>
2478 - </div>
2479 -
2480 - </div> </div> </div>
2481 - <div class="clear"></div>
2482 -
2483 - </div><?php
2484 -
2485 - }
2486 -
2487 -
2488 - /**
2489 - * Show Edit booking Button
2490 - */
2491 - function wpbc_for_booking_template__action_edit_booking(){
2492 -
2493 - // FixIn: 9.2.3.4.
2494 -// if ( ! class_exists('wpdev_bk_personal') ) {
2495 -// return false;
2496 -// }
2497 -
2498 - $booking_action = 'edit_booking';
2499 -
2500 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2501 - return false;
2502 - }
2503 -
2504 - $edit_booking_url = 'admin.php?page=' . wpbc_get_new_booking_url( false, false)
2505 - . '&booking_type={{data.parsed_fields.resource_id}}&booking_hash={{data.parsed_fields.hash}}&parent_res=1' ;
2506 - $edit_booking_url .= ( 'Off' !== get_bk_option( 'booking_is_resource_no_update__during_editing' ) ) ? '&resource_no_update=1' : ''; // FixIn: 9.4.2.3.
2507 -
2508 - $edit_booking_url .= '&booking_form={{data.parsed_fields.wpbc_custom_booking_form}}'; // FixIn: 9.4.3.12.
2509 -
2510 - $edit_booking_url .= '&is_show_payment_form=Off'; // FixIn: 9.9.0.38.
2511 -
2512 - $params = array(
2513 - 'type' => 'button',
2514 - 'title' => '',
2515 - 'hint' => array(
2516 - 'title' => __( 'Edit Booking', 'booking' ),
2517 - 'position' => 'top'
2518 - ),
2519 - 'link' => $edit_booking_url,//'javascript:void(0)',
2520 - 'action' => '',//"js_func( {{data['parsed_fields']['booking_id']}} );",
2521 - 'icon' => array(
2522 - 'icon_font' => 'wpbc_icn_draw',
2523 - 'position' => 'left',
2524 - 'icon_img' => ''
2525 - ),
2526 - 'class' => '',
2527 - 'style' => '',
2528 - 'mobile_show_text' => true,
2529 - 'attr' => array()
2530 - );
2531 -
2532 -
2533 - ?><div class="ui_element <# if ( '' == data['parsed_fields']['hash']) { #>disabled<# } #>"><?php
2534 - wpbc_flex_button( $params );
2535 - ?></div><?php
2536 - }
2537 -
2538 - /**
2539 - * Show Change booking resource for booking Button
2540 - */
2541 - function wpbc_for_booking_template__action_change_resource(){
2542 -
2543 - if ( ! class_exists('wpdev_bk_personal') ) {
2544 - return false;
2545 - }
2546 -
2547 - $booking_action = 'change_booking_resource';
2548 -
2549 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2550 - return false;
2551 - }
2552 -
2553 - $params = array(
2554 - 'type' => 'button',
2555 - 'title' => '',
2556 - 'hint' => array(
2557 - 'title' => __( 'Change Resource', 'booking' ),
2558 - 'position' => 'top'
2559 - ),
2560 - 'link' => 'javascript:void(0)',
2561 - 'action' => "wpbc_ajx_booking__ui_click_show__change_resource( {{data['parsed_fields']['booking_id']}}, {{data['parsed_fields']['resource_id']}} );",
2562 - 'icon' => array(
2563 - 'icon_font' => 'wpbc_icn_shuffle',
2564 - 'position' => 'left',
2565 - 'icon_img' => ''
2566 - ),
2567 - 'class' => '',
2568 - 'style' => '',
2569 - 'mobile_show_text' => true,
2570 - 'attr' => array()
2571 - );
2572 -
2573 -
2574 - ?><div class="ui_element"><?php
2575 - wpbc_flex_button( $params );
2576 - ?></div><?php
2577 - }
2578 -
2579 - /**
2580 - * Selectbox | Save | Close buttons for "Change booking resources" section
2581 - * @return false|void
2582 - */
2583 - function wpbc_for_booking_template_section__change_booking_resource(){
2584 -
2585 - if ( ! class_exists('wpdev_bk_personal') ) {
2586 - return false;
2587 - }
2588 -
2589 - $booking_action = 'change_booking_resource';
2590 -
2591 - $el_id = 'ui_btn_' . $booking_action;
2592 -
2593 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2594 - return false;
2595 - }
2596 -
2597 - ?><div class="ui_element" style="flex:100%;"></div>
2598 - <div id="ui__change_booking_resource__section_in_booking_{{data['parsed_fields']['booking_id']}}"
2599 - class="ui__change_booking_resource__section_in_booking ui__under_actions_row__section_in_booking"
2600 - ></div><?php
2601 - }
2602 -
2603 -
2604 - /**
2605 - * Show Duplicate booking Button
2606 - */
2607 - function wpbc_for_booking_template__action_duplicate_booking_to_other_resource(){
2608 -
2609 - if ( ! class_exists('wpdev_bk_personal') ) {
2610 - return false;
2611 - }
2612 -
2613 - $booking_action = 'duplicate_booking_to_other_resource';
2614 -
2615 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2616 - return false;
2617 - }
2618 -
2619 - $params = array(
2620 - 'type' => 'button',
2621 - 'title' => '',
2622 - 'hint' => array(
2623 - 'title' => __( 'Duplicate Booking', 'booking' ),
2624 - 'position' => 'top'
2625 - ),
2626 - 'link' => 'javascript:void(0)',
2627 - 'action' => "wpbc_ajx_booking__ui_click_show__duplicate_booking( {{data['parsed_fields']['booking_id']}}, {{data['parsed_fields']['resource_id']}} );",
2628 - 'icon' => array(
2629 - 'icon_font' => 'wpbc_icn_content_copy',
2630 - 'position' => 'left',
2631 - 'icon_img' => ''
2632 - ),
2633 - 'class' => '',
2634 - 'style' => '',
2635 - 'mobile_show_text' => true,
2636 - 'attr' => array()
2637 - );
2638 -
2639 -
2640 - ?><div class="ui_element"><?php
2641 - wpbc_flex_button( $params );
2642 - ?></div><?php
2643 - }
2644 -
2645 - /**
2646 - * Selectbox | Save | Close buttons for "Duplicate booking" section
2647 - * @return false|void
2648 - */
2649 - function wpbc_for_booking_template_section__duplicate_booking_to_other_resource(){
2650 -
2651 - if ( ! class_exists('wpdev_bk_personal') ) {
2652 - return false;
2653 - }
2654 -
2655 - $booking_action = 'duplicate_booking_to_other_resource';
2656 -
2657 - $el_id = 'ui_btn_' . $booking_action;
2658 -
2659 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2660 - return false;
2661 - }
2662 -
2663 - ?><div class="ui_element" style="flex:100%;"></div>
2664 - <div id="ui__duplicate_booking_to_other_resource__section_in_booking_{{data['parsed_fields']['booking_id']}}"
2665 - class="ui__duplicate_booking_to_other_resource__section_in_booking ui__under_actions_row__section_in_booking"
2666 - ></div><?php
2667 - }
2668 -
2669 -
2670 - /**
2671 - * Show Print booking Button
2672 - */
2673 - function wpbc_for_booking_template__action_print(){
2674 -
2675 - if ( ! class_exists('wpdev_bk_personal') ) {
2676 - //return false;
2677 - }
2678 -
2679 - $booking_action = 'set_print';
2680 -
2681 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2682 - return false;
2683 - }
2684 -
2685 - $params = array(
2686 - 'type' => 'button',
2687 - 'title' => '',
2688 - 'hint' => array(
2689 - 'title' => __( 'Print', 'booking' ),
2690 - 'position' => 'top'
2691 - ),
2692 - 'link' => 'javascript:void(0)',
2693 - 'action' => "wpbc_print_dialog__show( {{data['parsed_fields']['booking_id']}} );",
2694 - 'icon' => array(
2695 - 'icon_font' => 'wpbc_icn_print',
2696 - 'position' => 'left',
2697 - 'icon_img' => ''
2698 - ),
2699 - 'class' => '',
2700 - 'style' => '',
2701 - 'mobile_show_text' => true,
2702 - 'attr' => array()
2703 - );
2704 -
2705 -
2706 - ?><div class="ui_element"><?php
2707 - wpbc_flex_button( $params );
2708 - ?></div><?php
2709 - }
2710 -
2711 - /**
2712 - * Show Remark booking Button
2713 - */
2714 - function wpbc_for_booking_template__action_remark(){
2715 -
2716 - if ( ! class_exists('wpdev_bk_personal') ) {
2717 - return false;
2718 - }
2719 -
2720 - $booking_action = 'set_booking_note';
2721 -
2722 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2723 - return false;
2724 - }
2725 -
2726 - $params = array(
2727 - 'type' => 'button',
2728 - 'title' => '',
2729 - 'hint' => array(
2730 - 'title' => __( 'Edit Note', 'booking' ),
2731 - 'position' => 'top'
2732 - ),
2733 - 'link' => 'javascript:void(0)',
2734 - 'action' => "wpbc_ajx_booking__ui_click__remark( jQuery( this ) );",
2735 - 'icon' => array(
2736 - 'icon_font' => 'wpbc_icn_mode_comment',
2737 - 'position' => 'left',
2738 - 'icon_img' => ''
2739 - ),
2740 - 'class' => "{$booking_action}_button",
2741 - 'style' => '',
2742 - 'mobile_show_text' => true,
2743 - 'attr' => array( 'id' => "{$booking_action}_button{{data.parsed_fields.booking_id}}" )
2744 - );
2745 -
2746 - ?><div class="ui_element"><?php
2747 - wpbc_flex_button( $params );
2748 - ?></div><?php
2749 - }
2750 -
2751 - function wpbc_for_booking_template_section__action_remark_textarea(){
2752 -
2753 - if ( ! class_exists('wpdev_bk_personal') ) {
2754 - return false;
2755 - }
2756 -
2757 - $booking_action = 'set_booking_note';
2758 -
2759 - $el_id = 'ui_btn_' . $booking_action;
2760 -
2761 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2762 - return false;
2763 - }
2764 -
2765 - $params_textarea = array(
2766 - 'id' => "{$booking_action}_text_{{data.parsed_fields.booking_id}}" // HTML ID of element
2767 - , 'name' => "{$booking_action}_text_{{data.parsed_fields.booking_id}}" // HTML ID of element
2768 - , 'label' => ''
2769 - , 'style' => 'height: 8em; width: 100%;' // CSS of select element
2770 - , 'class' => "{$booking_action}_text" // CSS Class of select element
2771 - , 'disabled' => false
2772 - , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2773 - , 'rows' => '3'
2774 - , 'cols' => '50'
2775 - , 'placeholder' => ''
2776 - , 'value' => '{{{data.parsed_fields.remark}}}' // FixIn: 9.4.4.1.
2777 - , 'is_escape_value' => true
2778 - //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
2779 - //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
2780 - );
2781 -
2782 - $params_button_save = array(
2783 - 'type' => 'button' ,
2784 - 'title' => __( 'Save', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
2785 - 'hint' => array( 'title' => __( 'Save Changes', 'booking' ), 'position' => 'top' ), // Hint
2786 - 'link' => 'javascript:void(0)', // Direct link or skip it
2787 - 'action' => "wpbc_ajx_booking_ajax_action_request( {
2788 - 'booking_action' : '{$booking_action}',
2789 - 'booking_id' : {{data.parsed_fields.booking_id}},
2790 - 'remark' : jQuery( '#{$booking_action}_text_{{data.parsed_fields.booking_id}}' ).val(),
2791 - 'ui_clicked_element_id': '{$el_id}'
2792 - } );
2793 - wpbc_button_enable_loading_icon( this ); " ,
2794 - 'style' => '', // Any CSS class here
2795 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
2796 - 'icon' => array( 'icon_font' => 'wpbc_icn_check _circle_outline', 'position' => 'right', 'icon_img' => '' ),
2797 - 'class' => 'wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary'
2798 - 'attr' => array( 'id' => $el_id )
2799 - );
2800 -
2801 - $params_button_cancel = array(
2802 - 'type' => 'button' ,
2803 - 'title' => __( 'Cancel', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
2804 - 'hint' => array( 'title' => __('Close' ,'booking'), 'position' => 'top' ), // Hint
2805 - 'link' => 'javascript:void(0)', // Direct link or skip it
2806 - 'action' => "wpbc_ajx_booking__ui_click__remark( jQuery( '#{$booking_action}_button{{data.parsed_fields.booking_id}}' ) );" ,
2807 - 'style' => '', // Any CSS class here
2808 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
2809 - 'icon' => array( 'icon_font' => 'wpbc_icn_close _block', 'position' => 'right', 'icon_img' => '' ),
2810 - 'class' => '', // '' | 'wpbc_ui_button_primary'
2811 - 'attr' => array( 'id' => $el_id . '_cancel' )
2812 - );
2813 -
2814 - //$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
2815 - //$is_expand_remarks = wpbc_ajx__user_request_option__is_expand_remarks( $user_id );
2816 -
2817 - ?><div class="ui_remark_section is_expand_remarks_<?php //echo ($is_expand_remarks) ? 'on' : 'off'; ?>"
2818 - style="<# if ( 'Off' === wpbc_ajx_booking_listing.search_get_param('ui_usr__is_expand_remarks') ) { #>display: none;<# } #>"
2819 - ><?php
2820 -
2821 - wpbc_flex_textarea( $params_textarea );
2822 -
2823 - ?><div class="ui_group"><?php
2824 -
2825 - ?><div class="ui_element" ><?php
2826 - wpbc_flex_button($params_button_save);
2827 - ?></div><?php
2828 -
2829 - ?><div class="ui_element"><?php
2830 - wpbc_flex_button($params_button_cancel);
2831 - ?></div><?php
2832 -
2833 - ?></div><?php
2834 -
2835 - ?></div><?php
2836 - }
2837 -
2838 - /**
2839 - * Show Locale booking Button
2840 - */
2841 - function wpbc_for_booking_template__action_locale(){
2842 -
2843 - $booking_action = 'set_booking_locale';
2844 -
2845 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2846 - return false;
2847 - }
2848 -
2849 - ?><span class="ui_element_locale"><?php
2850 -
2851 - $params = array(
2852 - 'type' => 'button',
2853 - 'id' => "button_locale_for_booking{{data['parsed_fields']['booking_id']}}",
2854 - 'title' => '',
2855 - 'hint' => array(
2856 - 'title' => __( 'Change Language', 'booking' ),
2857 - 'position' => 'top'
2858 - ),
2859 - 'link' => 'javascript:void(0)',
2860 - 'action' => "jQuery('#locale_for_booking{{data[\'parsed_fields\'][\'booking_id\']}}').toggle();jQuery(this).hide();",
2861 - 'icon' => array(
2862 - 'icon_font' => 'wpbc_icn_language',
2863 - 'position' => 'left',
2864 - 'icon_img' => ''
2865 - ),
2866 - 'class' => 'set_booking_locale_button',
2867 - 'style' => '',
2868 - 'mobile_show_text' => true,
2869 - 'attr' => array()
2870 - );
2871 -
2872 - ?><div class="ui_element"><?php
2873 - wpbc_flex_button( $params );
2874 - ?></div><?php
2875 -
2876 -
2877 - $el_id = "locale_for_booking{{data.parsed_fields.booking_id}}";
2878 - ?><#
2879 - var selected_locale_value = '';
2880 - if (
2881 - ( 'undefined' !== typeof( data.parsed_fields.booking_options) )
2882 - && ( 'undefined' !== typeof( data.parsed_fields.booking_options.booking_meta_locale ) )
2883 - ){
2884 - var selected_locale_value = data.parsed_fields.booking_options.booking_meta_locale;
2885 - }
2886 - #><?php
2887 -
2888 - $availbale_locales_in_system = get_available_languages();
2889 - $select_box_options = array();
2890 - $select_box_options[''] = __( 'Default Locale', 'booking' );
2891 - $select_box_options['en_US'] = 'English (United States)';
2892 -
2893 - foreach ( $availbale_locales_in_system as $locale ) {
2894 - $select_box_options[$locale] = $locale;
2895 - }
2896 -
2897 - $params_select = array(
2898 - 'id' => $el_id // HTML ID of element
2899 - , 'name' => $el_id
2900 - , 'label' => '' // __( 'Next Days', 'booking' ) // Label (optional)
2901 - , 'style' => 'display: none;' // CSS of select element
2902 - , 'class' => 'set_booking_locale_selectbox' // CSS Class of select element
2903 - //, 'multiple' => true
2904 - , 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
2905 - , 'disabled' => false
2906 - , 'disabled_options' => array() // If some options disabled, then it has to list here
2907 - , 'options' => $select_box_options
2908 - //, '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
2909 - //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
2910 - , 'onchange' => "jQuery(this).hide();
2911 - var jButton = jQuery('#button_locale_for_booking{{data[\'parsed_fields\'][\'booking_id\']}}');
2912 - jButton.show();
2913 - wpbc_button_enable_loading_icon( jButton.get(0) ); "
2914 - . " wpbc_ajx_booking_ajax_action_request( {
2915 - 'booking_action' : '{$booking_action}',
2916 - 'booking_id' : {{data[\'parsed_fields\'][\'booking_id\']}},
2917 - 'booking_meta_locale' : jQuery('#locale_for_booking{{data[\'parsed_fields\'][\'booking_id\']}} option:selected').val()
2918 - } );"
2919 -
2920 - );
2921 -
2922 - ?><div class="ui_element"><?php
2923 - wpbc_flex_select( $params_select );
2924 - ?></div><?php
2925 -
2926 - ?></span><?php
2927 - }
2928 -
2929 - /**
2930 - * Show "Add to Google Calendar" booking Button
2931 - */
2932 - function wpbc_for_booking_template__action_add_google_calendar(){
2933 -
2934 - $booking_action = 'booking_add_google_calendar';
2935 -
2936 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2937 - return false;
2938 - }
2939 -
2940 - $params = array(
2941 - 'type' => 'button',
2942 - 'title' => '',
2943 - 'hint' => array(
2944 - 'title' => __( 'Add to Google Calendar', 'booking' ),
2945 - 'position' => 'top'
2946 - ),
2947 - 'link' => "{{{data['parsed_fields']['google_calendar_link']}}}", // "{{{encodeURIComponent(data['parsed_fields']['google_calendar_link'])}}}",
2948 - 'options' => array( 'link' => 'no_decode' ),
2949 - //'link' => 'javascript:void(0)',
2950 - //'action' => " wpbc_ajx_booking_ajax_action_request( {
2951 - // 'booking_action' : '{$booking_action}',
2952 - // 'booking_id' : {{data['parsed_fields']['booking_id']}}
2953 - // } );
2954 - // ",
2955 - 'icon' => array(
2956 - 'icon_font' => 'wpbc_icn_event',
2957 - 'position' => 'left',
2958 - 'icon_img' => ''
2959 - ),
2960 - 'class' => '',
2961 - 'style' => '',
2962 - 'mobile_show_text' => true,
2963 - 'attr' => array('target'=>'_blank')
2964 - );
2965 -
2966 - ?><div class="ui_element"><?php
2967 - wpbc_flex_button( $params );
2968 - ?></div><?php
2969 - }
2970 -
2971 - /**
2972 - * Show Trash booking Button
2973 - */
2974 - function wpbc_for_booking_template__action_trash(){
2975 -
2976 - $booking_action = 'move_booking_to_trash';
2977 -
2978 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
2979 - return false;
2980 - }
2981 -
2982 - $params = array(
2983 - 'type' => 'button',
2984 - 'hint' => array( 'title' => __( 'Reject - move to trash', 'booking' ), 'position' => 'top' ),
2985 - 'title' => '',
2986 - 'link' => 'javascript:void(0)',
2987 - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) {
2988 - wpbc_ajx_booking_ajax_action_request( {
2989 - 'booking_action' : '{$booking_action}',
2990 - 'booking_id' : {{data['parsed_fields']['booking_id']}}
2991 - } );
2992 - wpbc_button_enable_loading_icon( this );
2993 - }",
2994 - 'icon' => array(
2995 - 'icon_font' => 'wpbc_icn_delete_outline',
2996 - 'position' => 'left',
2997 - 'icon_img' => ''
2998 - ),
2999 - 'class' => '',
3000 - 'style' => '',
3001 - 'mobile_show_text' => true,
3002 - 'attr' => array()
3003 - );
3004 -
3005 - ?><# if ( '0' == data['parsed_fields']['trash']) { #><?php
3006 - ?><div class="ui_element"><?php
3007 - wpbc_flex_button( $params );
3008 - ?></div><?php
3009 - ?><# } #><?php
3010 - }
3011 -
3012 - /**
3013 - * Show Restore from Trash booking Button
3014 - */
3015 - function wpbc_for_booking_template__action_trash_restore(){
3016 -
3017 - $booking_action = 'restore_booking_from_trash';
3018 -
3019 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
3020 - return false;
3021 - }
3022 -
3023 - $params = array(
3024 - 'type' => 'button',
3025 - 'hint' => array( 'title' => __( 'Restore', 'booking' ), 'position' => 'top' ),
3026 - 'title' => '',
3027 - 'link' => 'javascript:void(0)',
3028 - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) {
3029 - wpbc_ajx_booking_ajax_action_request( {
3030 - 'booking_action' : '{$booking_action}',
3031 - 'booking_id' : {{data['parsed_fields']['booking_id']}}
3032 - } );
3033 - wpbc_button_enable_loading_icon( this );
3034 - }",
3035 - 'icon' => array(
3036 - 'icon_font' => 'wpbc_icn_rotate_left',
3037 - 'position' => 'left',
3038 - 'icon_img' => ''
3039 - ),
3040 - 'class' => '',
3041 - 'style' => '',
3042 - 'mobile_show_text' => true,
3043 - 'attr' => array()
3044 - );
3045 -
3046 - ?><# if ( '1' == data['parsed_fields']['trash']) { #><?php
3047 - ?><div class="ui_element"><?php
3048 - wpbc_flex_button( $params );
3049 - ?></div><?php
3050 - ?><# } #><?php
3051 - }
3052 -
3053 - /**
3054 - * Show Completely Delete booking Button
3055 - */
3056 - function wpbc_for_booking_template__action_delete(){
3057 -
3058 - $booking_action = 'delete_booking_completely';
3059 -
3060 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
3061 - return false;
3062 - }
3063 -
3064 - $params = array(
3065 - 'type' => 'button',
3066 - 'hint' => array( 'title' => __( 'Completely Delete', 'booking' ), 'position' => 'top' ),
3067 - 'title' => '',
3068 - 'link' => 'javascript:void(0)',
3069 - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to delete this booking ?', 'booking' ) ) . "') ) {
3070 - wpbc_ajx_booking_ajax_action_request( {
3071 - 'booking_action' : '{$booking_action}',
3072 - 'booking_id' : {{data['parsed_fields']['booking_id']}}
3073 - } );
3074 - wpbc_button_enable_loading_icon( this );
3075 - }",
3076 - 'icon' => array(
3077 - 'icon_font' => 'wpbc_icn_close',
3078 - 'position' => 'left',
3079 - 'icon_img' => ''
3080 - ),
3081 - 'class' => '',
3082 - 'style' => '',
3083 - 'mobile_show_text' => true,
3084 - 'attr' => array()
3085 - );
3086 -
3087 - ?><# if ( '1' == data['parsed_fields']['trash']) { #><?php
3088 - ?><div class="ui_element"><?php
3089 - wpbc_flex_button( $params );
3090 - ?></div><?php
3091 - ?><# } #><?php
3092 - }
3093 -
3094 - /**
3095 - * Show Approved booking Button
3096 - */
3097 - function wpbc_for_booking_template__action_approved(){
3098 -
3099 - $booking_action = 'set_booking_approved';
3100 -
3101 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
3102 - return false;
3103 - }
3104 -
3105 - $params = array(
3106 - 'type' => 'button',
3107 - 'title' => '',
3108 - 'hint' => array(
3109 - 'title' => __( 'Approve', 'booking' ),
3110 - 'position' => 'top'
3111 - ),
3112 - 'link' => 'javascript:void(0)',
3113 - 'action' => "wpbc_ajx_booking_ajax_action_request( {
3114 - 'booking_action' : '{$booking_action}',
3115 - 'booking_id' : {{data['parsed_fields']['booking_id']}}
3116 - } );
3117 - wpbc_button_enable_loading_icon( this ); ",
3118 - 'icon' => array(
3119 - 'icon_font' => 'wpbc_icn_check_circle_outline',
3120 - 'position' => 'left',
3121 - 'icon_img' => ''
3122 - ),
3123 - 'class' => '',
3124 - 'style' => '',
3125 - 'mobile_show_text' => true,
3126 - 'attr' => array()
3127 - );
3128 -
3129 - ?><# if ( '0' == data['approved']) { #><?php
3130 - ?><div class="ui_element"><?php
3131 - wpbc_flex_button( $params );
3132 - ?></div><?php
3133 - ?><# } #><?php
3134 - }
3135 -
3136 - /**
3137 - * Show Pending booking Button
3138 - */
3139 - function wpbc_for_booking_template__action_pending(){
3140 -
3141 - $booking_action = 'set_booking_pending';
3142 -
3143 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
3144 - return false;
3145 - }
3146 -
3147 - $params = array(
3148 - 'type' => 'button',
3149 - 'title' => '',
3150 - 'hint' => array(
3151 - 'title' => __( 'Pending', 'booking' ),
3152 - 'position' => 'top'
3153 - ),
3154 - 'link' => 'javascript:void(0)',
3155 - 'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to set booking as pending ?', 'booking' ) ) . "') ) {
3156 - wpbc_ajx_booking_ajax_action_request( {
3157 - 'booking_action' : '{$booking_action}',
3158 - 'booking_id' : {{data['parsed_fields']['booking_id']}}
3159 - } );
3160 - wpbc_button_enable_loading_icon( this );
3161 - }",
3162 - 'icon' => array(
3163 - 'icon_font' => 'wpbc_icn_block',
3164 - 'position' => 'left',
3165 - 'icon_img' => ''
3166 - ),
3167 - 'class' => '',
3168 - 'style' => '',
3169 - 'mobile_show_text' => true,
3170 - 'attr' => array()
3171 - );
3172 -
3173 - ?><# if ( '1' == data['approved']) { #><?php
3174 - ?><div class="ui_element"><?php
3175 - wpbc_flex_button( $params );
3176 - ?></div><?php
3177 - ?><# } #><?php
3178 - }
3179 -
3180 - /**
3181 2239 * Show Read booking Button
3182 2240 */
3183 2241 function wpbc_for_booking_template__action_read(){
3184 2242
@@ -3201,9 +2259,9 @@
3201 2259 'booking_id' : {{data['parsed_fields']['booking_id']}}
3202 2260 } );
3203 2261 wpbc_button_enable_loading_icon( this ); ",
3204 2262 'icon' => array(
3205 - 'icon_font' => 'wpbc_icn_visibility',
2263 + 'icon_font' => 'wpbc_icn_fiber_manual_record',// 'wpbc_icn_visibility',
3206 2264 'position' => 'left',
3207 2265 'icon_img' => ''
3208 2266 ),
3209 2267 'class' => 'wpbc_is_new_button',
@@ -3219,495 +2277,9 @@
3219 2277
3220 2278 // </editor-fold>
3221 2279
3222 2280
3223 -// <editor-fold defaultstate="collapsed" desc=" == Hidden Templates for sub action sections == " >
3224 2281
3225 - /**
3226 - * Hidden Templates for - Booking Actions
3227 - *
3228 - * @param $page
3229 - *
3230 - * @return void
3231 - */
3232 - function wpbc_for_booking_template__hidden_templates( $page ){
3233 -
3234 - // page=wpbc&view_mode=vm_booking_listing
3235 - if ( 'wpbc-ajx_booking' === $page ) { // it's from >> do_action( 'wpbc_hook_settings_page_footer', 'wpbc-ajx_booking' );
3236 - ?><div class="wpbc_hidden_templates"><?php
3237 -
3238 - wpbc_hidden_template__change_booking_resource();
3239 -
3240 - wpbc_hidden_template__duplicate_booking_to_other_resource();
3241 -
3242 - ?></div><?php
3243 -
3244 - wpbc_hidden_template__content_for_modal_payment_request();
3245 -
3246 - wpbc_hidden_template__content_for_modal_import_google_calendar();
3247 -
3248 - wpbc_hidden_template__content_for_modal_export_csv();
3249 -
3250 - do_action( 'wpbc_hook_booking_template__hidden_templates' ); // FixIn: 9.2.3.6.
3251 - }
3252 - }
3253 -
3254 - if ( 'vm_booking_listing' == wpbc_ajx_booking_listing__get_default_view_mode() ) {
3255 - //if ( strpos( $_SERVER['REQUEST_URI'], 'view_mode=vm_booking_listing' ) !== false ) { // Load only at AJX_Bookings Settings Page
3256 - add_action( 'wpbc_hook_settings_page_footer', 'wpbc_for_booking_template__hidden_templates' );
3257 - }
3258 -
3259 -
3260 - /**
3261 - * Hidden template -- Change booking resources
3262 - *
3263 - * We need to have such hidden template for generating select box for booking resource only once, while we show Listing.
3264 - * It's called each time from wpbc_ajx_define_templates__resource_manipulation() in wpbc_ajx_booking_show_listing()
3265 - * So we renew booking resource list with each Ajax request for Booking Listing.
3266 - *
3267 - * @return void
3268 - */
3269 - function wpbc_hidden_template__change_booking_resource(){
3270 -
3271 - // Here will be composed template with real HTML defined in "booking_listing.js" file in function wpbc_ajx_booking_show_listing( ...
3272 - ?><div id="wpbc_hidden_template__change_booking_resource"></div><?php
3273 -
3274 - // Template
3275 - ?><script type="text/html" id="tmpl-wpbc_ajx_change_booking_resource"><?php
3276 -
3277 - if ( ! class_exists('wpdev_bk_personal') ) {
3278 - echo '</script>';
3279 - return false;
3280 - }
3281 - /*
3282 - ?><# console.log( ' == TEMPLATE PARAMS "wpbc_ajx_change_booking_resource" == ', data ); #><?php
3283 - */
3284 - $booking_action = 'change_booking_resource';
3285 -
3286 - $el_id = 'ui_btn_' . $booking_action;
3287 -
3288 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
3289 - echo '</script>';
3290 - return false;
3291 - }
3292 -
3293 - $params_button_save = array(
3294 - 'type' => 'button' ,
3295 - 'title' => __( 'Change', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
3296 - 'hint' => array( 'title' => __( 'Save Changes', 'booking' ), 'position' => 'top' ), // Hint
3297 - 'link' => 'javascript:void(0)', // Direct link or skip it
3298 - 'action' => "wpbc_ajx_booking__ui_click_save__change_resource( this, '{$booking_action}', '{$el_id}' );" ,
3299 - 'style' => '', // Any CSS class here
3300 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
3301 - 'icon' => array( 'icon_font' => 'wpbc_icn_check _circle_outline', 'position' => 'right', 'icon_img' => '' ),
3302 - 'class' => 'wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary'
3303 - 'attr' => array( 'id' => $el_id )
3304 - );
3305 -
3306 - $params_button_cancel = array(
3307 - 'type' => 'button' ,
3308 - 'title' => __( 'Cancel', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
3309 - 'hint' => array( 'title' => __('Close' ,'booking'), 'position' => 'top' ), // Hint
3310 - 'link' => 'javascript:void(0)', // Direct link or skip it
3311 - 'action' => "wpbc_ajx_booking__ui_click_close__change_resource();" ,
3312 - 'style' => '', // Any CSS class here
3313 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
3314 - 'icon' => array( 'icon_font' => 'wpbc_icn_close _block', 'position' => 'right', 'icon_img' => '' ),
3315 - 'class' => '', // '' | 'wpbc_ui_button_primary'
3316 - 'attr' => array( 'id' => $el_id . '_cancel' )
3317 - );
3318 -
3319 - ?><div id="change_booking_resource__section" class="highlight_action_section">
3320 - <div class="wpbc_ajx_toolbar wpbc_buttons_row wpbc_buttons_row_for_booking"> <div class="ui_container ui_container_small"> <div class="ui_group">
3321 -
3322 - <input type="hidden" value="" id="change_booking_resource__booking_id" />
3323 -
3324 - <div class="ui_element">
3325 -
3326 - <select id="change_booking_resource__resource_select" name="change_booking_resource__resource_select" class="wpbc_ui_control wpbc_ui_select change_booking_resource_selectbox">
3327 - <# <?php if (0) { ?><script type="text/javascript"><?php /* Hack for showing JavaScript syntax */ } ?>
3328 - _.each( data.ajx_booking_resources, function ( p_resource, p_resource_id, p_data ){
3329 - #><option value="{{p_resource.booking_type_id}}"
3330 - style="<#
3331 - if( undefined != p_resource.parent ) {
3332 - if( '0' == p_resource.parent ) {
3333 - #>font-weight:600;<#
3334 - } else {
3335 - #>font-size:0.95em;padding-left:20px;<#
3336 - }
3337 - }
3338 - #>"
3339 - ><#
3340 - if( undefined != p_resource.parent ) {
3341 - if( '0' != p_resource.parent ) {
3342 - #>&nbsp;&nbsp;&nbsp;<#
3343 - }
3344 - }
3345 - #>{{p_resource.title}}</option><#
3346 - }); <?php if (0) { ?></script><?php /* Hack for showing JavaScript syntax */ } ?>
3347 - #>
3348 - </select>
3349 -
3350 - </div>
3351 -
3352 - <div class="ui_element" >
3353 - <?php wpbc_flex_button($params_button_save); ?>
3354 - </div>
3355 -
3356 - <div class="ui_element">
3357 - <?php wpbc_flex_button($params_button_cancel); ?>
3358 - </div>
3359 -
3360 - </div> </div> </div>
3361 - <div class="clear"></div>
3362 - </div>
3363 -
3364 - </script><?php
3365 - }
3366 -
3367 -
3368 - /**
3369 - * Hidden template -- Duplicate booking to other resources
3370 - *
3371 - * We need to have such hidden template for generating select box for booking resource only once, while we show Listing.
3372 - * It's called each time from wpbc_ajx_define_templates__resource_manipulation() in wpbc_ajx_booking_show_listing()
3373 - * So we renew booking resource list with each Ajax request for Booking Listing.
3374 - *
3375 - * @return void
3376 - */
3377 - function wpbc_hidden_template__duplicate_booking_to_other_resource(){
3378 -
3379 - // Here will be composed template with real HTML defined in "booking_listing.js" file in function wpbc_ajx_booking_show_listing( ...
3380 - ?><div id="wpbc_hidden_template__duplicate_booking_to_other_resource"></div><?php
3381 -
3382 - // Template
3383 - ?><script type="text/html" id="tmpl-wpbc_ajx_duplicate_booking_to_other_resource"><?php
3384 -
3385 - if ( ! class_exists('wpdev_bk_personal') ) {
3386 - echo '</script>';
3387 - return false;
3388 - }
3389 - /*
3390 - ?><# console.log( ' == TEMPLATE PARAMS "wpbc_ajx_duplicate_booking_to_other_resource" == ', data ); #><?php
3391 - /**/
3392 - $booking_action = 'duplicate_booking_to_other_resource';
3393 -
3394 - $el_id = 'ui_btn_' . $booking_action;
3395 -
3396 - if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
3397 - echo '</script>';
3398 - return false;
3399 - }
3400 -
3401 - $params_button_save = array(
3402 - 'type' => 'button' ,
3403 - 'title' => __( 'Duplicate Booking', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
3404 - 'hint' => array( 'title' => __( 'Save Changes', 'booking' ), 'position' => 'top' ), // Hint
3405 - 'link' => 'javascript:void(0)', // Direct link or skip it
3406 - 'action' => "wpbc_ajx_booking__ui_click_save__duplicate_booking( this, '{$booking_action}', '{$el_id}' );" ,
3407 - 'style' => '', // Any CSS class here
3408 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
3409 - 'icon' => array( 'icon_font' => 'wpbc_icn_check _circle_outline', 'position' => 'right', 'icon_img' => '' ),
3410 - 'class' => 'wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary'
3411 - 'attr' => array( 'id' => $el_id )
3412 - );
3413 -
3414 - $params_button_cancel = array(
3415 - 'type' => 'button' ,
3416 - 'title' => __( 'Cancel', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
3417 - 'hint' => array( 'title' => __('Close' ,'booking'), 'position' => 'top' ), // Hint
3418 - 'link' => 'javascript:void(0)', // Direct link or skip it
3419 - 'action' => "wpbc_ajx_booking__ui_click_close__duplicate_booking();" ,
3420 - 'style' => '', // Any CSS class here
3421 - 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
3422 - 'icon' => array( 'icon_font' => 'wpbc_icn_close _block', 'position' => 'right', 'icon_img' => '' ),
3423 - 'class' => '', // '' | 'wpbc_ui_button_primary'
3424 - 'attr' => array( 'id' => $el_id . '_cancel' )
3425 - );
3426 -
3427 - ?><div id="duplicate_booking_to_other_resource__section" class="highlight_action_section">
3428 - <div class="wpbc_ajx_toolbar wpbc_buttons_row wpbc_buttons_row_for_booking"> <div class="ui_container ui_container_small"> <div class="ui_group">
3429 -
3430 - <input type="hidden" value="" id="duplicate_booking_to_other_resource__booking_id" />
3431 -
3432 - <div class="ui_element">
3433 -
3434 - <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">
3435 - <# <?php if (0) { ?><script><?php /* Hack for showing JavaScript syntax */ } ?>
3436 - _.each( data.ajx_booking_resources, function ( p_resource, p_resource_id, p_data ){
3437 - #><option value="{{p_resource.booking_type_id}}"
3438 - style="<#
3439 - if( undefined != p_resource.parent ) {
3440 - if( '0' == p_resource.parent ) {
3441 - #>font-weight:600;<#
3442 - } else {
3443 - #>font-size:0.95em;padding-left:20px;<#
3444 - }
3445 - }
3446 - #>"
3447 - ><#
3448 - if( undefined != p_resource.parent ) {
3449 - if( '0' != p_resource.parent ) {
3450 - #>&nbsp;&nbsp;&nbsp;<#
3451 - }
3452 - }
3453 - #>{{p_resource.title}}</option><#
3454 - }); <?php if (0) { ?></script><?php /* Hack for showing JavaScript syntax */ } ?>
3455 - #>
3456 - </select>
3457 -
3458 - </div>
3459 -
3460 - <div class="ui_element" >
3461 - <?php wpbc_flex_button($params_button_save); ?>
3462 - </div>
3463 -
3464 - <div class="ui_element">
3465 - <?php wpbc_flex_button($params_button_cancel); ?>
3466 - </div>
3467 -
3468 - </div> </div> </div>
3469 - <div class="clear"></div>
3470 - </div>
3471 -
3472 - </script><?php
3473 - }
3474 -
3475 -
3476 - /** Payment Request Layout - Modal Window structure */
3477 - function wpbc_hidden_template__content_for_modal_payment_request() {
3478 -
3479 - if ( ! class_exists('wpdev_bk_biz_s') ) {
3480 - return false;
3481 - }
3482 - ?><span class="wpdevelop">
3483 - <div id="wpbc_modal__payment_request__section" class="modal wpbc_popup_modal" tabindex="-1" role="dialog">
3484 - <div class="modal-dialog">
3485 - <div class="modal-content">
3486 - <div class="modal-header">
3487 - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
3488 - <h4 class="modal-title"><?php esc_html_e('Send payment request to customer' ,'booking'); ?></h4>
3489 - </div>
3490 - <div class="modal-body">
3491 - <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>
3492 - <label class="help-block"><?php
3493 - /* translators: 1: ... */
3494 - echo wp_kses_post( sprintf( __( 'Type your %1$sreason for payment%2$s request', 'booking' ),'<b>',',</b>') ); ?></label>
3495 - <input type="hidden" id="wpbc_modal__payment_request__booking_id" value="" />
3496 - </div>
3497 - <div class="modal-footer">
3498 - <a id="wpbc_modal__payment_request__button_send" class="button button-primary"
3499 - onclick="javascript: wpbc_ajx_booking__ui_click__send_payment_request();" href="javascript:void(0);"
3500 - ><?php esc_html_e('Send Request' ,'booking'); ?></a>
3501 - <a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal"><?php esc_html_e('Close' ,'booking'); ?></a>
3502 - </div>
3503 - </div><!-- /.modal-content -->
3504 - </div><!-- /.modal-dialog -->
3505 - </div><!-- /.modal -->
3506 - </span><?php
3507 - }
3508 -
3509 - /** Payment Request Loyout - Modal Window structure */
3510 - function wpbc_hidden_template__content_for_modal_import_google_calendar() {
3511 -
3512 - ?><span class="wpdevelop"><?php
3513 -
3514 - $booking_gcal_feed = get_bk_option( 'booking_gcal_feed');
3515 - $is_this_btn_disabled = false;
3516 -
3517 - if ( ( ! class_exists('wpdev_bk_personal') ) && ( $booking_gcal_feed == '' ) ) {
3518 -
3519 - $is_this_btn_disabled = true;
3520 - $settigns_link = wpbc_get_settings_url() . "&tab=sync&subtab=gcal";
3521 - } else {
3522 - $booking_gcal_events_from = get_bk_option( 'booking_gcal_events_from' );
3523 - $booking_gcal_events_from_offset = get_bk_option( 'booking_gcal_events_from_offset' );
3524 - $booking_gcal_events_from_offset_type = get_bk_option( 'booking_gcal_events_from_offset_type' );
3525 -
3526 - $booking_gcal_events_until = get_bk_option( 'booking_gcal_events_until' );
3527 - $booking_gcal_events_until_offset = get_bk_option( 'booking_gcal_events_until_offset' );
3528 - $booking_gcal_events_until_offset_type = get_bk_option( 'booking_gcal_events_until_offset_type' );
3529 -
3530 - $booking_gcal_events_max = get_bk_option( 'booking_gcal_events_max' );
3531 - // $booking_gcal_timezone = get_bk_option( 'booking_gcal_timezone');
3532 -
3533 -
3534 - }
3535 - ?><div id="wpbc_modal__import_google_calendar__section" class="modal wpbc_popup_modal wpbc_modal__import_google_calendar__section" tabindex="-1" role="dialog">
3536 - <div class="modal-dialog modal-lg">
3537 - <div class="modal-content">
3538 - <div class="modal-header">
3539 - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
3540 - <h4 class="modal-title"><?php
3541 - if ( $is_this_btn_disabled ) esc_html_e('Warning!' ,'booking');
3542 - else esc_html_e('Retrieve Google Calendar Events ' ,'booking');
3543 - ?></h4>
3544 - </div>
3545 - <div class="modal-body">
3546 - <?php if ($is_this_btn_disabled) { ?>
3547 - <label class="help-block" style="display:block;">
3548 - <?php echo wp_kses_post( sprintf( __( 'Please configure settings for import Google Calendar events' ,'booking'),'<b>',',</b>') ); ?>
3549 - <a href="<?php echo esc_url( $settigns_link ); ?>"><?php esc_html_e('here' ,'booking'); ?></a>
3550 - </label>
3551 - <?php } else { ?>
3552 -
3553 - <table class="visibility_gcal_feeds_settings form-table0 settings-table0 table" >
3554 - <tbody>
3555 - <?php
3556 - if ( function_exists('wpbc_gcal_settings_content_field_selection_booking_resources') )
3557 - wpbc_gcal_settings_content_field_selection_booking_resources();
3558 - else {
3559 - ?><input type="hidden" name="wpbc_booking_resource" id="wpbc_booking_resource" value="" /><?php
3560 - }
3561 - wpbc_gcal_settings_content_field_from( $booking_gcal_events_from, $booking_gcal_events_from_offset, $booking_gcal_events_from_offset_type );
3562 - wpbc_gcal_settings_content_field_until( $booking_gcal_events_until, $booking_gcal_events_until_offset, $booking_gcal_events_until_offset_type );
3563 - wpbc_gcal_settings_content_field_max_feeds( $booking_gcal_events_max );
3564 - // wpbc_gcal_settings_content_field_timezone($booking_gcal_timezone);
3565 -
3566 - ?>
3567 - </tbody>
3568 - </table>
3569 -
3570 - <?php } ?>
3571 - </div>
3572 - <div class="modal-footer" style="text-align:center;">
3573 - <?php if ($is_this_btn_disabled) { ?>
3574 - <a href="<?php echo esc_url( $settigns_link ); ?>"
3575 - class="button button-primary" style="float:none;" >
3576 - <?php esc_html_e('Configure' ,'booking'); ?>
3577 - </a>
3578 - <?php } else { ?>
3579 - <a href="javascript:void(0)" class="button button-primary" style="float:none;"
3580 - id="wpbc_modal__import_google_calendar__button_send"
3581 - onclick="javascript:wpbc_ajx_booking__ui_click__import_google_calendar();jQuery('#wpbc_modal__import_google_calendar__section').wpbc_my_modal('hide');"
3582 - ><?php esc_html_e('Import Google Calendar Events' ,'booking'); ?></a>
3583 - <?php } ?>
3584 - <a href="javascript:void(0)" class="button" style="float:none;" data-dismiss="modal"><?php esc_html_e('Close' ,'booking'); ?></a>
3585 - </div>
3586 - </div><!-- /.modal-content -->
3587 - </div><!-- /.modal-dialog -->
3588 - </div><!-- /.modal -->
3589 - <?php
3590 -
3591 - ?></span><?php
3592 - }
3593 -
3594 -
3595 - /** Payment Request Layout - Modal Window structure */
3596 - function wpbc_hidden_template__content_for_modal_export_csv() {
3597 -
3598 - if ( ! class_exists('wpdev_bk_personal') ) {
3599 - return false;
3600 - }
3601 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended
3602 - $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
3603 - $booking_csv_export_params = get_user_option( 'booking_csv_export_params', (int) $user_id );
3604 - $booking_csv_export_params = ( ! empty( $booking_csv_export_params ) ) ? $booking_csv_export_params : array();
3605 - $defaults= array(
3606 - 'export_type' => 'csv_all',
3607 - 'selected_id' => '',
3608 - 'csv_export_separator' => 'semicolon',
3609 - 'csv_export_skip_fields' => ''
3610 - );
3611 - $export_params_arr = wp_parse_args( $booking_csv_export_params, $defaults );
3612 -
3613 - ?><span class="wpdevelop">
3614 - <div id="wpbc_modal__export_csv__section" class="modal wpbc_popup_modal" tabindex="-1" role="dialog">
3615 - <div class="modal-dialog">
3616 - <div class="modal-content">
3617 - <div class="modal-header">
3618 - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
3619 - <h4 class="modal-title"><?php esc_html_e('CSV Export' ,'booking'); ?></h4>
3620 - </div>
3621 - <div class="modal-body">
3622 - <table class="form-table"><tbody>
3623 - <?php
3624 - $default_options_values = wpbc_get_default_options();
3625 -
3626 - $field_options = array(
3627 - 'semicolon' => '; - ' . __( 'semicolon', 'booking' )
3628 - , 'comma' => ', - ' . __( 'comma', 'booking' )
3629 - );
3630 - $fields = array(
3631 - 'type' => 'select'
3632 - , 'value' => $export_params_arr['csv_export_separator'] //';'
3633 - , 'title' => __('CSV data separator', 'booking')
3634 - , 'description' => ''//sprintf(__('Select separator of data for export bookings to CSV.' ,'booking'),'<b>','</b>')
3635 - , 'options' => $field_options
3636 - , 'label' => ''
3637 - , 'disabled' => false
3638 - , 'disabled_options' => array()
3639 - , 'multiple' => false
3640 - , 'description_tag' => 'p'
3641 - , 'tr_class' => ''
3642 - , 'class' => ''
3643 - , 'css' => ''
3644 - , 'only_field' => false
3645 - , 'attr' => array()
3646 - //, 'value' => ''
3647 - );
3648 -
3649 - WPBC_Settings_API::field_select_row_static( 'wpbc_field_booking_csv_export_separator', $fields );
3650 -
3651 -
3652 - $field_options = array(
3653 - 'csv_page' => __( 'Current page', 'booking' )
3654 - , 'csv_all' => __( 'All pages', 'booking' )
3655 - );
3656 - $fields = array(
3657 - 'type' => 'select'
3658 - , 'value' => $export_params_arr['export_type']
3659 - , 'title' => __('Export pages', 'booking')
3660 - , 'description' => ''//sprintf(__('Select exporting current page or all pages.' ,'booking'),'<b>','</b>')
3661 - , 'options' => $field_options
3662 - , 'label' => ''
3663 - , 'disabled' => false
3664 - , 'disabled_options' => array()
3665 - , 'multiple' => false
3666 - , 'description_tag' => 'p'
3667 - , 'tr_class' => ''
3668 - , 'class' => ''
3669 - , 'css' => ''
3670 - , 'only_field' => false
3671 - , 'attr' => array()
3672 - //, 'value' => ''
3673 - );
3674 -
3675 - WPBC_Settings_API::field_select_row_static( 'wpbc_field_booking_csv_export_type', $fields );
3676 - ?>
3677 - </tbody></table>
3678 - <textarea id="wpbc_field_booking_csv_export_skip_fields"
3679 - name="wpbc_field_booking_csv_export_skip_fields"
3680 - style="width:100%;"
3681 - cols="87" rows="2"
3682 - placeholder="<?php echo 'trash,is_new,secondname'; ?>"
3683 - ><?php echo esc_textarea( $export_params_arr['csv_export_skip_fields'] ); ?></textarea>
3684 - <label class="help-block"><?php
3685 - /* translators: 1: ... */
3686 - echo wp_kses_post( sprintf( __( 'Enter field names separated by commas to %1$sskip the export%2$s', 'booking' ),'<b>','</b>') ); ?></label>
3687 - <input type="hidden" id="wpbc_modal__export_csv__booking_id" value="" />
3688 - </div>
3689 - <div class="modal-footer">
3690 - <a id="wpbc_modal__export_csv__button_send" class="button button-primary"
3691 - onclick="javascript: wpbc_ajx_booking__ui_click__export_csv( {
3692 - 'booking_action' : 'export_csv',
3693 - 'ui_clicked_element_id' : 'wpbc_modal__export_csv__button_send',
3694 - 'export_type' : jQuery('#wpbc_field_booking_csv_export_type option:selected').val(),
3695 - 'csv_export_separator' : jQuery('#wpbc_field_booking_csv_export_separator option:selected').val(),
3696 - 'csv_export_skip_fields': jQuery('#wpbc_field_booking_csv_export_skip_fields').val()
3697 - } );" href="javascript:void(0);"
3698 - ><?php esc_html_e('Export' ,'booking'); ?></a>
3699 - <a href="javascript:void(0)" class="button button-secondary" data-dismiss="modal"><?php esc_html_e('Close' ,'booking'); ?></a>
3700 - </div>
3701 - </div><!-- /.modal-content -->
3702 - </div><!-- /.modal-dialog -->
3703 - </div><!-- /.modal -->
3704 - </span><?php
3705 - }
3706 -
3707 -// </editor-fold>
3708 -
3709 -
3710 2282 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3711 2283 // Support functions
3712 2284 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3713 2285
@@ -3838,5 +2410,5 @@
3838 2410 // Default
3839 2411 }
3840 2412
3841 2413 return true;
3842 -}
2414 +}