Ejemplo n.º 1
0
 function evo_tx_custom_event_columns($column)
 {
     global $post, $eventon, $evotx;
     $meta = get_post_meta($post->ID);
     // ticket item meta
     $ticket_item = new evotx_TicketItem($post->ID, $meta);
     switch ($column) {
         case "tix":
             $tix_pmv = get_post_custom($post->ID);
             $edit_link = get_edit_post_link($post->ID);
             $tid = !empty($meta['tid']) ? $meta['tid'][0] : null;
             $qty = get_post_meta($post->ID, 'qty', true);
             $cost = get_post_meta($post->ID, 'cost', true);
             echo "<strong><a class='row-title' href='" . $edit_link . "'>#{$post->ID}</a></strong> by " . $meta['name'][0] . " " . $meta['email'][0];
             // get ticket ids
             $tix_id_ar = $ticket_item->ticket_ids('string');
             echo !empty($tid) ? '<br/><em class="lite">Ticket ID(s):</em> <i>' . $tix_id_ar . '</i>' : null;
             //$ticket_item->fix_wrong_qty();
             echo '<br/><span class="evotx_intrim">' . $qty . ' <em class="lite">(Qty)</em> - ' . (!empty($cost) ? get_woocommerce_currency_symbol() . apply_filters('woocommerce_get_price', $cost) : '-') . '<em class="lite"> (Total)</em></span>';
             //echo get_post_meta($post->ID, 'tix', true);
             break;
         case "tix_event":
             $e_id = !empty($meta['_eventid']) ? $meta['_eventid'][0] : null;
             if ($e_id) {
                 echo '<strong><a class="row-title" href="' . get_edit_post_link($e_id) . '">' . get_the_title($e_id) . '</a></strong>';
             } else {
                 echo '--';
             }
             break;
         case "tix_type":
             $type = get_post_meta($post->ID, 'type', true);
             echo !empty($type) ? $type : '-';
             break;
         case "tix_status":
             $checked_count = $ticket_item->checked_count();
             $status = 'checked';
             $checked_count_ = !empty($checked_count['checked']) ? $checked_count['checked'] : '0';
             // if all checked
             $_checked_class = $checked_count_ == $checked_count['qty'] ? 'checked' : 'check-in';
             // different state on checked tickets
             if ($checked_count['qty'] == '1' && $checked_count_ == '0') {
                 $display = $ticket_item->get_checkin_status('check-in');
             } elseif ($checked_count['qty'] == '1' && $checked_count_ == '1' || $checked_count['qty'] > 1 && $checked_count['qty'] == $checked_count_) {
                 $display = $ticket_item->get_checkin_status('checked');
             } else {
                 $display = $ticket_item->get_checkin_status($status) . ' ' . $checked_count_ . '/' . $checked_count['qty'];
             }
             // order
             $_orderid = get_post_meta($post->ID, '_orderid', true);
             if (!empty($_orderid)) {
                 $order = new WC_Order($_orderid);
                 $order_status = $order->status;
             } else {
                 $order_status = 'n/a';
             }
             echo "<p class='evotx_status_list {$order_status}'><em class='lite'>Order:</em> " . $order_status . "</p>";
             echo "<p class='evotx_status_list {$_checked_class}'><em class='lite'>Ticket:</em> <span class='tixstatus'>" . $display . "</span></p>";
             break;
     }
 }
Ejemplo n.º 2
0
 function evoTX_checkin_()
 {
     $ticket_item_id = $_POST['tiid'];
     $ticket_id = $_POST['tid'];
     $current_status = $_POST['status'];
     $ticketItem = new evotx_TicketItem($ticket_item_id);
     $other_status = $ticketItem->get_other_status($current_status);
     $ticketItem->change_ticket_status($other_status[0], $ticket_id, $ticket_item_id);
     $return_content = array('new_status' => $other_status[0], 'new_status_lang' => $other_status[1]);
     echo json_encode($return_content);
     exit;
 }
