Event Tickets - Version 4.0.4

Version Description

Download this release

Release Info

Developer borkweb
Plugin Icon 128x128 Event Tickets
Version 4.0.4
Comparing to
See all releases

Code changes from version 4.0.3 to 4.0.4

common/tests/wpunit/Tribe/Events/common/Date_UtilsTest.php ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace Tribe\Events\Common;
3
+
4
+ use \Tribe__Date_Utils as Date_Utils;
5
+
6
+ class Date_UtilsTest extends \Codeception\TestCase\WPTestCase {
7
+
8
+ /**
9
+ * @var string
10
+ */
11
+ protected static $tz_backup;
12
+
13
+ protected $backupGlobals = false;
14
+
15
+ public static function setUpBeforeClass() {
16
+ self::$tz_backup = date_default_timezone_get();
17
+
18
+ return parent::setUpBeforeClass();
19
+ }
20
+
21
+ public static function tearDownAfterClass() {
22
+ date_default_timezone_set( self::$tz_backup );
23
+
24
+ return parent::tearDownAfterClass();
25
+ }
26
+
27
+ public function setUp() {
28
+ // before
29
+ parent::setUp();
30
+
31
+ // your set up methods here
32
+ }
33
+
34
+ public function tearDown() {
35
+ // your tear down methods here
36
+
37
+ // then
38
+ parent::tearDown();
39
+ }
40
+
41
+ public function bad_argument_formats() {
42
+ return array_map( function ( $arr ) {
43
+ return [ $arr ];
44
+ }, [
45
+ [ 'day', 2, 3, 2012, 1 ], [ 2, 'week', 3, 2012, 1 ], [ 2, 2, 'month', 2012, 1 ], [ 2, 2, 3, 'year', 1 ],
46
+ [ 2, 2, 3, 2012, 'direction' ], [ 2, 2, 3, 2012, 23 ], [ 2, 2, 3, 2012, - 2 ],
47
+ ] );
48
+ }
49
+
50
+ /**
51
+ * get_weekday_timestamp returns false for wrong argument format
52
+ *
53
+ * @dataProvider bad_argument_formats
54
+ */
55
+ public function test_get_weekday_timestamp_returns_false_if_day_of_week_is_not_int( $args ) {
56
+ $this->assertFalse( call_user_func_array( [ 'Tribe__Date_Utils', 'get_weekday_timestamp' ], $args ) );
57
+ }
58
+
59
+ public function etc_natural_direction_expected_timestamps() {
60
+ return [
61
+ [ 1420416000, [ 1, 1, 1, 2015, 1 ] ], // Mon, first week of Jan 2015
62
+ [ 1423094400, [ 4, 1, 2, 2015, 1 ] ], // Thursday, first week of Feb 2015
63
+ [ 1425081600, [ 6, 4, 2, 2015, 1 ] ], // Saturday, 4th week of Feb 2015
64
+ ];
65
+ }
66
+
67
+ /**
68
+ * get_weekday_timestamp returns right timestamp etc in natural direction
69
+ *
70
+ * @dataProvider etc_natural_direction_expected_timestamps
71
+ */
72
+ public function test_get_weekday_timestamp_returns_right_timestamp_in_etc_natural_direction( $expected, $args ) {
73
+ date_default_timezone_set( 'Etc/GMT+0' );
74
+ $this->assertEquals( $expected, call_user_func_array( [
75
+ 'Tribe__Date_Utils', 'get_weekday_timestamp'
76
+ ], $args ) );
77
+ }
78
+
79
+ /**
80
+ * get_weekday_timestamp returns right timestamp etc -9 in natural direction
81
+ *
82
+ * @dataProvider etc_natural_direction_expected_timestamps
83
+ */
84
+ public function test_get_weekday_timestamp_returns_right_timestamp_etc_minus_9_in_natural_direction( $expected, $args ) {
85
+ date_default_timezone_set( 'Etc/GMT-9' );
86
+ $nine_hours = 60 * 60 * 9;
87
+ $this->assertEquals( $expected - $nine_hours, call_user_func_array( [
88
+ 'Tribe__Date_Utils', 'get_weekday_timestamp'
89
+ ], $args ) );
90
+ }
91
+
92
+ /**
93
+ * get_weekday_timestamp returns right timestamp etc +9 in natural direction
94
+ *
95
+ * @dataProvider etc_natural_direction_expected_timestamps
96
+ */
97
+ public function test_get_weekday_timestamp_returns_right_timestamp_etc_plus_9_in_natural_direction( $expected, $args ) {
98
+ date_default_timezone_set( 'Etc/GMT+9' );
99
+ $nine_hours = 60 * 60 * 9;
100
+ $this->assertEquals( $expected + $nine_hours, call_user_func_array( [
101
+ 'Tribe__Date_Utils', 'get_weekday_timestamp'
102
+ ], $args ) );
103
+ }
104
+
105
+ public function etc_reverse_direction_expected_timestamps() {
106
+ return [
107
+ [ 1422230400, [ 1, 1, 1, 2015, - 1 ] ], // Mon, last week of Jan 2015
108
+ [ 1424908800, [ 4, 1, 2, 2015, - 1 ] ], // Thursday, last week of Feb 2015
109
+ [ 1424476800, [ 6, 2, 2, 2015, - 1 ] ], // Saturday, penultimate week of Feb 2015
110
+ [ 1423872000, [ 6, 3, 2, 2015, - 1 ] ], // Saturday, antepenultimate week of Feb 2015
111
+ ];
112
+ }
113
+
114
+ /**
115
+ * get_weekday_timestamp returns right timestamp etc in reverse direction
116
+ *
117
+ * @dataProvider etc_reverse_direction_expected_timestamps
118
+ */
119
+ public function test_get_weekday_timestamp_returns_right_timestamp_in_etc_reverse_direction( $expected, $args ) {
120
+ date_default_timezone_set( 'Etc/GMT+0' );
121
+ $this->assertEquals( $expected, call_user_func_array( [
122
+ 'Tribe__Date_Utils', 'get_weekday_timestamp'
123
+ ], $args ) );
124
+ }
125
+
126
+ /**
127
+ * get_weekday_timestamp returns right timestamp etc -9 in reverse direction
128
+ *
129
+ * @dataProvider etc_reverse_direction_expected_timestamps
130
+ */
131
+ public function test_get_weekday_timestamp_returns_right_timestamp_etc_minus_9_in_reverse_direction( $expected, $args ) {
132
+ date_default_timezone_set( 'Etc/GMT-9' );
133
+ $nine_hours = 60 * 60 * 9;
134
+ $this->assertEquals( $expected - $nine_hours, call_user_func_array( [
135
+ 'Tribe__Date_Utils', 'get_weekday_timestamp'
136
+ ], $args ) );
137
+ }
138
+
139
+ /**
140
+ * get_weekday_timestamp returns right timestamp etc +9 in reverse direction
141
+ *
142
+ * @dataProvider etc_reverse_direction_expected_timestamps
143
+ */
144
+ public function test_get_weekday_timestamp_returns_right_timestamp_etc_plus_9_in_reverse_direction( $expected, $args ) {
145
+ date_default_timezone_set( 'Etc/GMT+9' );
146
+ $nine_hours = 60 * 60 * 9;
147
+ $this->assertEquals( $expected + $nine_hours, call_user_func_array( [
148
+ 'Tribe__Date_Utils', 'get_weekday_timestamp'
149
+ ], $args ) );
150
+ }
151
+ }
event-tickets.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Event Tickets
4
  Description: Event Tickets allows you to sell tickets to events
