Plugin Directory

Changeset 1373382


Ignore:
Timestamp:
03/17/2016 08:25:00 PM (10 years ago)
Author:
loushou
Message:
  • [tweak] changed all reservation checks to use millesecond precision
  • [fix] resolved child event featured image issue

loushou

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

Legend:

Unmodified
Added
Removed
  • opentickets-community-edition/trunk/inc/core/post-type.class.php

    r1367916 r1373382  
    10681068        } else return;
    10691069
     1070        // remove the cascade thumbnail logic because it interfers with the child event thumb selection
     1071        remove_filter( 'post_thumbnail_html', array( __CLASS__, 'cascade_thumbnail' ), 10, 5 );
     1072        remove_filter( 'get_post_metadata', array( __CLASS__, 'cascade_thumbnail_id' ), 10, 4 );
     1073
     1074        wp_enqueue_script( 'set-post-thumbnail' );
    10701075        // load the eit page js, which also loads all it's dependencies
    10711076        wp_enqueue_script('qsot-events-admin-edit-page');
  • opentickets-community-edition/trunk/inc/event-area/general-admission-zoner.class.php

    r1368520 r1373382  
    190190            $find_args = $lock_args;
    191191            unset( $find_args['quantity'] );
    192             $find_args['before'] = $lock->since;
     192            $find_args['before'] = $lock->since . '.' . $lock->mille;
    193193            $find_args['state'] = $this->stati['r'][0];
    194194
     
    216216            'state' => '*',
    217217            'fields' => 'total',
    218             'before' => $lock->since,
    219         ) );
     218            'before' => $lock->since . '.' . $lock->mille,
     219        ) ); // remove $lock_for, because this query includes the lock itself now
    220220        $my_total_before_lock = $this->find( array(
    221221            'event_id' => $args['event_id'],
     
    223223            'order_id' => array_unique( array( 0, isset( WC()->session->order_awaiting_payment ) ? absint( WC()->session->order_awaiting_payment ) : 0 ) ),
    224224            'fields' => 'total',
    225             'before' => $lock->since,
     225            'before' => $lock->since . '.' . $lock->mille,
    226226            'ticket_type_id' => $args['ticket_type_id'],
    227227            'customer_id' => $args['customer_id'],
  • opentickets-community-edition/trunk/inc/event-area/zoner-query.class.php

    r1311266 r1373382  
    4141    // deinitialize the object. remove actions and filter
    4242    public function deinitialize() {
     43    }
     44
     45    // break a time value into the timestamp and the mille seconds
     46    protected function _break_time( $time ) {
     47        $output = array( 'time' => $time, 'mille' => 0 );
     48        // split the timestamp into the two parts, timestamp and mille
     49        $time = explode( '.', $time );
     50
     51        // if the mille is set, use it
     52        if ( count( $time ) > 1 )
     53            $output['mille'] = absint( array_pop( $time ) );
     54
     55        // set the timestamp to just the mysql timestamp
     56        $output['time'] = current( $time );
     57
     58        // normalize that time stamp into a mysql format
     59        if ( is_numeric( $output['time'] ) )
     60            $output['time'] = date( 'Y-m-d H:i:s', $output['time'] );
     61
     62        // validate the timestamp, and scratch it if not valid
     63        if ( ! preg_match( '#\d{4}-\d{2}-\d{2}( \d{2}:\d{2}:\d{2})?#', $output['time'] ) || strtotime( $output['time'] ) <= 0 )
     64            $output['time'] = '';
     65
     66        return $output;
    4367    }
    4468
     
    101125        // handle before and after, in relation to the 'since' field
    102126        if ( '' !== $args['before'] ) {
    103             if ( preg_match( '#\d{4}-\d{2}-\d{2}( \d{2}:\d{2}:\d{2})?#', $args['before'] ) )
    104                 $where[] = $wpdb->prepare( 'and since < %s', $args['before'] );
    105             else if ( is_numeric( $args['before'] ) )
    106                 $where[] = $wpdb->prepare( 'and since < %s', date( 'Y-m-d H:i:s', $args['before'] ) );
     127            $op = '<';
     128            $args['before'] = $this->_break_time( $args['before'] );
     129            if ( isset( $args['before']['time'], $args['before']['mille'] ) && $args['before']['time'] ) {
     130                $where[] = $wpdb->prepare(
     131                    'and ( since ' . $op . ' %s or ( since = %s and mille ' . $op . ' %d ) )',
     132                    $args['before']['time'],
     133                    $args['before']['time'],
     134                    $args['before']['mille']
     135                );
     136            }
    107137        }
    108138        if ( '' !== $args['after'] ) {
    109             if ( preg_match( '#\d{4}-\d{2}-\d{2}( \d{2}:\d{2}:\d{2})?#', $args['after'] ) )
    110                 $where[] = $wpdb->prepare( 'and since < %s', $args['after'] );
    111             else if ( is_numeric( $args['after'] ) )
    112                 $where[] = $wpdb->prepare( 'and since < %s', date( 'Y-m-d H:i:s', $args['after'] ) );
     139            $op = '>';
     140            $args['after'] = $this->_break_time( $args['after'] );
     141            if ( isset( $args['after']['time'], $args['after']['mille'] ) && $args['after']['time'] ) {
     142                $where[] = $wpdb->prepare(
     143                    'and ( since ' . $op . ' %s or ( since = %s and mille ' . $op . ' %d ) )',
     144                    $args['after']['time'],
     145                    $args['after']['time'],
     146                    $args['after']['mille']
     147                );
     148            }
    113149        }
    114150
  • opentickets-community-edition/trunk/launcher.php

    r1369465 r1373382  
    44 * Plugin URI:  http://opentickets.com/
    55 * Description: Event Management and Online Ticket Sales Platform
    6  * Version:     2.2.3
     6 * Version:     2.2.4
    77 * Author:      Quadshot Software LLC
    88 * Author URI:  http://quadshot.com/
     
    5454            'fctm' => 'fc',
    5555            'always_reserve' => 0,
    56             'version' => '2.2.3',
     56            'version' => '2.2.4',
    5757            'min_wc_version' => '2.4.12',
    5858            'core_post_type' => 'qsot-event',
  • opentickets-community-edition/trunk/opentickets.php

    r1367916 r1373382  
    8181        // add an admin footer promo text bit. sorry guys we need this
    8282        add_action( 'admin_footer_text', array( __CLASS__, 'admin_footer_text' ), PHP_INT_MAX, 1 );
     83
     84        // if in the admin, make sure to record the first date this user has been using this software
     85        if ( is_admin() )
     86            self::_check_used_since();
    8387    }
    8488
     
    712716
    713717        return true;
     718    }
     719
     720    // make sure we record the earliest known date that this site started using our software
     721    protected static function _check_used_since() {
     722        // get the current value
     723        $current = get_option( '_qsot_used_since', '' );
     724
     725        // if the current value does not exist, then try to set it to the publish date of the first event
     726        if ( '' == $current || ! strtotime( $current ) ) {
     727            global $wpdb;
     728            $event_date = $wpdb->get_var( $wpdb->prepare( 'select post_date from ' . $wpdb->posts . ' where post_type = %s order by post_date asc, id asc', self::$o->core_post_type ) );
     729            // if we found the date, then use it
     730            if ( $event_date )
     731                update_option( '_qsot_used_since', $current = $event_date );
     732            // otherwise, use today
     733            else
     734                update_option( '_qsot_used_since', current_time( 'mysql' ) );
     735        }
    714736    }
    715737
  • opentickets-community-edition/trunk/readme.txt

    r1369465 r1373382  
    171171
    172172== Changelog ==
     173
     174= 2.2.4 - Mar/17/2016 =
     175* [tweak] changed all reservation checks to use millesecond precision
     176* [fix] resolved child event featured image issue
    173177
    174178= 2.2.3 - Mar/11/2016 =
Note: See TracChangeset for help on using the changeset viewer.