Ejemplo n.º 3
0
 function get_customer_ticket_list($event_id, $wcid)
 {
     // get all ticket items matching product id and event id
     $ticketItems = new WP_Query(array('posts_per_page' => -1, 'post_type' => 'evo-tix', 'meta_query' => array('relation' => 'AND', array('key' => 'wcid', 'value' => $wcid, 'compare' => '='), array('key' => '_eventid', 'value' => $event_id, 'compare' => '='))));
     $customer_ = array();
     if ($ticketItems->have_posts()) {
         while ($ticketItems->have_posts()) {
             $ticketItems->the_post();
             $tiid = get_the_ID();
             $tii_meta = get_post_custom($tiid);
             $order_id = !empty($tii_meta['_orderid']) ? $tii_meta['_orderid'] : false;
             $orderOK = false;
             if ($order_id) {
                 $order = new WC_Order($order_id[0]);
                 $order_status = $order->status;
                 $orderOK = $order_status == 'completed' ? true : false;
             }
             if ($orderOK) {
                 // if the order was completed for these tickets
                 $ticket_item = new evotx_TicketItem($tiid, $tii_meta);
                 $ticketids = $ticket_item->ticket_ids();
                 $customer_[$tii_meta['name'][0]][] = array('tiid' => $tiid, 'tids' => $ticketids, 'email' => $tii_meta['email'][0], 'type' => $tii_meta['type'][0], 'qty' => $tii_meta['qty'][0]);
             }
         }
     }
     return count($customer_) > 0 ? $customer_ : false;
 }