5
- Version: 4.0.3
6
  Author: Modern Tribe, Inc.
7
  Author URI: http://m.tri.be/28
8
  License: GPLv2 or later
2
  /*
3
  Plugin Name: Event Tickets
4
  Description: Event Tickets allows you to sell tickets to events
5
+ Version: 4.0.4
6
  Author: Modern Tribe, Inc.
7
  Author URI: http://m.tri.be/28
8
  License: GPLv2 or later
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: ModernTribe, borkweb, zbtirrell, barry.hughes, bordoni, brianjesse
4
  Tags: events, add-on, ticket sales, tickets, calendar, community, registration, api, dates, date, posts, workshop, conference, meeting, seminar, concert, summit, The Events Calendar, Events Calendar PRO, ticket integration, event ticketing, RSVP, Event Tickets, Event Tickets Plus
5
  Requires at least: 3.9
6
  Tested up to: 4.4
7
- Stable tag: 4.0.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -179,6 +179,10 @@ Our Premium Plugins:
179
 
180
  == Changelog ==
181
 
 
 
 
 
182
  = [4.0.3] 2015-12-22 =
183
 
184
  * Tweak - Leverage the original_stock() method when rendering ticket availability to avoid funky math problems with different Event Tickets Plus commerce providers (Thank you liblogger for reporting this issue!)
4
  Tags: events, add-on, ticket sales, tickets, calendar, community, registration, api, dates, date, posts, workshop, conference, meeting, seminar, concert, summit, The Events Calendar, Events Calendar PRO, ticket integration, event ticketing, RSVP, Event Tickets, Event Tickets Plus
5
  Requires at least: 3.9
6
  Tested up to: 4.4
7
+ Stable tag: 4.0.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
179
 
180
  == Changelog ==
181
 
182
+ = [4.0.4] 2015-12-23 =
183
+
184
+ * Fix - Resolved issue with stock calculations on the Attendees report
185
+
186
  = [4.0.3] 2015-12-22 =
187
 
188
  * Tweak - Leverage the original_stock() method when rendering ticket availability to avoid funky math problems with different Event Tickets Plus commerce providers (Thank you liblogger for reporting this issue!)
src/Tribe/Main.php CHANGED
@@ -9,7 +9,7 @@ class Tribe__Tickets__Main {
9
  /**
10
  * Current version of this plugin
11
  */
