Plugin Directory

Changeset 1574067


Ignore:
Timestamp:
01/13/2017 02:05:31 PM (9 years ago)
Author:
loushou
Message:
  • [tweak] made a javascript change that works around the new WC change that prevents the 'change seat' button from working in the admin
  • [tweak] another adjustment that solves an edge case daylights savings time issue

loushou

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

Legend:

Unmodified
Added
Removed
  • opentickets-community-edition/trunk/assets/js/admin/order/ticket-selection.js

    r1529668 r1574067  
    295295        function _setup_basic_events() {
    296296            me.e.scope.on( 'click', '[rel="add-tickets-btn"]', me.add_ticket_ui );
    297             me.e.scope.on( 'click', '.change-ticket', me.change_ticket_ui );
     297            me.e.order_items.on( 'click', '.change-ticket', me.change_ticket_ui );
    298298
    299299            qs.cbs.trigger( 'setup-events', [ me, S ] );
     
    476476        // start the UI with the mindset of 'changing' an existing reservation
    477477        me.change_ticket_ui = function( e ) {
     478            console.log( 'fucing click' );
    478479            e.preventDefault();
    479480
  • opentickets-community-edition/trunk/inc/sys/utils.php

    r1567191 r1574067  
    6868
    6969        // adjust the raw time we got above, to achieve the GMT time
    70         return $raw + ( ( 'to' == $method ? -1 : 1 ) * ( get_option( 'gmt_offset', 0 ) * HOUR_IN_SECONDS ) );
     70        return $raw + ( ( 'to' == $method ? -1 : 1 ) * ( ( get_option( 'gmt_offset', 0 ) + ( self::in_dst( $date ) ? '1' : 0 ) ) * HOUR_IN_SECONDS ) );
    7171    }
    7272
     
    138138
    139139        $time = null === $time ? time() : $time;
     140        $time = ! is_numeric( $time ) ? strtotime( $time ) : $time;
    140141        // get the current dst status
    141142        $dst_status = date( 'I', $time );
     
    150151    // make a timestamp UTC
    151152    public static function make_utc( $timestamp ) {
    152         $diff = QSOT_Utils::tz_diff( $timestamp );
    153         return date( 'c', strtotime( $timestamp ) - $diff );
     153        static $site = false;
     154        // site settings
     155        if ( false === $site )
     156            $site = self::site_offset();
     157
     158        // return an adjusted time, by accepting the hour/minute and date from the frontend, changing the tz to the site tz, and converting to utc
     159        return date( 'c', strtotime( self::change_offset( $timestamp, self::number_to_tz( $site[ self::in_dst( $timestamp ) ? 'dst' : 'non' ] ) ) ) );
     160    }
     161
     162    // get the site's offset informatino
     163    public static function site_offset() {
     164        static $site = false;
     165        // site settings
     166        if ( false === $site ) {
     167            $site = array(
     168                'non' => self::tz_to_number( self::non_dst_tz_offset() ),
     169                'dst' => self::tz_to_number( self::dst_tz_offset() ),
     170                'in_dst' => self::in_dst(),
     171            );
     172        }
     173        return $site;
    154174    }
    155175
     
    159179        // site settings
    160180        if ( false === $site )
    161             $site = self::tz_to_number( self::non_dst_tz_offset() );
     181            $site = self::site_offset();
    162182
    163183        // timestamp tz
    164         $tz = preg_replace( '#\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}#', '', $timestamp );
     184        $tz = preg_replace( '#(\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2})#', '', $timestamp );
    165185        if ( $tz == $timestamp || ! strlen( $tz ) )
    166186            return 0;
    167187
    168188        // flatten tz to number
    169         $tz = self::tz_to_number( $tz );
     189        $tz = self::tz_to_number( $tz ) - ( $site['in_dst'] ? 1 : 0 );
    170190
    171191        // return the difference in seconds
    172         return $zero_if_utc && 0 == $tz ? 0 : ( $site - $tz ) * HOUR_IN_SECONDS;
     192        return $zero_if_utc && 0 == $tz ? 0 : ( $site[ self::in_dst( $timestamp ) ? 'dst' : 'non' ] - $tz ) * HOUR_IN_SECONDS;
    173193    }
    174194
     
    187207    }
    188208
     209    // number to timezone
     210    public static function number_to_tz( $number ) {
     211        return sprintf(
     212            '%s%02s:%02s',
     213            $number < 0 ? '-' : '+',
     214            absint( floor( $number ) ),
     215            $number - floor( $number ) > 0 ? '30' : '00'
     216        );
     217    }
     218
    189219    // make a fake datestamp UTC
    190220    public static function fake_utc_date( $datestamp ) {
     
    214244        $offset = get_option( 'gmt_offset', 0 );
    215245
    216         return $offset = sprintf(
    217             $format,
    218             $offset < 0 ? '-' : '+',
    219             absint( floor( $offset ) ),
    220             $offset - floor( $offset ) > 0 ? '30' : '00'
    221         );
     246        return $offset = self::number_to_tz( $offset );
     247    }
     248
     249    // get the DST timezone
     250    public static function dst_tz_offset( $format='%s%02s:%02s' ) {
     251        static $offset = null;
     252        // do this once per page load
     253        if ( null !== $offset )
     254            return $offset;
     255
     256        // get the numeric offset from the db
     257        $offset = get_option( 'gmt_offset', 0 ) + 1;
     258
     259        return $offset = self::number_to_tz( $offset );
    222260    }
    223261
  • opentickets-community-edition/trunk/launcher.php

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

    r1567191 r1574067  
    171171
    172172== Changelog ==
     173
     174= 2.6.4- Jan/13/2017 =
     175* [tweak] made a javascript change that works around the new WC change that prevents the 'change seat' button from working in the admin
     176* [tweak] another adjustment that solves an edge case daylights savings time issue
    173177
    174178= 2.6.3 - Jan/3/2017 =
Note: See TracChangeset for help on using the changeset viewer.