Plugin Directory

Changeset 1479172


Ignore:
Timestamp:
08/19/2016 11:42:51 PM (10 years ago)
Author:
loushou
Message:
  • [new] support for the new Table Service plugin
  • [fix] repaired bug where logged out users who create an account during checkout, and fail their first payment, do no lose their tickets

loushou

Location:
opentickets-community-edition/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • opentickets-community-edition/trunk/assets/js/utils/tools.js

    r1386561 r1479172  
    610610
    611611        function cb_trigger(name, params) {
    612             var params = params || [];
    613             var cbs = cb_get(name);
     612            var params = params || [],
     613                    cbs = cb_get(name), res;
    614614            if (cbs instanceof Array) {
    615                 for (var i=0; i<cbs.length; i++)
    616                     cbs[i].f.apply(this, params);
    617             }
     615                for (var i=0; i<cbs.length; i++) {
     616                    res = cbs[i].f.apply(this, params);
     617                    if ( false === res )
     618                        break;
     619                }
     620            }
     621
     622            return res;
    618623        };
    619624
  • opentickets-community-edition/trunk/inc/event-area/general-admission-area-type.class.php

    r1437825 r1479172  
    667667        if ( $qty <= 0 ) {
    668668            $resp['e'][] = __( 'The quantity must be greater than zero.', 'opentickets-community-edition' );
    669             return $this->_add_data( $resp, $event );
     669            return $this->_add_data( apply_filters( 'qsot-seating-ajax-response-reserve', $resp, $event, null, $ticket_type ), $event );
    670670        }
    671671
     
    674674        if ( ! is_object( $event_area ) ) {
    675675            $resp['e'][] = __( 'Could not find that event.', 'opentickets-community-edition' );
    676             return $this->_add_data( $resp, $event );
     676            return $this->_add_data( apply_filters( 'qsot-seating-ajax-response-reserve', $resp, $event, null, $ticket_type ), $event );
    677677        }
    678678
     
    708708        }
    709709
    710         return $this->_add_data( $resp, $event, $event_area, $ticket_type );
     710        return $this->_add_data( apply_filters( 'qsot-seating-ajax-response-reserve', $resp, $event, $event_area, $ticket_type ), $event, $event_area, $ticket_type );
    711711    }
    712712
     
    717717        if ( ! is_object( $event_area ) ) {
    718718            $resp['e'][] = __( 'Could not find that event.', 'opentickets-community-edition' );
    719             return $this->_add_data( $resp, $event );
     719            return $this->_add_data( apply_filters( 'qsot-seating-ajax-response-remove', $resp, $event, null, $ticket_type ), $event );
    720720        }
    721721
     
    767767        }
    768768
    769         return $this->_add_data( $resp, $event, $event_area, $ticket_type );
     769        return $this->_add_data( apply_filters( 'qsot-seating-ajax-response-remove', $resp, $event, $event_area, $ticket_type ), $event, $event_area, $ticket_type );
    770770    }
    771771
     
    778778        if ( $qty <= 0 ) {
    779779            $resp['e'][] = __( 'The quantity must be greater than zero.', 'opentickets-community-edition' );
    780             return $this->_add_data( $resp, $event );
     780            return $this->_add_data( apply_filters( 'qsot-seating-ajax-response-update', $resp, $event, null, $ticket_type ), $event );
    781781        }
    782782
     
    785785        if ( ! is_object( $event_area ) ) {
    786786            $resp['e'][] = __( 'Could not find that event.', 'opentickets-community-edition' );
    787             return $this->_add_data( $resp, $event );
     787            return $this->_add_data( apply_filters( 'qsot-seating-ajax-response-update', $resp, $event, null, $ticket_type ), $event );
    788788        }
    789789
     
    822822        }
    823823
    824         return $this->_add_data( $resp, $event, $event_area, $ticket_type );
     824        return $this->_add_data( apply_filters( 'qsot-seating-ajax-response-update', $resp, $event, $event_area, $ticket_type ), $event, $event_area, $ticket_type );
    825825    }
    826826
  • opentickets-community-edition/trunk/inc/event-area/post-type.class.php

    r1458303 r1479172  
    105105
    106106        // during transitions of order status (and order creation), we need to perform certain operations. we may need to confirm tickets, or cancel them, depending on the transition
    107         add_action( 'woocommerce_checkout_update_order_meta', array( &$this, 'update_order_id' ), 100, 2 );
     107        add_action( 'woocommerce_checkout_order_processed', array( &$this, 'update_order_id' ), 100, 2 );
    108108        add_action( 'woocommerce_order_status_changed', array( &$this, 'order_status_changed' ), 100, 3 );
    109109        //add_action( 'woocommerce_order_status_changed', array( &$this, 'order_status_changed_pending' ), 101, 3 );
    110110        add_action( 'woocommerce_order_status_changed', array( &$this, 'order_status_changed_cancel' ), 102, 3 );
    111         add_action( 'woocommerce_checkout_update_order_meta', array( &$this, 'order_has_been_created' ), 10000, 2 );
     111        add_action( 'woocommerce_checkout_order_processed', array( &$this, 'order_has_been_created' ), 10000, 2 );
     112        add_action( 'woocommerce_resume_order', array( &$this, 'on_resume_order_disassociate' ), 10, 1 );
    112113
    113114        // solve order again conundrum
     
    887888        // @NOTE: need more uniform way of determining 'reserved' is what we are looking for
    888889        $reserved = 'reserved';
    889         $results = QSOT_Zoner_Query::instance()->find( array( 'state' => $reserved, 'customer_id' => QSOT::current_user() ) );
     890        $confirmed = 'confirmed';
     891        $where = array();
     892        $user_ids = array_filter( (array) QSOT::current_user() );
     893        $where[] = 'state = "' . $reserved . '" and session_customer_id in ("' . implode( '","', array_map( 'esc_sql', $user_ids ) ) . '")';
     894        if ( isset( $WC->session->order_awaiting_payment ) && intval( $WC->session->order_awaiting_payment ) > 0 )
     895            $where[] = 'state = "' . $confirmed . '" and order_id = ' . absint( $WC->session->order_awaiting_payment );
     896        $results = QSOT_Zoner_Query::instance()->find( array( 'where__extra' => array( ' and ((' . implode( ') or (', $where ) . '))' ) ) );
    890897
    891898        $event_to_area_type = $indexed = array();
     
    909916            $indexed[ $row->event_id ][ $row->state ][ $row->ticket_type_id ][] = $row;
    910917        }
    911         //die(var_dump($indexed ));
    912918
    913919        // cycle through the cart items, and remove any that do not have a matched indexed item
     
    923929            $quantity = 0;
    924930            // if there is a basic indexed matched key for this item, then find the appropriate quantity to use
    925             if ( isset( $indexed[ $eid ], $indexed[ $eid ][ $reserved ], $indexed[ $eid ][ $reserved ][ $pid ] ) ) {
    926                 // if there is not an appropriate area type for this event, then just pass it through using the indexed item quantity. this is the generic method, list_pluck
    927                 if ( ! isset( $event_to_area_type[ $eid ] ) || ! is_object( $event_to_area_type[ $eid ] ) || is_wp_error( $event_to_area_type[ $eid ] ) ) {
    928                     $quantity = array_sum( wp_list_pluck( $indexed[ $eid ][ $reserved ][ $pid ], 'quantity' ) );
    929                 // otherwise use the method of finding the quantity defined by the area_type itself
    930                 } else {
    931                     $quantity = $event_to_area_type[ $eid ]->cart_item_match_quantity( $item, $indexed[ $eid ][ $reserved ][ $pid ] );
     931            if ( isset( $indexed[ $eid ] ) ) {
     932                if ( isset( $indexed[ $eid ][ $reserved ], $indexed[ $eid ][ $reserved ][ $pid ] ) ) {
     933                    // if there is not an appropriate area type for this event, then just pass it through using the indexed item quantity. this is the generic method, list_pluck
     934                    if ( ! isset( $event_to_area_type[ $eid ] ) || ! is_object( $event_to_area_type[ $eid ] ) || is_wp_error( $event_to_area_type[ $eid ] ) ) {
     935                        $quantity = array_sum( wp_list_pluck( $indexed[ $eid ][ $reserved ][ $pid ], 'quantity' ) );
     936                    // otherwise use the method of finding the quantity defined by the area_type itself
     937                    } else {
     938                        $quantity = $event_to_area_type[ $eid ]->cart_item_match_quantity( $item, $indexed[ $eid ][ $reserved ][ $pid ] );
     939                    }
     940                } else if ( isset( $indexed[ $eid ][ $confirmed ], $indexed[ $eid ][ $confirmed ][ $pid ] ) ) {
     941                    // if these items have an order id
     942                    $order_ids = array_filter( wp_list_pluck( $indexed[ $eid ][ $confirmed ][ $pid ], 'order_id' ) );
     943                    if ( count( $order_ids ) == count( $indexed[ $eid ][ $confirmed ][ $pid ] ) ) {
     944                        // if there is not an appropriate area type for this event, then just pass it through using the indexed item quantity. this is the generic method, list_pluck
     945                        if ( ! isset( $event_to_area_type[ $eid ] ) || ! is_object( $event_to_area_type[ $eid ] ) || is_wp_error( $event_to_area_type[ $eid ] ) ) {
     946                            $quantity = array_sum( wp_list_pluck( $indexed[ $eid ][ $confirmed ][ $pid ], 'quantity' ) );
     947                        // otherwise use the method of finding the quantity defined by the area_type itself
     948                        } else {
     949                            $quantity = $event_to_area_type[ $eid ]->cart_item_match_quantity( $item, $indexed[ $eid ][ $confirmed ][ $pid ] );
     950                        }
     951                    }
    932952                }
    933953            }
     
    9801000
    9811001        $wpdb->query( $q );
     1002    }
     1003
     1004    // when resuming an order, we need to disassociate all order_item_ids from previous records, because the order items are about to get removed and recreated by core WC.
     1005    // this means we will not be able to properly update the order item id associations, because the original order item id will be gone
     1006    public function on_resume_order_disassociate( $order_id ) {
     1007        // start a basic zoner to do our bidding
     1008        $zoner = QSOT_General_Admission_Zoner::instance();
     1009
     1010        $args = array(
     1011            'event_id' => false,
     1012            'ticket_type_id' => false,
     1013            'quantity' => '',
     1014            'customer_id' => '',
     1015            'order_id' => $order_id,
     1016            'order_item_id' => '',
     1017            'state' => '*',
     1018            'where__extra' => '',
     1019        );
     1020        // find all rows that are associated with the order
     1021        $rows = $zoner->find( $args );
     1022
     1023        // udpate each row to not be associated with the order_item_id it previously was
     1024        if ( is_array( $rows ) ) foreach ( $rows as $row ) {
     1025            $zoner->update(
     1026                false,
     1027                array(
     1028                    'order_id' => $order_id,
     1029                    'order_item_id' => $row->order_item_id,
     1030                    'state' => $row->state,
     1031                ),
     1032                array(
     1033                    'order_item_id' => 0,
     1034                )
     1035            );
     1036        }
    9821037    }
    9831038
  • opentickets-community-edition/trunk/launcher.php

    r1465000 r1479172  
    44 * Plugin URI:  http://opentickets.com/
    55 * Description: Event Management and Online Ticket Sales Platform
    6  * Version:     2.4.4
     6 * Version:     2.4.5
    77 * Author:      Quadshot Software LLC
    88 * Author URI:  http://quadshot.com/
     
    5454            'fctm' => 'fc',
    5555            'always_reserve' => 0,
    56             'version' => '2.4.4',
     56            'version' => '2.4.5',
    5757            'min_wc_version' => '2.6.1',
    5858            'core_post_type' => 'qsot-event',
  • opentickets-community-edition/trunk/readme.txt

    r1465000 r1479172  
    172172== Changelog ==
    173173
    174 = 2.4.4 - 07/29/2016=
     174= 2.4.5 - 08/19/2016 =
     175* [new] support for the new Table Service plugin
     176* [fix] repaired bug where logged out users who create an account during checkout, and fail their first payment, do no lose their tickets
     177
     178= 2.4.4 - 07/29/2016 =
    175179* fixing modal issues caused by changing in WooCommerce CSS
    176180
Note: See TracChangeset for help on using the changeset viewer.