Ejemplo n.º 4
0
function evotx_metabox_002()
{
    global $post, $evotx;
    $ticketItem_meta = get_post_meta($post->ID);
    $ticket_item = new evotx_TicketItem($post->ID, $ticketItem_meta);
    $tix = new evotx_ticket();
    // Debug email templates
    $show_debug_email = false;
    if ($show_debug_email) {
        $order_id = $ticketItem_meta['_orderid'][0];
        $order = new WC_Order($order_id);
        $tickets = $order->get_items();
        $email_body_arguments = array('orderid' => $order_id, 'tickets' => $tickets, 'customer' => 'Ashan Jay', 'email' => 'yes');
        $tt = $tix->get_ticket_email_body($email_body_arguments);
        print_r($tt);
    }
    // get event times
    $event_id = !empty($ticketItem_meta['_eventid']) ? $ticketItem_meta['_eventid'][0] : '';
    $event_time = $ticket_item->get_event_time($event_id);
    // get corrected event ticket ids
    if (empty($ticketItem_meta['ticket_ids'][0])) {
        $tix->correct_tix_ids($ticketItem_meta, $post->ID);
    }
    ?>
	
		<div class='eventon_mb' style='margin:-6px -12px -12px'>
		<div style='background-color:#ECECEC; padding:15px;'>
			<div style='background-color:#fff; border-radius:8px;'>
			<table width='100%' class='evo_metatable' cellspacing="" style='vertical-align:top' valign='top'>
				<tr><td><?php 
    _e('Woocommerce Order ID', 'eventon');
    ?>
 #: </td><td><?php 
    echo '<a class="button" href="' . get_edit_post_link($ticketItem_meta['_orderid'][0]) . '">' . $ticketItem_meta['_orderid'][0] . '</a>';
    ?>
</td></tr>				
				<tr><td><?php 
    _e('Ticket Type', 'eventon');
    ?>
: </td><td><?php 
    echo !$ticketItem_meta['type'] ? $ticketItem_meta['type'][0] : '--';
    ?>
</td></tr>

				<?php 
    $ticket_holder = !empty($ticketItem_meta['_customerid'][0]) && $ticketItem_meta['_customerid'][0] != '0' ? '<a href="' . get_edit_user_link($ticketItem_meta['_customerid'][0]) . '">' . $ticketItem_meta['name'][0] . '</a>' : $ticketItem_meta['name'][0];
    ?>
				<tr><td><?php 
    _e('Ticket Holder', 'eventon');
    ?>
: </td><td><?php 
    echo $ticket_holder;
    ?>
</td></tr>
				<tr><td><?php 
    _e('Email Address', 'eventon');
    ?>
: </td><td><?php 
    echo $ticketItem_meta['email'][0];
    ?>
</td></tr>
				<tr><td><?php 
    _e('Quantity', 'eventon');
    ?>
: </td><td><?php 
    echo $ticketItem_meta['qty'][0];
    ?>
</td></tr>
				<tr><td><?php 
    _e('Cost for ticket(s)', 'eventon');
    ?>
: </td><td><?php 
    echo get_woocommerce_currency_symbol() . $ticketItem_meta['cost'][0];
    ?>
</td></tr>
				<tr><td><?php 
    _e('Event', 'eventon');
    ?>
: </td>
				<td><?php 
    echo '<a href="' . get_edit_post_link($event_id) . '">' . get_the_title($ticketItem_meta['_eventid'][0]) . '</a>';
    ?>

					<?php 
    // if this is a repeat event show repeat information
    $event_meta = get_post_meta($event_id);
    if (!empty($event_meta['evcal_repeat']) && $event_meta['evcal_repeat'][0] == 'yes') {
        echo "<p>This is a repeating event.</p>";
    }
    ?>
				</td></tr>
				<?php 
    // get translated checkin status
    $st_count = $ticket_item->checked_count();
    $status = $ticket_item->get_checkin_status('checked');
    $__count = ': ' . (!empty($st_count['checked']) ? $st_count['checked'] : '0') . ' out of ' . $ticketItem_meta['qty'][0];
    ?>
				<tr><td><?php 
    _e('Ticket Status', 'eventon');
    ?>
: </td><td><?php 
    echo $status . $__count;
    ?>
</td></tr>
				<tr><td><?php 
    _e('Ticket Time', 'eventon');
    ?>
: </td><td><?php 
    echo $event_time;
    ?>
</td></tr>
				<tr><td ><?php 
    _e('Ticket(s)', 'eventon');
    ?>
 #: </td><td>
					<?php 
    // get ticket IDs for this ticket item
    $ticketids = $ticket_item->ticket_ids();
    ?>
					<table id='evotx_ticketItem_tickets'>
						<?php 
    if (is_array($ticketids)) {
        foreach ($ticketids as $ff => $vv) {
            ?>
								<tr><td><?php 
            echo apply_filters('evotx_tixPost_tixid', $ff);
            ?>
<br/><span class='tix_status <?php 
            echo $vv;
            ?>
' data-tiid='<?php 
            echo $post->ID;
            ?>
' data-tid='<?php 
            echo $ff;
            ?>
' data-status='<?php 
            echo $vv;
            ?>
'><?php 
            echo $ticket_item->get_checkin_status($vv);
            ?>
</span></td></tr>
						<?php 
        }
    } else {
        echo "<tr><td>{$ticketids}</td></tr>";
    }
    ?>
					</table>

				</td></tr>
				<?php 
    do_action('eventontx_tix_post_table', $post->ID, $ticketItem_meta);
    ?>
			</table>
			</div>
		</div>
		</div>
		<?php 
}
// order items as ticket items - run through each
foreach ($args['tickets'] as $ticket_item) {
    // initiate ticket order item class
    $torderItem = new evotx_ticket_orderitem($ticket_item, $args['orderid']);
    $event_id = $torderItem->event_id();
    $e_pmv = get_post_custom($event_id);
    // verify only ticket items are in this email
    if (empty($event_id)) {
        continue;
    }
    // ticket item ID
    $ticket_item_id = $torderItem->the_ticket_item_id;
    // location data
    $location = (!empty($e_pmv['evcal_location_name']) ? $e_pmv['evcal_location_name'][0] . ' ' : null) . (!empty($e_pmv['evcal_location']) ? $e_pmv['evcal_location'][0] : null);
    // event time
    $ticketItem = new evotx_TicketItem($ticket_item_id);
    $__date = $ticketItem->_event_date($event_id, $e_pmv);
    $time = $ticketItem->get_correct_times($event_id, $e_pmv);
    $event_time = $ticketItem->get_event_time($event_id, $time['start'], $time['end']);
    ?>
	<tr>
		<td style='<?php 
    echo $__sty_td;
    ?>
'>
			
			<div class='event_date' style='<?php 
    echo $__styles_06;
    ?>
'>
				<p style='padding-top:10px;color:#555555; text-transform:uppercase; font-size:12px; margin:0px; line-height:100%'><?php