@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | */ |
54 | 54 | const onsale = 'TKO'; |
55 | 55 | |
56 | - /** |
|
57 | - * extra meta key for tracking ticket reservations |
|
58 | - * |
|
59 | - * @type string |
|
60 | - */ |
|
61 | - const META_KEY_TICKET_RESERVATIONS = 'ticket_reservations'; |
|
62 | - |
|
63 | - /** |
|
56 | + /** |
|
57 | + * extra meta key for tracking ticket reservations |
|
58 | + * |
|
59 | + * @type string |
|
60 | + */ |
|
61 | + const META_KEY_TICKET_RESERVATIONS = 'ticket_reservations'; |
|
62 | + |
|
63 | + /** |
|
64 | 64 | * cached result from method of the same name |
65 | 65 | * @var float $_ticket_total_with_taxes |
66 | 66 | */ |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | - /** |
|
72 | - * @param array $props_n_values incoming values |
|
73 | - * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
|
74 | - * used.) |
|
75 | - * @param array $date_formats incoming date_formats in an array where the first value is the |
|
76 | - * date_format and the second value is the time format |
|
77 | - * @return EE_Ticket |
|
78 | - * @throws \EE_Error |
|
79 | - */ |
|
71 | + /** |
|
72 | + * @param array $props_n_values incoming values |
|
73 | + * @param string $timezone incoming timezone (if not set the timezone set for the website will be |
|
74 | + * used.) |
|
75 | + * @param array $date_formats incoming date_formats in an array where the first value is the |
|
76 | + * date_format and the second value is the time format |
|
77 | + * @return EE_Ticket |
|
78 | + * @throws \EE_Error |
|
79 | + */ |
|
80 | 80 | public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
81 | 81 | $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
82 | 82 | return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
@@ -84,36 +84,36 @@ discard block |
||
84 | 84 | |
85 | 85 | |
86 | 86 | |
87 | - /** |
|
88 | - * @param array $props_n_values incoming values from the database |
|
89 | - * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
90 | - * the website will be used. |
|
91 | - * @return EE_Ticket |
|
92 | - * @throws \EE_Error |
|
93 | - */ |
|
87 | + /** |
|
88 | + * @param array $props_n_values incoming values from the database |
|
89 | + * @param string $timezone incoming timezone as set by the model. If not set the timezone for |
|
90 | + * the website will be used. |
|
91 | + * @return EE_Ticket |
|
92 | + * @throws \EE_Error |
|
93 | + */ |
|
94 | 94 | public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
95 | 95 | return new self( $props_n_values, TRUE, $timezone ); |
96 | 96 | } |
97 | 97 | |
98 | 98 | |
99 | 99 | |
100 | - /** |
|
101 | - * @return bool |
|
102 | - * @throws \EE_Error |
|
103 | - */ |
|
100 | + /** |
|
101 | + * @return bool |
|
102 | + * @throws \EE_Error |
|
103 | + */ |
|
104 | 104 | public function parent() { |
105 | 105 | return $this->get( 'TKT_parent' ); |
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | 109 | |
110 | - /** |
|
111 | - * return if a ticket has quantities available for purchase |
|
112 | - * |
|
113 | - * @param int $DTT_ID the primary key for a particular datetime |
|
114 | - * @return boolean |
|
115 | - * @throws \EE_Error |
|
116 | - */ |
|
110 | + /** |
|
111 | + * return if a ticket has quantities available for purchase |
|
112 | + * |
|
113 | + * @param int $DTT_ID the primary key for a particular datetime |
|
114 | + * @return boolean |
|
115 | + * @throws \EE_Error |
|
116 | + */ |
|
117 | 117 | public function available( $DTT_ID = 0 ) { |
118 | 118 | // are we checking availability for a particular datetime ? |
119 | 119 | if ( $DTT_ID ) { |
@@ -130,14 +130,14 @@ discard block |
||
130 | 130 | |
131 | 131 | |
132 | 132 | |
133 | - /** |
|
134 | - * Using the start date and end date this method calculates whether the ticket is On Sale, Pending, or Expired |
|
135 | - * |
|
136 | - * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
|
137 | - * @param bool | null $remaining if it is already known that tickets are available, then simply pass a bool to save further processing |
|
138 | - * @return mixed status int if the display string isn't requested |
|
139 | - * @throws \EE_Error |
|
140 | - */ |
|
133 | + /** |
|
134 | + * Using the start date and end date this method calculates whether the ticket is On Sale, Pending, or Expired |
|
135 | + * |
|
136 | + * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
|
137 | + * @param bool | null $remaining if it is already known that tickets are available, then simply pass a bool to save further processing |
|
138 | + * @return mixed status int if the display string isn't requested |
|
139 | + * @throws \EE_Error |
|
140 | + */ |
|
141 | 141 | public function ticket_status( $display = FALSE, $remaining = null ) { |
142 | 142 | $remaining = is_bool( $remaining ) ? $remaining : $this->is_remaining(); |
143 | 143 | if ( ! $remaining ) { |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | |
161 | 161 | |
162 | 162 | |
163 | - /** |
|
164 | - * The purpose of this method is to simply return a boolean for whether there are any tickets remaining for sale considering ALL the factors used for figuring that out. |
|
165 | - * |
|
166 | - * @access public |
|
167 | - * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
|
168 | - * @return boolean true = tickets remaining, false not. |
|
169 | - * @throws \EE_Error |
|
170 | - */ |
|
163 | + /** |
|
164 | + * The purpose of this method is to simply return a boolean for whether there are any tickets remaining for sale considering ALL the factors used for figuring that out. |
|
165 | + * |
|
166 | + * @access public |
|
167 | + * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
|
168 | + * @return boolean true = tickets remaining, false not. |
|
169 | + * @throws \EE_Error |
|
170 | + */ |
|
171 | 171 | public function is_remaining( $DTT_ID = 0 ) { |
172 | 172 | $num_remaining = $this->remaining( $DTT_ID ); |
173 | 173 | if ( $num_remaining === 0 ) { |
@@ -181,76 +181,76 @@ discard block |
||
181 | 181 | |
182 | 182 | |
183 | 183 | |
184 | - /** |
|
185 | - * return the total number of tickets available for purchase |
|
186 | - * |
|
187 | - * @param int $DTT_ID the primary key for a particular datetime. |
|
188 | - * set to 0 for all related datetimes |
|
189 | - * @return int |
|
190 | - * @throws \EE_Error |
|
191 | - */ |
|
184 | + /** |
|
185 | + * return the total number of tickets available for purchase |
|
186 | + * |
|
187 | + * @param int $DTT_ID the primary key for a particular datetime. |
|
188 | + * set to 0 for all related datetimes |
|
189 | + * @return int |
|
190 | + * @throws \EE_Error |
|
191 | + */ |
|
192 | 192 | public function remaining( $DTT_ID = 0 ) { |
193 | 193 | return $this->real_quantity_on_ticket('saleable', $DTT_ID ); |
194 | 194 | } |
195 | 195 | |
196 | 196 | |
197 | 197 | |
198 | - /** |
|
199 | - * Gets min |
|
200 | - * |
|
201 | - * @return int |
|
202 | - * @throws \EE_Error |
|
203 | - */ |
|
198 | + /** |
|
199 | + * Gets min |
|
200 | + * |
|
201 | + * @return int |
|
202 | + * @throws \EE_Error |
|
203 | + */ |
|
204 | 204 | public function min() { |
205 | 205 | return $this->get( 'TKT_min' ); |
206 | 206 | } |
207 | 207 | |
208 | 208 | |
209 | 209 | |
210 | - /** |
|
211 | - * return if a ticket is no longer available cause its available dates have expired. |
|
212 | - * |
|
213 | - * @return boolean |
|
214 | - * @throws \EE_Error |
|
215 | - */ |
|
210 | + /** |
|
211 | + * return if a ticket is no longer available cause its available dates have expired. |
|
212 | + * |
|
213 | + * @return boolean |
|
214 | + * @throws \EE_Error |
|
215 | + */ |
|
216 | 216 | public function is_expired() { |
217 | 217 | return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
218 | 218 | } |
219 | 219 | |
220 | 220 | |
221 | 221 | |
222 | - /** |
|
223 | - * Return if a ticket is yet to go on sale or not |
|
224 | - * |
|
225 | - * @return boolean |
|
226 | - * @throws \EE_Error |
|
227 | - */ |
|
222 | + /** |
|
223 | + * Return if a ticket is yet to go on sale or not |
|
224 | + * |
|
225 | + * @return boolean |
|
226 | + * @throws \EE_Error |
|
227 | + */ |
|
228 | 228 | public function is_pending() { |
229 | 229 | return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
230 | 230 | } |
231 | 231 | |
232 | 232 | |
233 | 233 | |
234 | - /** |
|
235 | - * Return if a ticket is on sale or not |
|
236 | - * |
|
237 | - * @return boolean |
|
238 | - * @throws \EE_Error |
|
239 | - */ |
|
234 | + /** |
|
235 | + * Return if a ticket is on sale or not |
|
236 | + * |
|
237 | + * @return boolean |
|
238 | + * @throws \EE_Error |
|
239 | + */ |
|
240 | 240 | public function is_on_sale() { |
241 | 241 | return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
242 | 242 | } |
243 | 243 | |
244 | 244 | |
245 | 245 | |
246 | - /** |
|
247 | - * This returns the chronologically last datetime that this ticket is associated with |
|
248 | - * |
|
249 | - * @param string $dt_frmt |
|
250 | - * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
|
251 | - * @return string |
|
252 | - * @throws \EE_Error |
|
253 | - */ |
|
246 | + /** |
|
247 | + * This returns the chronologically last datetime that this ticket is associated with |
|
248 | + * |
|
249 | + * @param string $dt_frmt |
|
250 | + * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
|
251 | + * @return string |
|
252 | + * @throws \EE_Error |
|
253 | + */ |
|
254 | 254 | public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
255 | 255 | $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
256 | 256 | $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : ''; |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | |
261 | 261 | |
262 | 262 | |
263 | - /** |
|
264 | - * This returns the chronologically first datetime that this ticket is associated with |
|
265 | - * |
|
266 | - * @return EE_Datetime |
|
267 | - * @throws \EE_Error |
|
268 | - */ |
|
263 | + /** |
|
264 | + * This returns the chronologically first datetime that this ticket is associated with |
|
265 | + * |
|
266 | + * @return EE_Datetime |
|
267 | + * @throws \EE_Error |
|
268 | + */ |
|
269 | 269 | public function first_datetime() { |
270 | 270 | $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
271 | 271 | return reset( $datetimes ); |
@@ -273,14 +273,14 @@ discard block |
||
273 | 273 | |
274 | 274 | |
275 | 275 | |
276 | - /** |
|
277 | - * Gets all the datetimes this ticket can be used for attending. |
|
278 | - * Unless otherwise specified, orders datetimes by start date. |
|
279 | - * |
|
280 | - * @param array $query_params see EEM_Base::get_all() |
|
281 | - * @return EE_Datetime[]|EE_Base_Class[] |
|
282 | - * @throws \EE_Error |
|
283 | - */ |
|
276 | + /** |
|
277 | + * Gets all the datetimes this ticket can be used for attending. |
|
278 | + * Unless otherwise specified, orders datetimes by start date. |
|
279 | + * |
|
280 | + * @param array $query_params see EEM_Base::get_all() |
|
281 | + * @return EE_Datetime[]|EE_Base_Class[] |
|
282 | + * @throws \EE_Error |
|
283 | + */ |
|
284 | 284 | public function datetimes( $query_params = array() ) { |
285 | 285 | if ( ! isset( $query_params[ 'order_by' ] ) ) { |
286 | 286 | $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | |
291 | 291 | |
292 | 292 | |
293 | - /** |
|
294 | - * This returns the chronologically last datetime that this ticket is associated with |
|
295 | - * |
|
296 | - * @return EE_Datetime |
|
297 | - * @throws \EE_Error |
|
298 | - */ |
|
293 | + /** |
|
294 | + * This returns the chronologically last datetime that this ticket is associated with |
|
295 | + * |
|
296 | + * @return EE_Datetime |
|
297 | + * @throws \EE_Error |
|
298 | + */ |
|
299 | 299 | public function last_datetime() { |
300 | 300 | $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
301 | 301 | return end( $datetimes ); |
@@ -303,19 +303,19 @@ discard block |
||
303 | 303 | |
304 | 304 | |
305 | 305 | |
306 | - /** |
|
307 | - * This returns the total tickets sold depending on the given parameters. |
|
308 | - * |
|
309 | - * @param string $what Can be one of two options: 'ticket', 'datetime'. |
|
310 | - * 'ticket' = total ticket sales for all datetimes this ticket is related to |
|
311 | - * 'datetime' = total ticket sales for a specified datetime (required $dtt_id) |
|
312 | - * 'datetime' = total ticket sales in the datetime_ticket table. |
|
313 | - * If $dtt_id is not given then we return an array of sales indexed by datetime. |
|
314 | - * If $dtt_id IS given then we return the tickets sold for that given datetime. |
|
315 | - * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
|
316 | - * @return mixed (array|int) how many tickets have sold |
|
317 | - * @throws \EE_Error |
|
318 | - */ |
|
306 | + /** |
|
307 | + * This returns the total tickets sold depending on the given parameters. |
|
308 | + * |
|
309 | + * @param string $what Can be one of two options: 'ticket', 'datetime'. |
|
310 | + * 'ticket' = total ticket sales for all datetimes this ticket is related to |
|
311 | + * 'datetime' = total ticket sales for a specified datetime (required $dtt_id) |
|
312 | + * 'datetime' = total ticket sales in the datetime_ticket table. |
|
313 | + * If $dtt_id is not given then we return an array of sales indexed by datetime. |
|
314 | + * If $dtt_id IS given then we return the tickets sold for that given datetime. |
|
315 | + * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
|
316 | + * @return mixed (array|int) how many tickets have sold |
|
317 | + * @throws \EE_Error |
|
318 | + */ |
|
319 | 319 | public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
320 | 320 | $total = 0; |
321 | 321 | $tickets_sold = $this->_all_tickets_sold(); |
@@ -340,12 +340,12 @@ discard block |
||
340 | 340 | |
341 | 341 | |
342 | 342 | |
343 | - /** |
|
344 | - * This returns an array indexed by datetime_id for tickets sold with this ticket. |
|
345 | - * |
|
346 | - * @return EE_Ticket[] |
|
347 | - * @throws \EE_Error |
|
348 | - */ |
|
343 | + /** |
|
344 | + * This returns an array indexed by datetime_id for tickets sold with this ticket. |
|
345 | + * |
|
346 | + * @return EE_Ticket[] |
|
347 | + * @throws \EE_Error |
|
348 | + */ |
|
349 | 349 | protected function _all_tickets_sold() { |
350 | 350 | $datetimes = $this->get_many_related( 'Datetime' ); |
351 | 351 | $tickets_sold = array(); |
@@ -361,29 +361,29 @@ discard block |
||
361 | 361 | |
362 | 362 | |
363 | 363 | |
364 | - /** |
|
365 | - * This returns the base price object for the ticket. |
|
366 | - * |
|
367 | - * @param bool $return_array whether to return as an array indexed by price id or just the object. |
|
368 | - * @return EE_Price|EE_Base_Class|EE_Price[]|EE_Base_Class[] |
|
369 | - * @throws \EE_Error |
|
370 | - */ |
|
364 | + /** |
|
365 | + * This returns the base price object for the ticket. |
|
366 | + * |
|
367 | + * @param bool $return_array whether to return as an array indexed by price id or just the object. |
|
368 | + * @return EE_Price|EE_Base_Class|EE_Price[]|EE_Base_Class[] |
|
369 | + * @throws \EE_Error |
|
370 | + */ |
|
371 | 371 | public function base_price( $return_array = FALSE ) { |
372 | 372 | $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
373 | 373 | return $return_array |
374 | - ? $this->get_many_related( 'Price', array( $_where ) ) |
|
375 | - : $this->get_first_related( 'Price', array( $_where ) ); |
|
374 | + ? $this->get_many_related( 'Price', array( $_where ) ) |
|
375 | + : $this->get_first_related( 'Price', array( $_where ) ); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
379 | 379 | |
380 | - /** |
|
381 | - * This returns ONLY the price modifiers for the ticket (i.e. no taxes or base price) |
|
382 | - * |
|
383 | - * @access public |
|
384 | - * @return EE_Price[] |
|
385 | - * @throws \EE_Error |
|
386 | - */ |
|
380 | + /** |
|
381 | + * This returns ONLY the price modifiers for the ticket (i.e. no taxes or base price) |
|
382 | + * |
|
383 | + * @access public |
|
384 | + * @return EE_Price[] |
|
385 | + * @throws \EE_Error |
|
386 | + */ |
|
387 | 387 | public function price_modifiers() { |
388 | 388 | $query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) ); |
389 | 389 | return $this->prices( $query_params ); |
@@ -391,132 +391,132 @@ discard block |
||
391 | 391 | |
392 | 392 | |
393 | 393 | |
394 | - /** |
|
395 | - * Gets all the prices that combine to form the final price of this ticket |
|
396 | - * |
|
397 | - * @param array $query_params like EEM_Base::get_all |
|
398 | - * @return EE_Price[]|EE_Base_Class[] |
|
399 | - * @throws \EE_Error |
|
400 | - */ |
|
394 | + /** |
|
395 | + * Gets all the prices that combine to form the final price of this ticket |
|
396 | + * |
|
397 | + * @param array $query_params like EEM_Base::get_all |
|
398 | + * @return EE_Price[]|EE_Base_Class[] |
|
399 | + * @throws \EE_Error |
|
400 | + */ |
|
401 | 401 | public function prices( $query_params = array() ) { |
402 | 402 | return $this->get_many_related( 'Price', $query_params ); |
403 | 403 | } |
404 | 404 | |
405 | 405 | |
406 | 406 | |
407 | - /** |
|
408 | - * Gets all the ticket applicabilities (ie, relations between datetimes and tickets) |
|
409 | - * |
|
410 | - * @param array $query_params see EEM_Base::get_all() |
|
411 | - * @return EE_Datetime_Ticket|EE_Base_Class[] |
|
412 | - * @throws \EE_Error |
|
413 | - */ |
|
407 | + /** |
|
408 | + * Gets all the ticket applicabilities (ie, relations between datetimes and tickets) |
|
409 | + * |
|
410 | + * @param array $query_params see EEM_Base::get_all() |
|
411 | + * @return EE_Datetime_Ticket|EE_Base_Class[] |
|
412 | + * @throws \EE_Error |
|
413 | + */ |
|
414 | 414 | public function datetime_tickets( $query_params = array() ) { |
415 | 415 | return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
416 | 416 | } |
417 | 417 | |
418 | 418 | |
419 | 419 | |
420 | - /** |
|
421 | - * Gets all the datetimes from the db ordered by DTT_order |
|
422 | - * |
|
423 | - * @param boolean $show_expired |
|
424 | - * @param boolean $show_deleted |
|
425 | - * @return EE_Datetime[] |
|
426 | - * @throws \EE_Error |
|
427 | - */ |
|
420 | + /** |
|
421 | + * Gets all the datetimes from the db ordered by DTT_order |
|
422 | + * |
|
423 | + * @param boolean $show_expired |
|
424 | + * @param boolean $show_deleted |
|
425 | + * @return EE_Datetime[] |
|
426 | + * @throws \EE_Error |
|
427 | + */ |
|
428 | 428 | public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
429 | 429 | return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
430 | 430 | } |
431 | 431 | |
432 | 432 | |
433 | 433 | |
434 | - /** |
|
435 | - * Gets ID |
|
436 | - * |
|
437 | - * @return string |
|
438 | - * @throws \EE_Error |
|
439 | - */ |
|
434 | + /** |
|
435 | + * Gets ID |
|
436 | + * |
|
437 | + * @return string |
|
438 | + * @throws \EE_Error |
|
439 | + */ |
|
440 | 440 | public function ID() { |
441 | 441 | return $this->get( 'TKT_ID' ); |
442 | 442 | } |
443 | 443 | |
444 | 444 | |
445 | 445 | |
446 | - /** |
|
447 | - * get the author of the ticket. |
|
448 | - * |
|
449 | - * @since 4.5.0 |
|
450 | - * @return int |
|
451 | - * @throws \EE_Error |
|
452 | - */ |
|
446 | + /** |
|
447 | + * get the author of the ticket. |
|
448 | + * |
|
449 | + * @since 4.5.0 |
|
450 | + * @return int |
|
451 | + * @throws \EE_Error |
|
452 | + */ |
|
453 | 453 | public function wp_user() { |
454 | 454 | return $this->get('TKT_wp_user'); |
455 | 455 | } |
456 | 456 | |
457 | 457 | |
458 | 458 | |
459 | - /** |
|
460 | - * Gets the template for the ticket |
|
461 | - * |
|
462 | - * @return EE_Ticket_Template|EE_Base_Class |
|
463 | - * @throws \EE_Error |
|
464 | - */ |
|
459 | + /** |
|
460 | + * Gets the template for the ticket |
|
461 | + * |
|
462 | + * @return EE_Ticket_Template|EE_Base_Class |
|
463 | + * @throws \EE_Error |
|
464 | + */ |
|
465 | 465 | public function template() { |
466 | 466 | return $this->get_first_related( 'Ticket_Template' ); |
467 | 467 | } |
468 | 468 | |
469 | 469 | |
470 | 470 | |
471 | - /** |
|
472 | - * Simply returns an array of EE_Price objects that are taxes. |
|
473 | - * |
|
474 | - * @return EE_Price[] |
|
475 | - * @throws \EE_Error |
|
476 | - */ |
|
471 | + /** |
|
472 | + * Simply returns an array of EE_Price objects that are taxes. |
|
473 | + * |
|
474 | + * @return EE_Price[] |
|
475 | + * @throws \EE_Error |
|
476 | + */ |
|
477 | 477 | public function get_ticket_taxes_for_admin() { |
478 | 478 | return EE_Taxes::get_taxes_for_admin(); |
479 | 479 | } |
480 | 480 | |
481 | 481 | |
482 | 482 | |
483 | - /** |
|
484 | - * @return float |
|
485 | - * @throws \EE_Error |
|
486 | - */ |
|
483 | + /** |
|
484 | + * @return float |
|
485 | + * @throws \EE_Error |
|
486 | + */ |
|
487 | 487 | public function ticket_price() { |
488 | 488 | return $this->get( 'TKT_price' ); |
489 | 489 | } |
490 | 490 | |
491 | 491 | |
492 | 492 | |
493 | - /** |
|
494 | - * @return mixed |
|
495 | - * @throws \EE_Error |
|
496 | - */ |
|
493 | + /** |
|
494 | + * @return mixed |
|
495 | + * @throws \EE_Error |
|
496 | + */ |
|
497 | 497 | public function pretty_price() { |
498 | 498 | return $this->get_pretty( 'TKT_price' ); |
499 | 499 | } |
500 | 500 | |
501 | 501 | |
502 | 502 | |
503 | - /** |
|
504 | - * @return bool |
|
505 | - * @throws \EE_Error |
|
506 | - */ |
|
503 | + /** |
|
504 | + * @return bool |
|
505 | + * @throws \EE_Error |
|
506 | + */ |
|
507 | 507 | public function is_free() { |
508 | 508 | return $this->get_ticket_total_with_taxes() === (float) 0; |
509 | 509 | } |
510 | 510 | |
511 | 511 | |
512 | 512 | |
513 | - /** |
|
514 | - * get_ticket_total_with_taxes |
|
515 | - * |
|
516 | - * @param bool $no_cache |
|
517 | - * @return float |
|
518 | - * @throws \EE_Error |
|
519 | - */ |
|
513 | + /** |
|
514 | + * get_ticket_total_with_taxes |
|
515 | + * |
|
516 | + * @param bool $no_cache |
|
517 | + * @return float |
|
518 | + * @throws \EE_Error |
|
519 | + */ |
|
520 | 520 | public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
521 | 521 | if ($this->_ticket_total_with_taxes === null || $no_cache ) { |
522 | 522 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
@@ -533,201 +533,201 @@ discard block |
||
533 | 533 | |
534 | 534 | |
535 | 535 | |
536 | - /** |
|
537 | - * @return float |
|
538 | - * @throws \EE_Error |
|
539 | - */ |
|
536 | + /** |
|
537 | + * @return float |
|
538 | + * @throws \EE_Error |
|
539 | + */ |
|
540 | 540 | public function get_ticket_subtotal() { |
541 | 541 | return EE_Taxes::get_subtotal_for_admin( $this ); |
542 | 542 | } |
543 | 543 | |
544 | 544 | |
545 | 545 | |
546 | - /** |
|
547 | - * Returns the total taxes applied to this ticket |
|
548 | - * |
|
549 | - * @return float |
|
550 | - * @throws \EE_Error |
|
551 | - */ |
|
546 | + /** |
|
547 | + * Returns the total taxes applied to this ticket |
|
548 | + * |
|
549 | + * @return float |
|
550 | + * @throws \EE_Error |
|
551 | + */ |
|
552 | 552 | public function get_ticket_taxes_total_for_admin() { |
553 | 553 | return EE_Taxes::get_total_taxes_for_admin( $this ); |
554 | 554 | } |
555 | 555 | |
556 | 556 | |
557 | 557 | |
558 | - /** |
|
559 | - * Sets name |
|
560 | - * |
|
561 | - * @param string $name |
|
562 | - * @throws \EE_Error |
|
563 | - */ |
|
558 | + /** |
|
559 | + * Sets name |
|
560 | + * |
|
561 | + * @param string $name |
|
562 | + * @throws \EE_Error |
|
563 | + */ |
|
564 | 564 | public function set_name( $name ) { |
565 | 565 | $this->set( 'TKT_name', $name ); |
566 | 566 | } |
567 | 567 | |
568 | 568 | |
569 | 569 | |
570 | - /** |
|
571 | - * Gets description |
|
572 | - * |
|
573 | - * @return string |
|
574 | - * @throws \EE_Error |
|
575 | - */ |
|
570 | + /** |
|
571 | + * Gets description |
|
572 | + * |
|
573 | + * @return string |
|
574 | + * @throws \EE_Error |
|
575 | + */ |
|
576 | 576 | public function description() { |
577 | 577 | return $this->get( 'TKT_description' ); |
578 | 578 | } |
579 | 579 | |
580 | 580 | |
581 | 581 | |
582 | - /** |
|
583 | - * Sets description |
|
584 | - * |
|
585 | - * @param string $description |
|
586 | - * @throws \EE_Error |
|
587 | - */ |
|
582 | + /** |
|
583 | + * Sets description |
|
584 | + * |
|
585 | + * @param string $description |
|
586 | + * @throws \EE_Error |
|
587 | + */ |
|
588 | 588 | public function set_description( $description ) { |
589 | 589 | $this->set( 'TKT_description', $description ); |
590 | 590 | } |
591 | 591 | |
592 | 592 | |
593 | 593 | |
594 | - /** |
|
595 | - * Gets start_date |
|
596 | - * |
|
597 | - * @param string $dt_frmt |
|
598 | - * @param string $tm_frmt |
|
599 | - * @return string |
|
600 | - * @throws \EE_Error |
|
601 | - */ |
|
594 | + /** |
|
595 | + * Gets start_date |
|
596 | + * |
|
597 | + * @param string $dt_frmt |
|
598 | + * @param string $tm_frmt |
|
599 | + * @return string |
|
600 | + * @throws \EE_Error |
|
601 | + */ |
|
602 | 602 | public function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
603 | 603 | return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
604 | 604 | } |
605 | 605 | |
606 | 606 | |
607 | 607 | |
608 | - /** |
|
609 | - * Sets start_date |
|
610 | - * |
|
611 | - * @param string $start_date |
|
612 | - * @return void |
|
613 | - * @throws \EE_Error |
|
614 | - */ |
|
608 | + /** |
|
609 | + * Sets start_date |
|
610 | + * |
|
611 | + * @param string $start_date |
|
612 | + * @return void |
|
613 | + * @throws \EE_Error |
|
614 | + */ |
|
615 | 615 | public function set_start_date( $start_date ) { |
616 | 616 | $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
617 | 617 | } |
618 | 618 | |
619 | 619 | |
620 | 620 | |
621 | - /** |
|
622 | - * Gets end_date |
|
623 | - * |
|
624 | - * @param string $dt_frmt |
|
625 | - * @param string $tm_frmt |
|
626 | - * @return string |
|
627 | - * @throws \EE_Error |
|
628 | - */ |
|
621 | + /** |
|
622 | + * Gets end_date |
|
623 | + * |
|
624 | + * @param string $dt_frmt |
|
625 | + * @param string $tm_frmt |
|
626 | + * @return string |
|
627 | + * @throws \EE_Error |
|
628 | + */ |
|
629 | 629 | public function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
630 | 630 | return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
631 | 631 | } |
632 | 632 | |
633 | 633 | |
634 | 634 | |
635 | - /** |
|
636 | - * Sets end_date |
|
637 | - * |
|
638 | - * @param string $end_date |
|
639 | - * @return void |
|
640 | - * @throws \EE_Error |
|
641 | - */ |
|
635 | + /** |
|
636 | + * Sets end_date |
|
637 | + * |
|
638 | + * @param string $end_date |
|
639 | + * @return void |
|
640 | + * @throws \EE_Error |
|
641 | + */ |
|
642 | 642 | public function set_end_date( $end_date ) { |
643 | 643 | $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
644 | 644 | } |
645 | 645 | |
646 | 646 | |
647 | 647 | |
648 | - /** |
|
649 | - * Sets sell until time |
|
650 | - * |
|
651 | - * @since 4.5.0 |
|
652 | - * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
|
653 | - * @throws \EE_Error |
|
654 | - */ |
|
648 | + /** |
|
649 | + * Sets sell until time |
|
650 | + * |
|
651 | + * @since 4.5.0 |
|
652 | + * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
|
653 | + * @throws \EE_Error |
|
654 | + */ |
|
655 | 655 | public function set_end_time( $time ) { |
656 | 656 | $this->_set_time_for( $time, 'TKT_end_date' ); |
657 | 657 | } |
658 | 658 | |
659 | 659 | |
660 | 660 | |
661 | - /** |
|
662 | - * Sets min |
|
663 | - * |
|
664 | - * @param int $min |
|
665 | - * @return void |
|
666 | - * @throws \EE_Error |
|
667 | - */ |
|
661 | + /** |
|
662 | + * Sets min |
|
663 | + * |
|
664 | + * @param int $min |
|
665 | + * @return void |
|
666 | + * @throws \EE_Error |
|
667 | + */ |
|
668 | 668 | public function set_min( $min ) { |
669 | 669 | $this->set( 'TKT_min', $min ); |
670 | 670 | } |
671 | 671 | |
672 | 672 | |
673 | 673 | |
674 | - /** |
|
675 | - * Gets max |
|
676 | - * |
|
677 | - * @return int |
|
678 | - * @throws \EE_Error |
|
679 | - */ |
|
674 | + /** |
|
675 | + * Gets max |
|
676 | + * |
|
677 | + * @return int |
|
678 | + * @throws \EE_Error |
|
679 | + */ |
|
680 | 680 | public function max() { |
681 | 681 | return $this->get( 'TKT_max' ); |
682 | 682 | } |
683 | 683 | |
684 | 684 | |
685 | 685 | |
686 | - /** |
|
687 | - * Sets max |
|
688 | - * |
|
689 | - * @param int $max |
|
690 | - * @return void |
|
691 | - * @throws \EE_Error |
|
692 | - */ |
|
686 | + /** |
|
687 | + * Sets max |
|
688 | + * |
|
689 | + * @param int $max |
|
690 | + * @return void |
|
691 | + * @throws \EE_Error |
|
692 | + */ |
|
693 | 693 | public function set_max( $max ) { |
694 | 694 | $this->set( 'TKT_max', $max ); |
695 | 695 | } |
696 | 696 | |
697 | 697 | |
698 | 698 | |
699 | - /** |
|
700 | - * Sets price |
|
701 | - * |
|
702 | - * @param float $price |
|
703 | - * @return void |
|
704 | - * @throws \EE_Error |
|
705 | - */ |
|
699 | + /** |
|
700 | + * Sets price |
|
701 | + * |
|
702 | + * @param float $price |
|
703 | + * @return void |
|
704 | + * @throws \EE_Error |
|
705 | + */ |
|
706 | 706 | public function set_price( $price ) { |
707 | 707 | $this->set( 'TKT_price', $price ); |
708 | 708 | } |
709 | 709 | |
710 | 710 | |
711 | 711 | |
712 | - /** |
|
713 | - * Gets sold |
|
714 | - * |
|
715 | - * @return int |
|
716 | - * @throws \EE_Error |
|
717 | - */ |
|
712 | + /** |
|
713 | + * Gets sold |
|
714 | + * |
|
715 | + * @return int |
|
716 | + * @throws \EE_Error |
|
717 | + */ |
|
718 | 718 | public function sold() { |
719 | 719 | return $this->get_raw( 'TKT_sold' ); |
720 | 720 | } |
721 | 721 | |
722 | 722 | |
723 | 723 | |
724 | - /** |
|
725 | - * Sets sold |
|
726 | - * |
|
727 | - * @param int $sold |
|
728 | - * @return void |
|
729 | - * @throws \EE_Error |
|
730 | - */ |
|
724 | + /** |
|
725 | + * Sets sold |
|
726 | + * |
|
727 | + * @param int $sold |
|
728 | + * @return void |
|
729 | + * @throws \EE_Error |
|
730 | + */ |
|
731 | 731 | public function set_sold( $sold ) { |
732 | 732 | // sold can not go below zero |
733 | 733 | $sold = max( 0, $sold ); |
@@ -736,13 +736,13 @@ discard block |
||
736 | 736 | |
737 | 737 | |
738 | 738 | |
739 | - /** |
|
740 | - * increments sold by amount passed by $qty |
|
741 | - * |
|
742 | - * @param int $qty |
|
743 | - * @return void |
|
744 | - * @throws \EE_Error |
|
745 | - */ |
|
739 | + /** |
|
740 | + * increments sold by amount passed by $qty |
|
741 | + * |
|
742 | + * @param int $qty |
|
743 | + * @return void |
|
744 | + * @throws \EE_Error |
|
745 | + */ |
|
746 | 746 | public function increase_sold( $qty = 1 ) { |
747 | 747 | $sold = $this->sold() + $qty; |
748 | 748 | // remove ticket reservation, but don't adjust datetime reservations, because that will happen |
@@ -751,22 +751,22 @@ discard block |
||
751 | 751 | $this->_increase_sold_for_datetimes( $qty ); |
752 | 752 | $this->set_sold( $sold ); |
753 | 753 | do_action( |
754 | - 'AHEE__EE_Ticket__increase_sold', |
|
755 | - $this, |
|
756 | - $qty, |
|
757 | - $sold |
|
758 | - ); |
|
754 | + 'AHEE__EE_Ticket__increase_sold', |
|
755 | + $this, |
|
756 | + $qty, |
|
757 | + $sold |
|
758 | + ); |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | |
762 | 762 | |
763 | - /** |
|
764 | - * Increases sold on related datetimes |
|
765 | - * |
|
766 | - * @param int $qty |
|
767 | - * @return void |
|
768 | - * @throws \EE_Error |
|
769 | - */ |
|
763 | + /** |
|
764 | + * Increases sold on related datetimes |
|
765 | + * |
|
766 | + * @param int $qty |
|
767 | + * @return void |
|
768 | + * @throws \EE_Error |
|
769 | + */ |
|
770 | 770 | protected function _increase_sold_for_datetimes( $qty = 1 ) { |
771 | 771 | $datetimes = $this->datetimes(); |
772 | 772 | if ( is_array( $datetimes ) ) { |
@@ -781,34 +781,34 @@ discard block |
||
781 | 781 | |
782 | 782 | |
783 | 783 | |
784 | - /** |
|
785 | - * decrements (subtracts) sold by amount passed by $qty |
|
786 | - * |
|
787 | - * @param int $qty |
|
788 | - * @return void |
|
789 | - * @throws \EE_Error |
|
790 | - */ |
|
784 | + /** |
|
785 | + * decrements (subtracts) sold by amount passed by $qty |
|
786 | + * |
|
787 | + * @param int $qty |
|
788 | + * @return void |
|
789 | + * @throws \EE_Error |
|
790 | + */ |
|
791 | 791 | public function decrease_sold( $qty = 1 ) { |
792 | 792 | $sold = $this->sold() - $qty; |
793 | 793 | $this->_decrease_sold_for_datetimes( $qty ); |
794 | 794 | $this->set_sold( $sold ); |
795 | - do_action( |
|
796 | - 'AHEE__EE_Ticket__decrease_sold', |
|
797 | - $this, |
|
798 | - $qty, |
|
799 | - $sold |
|
800 | - ); |
|
801 | - } |
|
802 | - |
|
803 | - |
|
804 | - |
|
805 | - /** |
|
806 | - * Decreases sold on related datetimes |
|
807 | - * |
|
808 | - * @param int $qty |
|
809 | - * @return void |
|
810 | - * @throws \EE_Error |
|
811 | - */ |
|
795 | + do_action( |
|
796 | + 'AHEE__EE_Ticket__decrease_sold', |
|
797 | + $this, |
|
798 | + $qty, |
|
799 | + $sold |
|
800 | + ); |
|
801 | + } |
|
802 | + |
|
803 | + |
|
804 | + |
|
805 | + /** |
|
806 | + * Decreases sold on related datetimes |
|
807 | + * |
|
808 | + * @param int $qty |
|
809 | + * @return void |
|
810 | + * @throws \EE_Error |
|
811 | + */ |
|
812 | 812 | protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
813 | 813 | $datetimes = $this->datetimes(); |
814 | 814 | if ( is_array( $datetimes ) ) { |
@@ -823,25 +823,25 @@ discard block |
||
823 | 823 | |
824 | 824 | |
825 | 825 | |
826 | - /** |
|
827 | - * Gets qty of reserved tickets |
|
828 | - * |
|
829 | - * @return int |
|
830 | - * @throws \EE_Error |
|
831 | - */ |
|
826 | + /** |
|
827 | + * Gets qty of reserved tickets |
|
828 | + * |
|
829 | + * @return int |
|
830 | + * @throws \EE_Error |
|
831 | + */ |
|
832 | 832 | public function reserved() { |
833 | 833 | return $this->get_raw( 'TKT_reserved' ); |
834 | 834 | } |
835 | 835 | |
836 | 836 | |
837 | 837 | |
838 | - /** |
|
839 | - * Sets reserved |
|
840 | - * |
|
841 | - * @param int $reserved |
|
842 | - * @return void |
|
843 | - * @throws \EE_Error |
|
844 | - */ |
|
838 | + /** |
|
839 | + * Sets reserved |
|
840 | + * |
|
841 | + * @param int $reserved |
|
842 | + * @return void |
|
843 | + * @throws \EE_Error |
|
844 | + */ |
|
845 | 845 | public function set_reserved( $reserved ) { |
846 | 846 | // reserved can not go below zero |
847 | 847 | $reserved = max( 0, (int) $reserved ); |
@@ -849,48 +849,48 @@ discard block |
||
849 | 849 | } |
850 | 850 | |
851 | 851 | |
852 | - /** |
|
853 | - * increments reserved by amount passed by $qty |
|
854 | - * |
|
855 | - * @param int $qty |
|
856 | - * @param string $source |
|
857 | - * @return void |
|
858 | - * @throws EE_Error |
|
859 | - * @throws InvalidArgumentException |
|
860 | - * @throws ReflectionException |
|
861 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
862 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
863 | - */ |
|
852 | + /** |
|
853 | + * increments reserved by amount passed by $qty |
|
854 | + * |
|
855 | + * @param int $qty |
|
856 | + * @param string $source |
|
857 | + * @return void |
|
858 | + * @throws EE_Error |
|
859 | + * @throws InvalidArgumentException |
|
860 | + * @throws ReflectionException |
|
861 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
862 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
863 | + */ |
|
864 | 864 | public function increase_reserved( $qty = 1, $source = 'unknown' ) { |
865 | 865 | $qty = absint( $qty ); |
866 | 866 | $reserved = $this->reserved() + $qty; |
867 | - if ( |
|
868 | - $reserved |
|
869 | - && $this->add_extra_meta( |
|
870 | - EE_Ticket::META_KEY_TICKET_RESERVATIONS, |
|
871 | - "{$qty} from {$source}" |
|
872 | - ) |
|
873 | - ) { |
|
874 | - $this->_increase_reserved_for_datetimes($qty); |
|
875 | - $this->set_reserved($reserved); |
|
876 | - do_action( |
|
877 | - 'AHEE__EE_Ticket__increase_reserved', |
|
878 | - $this, |
|
879 | - $qty, |
|
880 | - $reserved |
|
881 | - ); |
|
882 | - } |
|
883 | - } |
|
884 | - |
|
885 | - |
|
886 | - |
|
887 | - /** |
|
888 | - * Increases sold on related datetimes |
|
889 | - * |
|
890 | - * @param int $qty |
|
891 | - * @return void |
|
892 | - * @throws \EE_Error |
|
893 | - */ |
|
867 | + if ( |
|
868 | + $reserved |
|
869 | + && $this->add_extra_meta( |
|
870 | + EE_Ticket::META_KEY_TICKET_RESERVATIONS, |
|
871 | + "{$qty} from {$source}" |
|
872 | + ) |
|
873 | + ) { |
|
874 | + $this->_increase_reserved_for_datetimes($qty); |
|
875 | + $this->set_reserved($reserved); |
|
876 | + do_action( |
|
877 | + 'AHEE__EE_Ticket__increase_reserved', |
|
878 | + $this, |
|
879 | + $qty, |
|
880 | + $reserved |
|
881 | + ); |
|
882 | + } |
|
883 | + } |
|
884 | + |
|
885 | + |
|
886 | + |
|
887 | + /** |
|
888 | + * Increases sold on related datetimes |
|
889 | + * |
|
890 | + * @param int $qty |
|
891 | + * @return void |
|
892 | + * @throws \EE_Error |
|
893 | + */ |
|
894 | 894 | protected function _increase_reserved_for_datetimes( $qty = 1 ) { |
895 | 895 | $datetimes = $this->datetimes(); |
896 | 896 | if ( is_array( $datetimes ) ) { |
@@ -904,49 +904,49 @@ discard block |
||
904 | 904 | } |
905 | 905 | |
906 | 906 | |
907 | - /** |
|
908 | - * decrements (subtracts) reserved by amount passed by $qty |
|
909 | - * |
|
910 | - * @param int $qty |
|
911 | - * @param bool $adjust_datetimes |
|
912 | - * @param string $source |
|
913 | - * @return void |
|
914 | - * @throws EE_Error |
|
915 | - * @throws InvalidArgumentException |
|
916 | - * @throws ReflectionException |
|
917 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
918 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
919 | - */ |
|
907 | + /** |
|
908 | + * decrements (subtracts) reserved by amount passed by $qty |
|
909 | + * |
|
910 | + * @param int $qty |
|
911 | + * @param bool $adjust_datetimes |
|
912 | + * @param string $source |
|
913 | + * @return void |
|
914 | + * @throws EE_Error |
|
915 | + * @throws InvalidArgumentException |
|
916 | + * @throws ReflectionException |
|
917 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
918 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
919 | + */ |
|
920 | 920 | public function decrease_reserved( $qty = 1, $adjust_datetimes = true, $source = 'unknown' ) { |
921 | 921 | $reserved = $this->reserved() - absint( $qty ); |
922 | - if ( |
|
923 | - $this->add_extra_meta( |
|
924 | - EE_Ticket::META_KEY_TICKET_RESERVATIONS, |
|
925 | - "-{$qty} from {$source}" |
|
926 | - ) |
|
927 | - ) { |
|
928 | - if ($adjust_datetimes) { |
|
929 | - $this->_decrease_reserved_for_datetimes($qty); |
|
930 | - } |
|
931 | - $this->set_reserved($reserved); |
|
932 | - do_action( |
|
933 | - 'AHEE__EE_Ticket__decrease_reserved', |
|
934 | - $this, |
|
935 | - $qty, |
|
936 | - $reserved |
|
937 | - ); |
|
938 | - } |
|
939 | - } |
|
940 | - |
|
941 | - |
|
942 | - |
|
943 | - /** |
|
944 | - * Increases sold on related datetimes |
|
945 | - * |
|
946 | - * @param int $qty |
|
947 | - * @return void |
|
948 | - * @throws \EE_Error |
|
949 | - */ |
|
922 | + if ( |
|
923 | + $this->add_extra_meta( |
|
924 | + EE_Ticket::META_KEY_TICKET_RESERVATIONS, |
|
925 | + "-{$qty} from {$source}" |
|
926 | + ) |
|
927 | + ) { |
|
928 | + if ($adjust_datetimes) { |
|
929 | + $this->_decrease_reserved_for_datetimes($qty); |
|
930 | + } |
|
931 | + $this->set_reserved($reserved); |
|
932 | + do_action( |
|
933 | + 'AHEE__EE_Ticket__decrease_reserved', |
|
934 | + $this, |
|
935 | + $qty, |
|
936 | + $reserved |
|
937 | + ); |
|
938 | + } |
|
939 | + } |
|
940 | + |
|
941 | + |
|
942 | + |
|
943 | + /** |
|
944 | + * Increases sold on related datetimes |
|
945 | + * |
|
946 | + * @param int $qty |
|
947 | + * @return void |
|
948 | + * @throws \EE_Error |
|
949 | + */ |
|
950 | 950 | protected function _decrease_reserved_for_datetimes( $qty = 1 ) { |
951 | 951 | $datetimes = $this->datetimes(); |
952 | 952 | if ( is_array( $datetimes ) ) { |
@@ -961,18 +961,18 @@ discard block |
||
961 | 961 | |
962 | 962 | |
963 | 963 | |
964 | - /** |
|
965 | - * Gets ticket quantity |
|
966 | - * |
|
967 | - * @param string $context ticket quantity is somewhat subjective depending on the exact information sought |
|
968 | - * therefore $context can be one of three values: '', 'reg_limit', or 'saleable' |
|
969 | - * '' (default) quantity is the actual db value for TKT_qty, unaffected by other objects |
|
970 | - * REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes |
|
971 | - * SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and |
|
972 | - * is therefore the truest measure of tickets that can be purchased at the moment |
|
973 | - * @return int |
|
974 | - * @throws \EE_Error |
|
975 | - */ |
|
964 | + /** |
|
965 | + * Gets ticket quantity |
|
966 | + * |
|
967 | + * @param string $context ticket quantity is somewhat subjective depending on the exact information sought |
|
968 | + * therefore $context can be one of three values: '', 'reg_limit', or 'saleable' |
|
969 | + * '' (default) quantity is the actual db value for TKT_qty, unaffected by other objects |
|
970 | + * REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes |
|
971 | + * SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and |
|
972 | + * is therefore the truest measure of tickets that can be purchased at the moment |
|
973 | + * @return int |
|
974 | + * @throws \EE_Error |
|
975 | + */ |
|
976 | 976 | public function qty( $context = '' ) { |
977 | 977 | switch ( $context ) { |
978 | 978 | case 'reg_limit' : |
@@ -986,19 +986,19 @@ discard block |
||
986 | 986 | |
987 | 987 | |
988 | 988 | |
989 | - /** |
|
990 | - * Gets ticket quantity |
|
991 | - * |
|
992 | - * @param string $context ticket quantity is somewhat subjective depending on the exact information sought |
|
993 | - * therefore $context can be one of two values: 'reg_limit', or 'saleable' |
|
994 | - * REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes |
|
995 | - * SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and |
|
996 | - * is therefore the truest measure of tickets that can be purchased at the moment |
|
997 | - * @param int $DTT_ID the primary key for a particular datetime. |
|
998 | - * set to 0 for all related datetimes |
|
999 | - * @return int |
|
1000 | - * @throws \EE_Error |
|
1001 | - */ |
|
989 | + /** |
|
990 | + * Gets ticket quantity |
|
991 | + * |
|
992 | + * @param string $context ticket quantity is somewhat subjective depending on the exact information sought |
|
993 | + * therefore $context can be one of two values: 'reg_limit', or 'saleable' |
|
994 | + * REG LIMIT: caps qty based on DTT_reg_limit for ALL related datetimes |
|
995 | + * SALEABLE: also considers datetime sold and returns zero if ANY DTT is sold out, and |
|
996 | + * is therefore the truest measure of tickets that can be purchased at the moment |
|
997 | + * @param int $DTT_ID the primary key for a particular datetime. |
|
998 | + * set to 0 for all related datetimes |
|
999 | + * @return int |
|
1000 | + * @throws \EE_Error |
|
1001 | + */ |
|
1002 | 1002 | public function real_quantity_on_ticket( $context = 'reg_limit', $DTT_ID = 0 ) { |
1003 | 1003 | $raw = $this->get_raw( 'TKT_qty' ); |
1004 | 1004 | // return immediately if it's zero |
@@ -1081,212 +1081,212 @@ discard block |
||
1081 | 1081 | |
1082 | 1082 | |
1083 | 1083 | |
1084 | - /** |
|
1085 | - * Gets uses |
|
1086 | - * |
|
1087 | - * @return int |
|
1088 | - * @throws \EE_Error |
|
1089 | - */ |
|
1084 | + /** |
|
1085 | + * Gets uses |
|
1086 | + * |
|
1087 | + * @return int |
|
1088 | + * @throws \EE_Error |
|
1089 | + */ |
|
1090 | 1090 | public function uses() { |
1091 | 1091 | return $this->get( 'TKT_uses' ); |
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | |
1095 | 1095 | |
1096 | - /** |
|
1097 | - * Sets uses |
|
1098 | - * |
|
1099 | - * @param int $uses |
|
1100 | - * @return void |
|
1101 | - * @throws \EE_Error |
|
1102 | - */ |
|
1096 | + /** |
|
1097 | + * Sets uses |
|
1098 | + * |
|
1099 | + * @param int $uses |
|
1100 | + * @return void |
|
1101 | + * @throws \EE_Error |
|
1102 | + */ |
|
1103 | 1103 | public function set_uses( $uses ) { |
1104 | 1104 | $this->set( 'TKT_uses', $uses ); |
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | |
1108 | 1108 | |
1109 | - /** |
|
1110 | - * returns whether ticket is required or not. |
|
1111 | - * |
|
1112 | - * @return boolean |
|
1113 | - * @throws \EE_Error |
|
1114 | - */ |
|
1109 | + /** |
|
1110 | + * returns whether ticket is required or not. |
|
1111 | + * |
|
1112 | + * @return boolean |
|
1113 | + * @throws \EE_Error |
|
1114 | + */ |
|
1115 | 1115 | public function required() { |
1116 | 1116 | return $this->get( 'TKT_required' ); |
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | |
1120 | 1120 | |
1121 | - /** |
|
1122 | - * sets the TKT_required property |
|
1123 | - * |
|
1124 | - * @param boolean $required |
|
1125 | - * @return void |
|
1126 | - * @throws \EE_Error |
|
1127 | - */ |
|
1121 | + /** |
|
1122 | + * sets the TKT_required property |
|
1123 | + * |
|
1124 | + * @param boolean $required |
|
1125 | + * @return void |
|
1126 | + * @throws \EE_Error |
|
1127 | + */ |
|
1128 | 1128 | public function set_required( $required ) { |
1129 | 1129 | $this->set( 'TKT_required', $required ); |
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | |
1133 | 1133 | |
1134 | - /** |
|
1135 | - * Gets taxable |
|
1136 | - * |
|
1137 | - * @return boolean |
|
1138 | - * @throws \EE_Error |
|
1139 | - */ |
|
1134 | + /** |
|
1135 | + * Gets taxable |
|
1136 | + * |
|
1137 | + * @return boolean |
|
1138 | + * @throws \EE_Error |
|
1139 | + */ |
|
1140 | 1140 | public function taxable() { |
1141 | 1141 | return $this->get( 'TKT_taxable' ); |
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | |
1145 | 1145 | |
1146 | - /** |
|
1147 | - * Sets taxable |
|
1148 | - * |
|
1149 | - * @param boolean $taxable |
|
1150 | - * @return void |
|
1151 | - * @throws \EE_Error |
|
1152 | - */ |
|
1146 | + /** |
|
1147 | + * Sets taxable |
|
1148 | + * |
|
1149 | + * @param boolean $taxable |
|
1150 | + * @return void |
|
1151 | + * @throws \EE_Error |
|
1152 | + */ |
|
1153 | 1153 | public function set_taxable( $taxable ) { |
1154 | 1154 | $this->set( 'TKT_taxable', $taxable ); |
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | |
1158 | 1158 | |
1159 | - /** |
|
1160 | - * Gets is_default |
|
1161 | - * |
|
1162 | - * @return boolean |
|
1163 | - * @throws \EE_Error |
|
1164 | - */ |
|
1159 | + /** |
|
1160 | + * Gets is_default |
|
1161 | + * |
|
1162 | + * @return boolean |
|
1163 | + * @throws \EE_Error |
|
1164 | + */ |
|
1165 | 1165 | public function is_default() { |
1166 | 1166 | return $this->get( 'TKT_is_default' ); |
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
1170 | 1170 | |
1171 | - /** |
|
1172 | - * Sets is_default |
|
1173 | - * |
|
1174 | - * @param boolean $is_default |
|
1175 | - * @return void |
|
1176 | - * @throws \EE_Error |
|
1177 | - */ |
|
1171 | + /** |
|
1172 | + * Sets is_default |
|
1173 | + * |
|
1174 | + * @param boolean $is_default |
|
1175 | + * @return void |
|
1176 | + * @throws \EE_Error |
|
1177 | + */ |
|
1178 | 1178 | public function set_is_default( $is_default ) { |
1179 | 1179 | $this->set( 'TKT_is_default', $is_default ); |
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | |
1183 | 1183 | |
1184 | - /** |
|
1185 | - * Gets order |
|
1186 | - * |
|
1187 | - * @return int |
|
1188 | - * @throws \EE_Error |
|
1189 | - */ |
|
1184 | + /** |
|
1185 | + * Gets order |
|
1186 | + * |
|
1187 | + * @return int |
|
1188 | + * @throws \EE_Error |
|
1189 | + */ |
|
1190 | 1190 | public function order() { |
1191 | 1191 | return $this->get( 'TKT_order' ); |
1192 | 1192 | } |
1193 | 1193 | |
1194 | 1194 | |
1195 | 1195 | |
1196 | - /** |
|
1197 | - * Sets order |
|
1198 | - * |
|
1199 | - * @param int $order |
|
1200 | - * @return void |
|
1201 | - * @throws \EE_Error |
|
1202 | - */ |
|
1196 | + /** |
|
1197 | + * Sets order |
|
1198 | + * |
|
1199 | + * @param int $order |
|
1200 | + * @return void |
|
1201 | + * @throws \EE_Error |
|
1202 | + */ |
|
1203 | 1203 | public function set_order( $order ) { |
1204 | 1204 | $this->set( 'TKT_order', $order ); |
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | |
1208 | 1208 | |
1209 | - /** |
|
1210 | - * Gets row |
|
1211 | - * |
|
1212 | - * @return int |
|
1213 | - * @throws \EE_Error |
|
1214 | - */ |
|
1209 | + /** |
|
1210 | + * Gets row |
|
1211 | + * |
|
1212 | + * @return int |
|
1213 | + * @throws \EE_Error |
|
1214 | + */ |
|
1215 | 1215 | public function row() { |
1216 | 1216 | return $this->get( 'TKT_row' ); |
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | |
1220 | 1220 | |
1221 | - /** |
|
1222 | - * Sets row |
|
1223 | - * |
|
1224 | - * @param int $row |
|
1225 | - * @return void |
|
1226 | - * @throws \EE_Error |
|
1227 | - */ |
|
1221 | + /** |
|
1222 | + * Sets row |
|
1223 | + * |
|
1224 | + * @param int $row |
|
1225 | + * @return void |
|
1226 | + * @throws \EE_Error |
|
1227 | + */ |
|
1228 | 1228 | public function set_row( $row ) { |
1229 | 1229 | $this->set( 'TKT_row', $row ); |
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | |
1233 | 1233 | |
1234 | - /** |
|
1235 | - * Gets deleted |
|
1236 | - * |
|
1237 | - * @return boolean |
|
1238 | - * @throws \EE_Error |
|
1239 | - */ |
|
1234 | + /** |
|
1235 | + * Gets deleted |
|
1236 | + * |
|
1237 | + * @return boolean |
|
1238 | + * @throws \EE_Error |
|
1239 | + */ |
|
1240 | 1240 | public function deleted() { |
1241 | 1241 | return $this->get( 'TKT_deleted' ); |
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | |
1245 | 1245 | |
1246 | - /** |
|
1247 | - * Sets deleted |
|
1248 | - * |
|
1249 | - * @param boolean $deleted |
|
1250 | - * @return void |
|
1251 | - * @throws \EE_Error |
|
1252 | - */ |
|
1246 | + /** |
|
1247 | + * Sets deleted |
|
1248 | + * |
|
1249 | + * @param boolean $deleted |
|
1250 | + * @return void |
|
1251 | + * @throws \EE_Error |
|
1252 | + */ |
|
1253 | 1253 | public function set_deleted( $deleted ) { |
1254 | 1254 | $this->set( 'TKT_deleted', $deleted ); |
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | |
1258 | 1258 | |
1259 | - /** |
|
1260 | - * Gets parent |
|
1261 | - * |
|
1262 | - * @return int |
|
1263 | - * @throws \EE_Error |
|
1264 | - */ |
|
1259 | + /** |
|
1260 | + * Gets parent |
|
1261 | + * |
|
1262 | + * @return int |
|
1263 | + * @throws \EE_Error |
|
1264 | + */ |
|
1265 | 1265 | public function parent_ID() { |
1266 | 1266 | return $this->get( 'TKT_parent' ); |
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | |
1270 | 1270 | |
1271 | - /** |
|
1272 | - * Sets parent |
|
1273 | - * |
|
1274 | - * @param int $parent |
|
1275 | - * @return void |
|
1276 | - * @throws \EE_Error |
|
1277 | - */ |
|
1271 | + /** |
|
1272 | + * Sets parent |
|
1273 | + * |
|
1274 | + * @param int $parent |
|
1275 | + * @return void |
|
1276 | + * @throws \EE_Error |
|
1277 | + */ |
|
1278 | 1278 | public function set_parent_ID( $parent ) { |
1279 | 1279 | $this->set( 'TKT_parent', $parent ); |
1280 | 1280 | } |
1281 | 1281 | |
1282 | 1282 | |
1283 | 1283 | |
1284 | - /** |
|
1285 | - * Gets a string which is handy for showing in gateways etc that describes the ticket. |
|
1286 | - * |
|
1287 | - * @return string |
|
1288 | - * @throws \EE_Error |
|
1289 | - */ |
|
1284 | + /** |
|
1285 | + * Gets a string which is handy for showing in gateways etc that describes the ticket. |
|
1286 | + * |
|
1287 | + * @return string |
|
1288 | + * @throws \EE_Error |
|
1289 | + */ |
|
1290 | 1290 | public function name_and_info() { |
1291 | 1291 | $times = array(); |
1292 | 1292 | foreach ( $this->datetimes() as $datetime ) { |
@@ -1297,67 +1297,67 @@ discard block |
||
1297 | 1297 | |
1298 | 1298 | |
1299 | 1299 | |
1300 | - /** |
|
1301 | - * Gets name |
|
1302 | - * |
|
1303 | - * @return string |
|
1304 | - * @throws \EE_Error |
|
1305 | - */ |
|
1300 | + /** |
|
1301 | + * Gets name |
|
1302 | + * |
|
1303 | + * @return string |
|
1304 | + * @throws \EE_Error |
|
1305 | + */ |
|
1306 | 1306 | public function name() { |
1307 | 1307 | return $this->get( 'TKT_name' ); |
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | |
1311 | 1311 | |
1312 | - /** |
|
1313 | - * Gets price |
|
1314 | - * |
|
1315 | - * @return float |
|
1316 | - * @throws \EE_Error |
|
1317 | - */ |
|
1312 | + /** |
|
1313 | + * Gets price |
|
1314 | + * |
|
1315 | + * @return float |
|
1316 | + * @throws \EE_Error |
|
1317 | + */ |
|
1318 | 1318 | public function price() { |
1319 | 1319 | return $this->get( 'TKT_price' ); |
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | |
1323 | 1323 | |
1324 | - /** |
|
1325 | - * Gets all the registrations for this ticket |
|
1326 | - * |
|
1327 | - * @param array $query_params like EEM_Base::get_all's |
|
1328 | - * @return EE_Registration[]|EE_Base_Class[] |
|
1329 | - * @throws \EE_Error |
|
1330 | - */ |
|
1324 | + /** |
|
1325 | + * Gets all the registrations for this ticket |
|
1326 | + * |
|
1327 | + * @param array $query_params like EEM_Base::get_all's |
|
1328 | + * @return EE_Registration[]|EE_Base_Class[] |
|
1329 | + * @throws \EE_Error |
|
1330 | + */ |
|
1331 | 1331 | public function registrations( $query_params = array() ) { |
1332 | 1332 | return $this->get_many_related( 'Registration', $query_params ); |
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | |
1336 | 1336 | |
1337 | - /** |
|
1338 | - * Updates the TKT_sold attribute (and saves) based on the number of APPROVED registrations for this ticket. |
|
1339 | - * into account |
|
1340 | - * |
|
1341 | - * @return int |
|
1342 | - * @throws \EE_Error |
|
1343 | - */ |
|
1337 | + /** |
|
1338 | + * Updates the TKT_sold attribute (and saves) based on the number of APPROVED registrations for this ticket. |
|
1339 | + * into account |
|
1340 | + * |
|
1341 | + * @return int |
|
1342 | + * @throws \EE_Error |
|
1343 | + */ |
|
1344 | 1344 | public function update_tickets_sold() { |
1345 | - $count_regs_for_this_ticket = $this->count_registrations( |
|
1346 | - array( |
|
1347 | - array( |
|
1348 | - 'STS_ID' => EEM_Registration::status_id_approved, |
|
1349 | - 'REG_deleted' => 0, |
|
1350 | - ), |
|
1351 | - ) |
|
1352 | - ); |
|
1353 | - $sold = $this->sold(); |
|
1354 | - if ($count_regs_for_this_ticket > $sold) { |
|
1355 | - $this->increase_sold($count_regs_for_this_ticket - $sold); |
|
1356 | - $this->save(); |
|
1357 | - } else if ($count_regs_for_this_ticket < $sold) { |
|
1358 | - $this->decrease_sold($count_regs_for_this_ticket - $sold); |
|
1359 | - $this->save(); |
|
1360 | - } |
|
1345 | + $count_regs_for_this_ticket = $this->count_registrations( |
|
1346 | + array( |
|
1347 | + array( |
|
1348 | + 'STS_ID' => EEM_Registration::status_id_approved, |
|
1349 | + 'REG_deleted' => 0, |
|
1350 | + ), |
|
1351 | + ) |
|
1352 | + ); |
|
1353 | + $sold = $this->sold(); |
|
1354 | + if ($count_regs_for_this_ticket > $sold) { |
|
1355 | + $this->increase_sold($count_regs_for_this_ticket - $sold); |
|
1356 | + $this->save(); |
|
1357 | + } else if ($count_regs_for_this_ticket < $sold) { |
|
1358 | + $this->decrease_sold($count_regs_for_this_ticket - $sold); |
|
1359 | + $this->save(); |
|
1360 | + } |
|
1361 | 1361 | return $count_regs_for_this_ticket; |
1362 | 1362 | } |
1363 | 1363 | |
@@ -1385,21 +1385,21 @@ discard block |
||
1385 | 1385 | |
1386 | 1386 | |
1387 | 1387 | |
1388 | - /** |
|
1389 | - * Implementation of the EEI_Event_Relation interface method |
|
1390 | - * |
|
1391 | - * @see EEI_Event_Relation for comments |
|
1392 | - * @return EE_Event |
|
1393 | - * @throws \EE_Error |
|
1394 | - * @throws UnexpectedEntityException |
|
1395 | - */ |
|
1388 | + /** |
|
1389 | + * Implementation of the EEI_Event_Relation interface method |
|
1390 | + * |
|
1391 | + * @see EEI_Event_Relation for comments |
|
1392 | + * @return EE_Event |
|
1393 | + * @throws \EE_Error |
|
1394 | + * @throws UnexpectedEntityException |
|
1395 | + */ |
|
1396 | 1396 | public function get_related_event() { |
1397 | 1397 | //get one datetime to use for getting the event |
1398 | 1398 | $datetime = $this->first_datetime(); |
1399 | 1399 | if ( ! $datetime instanceof \EE_Datetime ) { |
1400 | 1400 | throw new UnexpectedEntityException( |
1401 | 1401 | $datetime, |
1402 | - 'EE_Datetime', |
|
1402 | + 'EE_Datetime', |
|
1403 | 1403 | sprintf( |
1404 | 1404 | __( 'The ticket (%s) is not associated with any valid datetimes.', 'event_espresso'), |
1405 | 1405 | $this->name() |
@@ -1410,7 +1410,7 @@ discard block |
||
1410 | 1410 | if ( ! $event instanceof \EE_Event ) { |
1411 | 1411 | throw new UnexpectedEntityException( |
1412 | 1412 | $event, |
1413 | - 'EE_Event', |
|
1413 | + 'EE_Event', |
|
1414 | 1414 | sprintf( |
1415 | 1415 | __( 'The ticket (%s) is not associated with a valid event.', 'event_espresso'), |
1416 | 1416 | $this->name() |
@@ -1422,14 +1422,14 @@ discard block |
||
1422 | 1422 | |
1423 | 1423 | |
1424 | 1424 | |
1425 | - /** |
|
1426 | - * Implementation of the EEI_Event_Relation interface method |
|
1427 | - * |
|
1428 | - * @see EEI_Event_Relation for comments |
|
1429 | - * @return string |
|
1430 | - * @throws UnexpectedEntityException |
|
1431 | - * @throws \EE_Error |
|
1432 | - */ |
|
1425 | + /** |
|
1426 | + * Implementation of the EEI_Event_Relation interface method |
|
1427 | + * |
|
1428 | + * @see EEI_Event_Relation for comments |
|
1429 | + * @return string |
|
1430 | + * @throws UnexpectedEntityException |
|
1431 | + * @throws \EE_Error |
|
1432 | + */ |
|
1433 | 1433 | public function get_event_name() { |
1434 | 1434 | $event = $this->get_related_event(); |
1435 | 1435 | return $event instanceof EE_Event ? $event->name() : ''; |
@@ -1437,28 +1437,28 @@ discard block |
||
1437 | 1437 | |
1438 | 1438 | |
1439 | 1439 | |
1440 | - /** |
|
1441 | - * Implementation of the EEI_Event_Relation interface method |
|
1442 | - * |
|
1443 | - * @see EEI_Event_Relation for comments |
|
1444 | - * @return int |
|
1445 | - * @throws UnexpectedEntityException |
|
1446 | - * @throws \EE_Error |
|
1447 | - */ |
|
1440 | + /** |
|
1441 | + * Implementation of the EEI_Event_Relation interface method |
|
1442 | + * |
|
1443 | + * @see EEI_Event_Relation for comments |
|
1444 | + * @return int |
|
1445 | + * @throws UnexpectedEntityException |
|
1446 | + * @throws \EE_Error |
|
1447 | + */ |
|
1448 | 1448 | public function get_event_ID() { |
1449 | 1449 | $event = $this->get_related_event(); |
1450 | 1450 | return $event instanceof EE_Event ? $event->ID() : 0; |
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | |
1454 | - /** |
|
1455 | - * This simply returns whether a ticket can be permanently deleted or not. |
|
1456 | - * The criteria for determining this is whether the ticket has any related registrations. |
|
1457 | - * If there are none then it can be permanently deleted. |
|
1458 | - * |
|
1459 | - * @return bool |
|
1460 | - */ |
|
1454 | + /** |
|
1455 | + * This simply returns whether a ticket can be permanently deleted or not. |
|
1456 | + * The criteria for determining this is whether the ticket has any related registrations. |
|
1457 | + * If there are none then it can be permanently deleted. |
|
1458 | + * |
|
1459 | + * @return bool |
|
1460 | + */ |
|
1461 | 1461 | public function is_permanently_deleteable() { |
1462 | - return $this->count_registrations() === 0; |
|
1463 | - } |
|
1462 | + return $this->count_registrations() === 0; |
|
1463 | + } |
|
1464 | 1464 | } //end EE_Ticket class |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\exceptions\UnexpectedEntityException; |
2 | 2 | |
3 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | /** |
7 | 7 | * Event Espresso |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | * @return EE_Ticket |
78 | 78 | * @throws \EE_Error |
79 | 79 | */ |
80 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
81 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
82 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
80 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
81 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
82 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | * @return EE_Ticket |
92 | 92 | * @throws \EE_Error |
93 | 93 | */ |
94 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
95 | - return new self( $props_n_values, TRUE, $timezone ); |
|
94 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
95 | + return new self($props_n_values, TRUE, $timezone); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @throws \EE_Error |
103 | 103 | */ |
104 | 104 | public function parent() { |
105 | - return $this->get( 'TKT_parent' ); |
|
105 | + return $this->get('TKT_parent'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | * @return boolean |
115 | 115 | * @throws \EE_Error |
116 | 116 | */ |
117 | - public function available( $DTT_ID = 0 ) { |
|
117 | + public function available($DTT_ID = 0) { |
|
118 | 118 | // are we checking availability for a particular datetime ? |
119 | - if ( $DTT_ID ) { |
|
119 | + if ($DTT_ID) { |
|
120 | 120 | // get that datetime object |
121 | - $datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
121 | + $datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
122 | 122 | // if ticket sales for this datetime have exceeded the reg limit... |
123 | - if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) { |
|
123 | + if ($datetime instanceof EE_Datetime && $datetime->sold_out()) { |
|
124 | 124 | return FALSE; |
125 | 125 | } |
126 | 126 | } |
@@ -138,22 +138,22 @@ discard block |
||
138 | 138 | * @return mixed status int if the display string isn't requested |
139 | 139 | * @throws \EE_Error |
140 | 140 | */ |
141 | - public function ticket_status( $display = FALSE, $remaining = null ) { |
|
142 | - $remaining = is_bool( $remaining ) ? $remaining : $this->is_remaining(); |
|
143 | - if ( ! $remaining ) { |
|
144 | - return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out; |
|
141 | + public function ticket_status($display = FALSE, $remaining = null) { |
|
142 | + $remaining = is_bool($remaining) ? $remaining : $this->is_remaining(); |
|
143 | + if ( ! $remaining) { |
|
144 | + return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out; |
|
145 | 145 | } |
146 | - if ( $this->get( 'TKT_deleted' ) ) { |
|
147 | - return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived; |
|
146 | + if ($this->get('TKT_deleted')) { |
|
147 | + return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived; |
|
148 | 148 | } |
149 | - if ( $this->is_expired() ) { |
|
150 | - return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired; |
|
149 | + if ($this->is_expired()) { |
|
150 | + return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired; |
|
151 | 151 | } |
152 | - if ( $this->is_pending() ) { |
|
153 | - return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending; |
|
152 | + if ($this->is_pending()) { |
|
153 | + return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending; |
|
154 | 154 | } |
155 | - if ( $this->is_on_sale() ) { |
|
156 | - return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale; |
|
155 | + if ($this->is_on_sale()) { |
|
156 | + return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale; |
|
157 | 157 | } |
158 | 158 | return ''; |
159 | 159 | } |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | * @return boolean true = tickets remaining, false not. |
169 | 169 | * @throws \EE_Error |
170 | 170 | */ |
171 | - public function is_remaining( $DTT_ID = 0 ) { |
|
172 | - $num_remaining = $this->remaining( $DTT_ID ); |
|
173 | - if ( $num_remaining === 0 ) { |
|
171 | + public function is_remaining($DTT_ID = 0) { |
|
172 | + $num_remaining = $this->remaining($DTT_ID); |
|
173 | + if ($num_remaining === 0) { |
|
174 | 174 | return FALSE; |
175 | 175 | } |
176 | - if ( $num_remaining > 0 && $num_remaining < $this->min() ) { |
|
176 | + if ($num_remaining > 0 && $num_remaining < $this->min()) { |
|
177 | 177 | return FALSE; |
178 | 178 | } |
179 | 179 | return TRUE; |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | * @return int |
190 | 190 | * @throws \EE_Error |
191 | 191 | */ |
192 | - public function remaining( $DTT_ID = 0 ) { |
|
193 | - return $this->real_quantity_on_ticket('saleable', $DTT_ID ); |
|
192 | + public function remaining($DTT_ID = 0) { |
|
193 | + return $this->real_quantity_on_ticket('saleable', $DTT_ID); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @throws \EE_Error |
203 | 203 | */ |
204 | 204 | public function min() { |
205 | - return $this->get( 'TKT_min' ); |
|
205 | + return $this->get('TKT_min'); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @throws \EE_Error |
215 | 215 | */ |
216 | 216 | public function is_expired() { |
217 | - return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
|
217 | + return ($this->get_raw('TKT_end_date') < time()); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @throws \EE_Error |
227 | 227 | */ |
228 | 228 | public function is_pending() { |
229 | - return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
|
229 | + return ($this->get_raw('TKT_start_date') > time()); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * @throws \EE_Error |
239 | 239 | */ |
240 | 240 | public function is_on_sale() { |
241 | - return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
|
241 | + return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time()); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | * @return string |
252 | 252 | * @throws \EE_Error |
253 | 253 | */ |
254 | - public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
|
255 | - $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
|
256 | - $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : ''; |
|
254 | + public function date_range($dt_frmt = '', $conjunction = ' - ') { |
|
255 | + $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : ''; |
|
256 | + $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : ''; |
|
257 | 257 | |
258 | - return $first_date && $last_date ? $first_date . $conjunction . $last_date : ''; |
|
258 | + return $first_date && $last_date ? $first_date.$conjunction.$last_date : ''; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | * @throws \EE_Error |
268 | 268 | */ |
269 | 269 | public function first_datetime() { |
270 | - $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
|
271 | - return reset( $datetimes ); |
|
270 | + $datetimes = $this->datetimes(array('limit' => 1)); |
|
271 | + return reset($datetimes); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | * @return EE_Datetime[]|EE_Base_Class[] |
282 | 282 | * @throws \EE_Error |
283 | 283 | */ |
284 | - public function datetimes( $query_params = array() ) { |
|
285 | - if ( ! isset( $query_params[ 'order_by' ] ) ) { |
|
286 | - $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
|
284 | + public function datetimes($query_params = array()) { |
|
285 | + if ( ! isset($query_params['order_by'])) { |
|
286 | + $query_params['order_by']['DTT_order'] = 'ASC'; |
|
287 | 287 | } |
288 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
288 | + return $this->get_many_related('Datetime', $query_params); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -297,8 +297,8 @@ discard block |
||
297 | 297 | * @throws \EE_Error |
298 | 298 | */ |
299 | 299 | public function last_datetime() { |
300 | - $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
|
301 | - return end( $datetimes ); |
|
300 | + $datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC'))); |
|
301 | + return end($datetimes); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -316,22 +316,22 @@ discard block |
||
316 | 316 | * @return mixed (array|int) how many tickets have sold |
317 | 317 | * @throws \EE_Error |
318 | 318 | */ |
319 | - public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
|
319 | + public function tickets_sold($what = 'ticket', $dtt_id = NULL) { |
|
320 | 320 | $total = 0; |
321 | 321 | $tickets_sold = $this->_all_tickets_sold(); |
322 | - switch ( $what ) { |
|
322 | + switch ($what) { |
|
323 | 323 | case 'ticket' : |
324 | - return $tickets_sold[ 'ticket' ]; |
|
324 | + return $tickets_sold['ticket']; |
|
325 | 325 | break; |
326 | 326 | case 'datetime' : |
327 | - if ( empty( $tickets_sold[ 'datetime' ] ) ) { |
|
327 | + if (empty($tickets_sold['datetime'])) { |
|
328 | 328 | return $total; |
329 | 329 | } |
330 | - if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) { |
|
331 | - EE_Error::add_error( __( 'You\'ve requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
330 | + if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) { |
|
331 | + EE_Error::add_error(__('You\'ve requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
332 | 332 | return $total; |
333 | 333 | } |
334 | - return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ]; |
|
334 | + return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id]; |
|
335 | 335 | break; |
336 | 336 | default: |
337 | 337 | return $total; |
@@ -347,15 +347,15 @@ discard block |
||
347 | 347 | * @throws \EE_Error |
348 | 348 | */ |
349 | 349 | protected function _all_tickets_sold() { |
350 | - $datetimes = $this->get_many_related( 'Datetime' ); |
|
350 | + $datetimes = $this->get_many_related('Datetime'); |
|
351 | 351 | $tickets_sold = array(); |
352 | - if ( ! empty( $datetimes ) ) { |
|
353 | - foreach ( $datetimes as $datetime ) { |
|
354 | - $tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' ); |
|
352 | + if ( ! empty($datetimes)) { |
|
353 | + foreach ($datetimes as $datetime) { |
|
354 | + $tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold'); |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | //Tickets sold |
358 | - $tickets_sold[ 'ticket' ] = $this->sold(); |
|
358 | + $tickets_sold['ticket'] = $this->sold(); |
|
359 | 359 | return $tickets_sold; |
360 | 360 | } |
361 | 361 | |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | * @return EE_Price|EE_Base_Class|EE_Price[]|EE_Base_Class[] |
369 | 369 | * @throws \EE_Error |
370 | 370 | */ |
371 | - public function base_price( $return_array = FALSE ) { |
|
372 | - $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
|
371 | + public function base_price($return_array = FALSE) { |
|
372 | + $_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price); |
|
373 | 373 | return $return_array |
374 | - ? $this->get_many_related( 'Price', array( $_where ) ) |
|
375 | - : $this->get_first_related( 'Price', array( $_where ) ); |
|
374 | + ? $this->get_many_related('Price', array($_where)) |
|
375 | + : $this->get_first_related('Price', array($_where)); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -385,8 +385,8 @@ discard block |
||
385 | 385 | * @throws \EE_Error |
386 | 386 | */ |
387 | 387 | public function price_modifiers() { |
388 | - $query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) ); |
|
389 | - return $this->prices( $query_params ); |
|
388 | + $query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax)))); |
|
389 | + return $this->prices($query_params); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | |
@@ -398,8 +398,8 @@ discard block |
||
398 | 398 | * @return EE_Price[]|EE_Base_Class[] |
399 | 399 | * @throws \EE_Error |
400 | 400 | */ |
401 | - public function prices( $query_params = array() ) { |
|
402 | - return $this->get_many_related( 'Price', $query_params ); |
|
401 | + public function prices($query_params = array()) { |
|
402 | + return $this->get_many_related('Price', $query_params); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | * @return EE_Datetime_Ticket|EE_Base_Class[] |
412 | 412 | * @throws \EE_Error |
413 | 413 | */ |
414 | - public function datetime_tickets( $query_params = array() ) { |
|
415 | - return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
|
414 | + public function datetime_tickets($query_params = array()) { |
|
415 | + return $this->get_many_related('Datetime_Ticket', $query_params); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -425,8 +425,8 @@ discard block |
||
425 | 425 | * @return EE_Datetime[] |
426 | 426 | * @throws \EE_Error |
427 | 427 | */ |
428 | - public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
|
429 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
|
428 | + public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) { |
|
429 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * @throws \EE_Error |
439 | 439 | */ |
440 | 440 | public function ID() { |
441 | - return $this->get( 'TKT_ID' ); |
|
441 | + return $this->get('TKT_ID'); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @throws \EE_Error |
464 | 464 | */ |
465 | 465 | public function template() { |
466 | - return $this->get_first_related( 'Ticket_Template' ); |
|
466 | + return $this->get_first_related('Ticket_Template'); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @throws \EE_Error |
486 | 486 | */ |
487 | 487 | public function ticket_price() { |
488 | - return $this->get( 'TKT_price' ); |
|
488 | + return $this->get('TKT_price'); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * @throws \EE_Error |
496 | 496 | */ |
497 | 497 | public function pretty_price() { |
498 | - return $this->get_pretty( 'TKT_price' ); |
|
498 | + return $this->get_pretty('TKT_price'); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | * @return float |
518 | 518 | * @throws \EE_Error |
519 | 519 | */ |
520 | - public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
|
521 | - if ($this->_ticket_total_with_taxes === null || $no_cache ) { |
|
520 | + public function get_ticket_total_with_taxes($no_cache = FALSE) { |
|
521 | + if ($this->_ticket_total_with_taxes === null || $no_cache) { |
|
522 | 522 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
523 | 523 | } |
524 | 524 | return (float) $this->_ticket_total_with_taxes; |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | |
528 | 528 | |
529 | 529 | public function ensure_TKT_Price_correct() { |
530 | - $this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) ); |
|
530 | + $this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this)); |
|
531 | 531 | $this->save(); |
532 | 532 | } |
533 | 533 | |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | * @throws \EE_Error |
539 | 539 | */ |
540 | 540 | public function get_ticket_subtotal() { |
541 | - return EE_Taxes::get_subtotal_for_admin( $this ); |
|
541 | + return EE_Taxes::get_subtotal_for_admin($this); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | * @throws \EE_Error |
551 | 551 | */ |
552 | 552 | public function get_ticket_taxes_total_for_admin() { |
553 | - return EE_Taxes::get_total_taxes_for_admin( $this ); |
|
553 | + return EE_Taxes::get_total_taxes_for_admin($this); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | |
@@ -561,8 +561,8 @@ discard block |
||
561 | 561 | * @param string $name |
562 | 562 | * @throws \EE_Error |
563 | 563 | */ |
564 | - public function set_name( $name ) { |
|
565 | - $this->set( 'TKT_name', $name ); |
|
564 | + public function set_name($name) { |
|
565 | + $this->set('TKT_name', $name); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | * @throws \EE_Error |
575 | 575 | */ |
576 | 576 | public function description() { |
577 | - return $this->get( 'TKT_description' ); |
|
577 | + return $this->get('TKT_description'); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | |
@@ -585,8 +585,8 @@ discard block |
||
585 | 585 | * @param string $description |
586 | 586 | * @throws \EE_Error |
587 | 587 | */ |
588 | - public function set_description( $description ) { |
|
589 | - $this->set( 'TKT_description', $description ); |
|
588 | + public function set_description($description) { |
|
589 | + $this->set('TKT_description', $description); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | * @return string |
600 | 600 | * @throws \EE_Error |
601 | 601 | */ |
602 | - public function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
603 | - return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
|
602 | + public function start_date($dt_frmt = '', $tm_frmt = '') { |
|
603 | + return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | |
@@ -612,8 +612,8 @@ discard block |
||
612 | 612 | * @return void |
613 | 613 | * @throws \EE_Error |
614 | 614 | */ |
615 | - public function set_start_date( $start_date ) { |
|
616 | - $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
|
615 | + public function set_start_date($start_date) { |
|
616 | + $this->_set_date_time('B', $start_date, 'TKT_start_date'); |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | |
@@ -626,8 +626,8 @@ discard block |
||
626 | 626 | * @return string |
627 | 627 | * @throws \EE_Error |
628 | 628 | */ |
629 | - public function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
630 | - return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
|
629 | + public function end_date($dt_frmt = '', $tm_frmt = '') { |
|
630 | + return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt); |
|
631 | 631 | } |
632 | 632 | |
633 | 633 | |
@@ -639,8 +639,8 @@ discard block |
||
639 | 639 | * @return void |
640 | 640 | * @throws \EE_Error |
641 | 641 | */ |
642 | - public function set_end_date( $end_date ) { |
|
643 | - $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
|
642 | + public function set_end_date($end_date) { |
|
643 | + $this->_set_date_time('B', $end_date, 'TKT_end_date'); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
653 | 653 | * @throws \EE_Error |
654 | 654 | */ |
655 | - public function set_end_time( $time ) { |
|
656 | - $this->_set_time_for( $time, 'TKT_end_date' ); |
|
655 | + public function set_end_time($time) { |
|
656 | + $this->_set_time_for($time, 'TKT_end_date'); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | |
@@ -665,8 +665,8 @@ discard block |
||
665 | 665 | * @return void |
666 | 666 | * @throws \EE_Error |
667 | 667 | */ |
668 | - public function set_min( $min ) { |
|
669 | - $this->set( 'TKT_min', $min ); |
|
668 | + public function set_min($min) { |
|
669 | + $this->set('TKT_min', $min); |
|
670 | 670 | } |
671 | 671 | |
672 | 672 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | * @throws \EE_Error |
679 | 679 | */ |
680 | 680 | public function max() { |
681 | - return $this->get( 'TKT_max' ); |
|
681 | + return $this->get('TKT_max'); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -690,8 +690,8 @@ discard block |
||
690 | 690 | * @return void |
691 | 691 | * @throws \EE_Error |
692 | 692 | */ |
693 | - public function set_max( $max ) { |
|
694 | - $this->set( 'TKT_max', $max ); |
|
693 | + public function set_max($max) { |
|
694 | + $this->set('TKT_max', $max); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | |
@@ -703,8 +703,8 @@ discard block |
||
703 | 703 | * @return void |
704 | 704 | * @throws \EE_Error |
705 | 705 | */ |
706 | - public function set_price( $price ) { |
|
707 | - $this->set( 'TKT_price', $price ); |
|
706 | + public function set_price($price) { |
|
707 | + $this->set('TKT_price', $price); |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | * @throws \EE_Error |
717 | 717 | */ |
718 | 718 | public function sold() { |
719 | - return $this->get_raw( 'TKT_sold' ); |
|
719 | + return $this->get_raw('TKT_sold'); |
|
720 | 720 | } |
721 | 721 | |
722 | 722 | |
@@ -728,10 +728,10 @@ discard block |
||
728 | 728 | * @return void |
729 | 729 | * @throws \EE_Error |
730 | 730 | */ |
731 | - public function set_sold( $sold ) { |
|
731 | + public function set_sold($sold) { |
|
732 | 732 | // sold can not go below zero |
733 | - $sold = max( 0, $sold ); |
|
734 | - $this->set( 'TKT_sold', $sold ); |
|
733 | + $sold = max(0, $sold); |
|
734 | + $this->set('TKT_sold', $sold); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | |
@@ -743,13 +743,13 @@ discard block |
||
743 | 743 | * @return void |
744 | 744 | * @throws \EE_Error |
745 | 745 | */ |
746 | - public function increase_sold( $qty = 1 ) { |
|
746 | + public function increase_sold($qty = 1) { |
|
747 | 747 | $sold = $this->sold() + $qty; |
748 | 748 | // remove ticket reservation, but don't adjust datetime reservations, because that will happen |
749 | 749 | // via \EE_Datetime::increase_sold() when \EE_Ticket::_increase_sold_for_datetimes() is called |
750 | - $this->decrease_reserved( $qty, false, __LINE__ . ') TKT' ); |
|
751 | - $this->_increase_sold_for_datetimes( $qty ); |
|
752 | - $this->set_sold( $sold ); |
|
750 | + $this->decrease_reserved($qty, false, __LINE__.') TKT'); |
|
751 | + $this->_increase_sold_for_datetimes($qty); |
|
752 | + $this->set_sold($sold); |
|
753 | 753 | do_action( |
754 | 754 | 'AHEE__EE_Ticket__increase_sold', |
755 | 755 | $this, |
@@ -767,12 +767,12 @@ discard block |
||
767 | 767 | * @return void |
768 | 768 | * @throws \EE_Error |
769 | 769 | */ |
770 | - protected function _increase_sold_for_datetimes( $qty = 1 ) { |
|
770 | + protected function _increase_sold_for_datetimes($qty = 1) { |
|
771 | 771 | $datetimes = $this->datetimes(); |
772 | - if ( is_array( $datetimes ) ) { |
|
773 | - foreach ( $datetimes as $datetime ) { |
|
774 | - if ( $datetime instanceof EE_Datetime ) { |
|
775 | - $datetime->increase_sold( $qty ); |
|
772 | + if (is_array($datetimes)) { |
|
773 | + foreach ($datetimes as $datetime) { |
|
774 | + if ($datetime instanceof EE_Datetime) { |
|
775 | + $datetime->increase_sold($qty); |
|
776 | 776 | $datetime->save(); |
777 | 777 | } |
778 | 778 | } |
@@ -788,10 +788,10 @@ discard block |
||
788 | 788 | * @return void |
789 | 789 | * @throws \EE_Error |
790 | 790 | */ |
791 | - public function decrease_sold( $qty = 1 ) { |
|
791 | + public function decrease_sold($qty = 1) { |
|
792 | 792 | $sold = $this->sold() - $qty; |
793 | - $this->_decrease_sold_for_datetimes( $qty ); |
|
794 | - $this->set_sold( $sold ); |
|
793 | + $this->_decrease_sold_for_datetimes($qty); |
|
794 | + $this->set_sold($sold); |
|
795 | 795 | do_action( |
796 | 796 | 'AHEE__EE_Ticket__decrease_sold', |
797 | 797 | $this, |
@@ -809,12 +809,12 @@ discard block |
||
809 | 809 | * @return void |
810 | 810 | * @throws \EE_Error |
811 | 811 | */ |
812 | - protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
|
812 | + protected function _decrease_sold_for_datetimes($qty = 1) { |
|
813 | 813 | $datetimes = $this->datetimes(); |
814 | - if ( is_array( $datetimes ) ) { |
|
815 | - foreach ( $datetimes as $datetime ) { |
|
816 | - if ( $datetime instanceof EE_Datetime ) { |
|
817 | - $datetime->decrease_sold( $qty ); |
|
814 | + if (is_array($datetimes)) { |
|
815 | + foreach ($datetimes as $datetime) { |
|
816 | + if ($datetime instanceof EE_Datetime) { |
|
817 | + $datetime->decrease_sold($qty); |
|
818 | 818 | $datetime->save(); |
819 | 819 | } |
820 | 820 | } |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | * @throws \EE_Error |
831 | 831 | */ |
832 | 832 | public function reserved() { |
833 | - return $this->get_raw( 'TKT_reserved' ); |
|
833 | + return $this->get_raw('TKT_reserved'); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | |
@@ -842,10 +842,10 @@ discard block |
||
842 | 842 | * @return void |
843 | 843 | * @throws \EE_Error |
844 | 844 | */ |
845 | - public function set_reserved( $reserved ) { |
|
845 | + public function set_reserved($reserved) { |
|
846 | 846 | // reserved can not go below zero |
847 | - $reserved = max( 0, (int) $reserved ); |
|
848 | - $this->set( 'TKT_reserved', $reserved ); |
|
847 | + $reserved = max(0, (int) $reserved); |
|
848 | + $this->set('TKT_reserved', $reserved); |
|
849 | 849 | } |
850 | 850 | |
851 | 851 | |
@@ -861,8 +861,8 @@ discard block |
||
861 | 861 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
862 | 862 | * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
863 | 863 | */ |
864 | - public function increase_reserved( $qty = 1, $source = 'unknown' ) { |
|
865 | - $qty = absint( $qty ); |
|
864 | + public function increase_reserved($qty = 1, $source = 'unknown') { |
|
865 | + $qty = absint($qty); |
|
866 | 866 | $reserved = $this->reserved() + $qty; |
867 | 867 | if ( |
868 | 868 | $reserved |
@@ -891,12 +891,12 @@ discard block |
||
891 | 891 | * @return void |
892 | 892 | * @throws \EE_Error |
893 | 893 | */ |
894 | - protected function _increase_reserved_for_datetimes( $qty = 1 ) { |
|
894 | + protected function _increase_reserved_for_datetimes($qty = 1) { |
|
895 | 895 | $datetimes = $this->datetimes(); |
896 | - if ( is_array( $datetimes ) ) { |
|
897 | - foreach ( $datetimes as $datetime ) { |
|
898 | - if ( $datetime instanceof EE_Datetime ) { |
|
899 | - $datetime->increase_reserved( $qty ); |
|
896 | + if (is_array($datetimes)) { |
|
897 | + foreach ($datetimes as $datetime) { |
|
898 | + if ($datetime instanceof EE_Datetime) { |
|
899 | + $datetime->increase_reserved($qty); |
|
900 | 900 | $datetime->save(); |
901 | 901 | } |
902 | 902 | } |
@@ -917,8 +917,8 @@ discard block |
||
917 | 917 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
918 | 918 | * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
919 | 919 | */ |
920 | - public function decrease_reserved( $qty = 1, $adjust_datetimes = true, $source = 'unknown' ) { |
|
921 | - $reserved = $this->reserved() - absint( $qty ); |
|
920 | + public function decrease_reserved($qty = 1, $adjust_datetimes = true, $source = 'unknown') { |
|
921 | + $reserved = $this->reserved() - absint($qty); |
|
922 | 922 | if ( |
923 | 923 | $this->add_extra_meta( |
924 | 924 | EE_Ticket::META_KEY_TICKET_RESERVATIONS, |
@@ -947,12 +947,12 @@ discard block |
||
947 | 947 | * @return void |
948 | 948 | * @throws \EE_Error |
949 | 949 | */ |
950 | - protected function _decrease_reserved_for_datetimes( $qty = 1 ) { |
|
950 | + protected function _decrease_reserved_for_datetimes($qty = 1) { |
|
951 | 951 | $datetimes = $this->datetimes(); |
952 | - if ( is_array( $datetimes ) ) { |
|
953 | - foreach ( $datetimes as $datetime ) { |
|
954 | - if ( $datetime instanceof EE_Datetime ) { |
|
955 | - $datetime->decrease_reserved( $qty ); |
|
952 | + if (is_array($datetimes)) { |
|
953 | + foreach ($datetimes as $datetime) { |
|
954 | + if ($datetime instanceof EE_Datetime) { |
|
955 | + $datetime->decrease_reserved($qty); |
|
956 | 956 | $datetime->save(); |
957 | 957 | } |
958 | 958 | } |
@@ -973,14 +973,14 @@ discard block |
||
973 | 973 | * @return int |
974 | 974 | * @throws \EE_Error |
975 | 975 | */ |
976 | - public function qty( $context = '' ) { |
|
977 | - switch ( $context ) { |
|
976 | + public function qty($context = '') { |
|
977 | + switch ($context) { |
|
978 | 978 | case 'reg_limit' : |
979 | 979 | return $this->real_quantity_on_ticket(); |
980 | 980 | case 'saleable' : |
981 | - return $this->real_quantity_on_ticket( 'saleable' ); |
|
981 | + return $this->real_quantity_on_ticket('saleable'); |
|
982 | 982 | default: |
983 | - return $this->get_raw( 'TKT_qty' ); |
|
983 | + return $this->get_raw('TKT_qty'); |
|
984 | 984 | } |
985 | 985 | } |
986 | 986 | |
@@ -999,15 +999,15 @@ discard block |
||
999 | 999 | * @return int |
1000 | 1000 | * @throws \EE_Error |
1001 | 1001 | */ |
1002 | - public function real_quantity_on_ticket( $context = 'reg_limit', $DTT_ID = 0 ) { |
|
1003 | - $raw = $this->get_raw( 'TKT_qty' ); |
|
1002 | + public function real_quantity_on_ticket($context = 'reg_limit', $DTT_ID = 0) { |
|
1003 | + $raw = $this->get_raw('TKT_qty'); |
|
1004 | 1004 | // return immediately if it's zero |
1005 | - if ( $raw === 0 ) { |
|
1005 | + if ($raw === 0) { |
|
1006 | 1006 | return $raw; |
1007 | 1007 | } |
1008 | 1008 | //echo "\n\n<br />Ticket: " . $this->name() . '<br />'; |
1009 | 1009 | // ensure qty doesn't exceed raw value for THIS ticket |
1010 | - $qty = min( EE_INF, $raw ); |
|
1010 | + $qty = min(EE_INF, $raw); |
|
1011 | 1011 | //echo "\n . qty: " . $qty . '<br />'; |
1012 | 1012 | // calculate this ticket's total sales and reservations |
1013 | 1013 | $sold_and_reserved_for_this_ticket = $this->sold() + $this->reserved(); |
@@ -1016,23 +1016,23 @@ discard block |
||
1016 | 1016 | //echo "\n . sold_and_reserved_for_this_ticket: " . $sold_and_reserved_for_this_ticket . '<br />'; |
1017 | 1017 | // first we need to calculate the maximum number of tickets available for the datetime |
1018 | 1018 | // do we want data for one datetime or all of them ? |
1019 | - $query_params = $DTT_ID ? array( array( 'DTT_ID' => $DTT_ID ) ) : array(); |
|
1020 | - $datetimes = $this->datetimes( $query_params ); |
|
1021 | - if ( is_array( $datetimes ) && ! empty( $datetimes ) ) { |
|
1022 | - foreach ( $datetimes as $datetime ) { |
|
1023 | - if ( $datetime instanceof EE_Datetime ) { |
|
1019 | + $query_params = $DTT_ID ? array(array('DTT_ID' => $DTT_ID)) : array(); |
|
1020 | + $datetimes = $this->datetimes($query_params); |
|
1021 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
1022 | + foreach ($datetimes as $datetime) { |
|
1023 | + if ($datetime instanceof EE_Datetime) { |
|
1024 | 1024 | $datetime->refresh_from_db(); |
1025 | 1025 | //echo "\n . . datetime name: " . $datetime->name() . '<br />'; |
1026 | 1026 | //echo "\n . . datetime ID: " . $datetime->ID() . '<br />'; |
1027 | 1027 | // initialize with no restrictions for each datetime |
1028 | 1028 | // but adjust datetime qty based on datetime reg limit |
1029 | - $datetime_qty = min( EE_INF, $datetime->reg_limit() ); |
|
1029 | + $datetime_qty = min(EE_INF, $datetime->reg_limit()); |
|
1030 | 1030 | //echo "\n . . . datetime reg_limit: " . $datetime->reg_limit() . '<br />'; |
1031 | 1031 | //echo "\n . . . datetime_qty: " . $datetime_qty . '<br />'; |
1032 | 1032 | // if we want the actual saleable amount, then we need to consider OTHER ticket sales |
1033 | 1033 | // and reservations for this datetime, that do NOT include sales and reservations |
1034 | 1034 | // for this ticket (so we add $this->sold() and $this->reserved() back in) |
1035 | - if ( $context === 'saleable' ) { |
|
1035 | + if ($context === 'saleable') { |
|
1036 | 1036 | $datetime_qty = max( |
1037 | 1037 | $datetime_qty - $datetime->sold_and_reserved() + $sold_and_reserved_for_this_ticket, |
1038 | 1038 | 0 |
@@ -1044,16 +1044,16 @@ discard block |
||
1044 | 1044 | $datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0; |
1045 | 1045 | //echo "\n . . . datetime_qty: " . $datetime_qty . '<br />'; |
1046 | 1046 | } |
1047 | - $qty = min( $datetime_qty, $qty ); |
|
1047 | + $qty = min($datetime_qty, $qty); |
|
1048 | 1048 | //echo "\n . . qty: " . $qty . '<br />'; |
1049 | 1049 | } |
1050 | 1050 | } |
1051 | 1051 | } |
1052 | 1052 | // NOW that we know the maximum number of tickets available for the datetime |
1053 | 1053 | // we can finally factor in the details for this specific ticket |
1054 | - if ( $qty > 0 && $context === 'saleable' ) { |
|
1054 | + if ($qty > 0 && $context === 'saleable') { |
|
1055 | 1055 | // and subtract the sales for THIS ticket |
1056 | - $qty = max( $qty - $sold_and_reserved_for_this_ticket, 0 ); |
|
1056 | + $qty = max($qty - $sold_and_reserved_for_this_ticket, 0); |
|
1057 | 1057 | //echo "\n . qty: " . $qty . '<br />'; |
1058 | 1058 | } |
1059 | 1059 | //echo "\nFINAL QTY: " . $qty . "<br /><br />"; |
@@ -1069,14 +1069,14 @@ discard block |
||
1069 | 1069 | * @return void |
1070 | 1070 | * @throws \EE_Error |
1071 | 1071 | */ |
1072 | - public function set_qty( $qty ) { |
|
1072 | + public function set_qty($qty) { |
|
1073 | 1073 | $datetimes = $this->datetimes(); |
1074 | - foreach ( $datetimes as $datetime ) { |
|
1075 | - if ( $datetime instanceof EE_Datetime ) { |
|
1076 | - $qty = min( $qty, $datetime->reg_limit() ); |
|
1074 | + foreach ($datetimes as $datetime) { |
|
1075 | + if ($datetime instanceof EE_Datetime) { |
|
1076 | + $qty = min($qty, $datetime->reg_limit()); |
|
1077 | 1077 | } |
1078 | 1078 | } |
1079 | - $this->set( 'TKT_qty', $qty ); |
|
1079 | + $this->set('TKT_qty', $qty); |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | * @throws \EE_Error |
1089 | 1089 | */ |
1090 | 1090 | public function uses() { |
1091 | - return $this->get( 'TKT_uses' ); |
|
1091 | + return $this->get('TKT_uses'); |
|
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | |
@@ -1100,8 +1100,8 @@ discard block |
||
1100 | 1100 | * @return void |
1101 | 1101 | * @throws \EE_Error |
1102 | 1102 | */ |
1103 | - public function set_uses( $uses ) { |
|
1104 | - $this->set( 'TKT_uses', $uses ); |
|
1103 | + public function set_uses($uses) { |
|
1104 | + $this->set('TKT_uses', $uses); |
|
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | * @throws \EE_Error |
1114 | 1114 | */ |
1115 | 1115 | public function required() { |
1116 | - return $this->get( 'TKT_required' ); |
|
1116 | + return $this->get('TKT_required'); |
|
1117 | 1117 | } |
1118 | 1118 | |
1119 | 1119 | |
@@ -1125,8 +1125,8 @@ discard block |
||
1125 | 1125 | * @return void |
1126 | 1126 | * @throws \EE_Error |
1127 | 1127 | */ |
1128 | - public function set_required( $required ) { |
|
1129 | - $this->set( 'TKT_required', $required ); |
|
1128 | + public function set_required($required) { |
|
1129 | + $this->set('TKT_required', $required); |
|
1130 | 1130 | } |
1131 | 1131 | |
1132 | 1132 | |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | * @throws \EE_Error |
1139 | 1139 | */ |
1140 | 1140 | public function taxable() { |
1141 | - return $this->get( 'TKT_taxable' ); |
|
1141 | + return $this->get('TKT_taxable'); |
|
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | |
@@ -1150,8 +1150,8 @@ discard block |
||
1150 | 1150 | * @return void |
1151 | 1151 | * @throws \EE_Error |
1152 | 1152 | */ |
1153 | - public function set_taxable( $taxable ) { |
|
1154 | - $this->set( 'TKT_taxable', $taxable ); |
|
1153 | + public function set_taxable($taxable) { |
|
1154 | + $this->set('TKT_taxable', $taxable); |
|
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @throws \EE_Error |
1164 | 1164 | */ |
1165 | 1165 | public function is_default() { |
1166 | - return $this->get( 'TKT_is_default' ); |
|
1166 | + return $this->get('TKT_is_default'); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
@@ -1175,8 +1175,8 @@ discard block |
||
1175 | 1175 | * @return void |
1176 | 1176 | * @throws \EE_Error |
1177 | 1177 | */ |
1178 | - public function set_is_default( $is_default ) { |
|
1179 | - $this->set( 'TKT_is_default', $is_default ); |
|
1178 | + public function set_is_default($is_default) { |
|
1179 | + $this->set('TKT_is_default', $is_default); |
|
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | * @throws \EE_Error |
1189 | 1189 | */ |
1190 | 1190 | public function order() { |
1191 | - return $this->get( 'TKT_order' ); |
|
1191 | + return $this->get('TKT_order'); |
|
1192 | 1192 | } |
1193 | 1193 | |
1194 | 1194 | |
@@ -1200,8 +1200,8 @@ discard block |
||
1200 | 1200 | * @return void |
1201 | 1201 | * @throws \EE_Error |
1202 | 1202 | */ |
1203 | - public function set_order( $order ) { |
|
1204 | - $this->set( 'TKT_order', $order ); |
|
1203 | + public function set_order($order) { |
|
1204 | + $this->set('TKT_order', $order); |
|
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | * @throws \EE_Error |
1214 | 1214 | */ |
1215 | 1215 | public function row() { |
1216 | - return $this->get( 'TKT_row' ); |
|
1216 | + return $this->get('TKT_row'); |
|
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | |
@@ -1225,8 +1225,8 @@ discard block |
||
1225 | 1225 | * @return void |
1226 | 1226 | * @throws \EE_Error |
1227 | 1227 | */ |
1228 | - public function set_row( $row ) { |
|
1229 | - $this->set( 'TKT_row', $row ); |
|
1228 | + public function set_row($row) { |
|
1229 | + $this->set('TKT_row', $row); |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | * @throws \EE_Error |
1239 | 1239 | */ |
1240 | 1240 | public function deleted() { |
1241 | - return $this->get( 'TKT_deleted' ); |
|
1241 | + return $this->get('TKT_deleted'); |
|
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | |
@@ -1250,8 +1250,8 @@ discard block |
||
1250 | 1250 | * @return void |
1251 | 1251 | * @throws \EE_Error |
1252 | 1252 | */ |
1253 | - public function set_deleted( $deleted ) { |
|
1254 | - $this->set( 'TKT_deleted', $deleted ); |
|
1253 | + public function set_deleted($deleted) { |
|
1254 | + $this->set('TKT_deleted', $deleted); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | |
@@ -1263,7 +1263,7 @@ discard block |
||
1263 | 1263 | * @throws \EE_Error |
1264 | 1264 | */ |
1265 | 1265 | public function parent_ID() { |
1266 | - return $this->get( 'TKT_parent' ); |
|
1266 | + return $this->get('TKT_parent'); |
|
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | |
@@ -1275,8 +1275,8 @@ discard block |
||
1275 | 1275 | * @return void |
1276 | 1276 | * @throws \EE_Error |
1277 | 1277 | */ |
1278 | - public function set_parent_ID( $parent ) { |
|
1279 | - $this->set( 'TKT_parent', $parent ); |
|
1278 | + public function set_parent_ID($parent) { |
|
1279 | + $this->set('TKT_parent', $parent); |
|
1280 | 1280 | } |
1281 | 1281 | |
1282 | 1282 | |
@@ -1289,10 +1289,10 @@ discard block |
||
1289 | 1289 | */ |
1290 | 1290 | public function name_and_info() { |
1291 | 1291 | $times = array(); |
1292 | - foreach ( $this->datetimes() as $datetime ) { |
|
1292 | + foreach ($this->datetimes() as $datetime) { |
|
1293 | 1293 | $times[] = $datetime->start_date_and_time(); |
1294 | 1294 | } |
1295 | - return $this->name() . ' @ ' . implode( ', ', $times ) . ' for ' . $this->pretty_price(); |
|
1295 | + return $this->name().' @ '.implode(', ', $times).' for '.$this->pretty_price(); |
|
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | * @throws \EE_Error |
1305 | 1305 | */ |
1306 | 1306 | public function name() { |
1307 | - return $this->get( 'TKT_name' ); |
|
1307 | + return $this->get('TKT_name'); |
|
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | |
@@ -1316,7 +1316,7 @@ discard block |
||
1316 | 1316 | * @throws \EE_Error |
1317 | 1317 | */ |
1318 | 1318 | public function price() { |
1319 | - return $this->get( 'TKT_price' ); |
|
1319 | + return $this->get('TKT_price'); |
|
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | |
@@ -1328,8 +1328,8 @@ discard block |
||
1328 | 1328 | * @return EE_Registration[]|EE_Base_Class[] |
1329 | 1329 | * @throws \EE_Error |
1330 | 1330 | */ |
1331 | - public function registrations( $query_params = array() ) { |
|
1332 | - return $this->get_many_related( 'Registration', $query_params ); |
|
1331 | + public function registrations($query_params = array()) { |
|
1332 | + return $this->get_many_related('Registration', $query_params); |
|
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | * @param array $query_params like EEM_Base::get_all's |
1369 | 1369 | * @return int |
1370 | 1370 | */ |
1371 | - public function count_registrations( $query_params = array() ) { |
|
1371 | + public function count_registrations($query_params = array()) { |
|
1372 | 1372 | return $this->count_related('Registration', $query_params); |
1373 | 1373 | } |
1374 | 1374 | |
@@ -1396,23 +1396,23 @@ discard block |
||
1396 | 1396 | public function get_related_event() { |
1397 | 1397 | //get one datetime to use for getting the event |
1398 | 1398 | $datetime = $this->first_datetime(); |
1399 | - if ( ! $datetime instanceof \EE_Datetime ) { |
|
1399 | + if ( ! $datetime instanceof \EE_Datetime) { |
|
1400 | 1400 | throw new UnexpectedEntityException( |
1401 | 1401 | $datetime, |
1402 | 1402 | 'EE_Datetime', |
1403 | 1403 | sprintf( |
1404 | - __( 'The ticket (%s) is not associated with any valid datetimes.', 'event_espresso'), |
|
1404 | + __('The ticket (%s) is not associated with any valid datetimes.', 'event_espresso'), |
|
1405 | 1405 | $this->name() |
1406 | 1406 | ) |
1407 | 1407 | ); |
1408 | 1408 | } |
1409 | 1409 | $event = $datetime->event(); |
1410 | - if ( ! $event instanceof \EE_Event ) { |
|
1410 | + if ( ! $event instanceof \EE_Event) { |
|
1411 | 1411 | throw new UnexpectedEntityException( |
1412 | 1412 | $event, |
1413 | 1413 | 'EE_Event', |
1414 | 1414 | sprintf( |
1415 | - __( 'The ticket (%s) is not associated with a valid event.', 'event_espresso'), |
|
1415 | + __('The ticket (%s) is not associated with a valid event.', 'event_espresso'), |
|
1416 | 1416 | $this->name() |
1417 | 1417 | ) |
1418 | 1418 | ); |