diff --git a/inc/mep_event_meta.php b/inc/mep_event_meta.php index 1900a19..fb28530 100644 --- a/inc/mep_event_meta.php +++ b/inc/mep_event_meta.php @@ -23,14 +23,39 @@ function mep_event_meta_box_add(){ add_meta_box( 'mep-event-available-set-on-off', __('Show Available Seat Count?','mage-eventpress'), 'mep_event_available_seat_cb', 'mep_events', 'side', 'low' ); + add_meta_box( 'mep-event-day-details', __('Event Daywise Details','mage-eventpress'), 'mep_event_day_details_cb', 'mep_events', 'normal', 'high' ); add_meta_box( 'mep-event-day-details', __('Event Daywise Details','mage-eventpress'), 'mep_event_day_details_cb', 'mep_events', 'normal', 'high' ); if(get_option( 'woocommerce_calc_taxes' )=='yes'){ add_meta_box( 'mep-event-tax-sec', __('Event Tax','mage-eventpress'), 'mep_event_tax_cb', 'mep_events', 'side', 'low' ); - } + } +add_meta_box( 'mep-event-rest-count-sec', __('Event Reset Booking Count','mage-eventpress'), 'mep_event_reset_booking_count', 'mep_events', 'side', 'low' ); } + + + +function mep_event_reset_booking_count($post){ + $values = get_post_custom( $post->ID ); + wp_nonce_field( 'mep_event_reset_btn_nonce', 'mep_event_reset_btn_nonce' ); +?> +
+
ID); ?>
+

+ +
+ ID ); wp_nonce_field( 'mep_event_reg_btn_nonce', 'mep_event_reg_btn_nonce' ); @@ -47,6 +72,11 @@ function mep_event_change_reg_status_cb($post){ } + + + + + function mep_event_tax_cb($post){ $values = get_post_custom( $post->ID ); wp_nonce_field( 'mep_event_reg_btn_nonce', 'mep_event_reg_btn_nonce' ); @@ -131,12 +161,28 @@ if(isset($_POST['mep_reg_status'])){ } +if(isset($_POST['mep_reset_status'])){ + $mep_reset_status = strip_tags($_POST['mep_reset_status']); +}else{ + $mep_reset_status = 'off'; +} + + if(isset($_POST['mep_available_seat'])){ - $mep_available_seat = strip_tags($_POST['mep_available_seat']); + $mep_available_seat = strip_tags($_POST['mep_available_seat']); }else{ $mep_available_seat = 'off'; } + +if($mep_reset_status=='on'){ + mep_reset_event_booking($post_id); +} + + + + + if(isset($_POST['_tax_status'])){ $_tax_status = strip_tags($_POST['_tax_status']); }else{ diff --git a/readme.txt b/readme.txt index fc1742c..9acca0f 100644 --- a/readme.txt +++ b/readme.txt @@ -340,4 +340,11 @@ A. you can create support ticket here with problem details with possible screens ==> Template broken issue fixed. ==> Add Ticket Number into CSV File ==> Dynamic Column feature in CSV file -11 June 2019* \ No newline at end of file +11 June 2019* + + +*= 2.6.4 = +*Update Release: +==> Booking counting duplicating issue fixed in free event. +==> Add new feature Reset Booking count option. +19 June 2019* \ No newline at end of file diff --git a/woocommerce-event-press.php b/woocommerce-event-press.php index f8a36e7..2f793fe 100644 --- a/woocommerce-event-press.php +++ b/woocommerce-event-press.php @@ -3,7 +3,7 @@ * Plugin Name: Woocommerce Events Manager * Plugin URI: http://mage-people.com * Description: A Complete Event Solution for WordPress by MagePeople.. -* Version: 2.6.3 +* Version: 2.6.4 * Author: MagePeople Team * Author URI: http://www.mage-people.com/ * Text Domain: mage-eventpress @@ -250,7 +250,7 @@ if (get_post_type($event_id) == 'mep_events') { -add_action('woocommerce_order_status_changed', 'your_function', 10, 4); +// add_action('woocommerce_order_status_changed', 'your_function', 10, 4); add_action('woocommerce_order_status_changed', 'mep_event_seat_management', 10, 4); function mep_event_seat_management( $order_id, $from_status, $to_status, $order ) { global $wpdb; @@ -382,6 +382,7 @@ update_post_meta( $event_id, $mep_atnd, "a2"); update_post_meta( $event_id, $order_meta_text, $order_completed); }elseif($mep_stock_msg=='pending'){ + if($ordr_total>0){ update_post_meta( $event_id, 'total_booking', ($mep_total_booking+$item_quantity)); update_post_meta( $event_id, $order_meta_text, $order_completed); @@ -394,9 +395,7 @@ update_post_meta( $event_id, $mep_atnd, "a2"); update_post_meta( $event_id, "mep_xtra_$order_option_name",$ntes); } } - - - + } } else{ @@ -1360,6 +1359,45 @@ function mep_get_event_total_seat($event_id){ + +function mep_reset_event_booking($event_id){ + $mep_event_ticket_type = get_post_meta($event_id, 'mep_event_ticket_type', true); + if($mep_event_ticket_type){ + foreach ( $mep_event_ticket_type as $field ) { + $qm = $field['option_name_t']; + $tesqn = $event_id.str_replace(' ', '', $qm); + $reset = update_post_meta($event_id,"mep_xtra_$tesqn",0); + } + // if($reset){ return 'Reset Done!'; } + }else{ + $reset = update_post_meta($event_id,"total_booking",0); + // if($reset){ return 'Reset Done!'; } + } + $args_search_qqq = array ( + 'post_type' => array( 'mep_events_attendees' ), + 'posts_per_page' => -1, + 'post_status' => 'publish', + 'meta_query' => array( + array( + 'key' => 'ea_event_id', + 'value' => $event_id, + 'compare' => '=' + ) + ) + ); + $loop = new WP_Query($args_search_qqq); + while ($loop->have_posts()) { + $loop->the_post(); + $post_id = get_the_id(); // change this to your post ID + $status = 'trash'; + $current_post = get_post( $post_id, 'ARRAY_A' ); + $current_post['post_status'] = $status; + wp_update_post($current_post); + } +} + + + // Add the custom columns to the book post type: add_filter( 'manage_mep_events_posts_columns', 'mep_set_custom_mep_events_columns' ); function mep_set_custom_mep_events_columns($columns) {