@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
127 | 127 | do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
128 | 128 | return TRUE; |
129 | - }else{ |
|
129 | + } else{ |
|
130 | 130 | //even though the old value matches the new value, it's still good to |
131 | 131 | //allow the parent set method to have a say |
132 | 132 | parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
@@ -625,8 +625,9 @@ discard block |
||
625 | 625 | * @return EE_Registration |
626 | 626 | */ |
627 | 627 | public function get_primary_registration() { |
628 | - if ( $this->is_primary_registrant() ) |
|
629 | - return $this; |
|
628 | + if ( $this->is_primary_registrant() ) { |
|
629 | + return $this; |
|
630 | + } |
|
630 | 631 | |
631 | 632 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
632 | 633 | $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_Registration class |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | * @param string $timezone |
39 | 39 | * @return EE_Registration |
40 | 40 | */ |
41 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
42 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
43 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
41 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
42 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
43 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * @param string $timezone |
51 | 51 | * @return EE_Registration |
52 | 52 | */ |
53 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
54 | - return new self( $props_n_values, TRUE, $timezone ); |
|
53 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
54 | + return new self($props_n_values, TRUE, $timezone); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @access public |
63 | 63 | * @param int $EVT_ID Event ID |
64 | 64 | */ |
65 | - public function set_event( $EVT_ID = 0 ) { |
|
66 | - $this->set( 'EVT_ID', $EVT_ID ); |
|
65 | + public function set_event($EVT_ID = 0) { |
|
66 | + $this->set('EVT_ID', $EVT_ID); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -74,18 +74,18 @@ discard block |
||
74 | 74 | * @param mixed $field_value |
75 | 75 | * @param bool $use_default |
76 | 76 | */ |
77 | - public function set( $field_name, $field_value, $use_default = FALSE ) { |
|
78 | - switch( $field_name ) { |
|
77 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
78 | + switch ($field_name) { |
|
79 | 79 | case 'REG_code' : |
80 | - if ( ! empty( $field_value ) && $this->reg_code() == '' ) { |
|
81 | - $this->set_reg_code( $field_value, $use_default ); |
|
80 | + if ( ! empty($field_value) && $this->reg_code() == '') { |
|
81 | + $this->set_reg_code($field_value, $use_default); |
|
82 | 82 | } |
83 | 83 | break; |
84 | 84 | case 'STS_ID' : |
85 | - $this->set_status( $field_value, $use_default ); |
|
85 | + $this->set_status($field_value, $use_default); |
|
86 | 86 | break; |
87 | 87 | default : |
88 | - parent::set( $field_name, $field_value, $use_default ); |
|
88 | + parent::set($field_name, $field_value, $use_default); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -102,30 +102,30 @@ discard block |
||
102 | 102 | * @param boolean $use_default |
103 | 103 | * @return bool |
104 | 104 | */ |
105 | - public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) { |
|
105 | + public function set_status($new_STS_ID = NULL, $use_default = FALSE) { |
|
106 | 106 | // get current REG_Status |
107 | 107 | $old_STS_ID = $this->status_ID(); |
108 | 108 | // if status has changed |
109 | - if ( $old_STS_ID != $new_STS_ID ) { |
|
109 | + if ($old_STS_ID != $new_STS_ID) { |
|
110 | 110 | // TO approved |
111 | - if ( $new_STS_ID == EEM_Registration::status_id_approved ) { |
|
111 | + if ($new_STS_ID == EEM_Registration::status_id_approved) { |
|
112 | 112 | // reserve a space by incrementing ticket and datetime sold values |
113 | 113 | $this->_reserve_registration_space(); |
114 | - do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
114 | + do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID); |
|
115 | 115 | // OR FROM approved |
116 | - } else if ( $old_STS_ID == EEM_Registration::status_id_approved ) { |
|
116 | + } else if ($old_STS_ID == EEM_Registration::status_id_approved) { |
|
117 | 117 | // release a space by decrementing ticket and datetime sold values |
118 | 118 | $this->_release_registration_space(); |
119 | - do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
119 | + do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID); |
|
120 | 120 | } |
121 | 121 | // update status |
122 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
123 | - do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
|
122 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
123 | + do_action('AHEE__EE_Registration__set_status__after_update', $this); |
|
124 | 124 | return TRUE; |
125 | - }else{ |
|
125 | + } else { |
|
126 | 126 | //even though the old value matches the new value, it's still good to |
127 | 127 | //allow the parent set method to have a say |
128 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
128 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
129 | 129 | return TRUE; |
130 | 130 | } |
131 | 131 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @access public |
138 | 138 | */ |
139 | 139 | public function status_ID() { |
140 | - return $this->get( 'STS_ID' ); |
|
140 | + return $this->get('STS_ID'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | $ticket->increase_sold(); |
152 | 152 | $ticket->save(); |
153 | 153 | $datetimes = $ticket->datetimes(); |
154 | - if ( is_array( $datetimes ) ) { |
|
155 | - foreach ( $datetimes as $datetime ) { |
|
156 | - if ( $datetime instanceof EE_Datetime ) { |
|
154 | + if (is_array($datetimes)) { |
|
155 | + foreach ($datetimes as $datetime) { |
|
156 | + if ($datetime instanceof EE_Datetime) { |
|
157 | 157 | $datetime->increase_sold(); |
158 | 158 | $datetime->save(); |
159 | 159 | } |
@@ -171,12 +171,12 @@ discard block |
||
171 | 171 | * @param boolean $include_archived whether to include archived tickets or not. |
172 | 172 | * @return EE_Ticket |
173 | 173 | */ |
174 | - public function ticket( $include_archived = TRUE ) { |
|
174 | + public function ticket($include_archived = TRUE) { |
|
175 | 175 | $query_params = array(); |
176 | - if ( $include_archived ) { |
|
177 | - $query_params[ 'default_where_conditions' ] = 'none'; |
|
176 | + if ($include_archived) { |
|
177 | + $query_params['default_where_conditions'] = 'none'; |
|
178 | 178 | } |
179 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
179 | + return $this->get_first_related('Ticket', $query_params); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @return EE_Event |
187 | 187 | */ |
188 | 188 | public function event() { |
189 | - return $this->get_first_related( 'Event' ); |
|
189 | + return $this->get_first_related('Event'); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function wp_user() { |
202 | 202 | $event = $this->event(); |
203 | - if ( $event instanceof EE_Event ) { |
|
203 | + if ($event instanceof EE_Event) { |
|
204 | 204 | return $event->wp_user(); |
205 | 205 | } |
206 | 206 | return 0; |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | $ticket->decrease_sold(); |
218 | 218 | $ticket->save(); |
219 | 219 | $datetimes = $ticket->datetimes(); |
220 | - if ( is_array( $datetimes ) ) { |
|
221 | - foreach ( $datetimes as $datetime ) { |
|
222 | - if ( $datetime instanceof EE_Datetime ) { |
|
220 | + if (is_array($datetimes)) { |
|
221 | + foreach ($datetimes as $datetime) { |
|
222 | + if ($datetime instanceof EE_Datetime) { |
|
223 | 223 | $datetime->decrease_sold(); |
224 | 224 | $datetime->save(); |
225 | 225 | } |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | * @access public |
236 | 236 | * @param int $ATT_ID Attendee ID |
237 | 237 | */ |
238 | - public function set_attendee_id( $ATT_ID = 0 ) { |
|
239 | - $this->set( 'ATT_ID', $ATT_ID ); |
|
238 | + public function set_attendee_id($ATT_ID = 0) { |
|
239 | + $this->set('ATT_ID', $ATT_ID); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | * @access public |
248 | 248 | * @param int $TXN_ID Transaction ID |
249 | 249 | */ |
250 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
251 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
250 | + public function set_transaction_id($TXN_ID = 0) { |
|
251 | + $this->set('TXN_ID', $TXN_ID); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
@@ -259,8 +259,8 @@ discard block |
||
259 | 259 | * @access public |
260 | 260 | * @param string $REG_session PHP Session ID |
261 | 261 | */ |
262 | - public function set_session( $REG_session = '' ) { |
|
263 | - $this->set( 'REG_session', $REG_session ); |
|
262 | + public function set_session($REG_session = '') { |
|
263 | + $this->set('REG_session', $REG_session); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | * @access public |
272 | 272 | * @param string $REG_url_link Registration URL Link |
273 | 273 | */ |
274 | - public function set_reg_url_link( $REG_url_link = '' ) { |
|
275 | - $this->set( 'REG_url_link', $REG_url_link ); |
|
274 | + public function set_reg_url_link($REG_url_link = '') { |
|
275 | + $this->set('REG_url_link', $REG_url_link); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | * @access public |
284 | 284 | * @param int $REG_count Primary Attendee |
285 | 285 | */ |
286 | - public function set_count( $REG_count = 1 ) { |
|
287 | - $this->set( 'REG_count', $REG_count ); |
|
286 | + public function set_count($REG_count = 1) { |
|
287 | + $this->set('REG_count', $REG_count); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | * @access public |
296 | 296 | * @param boolean $REG_group_size Group Registration |
297 | 297 | */ |
298 | - public function set_group_size( $REG_group_size = FALSE ) { |
|
299 | - $this->set( 'REG_group_size', $REG_group_size ); |
|
298 | + public function set_group_size($REG_group_size = FALSE) { |
|
299 | + $this->set('REG_group_size', $REG_group_size); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | * @access public |
380 | 380 | * @param mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date |
381 | 381 | */ |
382 | - public function set_reg_date( $REG_date = FALSE ) { |
|
383 | - $this->set( 'REG_date', $REG_date ); |
|
382 | + public function set_reg_date($REG_date = FALSE) { |
|
383 | + $this->set('REG_date', $REG_date); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -391,8 +391,8 @@ discard block |
||
391 | 391 | * @access public |
392 | 392 | * @param float $REG_final_price |
393 | 393 | */ |
394 | - public function set_final_price( $REG_final_price = 0.00 ) { |
|
395 | - $this->set( 'REG_final_price', $REG_final_price ); |
|
394 | + public function set_final_price($REG_final_price = 0.00) { |
|
395 | + $this->set('REG_final_price', $REG_final_price); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | * @access public |
404 | 404 | * @param float $REG_paid |
405 | 405 | */ |
406 | - public function set_paid( $REG_paid = 0.00 ) { |
|
407 | - $this->set( 'REG_paid', $REG_paid ); |
|
406 | + public function set_paid($REG_paid = 0.00) { |
|
407 | + $this->set('REG_paid', $REG_paid); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | |
@@ -415,8 +415,8 @@ discard block |
||
415 | 415 | * @access public |
416 | 416 | * @param boolean $REG_att_is_going Attendee Is Going |
417 | 417 | */ |
418 | - public function set_att_is_going( $REG_att_is_going = FALSE ) { |
|
419 | - $this->set( 'REG_att_is_going', $REG_att_is_going ); |
|
418 | + public function set_att_is_going($REG_att_is_going = FALSE) { |
|
419 | + $this->set('REG_att_is_going', $REG_att_is_going); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | * @return EE_Attendee |
427 | 427 | */ |
428 | 428 | public function attendee() { |
429 | - return $this->get_first_related( 'Attendee' ); |
|
429 | + return $this->get_first_related('Attendee'); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * @access public |
437 | 437 | */ |
438 | 438 | public function event_ID() { |
439 | - return $this->get( 'EVT_ID' ); |
|
439 | + return $this->get('EVT_ID'); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | */ |
448 | 448 | public function event_name() { |
449 | 449 | $event = $this->event_obj(); |
450 | - if ( $event ) { |
|
450 | + if ($event) { |
|
451 | 451 | return $event->name(); |
452 | 452 | } else { |
453 | 453 | return NULL; |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @return EE_Event |
462 | 462 | */ |
463 | 463 | public function event_obj() { |
464 | - return $this->get_first_related( 'Event' ); |
|
464 | + return $this->get_first_related('Event'); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | * @access public |
472 | 472 | */ |
473 | 473 | public function attendee_ID() { |
474 | - return $this->get( 'ATT_ID' ); |
|
474 | + return $this->get('ATT_ID'); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | * @access public |
482 | 482 | */ |
483 | 483 | public function session_ID() { |
484 | - return $this->get( 'REG_session' ); |
|
484 | + return $this->get('REG_session'); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
492 | 492 | * @return string |
493 | 493 | */ |
494 | - public function receipt_url( $messenger = 'html' ) { |
|
494 | + public function receipt_url($messenger = 'html') { |
|
495 | 495 | |
496 | 496 | /** |
497 | 497 | * The below will be deprecated one version after this. We check first if there is a custom receipt template already in use on old system. If there is then we just return the standard url for it. |
@@ -500,12 +500,12 @@ discard block |
||
500 | 500 | */ |
501 | 501 | EE_Registry::instance()->load_helper('Template'); |
502 | 502 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php'; |
503 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
503 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
504 | 504 | |
505 | - if ( $has_custom ) { |
|
506 | - return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) ); |
|
505 | + if ($has_custom) { |
|
506 | + return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch')); |
|
507 | 507 | } |
508 | - return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' ); |
|
508 | + return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt'); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
517 | 517 | * @return string |
518 | 518 | */ |
519 | - public function invoice_url( $messenger = 'html' ) { |
|
519 | + public function invoice_url($messenger = 'html') { |
|
520 | 520 | /** |
521 | 521 | * The below will be deprecated one version after this. We check first if there is a custom invoice template already in use on old system. If there is then we just return the standard url for it. |
522 | 522 | * |
@@ -524,21 +524,21 @@ discard block |
||
524 | 524 | */ |
525 | 525 | EE_Registry::instance()->load_helper('Template'); |
526 | 526 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php'; |
527 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
527 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
528 | 528 | |
529 | - if ( $has_custom ) { |
|
530 | - if ( $messenger == 'html' ) { |
|
531 | - return $this->invoice_url( 'launch' ); |
|
529 | + if ($has_custom) { |
|
530 | + if ($messenger == 'html') { |
|
531 | + return $this->invoice_url('launch'); |
|
532 | 532 | } |
533 | 533 | $route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice'; |
534 | 534 | |
535 | - $query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() ); |
|
536 | - if ( $messenger == 'html' ) { |
|
535 | + $query_args = array('ee' => $route, 'id' => $this->reg_url_link()); |
|
536 | + if ($messenger == 'html') { |
|
537 | 537 | $query_args['html'] = TRUE; |
538 | 538 | } |
539 | - return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) ); |
|
539 | + return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id)); |
|
540 | 540 | } |
541 | - return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' ); |
|
541 | + return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice'); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @access public |
549 | 549 | */ |
550 | 550 | public function reg_url_link() { |
551 | - return $this->get( 'REG_url_link' ); |
|
551 | + return $this->get('REG_url_link'); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | |
@@ -558,8 +558,8 @@ discard block |
||
558 | 558 | * @param string $type 'download','launch', or 'html' (default is 'launch') |
559 | 559 | * @return void |
560 | 560 | */ |
561 | - public function e_invoice_url( $type = 'launch' ) { |
|
562 | - echo $this->invoice_url( $type ); |
|
561 | + public function e_invoice_url($type = 'launch') { |
|
562 | + echo $this->invoice_url($type); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | * @return string |
580 | 580 | */ |
581 | 581 | public function payment_overview_url() { |
582 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), get_permalink( EE_Registry::instance()->CFG->core->reg_page_id ) ); |
|
582 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), get_permalink(EE_Registry::instance()->CFG->core->reg_page_id)); |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | * @return string |
591 | 591 | */ |
592 | 592 | public function edit_attendee_information_url() { |
593 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), get_permalink( EE_Registry::instance()->CFG->core->reg_page_id ) ); |
|
593 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), get_permalink(EE_Registry::instance()->CFG->core->reg_page_id)); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | |
@@ -600,8 +600,8 @@ discard block |
||
600 | 600 | * @return string |
601 | 601 | */ |
602 | 602 | public function get_admin_edit_url() { |
603 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
604 | - return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) ); |
|
603 | + EE_Registry::instance()->load_helper('URL'); |
|
604 | + return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php')); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | * @access public |
612 | 612 | */ |
613 | 613 | public function is_primary_registrant() { |
614 | - return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE; |
|
614 | + return $this->get('REG_count') == 1 ? TRUE : FALSE; |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | |
@@ -620,12 +620,12 @@ discard block |
||
620 | 620 | * This returns the primary registration object for this registration group (which may be this object). |
621 | 621 | * @return EE_Registration |
622 | 622 | */ |
623 | - public function get_primary_registration() { |
|
624 | - if ( $this->is_primary_registrant() ) |
|
623 | + public function get_primary_registration() { |
|
624 | + if ($this->is_primary_registrant()) |
|
625 | 625 | return $this; |
626 | 626 | |
627 | 627 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
628 | - $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
|
628 | + $primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1))); |
|
629 | 629 | return $primary_registrant; |
630 | 630 | } |
631 | 631 | |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | * @access public |
637 | 637 | */ |
638 | 638 | public function count() { |
639 | - return $this->get( 'REG_count' ); |
|
639 | + return $this->get('REG_count'); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @access public |
647 | 647 | */ |
648 | 648 | public function group_size() { |
649 | - return $this->get( 'REG_group_size' ); |
|
649 | + return $this->get('REG_group_size'); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | * @access public |
657 | 657 | */ |
658 | 658 | public function date() { |
659 | - return $this->get( 'REG_date' ); |
|
659 | + return $this->get('REG_date'); |
|
660 | 660 | } |
661 | 661 | |
662 | 662 | |
@@ -667,8 +667,8 @@ discard block |
||
667 | 667 | * @param string $time_format |
668 | 668 | * @return string |
669 | 669 | */ |
670 | - public function pretty_date( $date_format = NULL, $time_format = NULL ) { |
|
671 | - return $this->get_datetime( 'REG_date', $date_format, $time_format ); |
|
670 | + public function pretty_date($date_format = NULL, $time_format = NULL) { |
|
671 | + return $this->get_datetime('REG_date', $date_format, $time_format); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | * @return float |
681 | 681 | */ |
682 | 682 | public function final_price() { |
683 | - return $this->get( 'REG_final_price' ); |
|
683 | + return $this->get('REG_final_price'); |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | * @return string |
692 | 692 | */ |
693 | 693 | public function pretty_final_price() { |
694 | - return $this->get_pretty( 'REG_final_price' ); |
|
694 | + return $this->get_pretty('REG_final_price'); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | * @return float |
703 | 703 | */ |
704 | 704 | public function paid() { |
705 | - return $this->get( 'REG_paid' ); |
|
705 | + return $this->get('REG_paid'); |
|
706 | 706 | } |
707 | 707 | |
708 | 708 | |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | * @return float |
714 | 714 | */ |
715 | 715 | public function pretty_paid() { |
716 | - return $this->get_pretty( 'REG_paid' ); |
|
716 | + return $this->get_pretty('REG_paid'); |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | |
@@ -725,11 +725,11 @@ discard block |
||
725 | 725 | * @param array $requires_payment |
726 | 726 | * @return bool |
727 | 727 | */ |
728 | - public function owes_monies_and_can_pay( $requires_payment = array()) { |
|
728 | + public function owes_monies_and_can_pay($requires_payment = array()) { |
|
729 | 729 | // these reg statuses require payment (if event is not free) |
730 | - $requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
730 | + $requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
731 | 731 | if ( |
732 | - in_array( $this->status_ID(), $requires_payment ) && |
|
732 | + in_array($this->status_ID(), $requires_payment) && |
|
733 | 733 | $this->final_price() != 0 && |
734 | 734 | $this->final_price() != $this->paid() |
735 | 735 | ) { |
@@ -746,8 +746,8 @@ discard block |
||
746 | 746 | * @param bool $show_icons |
747 | 747 | * @return void |
748 | 748 | */ |
749 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
750 | - echo $this->pretty_status( $show_icons ); |
|
749 | + public function e_pretty_status($show_icons = FALSE) { |
|
750 | + echo $this->pretty_status($show_icons); |
|
751 | 751 | } |
752 | 752 | |
753 | 753 | |
@@ -758,10 +758,10 @@ discard block |
||
758 | 758 | * @param bool $show_icons |
759 | 759 | * @return string |
760 | 760 | */ |
761 | - public function pretty_status( $show_icons = FALSE ) { |
|
762 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
761 | + public function pretty_status($show_icons = FALSE) { |
|
762 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
763 | 763 | $icon = ''; |
764 | - switch ( $this->status_ID() ) { |
|
764 | + switch ($this->status_ID()) { |
|
765 | 765 | case EEM_Registration::status_id_approved: |
766 | 766 | $icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : ''; |
767 | 767 | break; |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | $icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : ''; |
782 | 782 | break; |
783 | 783 | } |
784 | - return $icon . $status[ $this->status_ID() ]; |
|
784 | + return $icon.$status[$this->status_ID()]; |
|
785 | 785 | } |
786 | 786 | |
787 | 787 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | * @access public |
792 | 792 | */ |
793 | 793 | public function att_is_going() { |
794 | - return $this->get( 'REG_att_is_going' ); |
|
794 | + return $this->get('REG_att_is_going'); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | |
@@ -801,8 +801,8 @@ discard block |
||
801 | 801 | * @param array $query_params like EEM_Base::get_all |
802 | 802 | * @return EE_Answer[] |
803 | 803 | */ |
804 | - public function answers( $query_params = NULL ) { |
|
805 | - return $this->get_many_related( 'Answer', $query_params ); |
|
804 | + public function answers($query_params = NULL) { |
|
805 | + return $this->get_many_related('Answer', $query_params); |
|
806 | 806 | } |
807 | 807 | |
808 | 808 | |
@@ -816,9 +816,9 @@ discard block |
||
816 | 816 | * (because the answer might be an array of answer values, so passing pretty_value=true |
817 | 817 | * will convert it into some kind of string) |
818 | 818 | */ |
819 | - public function answer_value_to_question( $question, $pretty_value=true ) { |
|
819 | + public function answer_value_to_question($question, $pretty_value = true) { |
|
820 | 820 | $question_id = EEM_Question::instance()->ensure_is_ID($question); |
821 | - return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value); |
|
821 | + return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value); |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | /** |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | * @return string |
828 | 828 | */ |
829 | 829 | public function reg_date() { |
830 | - return $this->get_datetime( 'REG_date' ); |
|
830 | + return $this->get_datetime('REG_date'); |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | * @return EE_Datetime_Ticket |
840 | 840 | */ |
841 | 841 | public function datetime_ticket() { |
842 | - return $this->get_first_related( 'Datetime_Ticket' ); |
|
842 | + return $this->get_first_related('Datetime_Ticket'); |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | |
@@ -849,15 +849,15 @@ discard block |
||
849 | 849 | * @param EE_Datetime_Ticket $datetime_ticket |
850 | 850 | * @return EE_Datetime_Ticket |
851 | 851 | */ |
852 | - public function set_datetime_ticket( $datetime_ticket ) { |
|
853 | - return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' ); |
|
852 | + public function set_datetime_ticket($datetime_ticket) { |
|
853 | + return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket'); |
|
854 | 854 | } |
855 | 855 | /** |
856 | 856 | * Gets deleted |
857 | 857 | * @return boolean |
858 | 858 | */ |
859 | 859 | public function deleted() { |
860 | - return $this->get( 'REG_deleted' ); |
|
860 | + return $this->get('REG_deleted'); |
|
861 | 861 | } |
862 | 862 | |
863 | 863 | /** |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | * @return boolean |
867 | 867 | */ |
868 | 868 | public function set_deleted($deleted) { |
869 | - $this->set( 'REG_deleted', $deleted ); |
|
869 | + $this->set('REG_deleted', $deleted); |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | * @return EE_Status |
877 | 877 | */ |
878 | 878 | public function status_obj() { |
879 | - return $this->get_first_related( 'Status' ); |
|
879 | + return $this->get_first_related('Status'); |
|
880 | 880 | } |
881 | 881 | |
882 | 882 | |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | * @return int |
888 | 888 | */ |
889 | 889 | public function count_checkins() { |
890 | - return $this->get_model()->count_related( $this, 'Checkin' ); |
|
890 | + return $this->get_model()->count_related($this, 'Checkin'); |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | * @return int |
898 | 898 | */ |
899 | 899 | public function count_checkins_not_checkedout() { |
900 | - return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) ); |
|
900 | + return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1))); |
|
901 | 901 | } |
902 | 902 | |
903 | 903 | |
@@ -910,20 +910,20 @@ discard block |
||
910 | 910 | * |
911 | 911 | * @return bool |
912 | 912 | */ |
913 | - public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) { |
|
914 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
913 | + public function can_checkin($DTT_OR_ID, $check_approved = TRUE) { |
|
914 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
915 | 915 | |
916 | 916 | //first check registration status |
917 | - if ( ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) { |
|
917 | + if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) { |
|
918 | 918 | return false; |
919 | 919 | } |
920 | 920 | //is there a datetime ticket that matches this dtt_ID? |
921 | - if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) { |
|
921 | + if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) { |
|
922 | 922 | return false; |
923 | 923 | } |
924 | 924 | |
925 | 925 | //final check is against TKT_uses |
926 | - return $this->verify_can_checkin_against_TKT_uses( $DTT_ID ); |
|
926 | + return $this->verify_can_checkin_against_TKT_uses($DTT_ID); |
|
927 | 927 | } |
928 | 928 | |
929 | 929 | |
@@ -936,10 +936,10 @@ discard block |
||
936 | 936 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
937 | 937 | * @return bool true means can checkin. false means cannot checkin. |
938 | 938 | */ |
939 | - public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) { |
|
940 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
939 | + public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) { |
|
940 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
941 | 941 | |
942 | - if ( ! $DTT_ID ) { |
|
942 | + if ( ! $DTT_ID) { |
|
943 | 943 | return false; |
944 | 944 | } |
945 | 945 | |
@@ -947,23 +947,23 @@ discard block |
||
947 | 947 | |
948 | 948 | // if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in |
949 | 949 | // or not. |
950 | - if ( ! $max_uses || $max_uses === INF ) { |
|
950 | + if ( ! $max_uses || $max_uses === INF) { |
|
951 | 951 | return true; |
952 | 952 | } |
953 | 953 | |
954 | 954 | //does this datetime have a checkin record? If so, then the dtt count has already been verified so we can just |
955 | 955 | //go ahead and toggle. |
956 | - if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) { |
|
956 | + if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) { |
|
957 | 957 | return true; |
958 | 958 | } |
959 | 959 | |
960 | 960 | //made it here so the last check is whether the number of checkins per unique datetime on this registration |
961 | 961 | //disallows further check-ins. |
962 | - $count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true ); |
|
962 | + $count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true); |
|
963 | 963 | // checkins have already reached their max number of uses |
964 | 964 | // so registrant can NOT checkin |
965 | - if ( $count_unique_dtt_checkins >= $max_uses ) { |
|
966 | - EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
965 | + if ($count_unique_dtt_checkins >= $max_uses) { |
|
966 | + EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
967 | 967 | return false; |
968 | 968 | } |
969 | 969 | return true; |
@@ -984,15 +984,15 @@ discard block |
||
984 | 984 | * @param bool $verify If true then can_checkin() is used to verify whether the person can be checked in or not. Otherwise this forces change in checkin status. |
985 | 985 | * @return int|BOOL the chk_in status toggled to OR false if nothing got changed. |
986 | 986 | */ |
987 | - public function toggle_checkin_status( $DTT_ID = null, $verify = false ) { |
|
988 | - if ( empty( $DTT_ID ) ) { |
|
987 | + public function toggle_checkin_status($DTT_ID = null, $verify = false) { |
|
988 | + if (empty($DTT_ID)) { |
|
989 | 989 | $datetime = $this->get_related_primary_datetime(); |
990 | 990 | $DTT_ID = $datetime->ID(); |
991 | 991 | // verify the registration can checkin for the given DTT_ID |
992 | - } elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) { |
|
992 | + } elseif ( ! $this->can_checkin($DTT_ID, $verify)) { |
|
993 | 993 | EE_Error::add_error( |
994 | 994 | sprintf( |
995 | - __( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), |
|
995 | + __('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), |
|
996 | 996 | because the registration does not have access', 'event_espresso'), |
997 | 997 | $this->ID(), |
998 | 998 | $DTT_ID |
@@ -1007,8 +1007,8 @@ discard block |
||
1007 | 1007 | EE_Registration::checkin_status_out => EE_Registration::checkin_status_in |
1008 | 1008 | ); |
1009 | 1009 | //start by getting the current status so we know what status we'll be changing to. |
1010 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL ); |
|
1011 | - $status_to = $status_paths[ $cur_status ]; |
|
1010 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL); |
|
1011 | + $status_to = $status_paths[$cur_status]; |
|
1012 | 1012 | // database only records true for checked IN or false for checked OUT |
1013 | 1013 | // no record ( null ) means checked in NEVER, but we obviously don't save that |
1014 | 1014 | $new_status = $status_to == EE_Registration::checkin_status_in ? true : false; |
@@ -1016,24 +1016,24 @@ discard block |
||
1016 | 1016 | // because we are keeping track of Check-ins over time. |
1017 | 1017 | // Eventually we'll probably want to show a list table |
1018 | 1018 | // for the individual Check-ins so that they can be managed. |
1019 | - $checkin = EE_Checkin::new_instance( array( |
|
1019 | + $checkin = EE_Checkin::new_instance(array( |
|
1020 | 1020 | 'REG_ID' => $this->ID(), |
1021 | 1021 | 'DTT_ID' => $DTT_ID, |
1022 | 1022 | 'CHK_in' => $new_status |
1023 | - ) ); |
|
1023 | + )); |
|
1024 | 1024 | // if the record could not be saved then return false |
1025 | - if ( $checkin->save() === 0 ) { |
|
1026 | - if ( WP_DEBUG ) { |
|
1025 | + if ($checkin->save() === 0) { |
|
1026 | + if (WP_DEBUG) { |
|
1027 | 1027 | global $wpdb; |
1028 | 1028 | $error = sprintf( |
1029 | - __( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ), |
|
1029 | + __('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'), |
|
1030 | 1030 | '<br />', |
1031 | 1031 | $wpdb->last_error |
1032 | 1032 | ); |
1033 | 1033 | } else { |
1034 | - $error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' ); |
|
1034 | + $error = __('Registration check in update failed because of an unknown database error', 'event_espresso'); |
|
1035 | 1035 | } |
1036 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
1036 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
1037 | 1037 | return false; |
1038 | 1038 | } |
1039 | 1039 | return $status_to; |
@@ -1057,19 +1057,19 @@ discard block |
||
1057 | 1057 | * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id. |
1058 | 1058 | * @return int Integer representing Check-in status. |
1059 | 1059 | */ |
1060 | - public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) { |
|
1061 | - if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) { |
|
1060 | + public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) { |
|
1061 | + if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) { |
|
1062 | 1062 | $datetime = $this->get_related_primary_datetime(); |
1063 | - if ( ! $datetime instanceof EE_Datetime ) { |
|
1063 | + if ( ! $datetime instanceof EE_Datetime) { |
|
1064 | 1064 | return 0; |
1065 | 1065 | } |
1066 | 1066 | $DTT_ID = $datetime->ID(); |
1067 | 1067 | //verify the registration can checkin for the given DTT_ID |
1068 | 1068 | } |
1069 | 1069 | //get checkin object (if exists) |
1070 | - $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) ); |
|
1071 | - if ( $checkin instanceof EE_Checkin ) { |
|
1072 | - if ( $checkin->get( 'CHK_in' ) ) { |
|
1070 | + $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC'))); |
|
1071 | + if ($checkin instanceof EE_Checkin) { |
|
1072 | + if ($checkin->get('CHK_in')) { |
|
1073 | 1073 | return EE_Registration::checkin_status_in; //checked in |
1074 | 1074 | } else { |
1075 | 1075 | return EE_Registration::checkin_status_out; //had checked in but is now checked out. |
@@ -1087,28 +1087,28 @@ discard block |
||
1087 | 1087 | * @param bool $error This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name. |
1088 | 1088 | * @return string internationalized message |
1089 | 1089 | */ |
1090 | - public function get_checkin_msg( $DTT_ID, $error = FALSE ) { |
|
1090 | + public function get_checkin_msg($DTT_ID, $error = FALSE) { |
|
1091 | 1091 | //let's get the attendee first so we can include the name of the attendee |
1092 | - $attendee = $this->get_first_related( 'Attendee' ); |
|
1093 | - if ( $attendee instanceof EE_Attendee ) { |
|
1094 | - if ( $error ) { |
|
1095 | - return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() ); |
|
1092 | + $attendee = $this->get_first_related('Attendee'); |
|
1093 | + if ($attendee instanceof EE_Attendee) { |
|
1094 | + if ($error) { |
|
1095 | + return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name()); |
|
1096 | 1096 | } |
1097 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID ); |
|
1097 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID); |
|
1098 | 1098 | //what is the status message going to be? |
1099 | - switch ( $cur_status ) { |
|
1099 | + switch ($cur_status) { |
|
1100 | 1100 | case EE_Registration::checkin_status_never : |
1101 | - return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() ); |
|
1101 | + return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name()); |
|
1102 | 1102 | break; |
1103 | 1103 | case EE_Registration::checkin_status_in : |
1104 | - return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() ); |
|
1104 | + return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name()); |
|
1105 | 1105 | break; |
1106 | 1106 | case EE_Registration::checkin_status_out : |
1107 | - return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() ); |
|
1107 | + return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name()); |
|
1108 | 1108 | break; |
1109 | 1109 | } |
1110 | 1110 | } |
1111 | - return __( "The check-in status could not be determined.", "event_espresso" ); |
|
1111 | + return __("The check-in status could not be determined.", "event_espresso"); |
|
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | * @return EE_Transaction |
1119 | 1119 | */ |
1120 | 1120 | public function transaction() { |
1121 | - return $this->get_first_related( 'Transaction' ); |
|
1121 | + return $this->get_first_related('Transaction'); |
|
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 | |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | * @access public |
1130 | 1130 | */ |
1131 | 1131 | public function reg_code() { |
1132 | - return $this->get( 'REG_code' ); |
|
1132 | + return $this->get('REG_code'); |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | * @access public |
1140 | 1140 | */ |
1141 | 1141 | public function transaction_ID() { |
1142 | - return $this->get( 'TXN_ID' ); |
|
1142 | + return $this->get('TXN_ID'); |
|
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | * @return int |
1149 | 1149 | */ |
1150 | 1150 | public function ticket_ID() { |
1151 | - return $this->get( 'TKT_ID' ); |
|
1151 | + return $this->get('TKT_ID'); |
|
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | |
@@ -1160,17 +1160,17 @@ discard block |
||
1160 | 1160 | * @param string $REG_code Registration Code |
1161 | 1161 | * @param boolean $use_default |
1162 | 1162 | */ |
1163 | - public function set_reg_code( $REG_code, $use_default = FALSE ) { |
|
1164 | - if ( empty( $REG_code )) { |
|
1165 | - EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1163 | + public function set_reg_code($REG_code, $use_default = FALSE) { |
|
1164 | + if (empty($REG_code)) { |
|
1165 | + EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1166 | 1166 | return; |
1167 | 1167 | } |
1168 | - if ( ! $this->reg_code() ) { |
|
1169 | - parent::set( 'REG_code', $REG_code, $use_default ); |
|
1168 | + if ( ! $this->reg_code()) { |
|
1169 | + parent::set('REG_code', $REG_code, $use_default); |
|
1170 | 1170 | } else { |
1171 | 1171 | EE_Error::doing_it_wrong( |
1172 | - __CLASS__ . '::' . __FUNCTION__, |
|
1173 | - __( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ), |
|
1172 | + __CLASS__.'::'.__FUNCTION__, |
|
1173 | + __('Can not change a registration REG_code once it has been set.', 'event_espresso'), |
|
1174 | 1174 | '4.6.0' |
1175 | 1175 | ); |
1176 | 1176 | } |
@@ -1190,17 +1190,17 @@ discard block |
||
1190 | 1190 | * @return EE_Registration[] or empty array if this isn't a group registration. |
1191 | 1191 | */ |
1192 | 1192 | public function get_all_other_registrations_in_group() { |
1193 | - if ( $this->group_size() < 2 ) { |
|
1193 | + if ($this->group_size() < 2) { |
|
1194 | 1194 | return array(); |
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | $query[0] = array( |
1198 | 1198 | 'TXN_ID' => $this->transaction_ID(), |
1199 | - 'REG_ID' => array( '!=', $this->ID() ), |
|
1199 | + 'REG_ID' => array('!=', $this->ID()), |
|
1200 | 1200 | 'TKT_ID' => $this->ticket_ID() |
1201 | 1201 | ); |
1202 | 1202 | |
1203 | - $registrations = $this->get_model()->get_all( $query ); |
|
1203 | + $registrations = $this->get_model()->get_all($query); |
|
1204 | 1204 | return $registrations; |
1205 | 1205 | } |
1206 | 1206 | |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | * @access public |
1213 | 1213 | */ |
1214 | 1214 | public function price_paid() { |
1215 | - EE_Error::doing_it_wrong( 'EE_Registration::price_paid()', __( 'This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1215 | + EE_Error::doing_it_wrong('EE_Registration::price_paid()', __('This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1216 | 1216 | return $this->final_price(); |
1217 | 1217 | } |
1218 | 1218 | |
@@ -1224,9 +1224,9 @@ discard block |
||
1224 | 1224 | * @access public |
1225 | 1225 | * @param float $REG_final_price |
1226 | 1226 | */ |
1227 | - public function set_price_paid( $REG_final_price = 0.00 ) { |
|
1228 | - EE_Error::doing_it_wrong( 'EE_Registration::set_price_paid()', __( 'This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1229 | - $this->set_final_price( $REG_final_price ); |
|
1227 | + public function set_price_paid($REG_final_price = 0.00) { |
|
1228 | + EE_Error::doing_it_wrong('EE_Registration::set_price_paid()', __('This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1229 | + $this->set_final_price($REG_final_price); |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | |
@@ -1237,7 +1237,7 @@ discard block |
||
1237 | 1237 | * @return string |
1238 | 1238 | */ |
1239 | 1239 | public function pretty_price_paid() { |
1240 | - EE_Error::doing_it_wrong( 'EE_Registration::pretty_price_paid()', __( 'This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1240 | + EE_Error::doing_it_wrong('EE_Registration::pretty_price_paid()', __('This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1241 | 1241 | return $this->pretty_final_price(); |
1242 | 1242 | } |
1243 | 1243 |
@@ -618,9 +618,9 @@ |
||
618 | 618 | |
619 | 619 | |
620 | 620 | /** |
621 | - * get Attendee Number |
|
622 | - * @access public |
|
623 | - */ |
|
621 | + * get Attendee Number |
|
622 | + * @access public |
|
623 | + */ |
|
624 | 624 | public function count() { |
625 | 625 | return $this->get( 'REG_count' ); |
626 | 626 | } |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | * final_price |
678 | 678 | * total owing for this registration after all ticket/price modifications |
679 | 679 | * @access public |
680 | - * @return float |
|
680 | + * @return boolean |
|
681 | 681 | */ |
682 | 682 | public function final_price() { |
683 | 683 | return $this->get( 'REG_final_price' ); |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | /** |
700 | 700 | * get paid (yeah) |
701 | 701 | * @access public |
702 | - * @return float |
|
702 | + * @return boolean |
|
703 | 703 | */ |
704 | 704 | public function paid() { |
705 | 705 | return $this->get( 'REG_paid' ); |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | /** |
864 | 864 | * Sets deleted |
865 | 865 | * @param boolean $deleted |
866 | - * @return boolean |
|
866 | + * @return boolean|null |
|
867 | 867 | */ |
868 | 868 | public function set_deleted($deleted) { |
869 | 869 | $this->set( 'REG_deleted', $deleted ); |
@@ -907,6 +907,7 @@ discard block |
||
907 | 907 | * |
908 | 908 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
909 | 909 | * @param bool $check_approved This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access. |
910 | + * @param integer $DTT_OR_ID |
|
910 | 911 | * |
911 | 912 | * @return bool |
912 | 913 | */ |
@@ -1145,7 +1146,7 @@ discard block |
||
1145 | 1146 | |
1146 | 1147 | |
1147 | 1148 | /** |
1148 | - * @return int |
|
1149 | + * @return boolean |
|
1149 | 1150 | */ |
1150 | 1151 | public function ticket_ID() { |
1151 | 1152 | return $this->get( 'TKT_ID' ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @return boolean success |
34 | 34 | */ |
35 | 35 | public function delete() { |
36 | - return $this->delete_or_restore( TRUE ); |
|
36 | + return $this->delete_or_restore(TRUE); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return boolean success |
44 | 44 | */ |
45 | 45 | public function delete_permanently() { |
46 | - return $this->get_model()->delete_permanently_by_ID( $this->ID() ); |
|
46 | + return $this->get_model()->delete_permanently_by_ID($this->ID()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @param bool $delete true=>delete, false=>restore |
54 | 54 | * @return bool |
55 | 55 | */ |
56 | - public function delete_or_restore( $delete = TRUE ) { |
|
56 | + public function delete_or_restore($delete = TRUE) { |
|
57 | 57 | $model = $this->get_model(); |
58 | - return $model->delete_or_restore_by_ID( $delete, $this->ID() ); |
|
58 | + return $model->delete_or_restore_by_ID($delete, $this->ID()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -65,6 +65,6 @@ discard block |
||
65 | 65 | * @return boolean |
66 | 66 | */ |
67 | 67 | public function restore() { |
68 | - return $this->delete_or_restore( FALSE ); |
|
68 | + return $this->delete_or_restore(FALSE); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | \ No newline at end of file |
@@ -36,8 +36,9 @@ |
||
36 | 36 | $tax = 0; |
37 | 37 | $total_tax = 0; |
38 | 38 | //This first checks to see if the given ticket is taxable. |
39 | - if ( ! $ticket->get( 'TKT_taxable' ) ) |
|
40 | - return $tax; |
|
39 | + if ( ! $ticket->get( 'TKT_taxable' ) ) { |
|
40 | + return $tax; |
|
41 | + } |
|
41 | 42 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
42 | 43 | $subtotal = self::get_subtotal_for_admin( $ticket ); |
43 | 44 | //get taxes |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Taxes class |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | * @param EE_Ticket $ticket incoming EE_Ticket |
33 | 33 | * @return float total taxes to apply to ticket. |
34 | 34 | */ |
35 | - public static function get_total_taxes_for_admin( EE_Ticket $ticket ) { |
|
35 | + public static function get_total_taxes_for_admin(EE_Ticket $ticket) { |
|
36 | 36 | $tax = 0; |
37 | 37 | $total_tax = 0; |
38 | 38 | //This first checks to see if the given ticket is taxable. |
39 | - if ( ! $ticket->get( 'TKT_taxable' ) ) |
|
39 | + if ( ! $ticket->get('TKT_taxable')) |
|
40 | 40 | return $tax; |
41 | 41 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
42 | - $subtotal = self::get_subtotal_for_admin( $ticket ); |
|
42 | + $subtotal = self::get_subtotal_for_admin($ticket); |
|
43 | 43 | //get taxes |
44 | 44 | $taxes = self::get_taxes_for_admin(); |
45 | 45 | //apply taxes to subtotal |
46 | - foreach ( $taxes as $tax ) { |
|
46 | + foreach ($taxes as $tax) { |
|
47 | 47 | //assuming taxes are not cumulative |
48 | - $total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100; |
|
48 | + $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
49 | 49 | } |
50 | 50 | return $total_tax; |
51 | 51 | } |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * @param EE_Ticket $ticket |
57 | 57 | * @return float |
58 | 58 | */ |
59 | - public static function get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
59 | + public static function get_subtotal_for_admin(EE_Ticket $ticket) { |
|
60 | 60 | $TKT_ID = $ticket->ID(); |
61 | - return isset( self::$_subtotal[ $TKT_ID ] ) ? self::$_subtotal[ $TKT_ID ] : self::_get_subtotal_for_admin( $ticket ); |
|
61 | + return isset(self::$_subtotal[$TKT_ID]) ? self::$_subtotal[$TKT_ID] : self::_get_subtotal_for_admin($ticket); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -68,26 +68,26 @@ discard block |
||
68 | 68 | * @param EE_Ticket $ticket |
69 | 69 | * @return float subtotal calculated from all EE_Price[] on Ticket. |
70 | 70 | */ |
71 | - private static function _get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
71 | + private static function _get_subtotal_for_admin(EE_Ticket $ticket) { |
|
72 | 72 | $subtotal = 0; |
73 | 73 | //get all prices |
74 | - $prices = $ticket->get_many_related( 'Price', array( 'default_where_conditions' => 'none', 'order_by' => array( 'PRC_order' => 'ASC' ) ) ); |
|
74 | + $prices = $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))); |
|
75 | 75 | //let's loop through them (base price is always the first item) |
76 | - foreach ( $prices as $price ) { |
|
77 | - if ( $price instanceof EE_Price ) { |
|
78 | - switch ( $price->type_obj()->base_type() ) { |
|
76 | + foreach ($prices as $price) { |
|
77 | + if ($price instanceof EE_Price) { |
|
78 | + switch ($price->type_obj()->base_type()) { |
|
79 | 79 | case 1: // base price |
80 | 80 | case 3: // surcharges |
81 | - $subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' ); |
|
81 | + $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount'); |
|
82 | 82 | break; |
83 | 83 | case 2: // discounts |
84 | - $subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' ); |
|
84 | + $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount'); |
|
85 | 85 | break; |
86 | 86 | } |
87 | 87 | } |
88 | 88 | } |
89 | 89 | $TKT_ID = $ticket->ID(); |
90 | - self::$_subtotal = array( $TKT_ID => $subtotal ); |
|
90 | + self::$_subtotal = array($TKT_ID => $subtotal); |
|
91 | 91 | return $subtotal; |
92 | 92 | } |
93 | 93 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @return EE_Price[] EE_Price objects that have PRT_ID == 4 |
99 | 99 | */ |
100 | 100 | public static function get_taxes_for_admin() { |
101 | - self::$_default_taxes = ! empty( self::$_default_taxes ) ? self::$_default_taxes : EE_Registry::instance()->load_model( 'Price' )->get_all( array( array( 'Price_Type.PBT_ID' => 4 ) ) ); |
|
101 | + self::$_default_taxes = ! empty(self::$_default_taxes) ? self::$_default_taxes : EE_Registry::instance()->load_model('Price')->get_all(array(array('Price_Type.PBT_ID' => 4))); |
|
102 | 102 | return self::$_default_taxes; |
103 | 103 | } |
104 | 104 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @param array $props_n_values |
31 | 31 | * @return EE_Term_Relationship |
32 | 32 | */ |
33 | - public static function new_instance( $props_n_values = array() ) { |
|
34 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
35 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
33 | + public static function new_instance($props_n_values = array()) { |
|
34 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
35 | + return $has_object ? $has_object : new self($props_n_values); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * @param array $props_n_values |
42 | 42 | * @return EE_Term_Relationship |
43 | 43 | */ |
44 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
45 | - return new self( $props_n_values, TRUE ); |
|
44 | + public static function new_instance_from_db($props_n_values = array()) { |
|
45 | + return new self($props_n_values, TRUE); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param string $timezone |
36 | 36 | * @return EE_Ticket_Price|mixed |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param string $timezone |
48 | 48 | * @return EE_Ticket_Price |
49 | 49 | */ |
50 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
51 | - return new self( $props_n_values, TRUE, $timezone ); |
|
50 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
51 | + return new self($props_n_values, TRUE, $timezone); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param string $timezone |
36 | 36 | * @return EE_Ticket_Template|mixed |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param string $timezone |
48 | 48 | * @return EE_Ticket_Template |
49 | 49 | */ |
50 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
51 | - return new self( $props_n_values, TRUE, $timezone ); |
|
50 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
51 | + return new self($props_n_values, TRUE, $timezone); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 |
@@ -742,11 +742,11 @@ |
||
742 | 742 | $pm = $this->get_first_related('Payment_Method'); |
743 | 743 | if( $pm instanceof EE_Payment_Method ){ |
744 | 744 | return $pm; |
745 | - }else{ |
|
745 | + } else{ |
|
746 | 746 | $last_payment = $this->last_payment(); |
747 | 747 | if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
748 | 748 | return $last_payment->payment_method(); |
749 | - }else{ |
|
749 | + } else{ |
|
750 | 750 | return NULL; |
751 | 751 | } |
752 | 752 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | /** |
210 | 210 | * get Transaction Total |
211 | 211 | * @access public |
212 | - * @return float |
|
212 | + * @return boolean |
|
213 | 213 | */ |
214 | 214 | public function total() { |
215 | 215 | return $this->get( 'TXN_total' ); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * get Total Amount Paid to Date |
222 | 222 | * @access public |
223 | - * @return float |
|
223 | + * @return boolean |
|
224 | 224 | */ |
225 | 225 | public function paid() { |
226 | 226 | return $this->get( 'TXN_paid' ); |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * Gets all the attendees for this transaction (handy for use with EE_Attendee's get_registrations_for_event function |
324 | 324 | * for getting attendees and how many registrations they each have for an event) |
325 | - * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT' |
|
325 | + * @return EE_Base_Class[] EE_Attendee[] by default, int if $output is set to 'COUNT' |
|
326 | 326 | */ |
327 | 327 | public function attendees() { |
328 | 328 | return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) ); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | /** |
568 | 568 | * Gets all the extra meta info on this payment |
569 | 569 | * @param array $query_params like EEM_Base::get_all |
570 | - * @return EE_Extra_Meta |
|
570 | + * @return EE_Base_Class[] |
|
571 | 571 | */ |
572 | 572 | public function extra_meta( $query_params = array() ) { |
573 | 573 | return $this->get_many_related( 'Extra_Meta', $query_params ); |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | |
715 | 715 | /** |
716 | 716 | * Gets PMD_ID |
717 | - * @return int |
|
717 | + * @return boolean |
|
718 | 718 | */ |
719 | 719 | function payment_method_ID() { |
720 | 720 | return $this->get('PMD_ID'); |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | /** |
726 | 726 | * Sets PMD_ID |
727 | 727 | * @param int $PMD_ID |
728 | - * @return boolean |
|
728 | + * @return boolean|null |
|
729 | 729 | */ |
730 | 730 | function set_payment_method_ID($PMD_ID) { |
731 | 731 | $this->set('PMD_ID', $PMD_ID); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @subpackage includes/classes/EE_Transaction.class.php |
27 | 27 | * @author Brent Christensen |
28 | 28 | */ |
29 | -class EE_Transaction extends EE_Base_Class implements EEI_Transaction{ |
|
29 | +class EE_Transaction extends EE_Base_Class implements EEI_Transaction { |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param string $timezone |
36 | 36 | * @return EE_Transaction |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | * @param string $timezone |
49 | 49 | * @return EE_Transaction |
50 | 50 | */ |
51 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
52 | - return new self( $props_n_values, TRUE, $timezone ); |
|
51 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
52 | + return new self($props_n_values, TRUE, $timezone); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * @return void |
65 | 65 | */ |
66 | 66 | public function lock() { |
67 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
68 | - $locked_transactions[ $this->ID() ] = true; |
|
69 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
67 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
68 | + $locked_transactions[$this->ID()] = true; |
|
69 | + update_option('ee_locked_transactions', $locked_transactions); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | public function unlock() { |
83 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
84 | - unset( $locked_transactions[ $this->ID() ] ); |
|
85 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
83 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
84 | + unset($locked_transactions[$this->ID()]); |
|
85 | + update_option('ee_locked_transactions', $locked_transactions); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @return boolean |
100 | 100 | */ |
101 | 101 | public function is_locked() { |
102 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
103 | - return isset( $locked_transactions[ $this->ID() ] ) ? true : false; |
|
102 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
103 | + return isset($locked_transactions[$this->ID()]) ? true : false; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * @access public |
112 | 112 | * @param float $total total value of transaction |
113 | 113 | */ |
114 | - public function set_total( $total = 0.00 ) { |
|
115 | - $this->set( 'TXN_total', $total ); |
|
114 | + public function set_total($total = 0.00) { |
|
115 | + $this->set('TXN_total', $total); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @access public |
124 | 124 | * @param float $total_paid total amount paid to date (sum of all payments) |
125 | 125 | */ |
126 | - public function set_paid( $total_paid = 0.00 ) { |
|
127 | - $this->set( 'TXN_paid', $total_paid ); |
|
126 | + public function set_paid($total_paid = 0.00) { |
|
127 | + $this->set('TXN_paid', $total_paid); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -135,8 +135,8 @@ discard block |
||
135 | 135 | * @access public |
136 | 136 | * @param string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set |
137 | 137 | */ |
138 | - public function set_status( $status = '' ) { |
|
139 | - $this->set( 'STS_ID', $status ); |
|
138 | + public function set_status($status = '') { |
|
139 | + $this->set('STS_ID', $status); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @access public |
148 | 148 | * @param string $hash_salt required for some payment gateways |
149 | 149 | */ |
150 | - public function set_hash_salt( $hash_salt = '' ) { |
|
151 | - $this->set( 'TXN_hash_salt', $hash_salt ); |
|
150 | + public function set_hash_salt($hash_salt = '') { |
|
151 | + $this->set('TXN_hash_salt', $hash_salt); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | * Sets TXN_reg_steps array |
158 | 158 | * @param array $txn_reg_steps |
159 | 159 | */ |
160 | - function set_reg_steps( $txn_reg_steps ) { |
|
161 | - $this->set( 'TXN_reg_steps', $txn_reg_steps ); |
|
160 | + function set_reg_steps($txn_reg_steps) { |
|
161 | + $this->set('TXN_reg_steps', $txn_reg_steps); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * @return array |
169 | 169 | */ |
170 | 170 | function reg_steps() { |
171 | - $TXN_reg_steps = $this->get( 'TXN_reg_steps' ); |
|
172 | - return is_array( $TXN_reg_steps ) ? $TXN_reg_steps : array(); |
|
171 | + $TXN_reg_steps = $this->get('TXN_reg_steps'); |
|
172 | + return is_array($TXN_reg_steps) ? $TXN_reg_steps : array(); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @return string of transaction's total cost, with currency symbol and decimal |
180 | 180 | */ |
181 | 181 | public function pretty_total() { |
182 | - return $this->get_pretty( 'TXN_total' ); |
|
182 | + return $this->get_pretty('TXN_total'); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @return string |
190 | 190 | */ |
191 | 191 | public function pretty_paid() { |
192 | - return $this->get_pretty( 'TXN_paid' ); |
|
192 | + return $this->get_pretty('TXN_paid'); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @return float amount remaining |
202 | 202 | */ |
203 | 203 | public function remaining() { |
204 | - return (float)( $this->total() - $this->paid() ); |
|
204 | + return (float) ($this->total() - $this->paid()); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @return float |
213 | 213 | */ |
214 | 214 | public function total() { |
215 | - return $this->get( 'TXN_total' ); |
|
215 | + return $this->get('TXN_total'); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @return float |
224 | 224 | */ |
225 | 225 | public function paid() { |
226 | - return $this->get( 'TXN_paid' ); |
|
226 | + return $this->get('TXN_paid'); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * @access public |
234 | 234 | */ |
235 | 235 | public function get_cart_session() { |
236 | - $session_data = $this->get( 'TXN_session_data' ); |
|
237 | - return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart ? $session_data[ 'cart' ] : NULL; |
|
236 | + $session_data = $this->get('TXN_session_data'); |
|
237 | + return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart ? $session_data['cart'] : NULL; |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -244,9 +244,9 @@ discard block |
||
244 | 244 | * @access public |
245 | 245 | */ |
246 | 246 | public function session_data() { |
247 | - $session_data = $this->get( 'TXN_session_data' ); |
|
248 | - if ( empty( $session_data ) ) { |
|
249 | - $session_data = array( 'id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array() ); |
|
247 | + $session_data = $this->get('TXN_session_data'); |
|
248 | + if (empty($session_data)) { |
|
249 | + $session_data = array('id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array()); |
|
250 | 250 | } |
251 | 251 | return $session_data; |
252 | 252 | } |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | * @access public |
260 | 260 | * @param EE_Session|array $session_data |
261 | 261 | */ |
262 | - public function set_txn_session_data( $session_data ) { |
|
263 | - if ( $session_data instanceof EE_Session ) { |
|
264 | - $this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE )); |
|
262 | + public function set_txn_session_data($session_data) { |
|
263 | + if ($session_data instanceof EE_Session) { |
|
264 | + $this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE)); |
|
265 | 265 | } else { |
266 | - $this->set( 'TXN_session_data', $session_data ); |
|
266 | + $this->set('TXN_session_data', $session_data); |
|
267 | 267 | } |
268 | 268 | } |
269 | 269 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * @access public |
275 | 275 | */ |
276 | 276 | public function hash_salt_() { |
277 | - return $this->get( 'TXN_hash_salt' ); |
|
277 | + return $this->get('TXN_hash_salt'); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | |
@@ -293,13 +293,13 @@ discard block |
||
293 | 293 | * @param boolean $gmt - whether to return a unix timestamp with UTC offset applied (default) or no UTC offset applied |
294 | 294 | * @return string | int |
295 | 295 | */ |
296 | - public function datetime( $format = FALSE, $gmt = FALSE ) { |
|
297 | - if ( $format ) { |
|
298 | - return $this->get_pretty( 'TXN_timestamp' ); |
|
299 | - } else if ( $gmt ) { |
|
300 | - return $this->get_raw( 'TXN_timestamp' ); |
|
296 | + public function datetime($format = FALSE, $gmt = FALSE) { |
|
297 | + if ($format) { |
|
298 | + return $this->get_pretty('TXN_timestamp'); |
|
299 | + } else if ($gmt) { |
|
300 | + return $this->get_raw('TXN_timestamp'); |
|
301 | 301 | } else { |
302 | - return $this->get( 'TXN_timestamp' ); |
|
302 | + return $this->get('TXN_timestamp'); |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
@@ -311,10 +311,10 @@ discard block |
||
311 | 311 | * @param boolean $get_cached TRUE to retrieve cached registrations or FALSE to pull from the db |
312 | 312 | * @return EE_Registration[] |
313 | 313 | */ |
314 | - public function registrations( $query_params = array(), $get_cached = FALSE ) { |
|
315 | - $query_params = ( empty( $query_params ) || ! is_array( $query_params ) ) ? array( 'order_by' => array( 'Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC' ) ) : $query_params; |
|
314 | + public function registrations($query_params = array(), $get_cached = FALSE) { |
|
315 | + $query_params = (empty($query_params) || ! is_array($query_params)) ? array('order_by' => array('Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC')) : $query_params; |
|
316 | 316 | $query_params = $get_cached ? array() : $query_params; |
317 | - return $this->get_many_related( 'Registration', $query_params ); |
|
317 | + return $this->get_many_related('Registration', $query_params); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT' |
326 | 326 | */ |
327 | 327 | public function attendees() { |
328 | - return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) ); |
|
328 | + return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID()))); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -335,8 +335,8 @@ discard block |
||
335 | 335 | * @param array $query_params like EEM_Base::get_all |
336 | 336 | * @return EE_Payment[] |
337 | 337 | */ |
338 | - public function payments( $query_params = array() ) { |
|
339 | - return $this->get_many_related( 'Payment', $query_params ); |
|
338 | + public function payments($query_params = array()) { |
|
339 | + return $this->get_many_related('Payment', $query_params); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | * @return EE_Payment[] |
347 | 347 | */ |
348 | 348 | public function approved_payments() { |
349 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
350 | - return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) ); |
|
349 | + EE_Registry::instance()->load_model('Payment'); |
|
350 | + return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC'))); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -357,8 +357,8 @@ discard block |
||
357 | 357 | * @param bool $show_icons |
358 | 358 | * @return string |
359 | 359 | */ |
360 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
361 | - echo $this->pretty_status( $show_icons ); |
|
360 | + public function e_pretty_status($show_icons = FALSE) { |
|
361 | + echo $this->pretty_status($show_icons); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | * @param bool $show_icons |
369 | 369 | * @return string |
370 | 370 | */ |
371 | - public function pretty_status( $show_icons = FALSE ) { |
|
372 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
371 | + public function pretty_status($show_icons = FALSE) { |
|
372 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
373 | 373 | $icon = ''; |
374 | - switch ( $this->status_ID() ) { |
|
374 | + switch ($this->status_ID()) { |
|
375 | 375 | case EEM_Transaction::complete_status_code: |
376 | 376 | $icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : ''; |
377 | 377 | break; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | $icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : ''; |
389 | 389 | break; |
390 | 390 | } |
391 | - return $icon . $status[ $this->status_ID() ]; |
|
391 | + return $icon.$status[$this->status_ID()]; |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * @access public |
399 | 399 | */ |
400 | 400 | public function status_ID() { |
401 | - return $this->get( 'STS_ID' ); |
|
401 | + return $this->get('STS_ID'); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @return boolean |
409 | 409 | */ |
410 | 410 | public function is_free() { |
411 | - return (float)$this->get( 'TXN_total' ) == 0 ? TRUE : FALSE; |
|
411 | + return (float) $this->get('TXN_total') == 0 ? TRUE : FALSE; |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | |
@@ -476,12 +476,12 @@ discard block |
||
476 | 476 | * @access public |
477 | 477 | * @return string |
478 | 478 | */ |
479 | - public function invoice_url( $type = 'html' ) { |
|
479 | + public function invoice_url($type = 'html') { |
|
480 | 480 | $REG = $this->primary_registration(); |
481 | - if ( ! $REG instanceof EE_Registration ) { |
|
481 | + if ( ! $REG instanceof EE_Registration) { |
|
482 | 482 | return ''; |
483 | 483 | } |
484 | - return $REG->invoice_url( $type ); |
|
484 | + return $REG->invoice_url($type); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | * @return EE_Registration |
492 | 492 | */ |
493 | 493 | public function primary_registration() { |
494 | - return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) ); |
|
494 | + return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | |
@@ -501,12 +501,12 @@ discard block |
||
501 | 501 | * @param string $type 'pdf' or 'html' (default is 'html') |
502 | 502 | * @return string |
503 | 503 | */ |
504 | - public function receipt_url( $type = 'html' ) { |
|
504 | + public function receipt_url($type = 'html') { |
|
505 | 505 | $REG = $this->primary_registration(); |
506 | - if ( ! $REG instanceof EE_Registration ) { |
|
506 | + if ( ! $REG instanceof EE_Registration) { |
|
507 | 507 | return ''; |
508 | 508 | } |
509 | - return $REG->receipt_url( $type ); |
|
509 | + return $REG->receipt_url($type); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -531,15 +531,15 @@ discard block |
||
531 | 531 | * @deprecated |
532 | 532 | * @return boolean |
533 | 533 | */ |
534 | - public function update_based_on_payments(){ |
|
534 | + public function update_based_on_payments() { |
|
535 | 535 | EE_Error::doing_it_wrong( |
536 | - __CLASS__ . '::' . __FUNCTION__, |
|
537 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
536 | + __CLASS__.'::'.__FUNCTION__, |
|
537 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
538 | 538 | '4.6.0' |
539 | 539 | ); |
540 | 540 | /** @type EE_Transaction_Processor $transaction_processor */ |
541 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
542 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this ); |
|
541 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
542 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @return string |
549 | 549 | */ |
550 | 550 | public function gateway_response_on_transaction() { |
551 | - $payment = $this->get_first_related( 'Payment' ); |
|
551 | + $payment = $this->get_first_related('Payment'); |
|
552 | 552 | return $payment instanceof EE_Payment ? $payment->gateway_response() : ''; |
553 | 553 | } |
554 | 554 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | * @return EE_Status |
560 | 560 | */ |
561 | 561 | public function status_obj() { |
562 | - return $this->get_first_related( 'Status' ); |
|
562 | + return $this->get_first_related('Status'); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | |
@@ -569,8 +569,8 @@ discard block |
||
569 | 569 | * @param array $query_params like EEM_Base::get_all |
570 | 570 | * @return EE_Extra_Meta |
571 | 571 | */ |
572 | - public function extra_meta( $query_params = array() ) { |
|
573 | - return $this->get_many_related( 'Extra_Meta', $query_params ); |
|
572 | + public function extra_meta($query_params = array()) { |
|
573 | + return $this->get_many_related('Extra_Meta', $query_params); |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | |
@@ -580,8 +580,8 @@ discard block |
||
580 | 580 | * @param EE_Registration $registration |
581 | 581 | * @return EE_Base_Class the relation was added to |
582 | 582 | */ |
583 | - public function add_registration( EE_Registration $registration ) { |
|
584 | - return $this->_add_relation_to( $registration, 'Registration' ); |
|
583 | + public function add_registration(EE_Registration $registration) { |
|
584 | + return $this->_add_relation_to($registration, 'Registration'); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | |
@@ -592,8 +592,8 @@ discard block |
||
592 | 592 | * @param int $registration_or_id |
593 | 593 | * @return EE_Base_Class that was removed from being related |
594 | 594 | */ |
595 | - public function remove_registration_with_id( $registration_or_id ) { |
|
596 | - return $this->_remove_relation_to( $registration_or_id, 'Registration' ); |
|
595 | + public function remove_registration_with_id($registration_or_id) { |
|
596 | + return $this->_remove_relation_to($registration_or_id, 'Registration'); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | * @return EE_Line_Item[] |
604 | 604 | */ |
605 | 605 | public function items_purchased() { |
606 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) ); |
|
606 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item))); |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | |
@@ -613,8 +613,8 @@ discard block |
||
613 | 613 | * @param EE_Line_Item $line_item |
614 | 614 | * @return EE_Base_Class the relation was added to |
615 | 615 | */ |
616 | - public function add_line_item( EE_Line_Item $line_item ) { |
|
617 | - return $this->_add_relation_to( $line_item, 'Line_Item' ); |
|
616 | + public function add_line_item(EE_Line_Item $line_item) { |
|
617 | + return $this->_add_relation_to($line_item, 'Line_Item'); |
|
618 | 618 | } |
619 | 619 | |
620 | 620 | |
@@ -624,8 +624,8 @@ discard block |
||
624 | 624 | * @param array $query_params |
625 | 625 | * @return EE_Line_Item[] |
626 | 626 | */ |
627 | - public function line_items( $query_params = array() ) { |
|
628 | - return $this->get_many_related( 'Line_Item', $query_params ); |
|
627 | + public function line_items($query_params = array()) { |
|
628 | + return $this->get_many_related('Line_Item', $query_params); |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | * @return EE_Line_Item[] |
636 | 636 | */ |
637 | 637 | public function tax_items() { |
638 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) ); |
|
638 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | |
@@ -646,9 +646,9 @@ discard block |
||
646 | 646 | * @return EE_Line_Item |
647 | 647 | */ |
648 | 648 | public function total_line_item() { |
649 | - $item = $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) ); |
|
650 | - if( ! $item ){ |
|
651 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
649 | + $item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total))); |
|
650 | + if ( ! $item) { |
|
651 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
652 | 652 | $item = EEH_Line_Item::create_default_total_line_item(); |
653 | 653 | } |
654 | 654 | return $item; |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | */ |
664 | 664 | public function tax_total() { |
665 | 665 | $tax_line_item = $this->tax_total_line_item(); |
666 | - if ( $tax_line_item ) { |
|
666 | + if ($tax_line_item) { |
|
667 | 667 | return $tax_line_item->total(); |
668 | 668 | } else { |
669 | 669 | return 0; |
@@ -677,9 +677,9 @@ discard block |
||
677 | 677 | * @return EE_Line_Item |
678 | 678 | */ |
679 | 679 | public function tax_total_line_item() { |
680 | - $item = $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax_sub_total ) ) ); |
|
681 | - if( ! $item ){ |
|
682 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
680 | + $item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax_sub_total))); |
|
681 | + if ( ! $item) { |
|
682 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
683 | 683 | $item = EEH_Line_Item::create_default_total_line_item(); |
684 | 684 | } |
685 | 685 | return $item; |
@@ -691,20 +691,20 @@ discard block |
||
691 | 691 | * Gets the array of billing info for the gateway and for this transaction's primary registration's attendee. |
692 | 692 | * @return EE_Form_Section_Proper |
693 | 693 | */ |
694 | - public function billing_info(){ |
|
694 | + public function billing_info() { |
|
695 | 695 | $payment_method = $this->payment_method(); |
696 | - if ( !$payment_method){ |
|
696 | + if ( ! $payment_method) { |
|
697 | 697 | EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
698 | 698 | return false; |
699 | 699 | } |
700 | 700 | $primary_reg = $this->primary_registration(); |
701 | - if ( ! $primary_reg ) { |
|
702 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
701 | + if ( ! $primary_reg) { |
|
702 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
703 | 703 | return FALSE; |
704 | 704 | } |
705 | 705 | $attendee = $primary_reg->attendee(); |
706 | - if ( ! $attendee ) { |
|
707 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
706 | + if ( ! $attendee) { |
|
707 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
708 | 708 | return FALSE; |
709 | 709 | } |
710 | 710 | return $attendee->billing_info_for_payment_method($payment_method); |
@@ -739,15 +739,15 @@ discard block |
||
739 | 739 | * offline ones, dont' create payments) |
740 | 740 | * @return EE_Payment_Method |
741 | 741 | */ |
742 | - function payment_method(){ |
|
742 | + function payment_method() { |
|
743 | 743 | $pm = $this->get_first_related('Payment_Method'); |
744 | - if( $pm instanceof EE_Payment_Method ){ |
|
744 | + if ($pm instanceof EE_Payment_Method) { |
|
745 | 745 | return $pm; |
746 | - }else{ |
|
746 | + } else { |
|
747 | 747 | $last_payment = $this->last_payment(); |
748 | - if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
|
748 | + if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) { |
|
749 | 749 | return $last_payment->payment_method(); |
750 | - }else{ |
|
750 | + } else { |
|
751 | 751 | return NULL; |
752 | 752 | } |
753 | 753 | } |
@@ -758,15 +758,15 @@ discard block |
||
758 | 758 | * @return EE_Payment |
759 | 759 | */ |
760 | 760 | public function last_payment() { |
761 | - return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) ); |
|
761 | + return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc'))); |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | /** |
765 | 765 | * Gets all the line items which are unrelated to tickets on this transaction |
766 | 766 | * @return EE_Line_Item[] |
767 | 767 | */ |
768 | - public function non_ticket_line_items(){ |
|
769 | - return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() ); |
|
768 | + public function non_ticket_line_items() { |
|
769 | + return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID()); |
|
770 | 770 | } |
771 | 771 | |
772 | 772 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_WP_User class |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param array $props_n_values |
23 | 23 | * @return EE_WP_User|mixed |
24 | 24 | */ |
25 | - public static function new_instance( $props_n_values = array() ) { |
|
26 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
27 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
25 | + public static function new_instance($props_n_values = array()) { |
|
26 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
27 | + return $has_object ? $has_object : new self($props_n_values); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param array $props_n_values |
34 | 34 | * @return EE_WP_User |
35 | 35 | */ |
36 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
37 | - return new self( $props_n_values, TRUE ); |
|
36 | + public static function new_instance_from_db($props_n_values = array()) { |
|
37 | + return new self($props_n_values, TRUE); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @return WP_User |
43 | 43 | */ |
44 | 44 | public function wp_user_obj() { |
45 | - if( ! $this->_wp_user_obj ) { |
|
46 | - $this->_wp_user_obj = get_user_by('ID', $this->ID() ); |
|
45 | + if ( ! $this->_wp_user_obj) { |
|
46 | + $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
47 | 47 | } |
48 | 48 | return $this->_wp_user_obj; |
49 | 49 | } |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * constructor |
52 | 52 | */ |
53 | - protected function __construct( $timezone = NULL ){ |
|
54 | - $this->singular_item = __('Answer','event_espresso'); |
|
55 | - $this->plural_item = __('Answers','event_espresso'); |
|
53 | + protected function __construct($timezone = NULL) { |
|
54 | + $this->singular_item = __('Answer', 'event_espresso'); |
|
55 | + $this->plural_item = __('Answers', 'event_espresso'); |
|
56 | 56 | $this->_tables = array( |
57 | 57 | 'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID') |
58 | 58 | ); |
59 | 59 | $this->_fields = array( |
60 | 60 | 'Answer'=>array( |
61 | - 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')), |
|
62 | - 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'), |
|
63 | - 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'), |
|
64 | - 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value','event_espresso'), false, '') |
|
61 | + 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')), |
|
62 | + 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'), |
|
63 | + 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), |
|
64 | + 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '') |
|
65 | 65 | )); |
66 | 66 | $this->_model_relations = array( |
67 | 67 | 'Registration'=>new EE_Belongs_To_Relation(), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | ); |
70 | 70 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
71 | 71 | $this->_caps_slug = 'registrations'; |
72 | - parent::__construct( $timezone ); |
|
72 | + parent::__construct($timezone); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -82,19 +82,19 @@ discard block |
||
82 | 82 | * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value' |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){ |
|
86 | - $value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer ); |
|
87 | - if ( $value === NULL ){ |
|
88 | - $answer_obj = $this->get_registration_question_answer_object( $registration, $question_id, $pretty_answer ); |
|
89 | - if( $answer_obj instanceof EE_Answer ){ |
|
90 | - if($pretty_answer){ |
|
85 | + public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) { |
|
86 | + $value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer); |
|
87 | + if ($value === NULL) { |
|
88 | + $answer_obj = $this->get_registration_question_answer_object($registration, $question_id, $pretty_answer); |
|
89 | + if ($answer_obj instanceof EE_Answer) { |
|
90 | + if ($pretty_answer) { |
|
91 | 91 | $value = $answer_obj->pretty_value(); |
92 | - }else{ |
|
92 | + } else { |
|
93 | 93 | $value = $answer_obj->value(); |
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | - return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id ); |
|
97 | + return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | * @param int $question_id |
106 | 106 | * @return EE_Answer |
107 | 107 | */ |
108 | - public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){ |
|
109 | - $answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() ))); |
|
110 | - return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id ); |
|
108 | + public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) { |
|
109 | + $answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID()))); |
|
110 | + return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -119,27 +119,27 @@ discard block |
||
119 | 119 | * @param boolean $pretty_answer |
120 | 120 | * @return string |
121 | 121 | */ |
122 | - public function get_attendee_property_answer_value( EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE ){ |
|
122 | + public function get_attendee_property_answer_value(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) { |
|
123 | 123 | $field_name = NULL; |
124 | 124 | $value = NULL; |
125 | 125 | //only bother checking if the registration has an attendee |
126 | - if( $registration->attendee() instanceof EE_Attendee && isset($this->_question_id_to_att_field_map[$question_id])){ |
|
126 | + if ($registration->attendee() instanceof EE_Attendee && isset($this->_question_id_to_att_field_map[$question_id])) { |
|
127 | 127 | $field_name = $this->_question_id_to_att_field_map[$question_id]; |
128 | - if($pretty_answer){ |
|
129 | - if($field_name == 'STA_ID'){ |
|
128 | + if ($pretty_answer) { |
|
129 | + if ($field_name == 'STA_ID') { |
|
130 | 130 | $state = $registration->attendee()->state_obj(); |
131 | - $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'),$registration->attendee()->state_ID()); |
|
132 | - }else if($field_name == 'CNT_ISO'){ |
|
131 | + $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID()); |
|
132 | + } else if ($field_name == 'CNT_ISO') { |
|
133 | 133 | $country = $registration->attendee()->country_obj(); |
134 | - $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID()); |
|
135 | - }else{ |
|
134 | + $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID()); |
|
135 | + } else { |
|
136 | 136 | $value = $registration->attendee()->get_pretty($field_name); |
137 | 137 | } |
138 | - }else{ |
|
138 | + } else { |
|
139 | 139 | $value = $registration->attendee()->get($field_name); |
140 | 140 | } |
141 | 141 | } |
142 | - return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id ); |
|
142 | + return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -89,7 +91,7 @@ discard block |
||
89 | 91 | if( $answer_obj instanceof EE_Answer ){ |
90 | 92 | if($pretty_answer){ |
91 | 93 | $value = $answer_obj->pretty_value(); |
92 | - }else{ |
|
94 | + } else{ |
|
93 | 95 | $value = $answer_obj->value(); |
94 | 96 | } |
95 | 97 | } |
@@ -129,13 +131,13 @@ discard block |
||
129 | 131 | if($field_name == 'STA_ID'){ |
130 | 132 | $state = $registration->attendee()->state_obj(); |
131 | 133 | $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'),$registration->attendee()->state_ID()); |
132 | - }else if($field_name == 'CNT_ISO'){ |
|
134 | + } else if($field_name == 'CNT_ISO'){ |
|
133 | 135 | $country = $registration->attendee()->country_obj(); |
134 | 136 | $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID()); |
135 | - }else{ |
|
137 | + } else{ |
|
136 | 138 | $value = $registration->attendee()->get_pretty($field_name); |
137 | 139 | } |
138 | - }else{ |
|
140 | + } else{ |
|
139 | 141 | $value = $registration->attendee()->get($field_name); |
140 | 142 | } |
141 | 143 | } |