12
- const VERSION = '4.0.3';
13
 
14
  /**
15
  * Min required The Events Calendar version
9
  /**
10
  * Current version of this plugin
11
  */
12
+ const VERSION = '4.0.4';
13
 
14
  /**
15
  * Min required The Events Calendar version
src/admin-views/attendees.php CHANGED
@@ -12,10 +12,10 @@ $total_pending = 0;
12
  $total_completed = 0;
13
 
14
  foreach ( $tickets as $ticket ) {
15
- $total_sold += $ticket->qty_sold();
16
  $total_pending += $ticket->qty_pending();
17
- $total_completed = $total_sold - $total_pending;
18
  }
 
19
 
20
  ?>
21
 
12
  $total_completed = 0;
13
 
14
  foreach ( $tickets as $ticket ) {
15
+ $total_sold += $ticket->qty_sold() + $ticket->qty_pending();
16
  $total_pending += $ticket->qty_pending();
 
17
  }
18
+ $total_completed = $total_sold - $total_pending;
19
 
20
  ?>
21
 
src/template-tags/tickets.php CHANGED
@@ -199,7 +199,7 @@ if ( ! function_exists( 'tribe_tickets_get_ticket_stock_message' ) ) {
199
  * @return string
200
  */
201
  function tribe_tickets_get_ticket_stock_message( $ticket ) {
202
- $stock = $ticket->stock();
203
  $sold = $ticket->qty_sold();
204
  $pending = $ticket->qty_pending();
205
 
199
  * @return string
200
  */
201
  function tribe_tickets_get_ticket_stock_message( $ticket ) {
202
+ $stock = $ticket->original_stock();
203
  $sold = $ticket->qty_sold();
204
  $pending = $ticket->qty_pending();
205