@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Transactions_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | protected function _ajax_hooks() { |
83 | - add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds')); |
|
84 | - add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds')); |
|
85 | - add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment')); |
|
83 | + add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds')); |
|
84 | + add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds')); |
|
85 | + add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment')); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'buttons' => array( |
98 | 98 | 'add' => __('Add New Transaction', 'event_espresso'), |
99 | 99 | 'edit' => __('Edit Transaction', 'event_espresso'), |
100 | - 'delete' => __('Delete Transaction','event_espresso'), |
|
100 | + 'delete' => __('Delete Transaction', 'event_espresso'), |
|
101 | 101 | ) |
102 | 102 | ); |
103 | 103 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->_set_transaction_status_array(); |
115 | 115 | |
116 | - $txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0; |
|
116 | + $txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0; |
|
117 | 117 | |
118 | 118 | $this->_page_routes = array( |
119 | 119 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | 'filename' => 'transactions_overview_views_filters_search' |
186 | 186 | ), |
187 | 187 | ), |
188 | - 'help_tour' => array( 'Transactions_Overview_Help_Tour' ), |
|
188 | + 'help_tour' => array('Transactions_Overview_Help_Tour'), |
|
189 | 189 | /** |
190 | 190 | * commented out because currently we are not displaying tips for transaction list table status but this |
191 | 191 | * may change in a later iteration so want to keep the code for then. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | 'nav' => array( |
198 | 198 | 'label' => __('View Transaction', 'event_espresso'), |
199 | 199 | 'order' => 5, |
200 | - 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
200 | + 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
201 | 201 | 'persistent' => FALSE |
202 | 202 | ), |
203 | 203 | 'help_tabs' => array( |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | 'filename' => 'transactions_view_transaction_primary_registrant_billing_information' |
219 | 219 | ), |
220 | 220 | ), |
221 | - 'qtips' => array( 'Transaction_Details_Tips' ), |
|
222 | - 'help_tour' => array( 'Transaction_Details_Help_Tour' ), |
|
221 | + 'qtips' => array('Transaction_Details_Tips'), |
|
222 | + 'help_tour' => array('Transaction_Details_Help_Tour'), |
|
223 | 223 | 'metaboxes' => array('_transaction_details_metaboxes'), |
224 | 224 | |
225 | 225 | 'require_nonce' => FALSE |
@@ -237,21 +237,21 @@ discard block |
||
237 | 237 | // IF a registration was JUST added via the admin... |
238 | 238 | if ( |
239 | 239 | isset( |
240 | - $this->_req_data[ 'redirect_from' ], |
|
241 | - $this->_req_data[ 'EVT_ID' ], |
|
242 | - $this->_req_data[ 'event_name' ] |
|
240 | + $this->_req_data['redirect_from'], |
|
241 | + $this->_req_data['EVT_ID'], |
|
242 | + $this->_req_data['event_name'] |
|
243 | 243 | ) |
244 | 244 | ) { |
245 | 245 | // then set a cookie so that we can block any attempts to use |
246 | 246 | // the back button as a way to enter another registration. |
247 | - setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' ); |
|
247 | + setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/'); |
|
248 | 248 | // and update the global |
249 | - $_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ]; |
|
249 | + $_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID']; |
|
250 | 250 | } |
251 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
252 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
253 | - EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status; |
|
254 | - EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status; |
|
251 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
252 | + EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
253 | + EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status; |
|
254 | + EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status; |
|
255 | 255 | } |
256 | 256 | public function admin_notices() {} |
257 | 257 | public function admin_footer_scripts() {} |
@@ -318,14 +318,14 @@ discard block |
||
318 | 318 | */ |
319 | 319 | public function load_scripts_styles() { |
320 | 320 | //enqueue style |
321 | - wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
321 | + wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
322 | 322 | wp_enqueue_style('espresso_txn'); |
323 | 323 | |
324 | 324 | //scripts |
325 | 325 | add_filter('FHEE_load_accounting_js', '__return_true'); |
326 | 326 | |
327 | 327 | //scripts |
328 | - wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
328 | + wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
329 | 329 | wp_enqueue_script('espresso_txn'); |
330 | 330 | |
331 | 331 | } |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @return void |
366 | 366 | */ |
367 | 367 | protected function _set_list_table_views_default() { |
368 | - $this->_views = array ( |
|
369 | - 'all' => array ( |
|
368 | + $this->_views = array( |
|
369 | + 'all' => array( |
|
370 | 370 | 'slug' => 'all', |
371 | 371 | 'label' => __('View All Transactions', 'event_espresso'), |
372 | 372 | 'count' => 0 |
@@ -394,20 +394,20 @@ discard block |
||
394 | 394 | * @return void |
395 | 395 | */ |
396 | 396 | private function _set_transaction_object() { |
397 | - if ( is_object( $this->_transaction) ) |
|
397 | + if (is_object($this->_transaction)) |
|
398 | 398 | return; //get out we've already set the object |
399 | 399 | |
400 | 400 | $TXN = EEM_Transaction::instance(); |
401 | 401 | |
402 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
402 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
403 | 403 | |
404 | 404 | //get transaction object |
405 | 405 | $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
406 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
406 | + $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
407 | 407 | |
408 | - if ( empty( $this->_transaction ) ) { |
|
409 | - $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . __(' could not be retrieved.', 'event_espresso'); |
|
410 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
408 | + if (empty($this->_transaction)) { |
|
409 | + $error_msg = __('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.__(' could not be retrieved.', 'event_espresso'); |
|
410 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | ), |
434 | 434 | 'view_receipt' => array( |
435 | 435 | 'class' => 'dashicons dashicons-media-default', |
436 | - 'desc' => __('View Transaction Receipt', 'event_espresso' ) |
|
436 | + 'desc' => __('View Transaction Receipt', 'event_espresso') |
|
437 | 437 | ), |
438 | 438 | 'view_registration' => array( |
439 | 439 | 'class' => 'dashicons dashicons-clipboard', |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | ) |
443 | 443 | ); |
444 | 444 | |
445 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) { |
|
445 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) { |
|
446 | 446 | |
447 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
448 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
447 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
448 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
449 | 449 | $items['send_payment_reminder'] = array( |
450 | 450 | 'class' => 'dashicons dashicons-email-alt', |
451 | 451 | 'desc' => __('Send Payment Reminder', 'event_espresso') |
@@ -466,29 +466,29 @@ discard block |
||
466 | 466 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items', |
467 | 467 | array( |
468 | 468 | 'overpaid' => array( |
469 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code, |
|
470 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' ) |
|
469 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code, |
|
470 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence') |
|
471 | 471 | ), |
472 | 472 | 'complete' => array( |
473 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code, |
|
474 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' ) |
|
473 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code, |
|
474 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence') |
|
475 | 475 | ), |
476 | 476 | 'incomplete' => array( |
477 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code, |
|
478 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' ) |
|
477 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code, |
|
478 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence') |
|
479 | 479 | ), |
480 | 480 | 'abandoned' => array( |
481 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code, |
|
482 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' ) |
|
481 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code, |
|
482 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence') |
|
483 | 483 | ), |
484 | 484 | 'failed' => array( |
485 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code, |
|
486 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' ) |
|
485 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code, |
|
486 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence') |
|
487 | 487 | ) |
488 | 488 | ) |
489 | 489 | ); |
490 | 490 | |
491 | - return array_merge( $items, $more_items); |
|
491 | + return array_merge($items, $more_items); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | |
@@ -501,9 +501,9 @@ discard block |
||
501 | 501 | */ |
502 | 502 | protected function _transactions_overview_list_table() { |
503 | 503 | $this->_admin_page_title = __('Transactions', 'event_espresso'); |
504 | - $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL; |
|
505 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( __('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : ''; |
|
506 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() ); |
|
504 | + $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL; |
|
505 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : ''; |
|
506 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items()); |
|
507 | 507 | $this->display_admin_list_table_page_with_no_sidebar(); |
508 | 508 | } |
509 | 509 | |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | * @return void |
518 | 518 | */ |
519 | 519 | protected function _transaction_details() { |
520 | - do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
|
521 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
520 | + do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction); |
|
521 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
522 | 522 | |
523 | 523 | $this->_set_transaction_status_array(); |
524 | 524 | |
@@ -531,14 +531,14 @@ discard block |
||
531 | 531 | $attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL; |
532 | 532 | |
533 | 533 | $this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID(); |
534 | - $this->_template_args['txn_nmbr']['label'] = __( 'Transaction Number', 'event_espresso' ); |
|
534 | + $this->_template_args['txn_nmbr']['label'] = __('Transaction Number', 'event_espresso'); |
|
535 | 535 | |
536 | 536 | $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp'); |
537 | - $this->_template_args['txn_datetime']['label'] = __( 'Date', 'event_espresso' ); |
|
537 | + $this->_template_args['txn_datetime']['label'] = __('Date', 'event_espresso'); |
|
538 | 538 | |
539 | - $this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ]; |
|
540 | - $this->_template_args['txn_status']['label'] = __( 'Transaction Status', 'event_espresso' ); |
|
541 | - $this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID'); |
|
539 | + $this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')]; |
|
540 | + $this->_template_args['txn_status']['label'] = __('Transaction Status', 'event_espresso'); |
|
541 | + $this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID'); |
|
542 | 542 | |
543 | 543 | $this->_template_args['grand_total'] = $this->_transaction->get('TXN_total'); |
544 | 544 | $this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid'); |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | 'espresso_transactions_send_payment_reminder' |
551 | 551 | ) |
552 | 552 | ) { |
553 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
553 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
554 | 554 | $this->_template_args['send_payment_reminder_button'] = |
555 | - EEH_MSG_Template::is_mt_active( 'payment_reminder' ) |
|
555 | + EEH_MSG_Template::is_mt_active('payment_reminder') |
|
556 | 556 | && $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code |
557 | 557 | && $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code |
558 | 558 | ? EEH_Template::get_button_or_link( |
@@ -574,40 +574,40 @@ discard block |
||
574 | 574 | } |
575 | 575 | |
576 | 576 | $amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid'); |
577 | - $this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE ); |
|
578 | - if ( EE_Registry::instance()->CFG->currency->sign_b4 ) { |
|
579 | - $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due']; |
|
577 | + $this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE); |
|
578 | + if (EE_Registry::instance()->CFG->currency->sign_b4) { |
|
579 | + $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due']; |
|
580 | 580 | } else { |
581 | - $this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign; |
|
581 | + $this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign; |
|
582 | 582 | } |
583 | - $this->_template_args['amount_due_class'] = ''; |
|
583 | + $this->_template_args['amount_due_class'] = ''; |
|
584 | 584 | |
585 | - if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) { |
|
585 | + if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) { |
|
586 | 586 | // paid in full |
587 | - $this->_template_args['amount_due'] = FALSE; |
|
588 | - } elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) { |
|
587 | + $this->_template_args['amount_due'] = FALSE; |
|
588 | + } elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) { |
|
589 | 589 | // overpaid |
590 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
591 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) { |
|
590 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
591 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) { |
|
592 | 592 | // monies owing |
593 | - $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
594 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) { |
|
593 | + $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
594 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) { |
|
595 | 595 | // no payments made yet |
596 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
597 | - } elseif ( $this->_transaction->get('TXN_total') == 0 ) { |
|
596 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
597 | + } elseif ($this->_transaction->get('TXN_total') == 0) { |
|
598 | 598 | // free event |
599 | - $this->_template_args['amount_due'] = FALSE; |
|
599 | + $this->_template_args['amount_due'] = FALSE; |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | $payment_method = $this->_transaction->payment_method(); |
603 | 603 | |
604 | 604 | $this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method |
605 | 605 | ? $payment_method->admin_name() |
606 | - : __( 'Unknown', 'event_espresso' ); |
|
606 | + : __('Unknown', 'event_espresso'); |
|
607 | 607 | |
608 | 608 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
609 | 609 | // link back to overview |
610 | - $this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] ) |
|
610 | + $this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER']) |
|
611 | 611 | ? $_SERVER['HTTP_REFERER'] |
612 | 612 | : TXN_ADMIN_URL; |
613 | 613 | |
@@ -615,13 +615,13 @@ discard block |
||
615 | 615 | // next link |
616 | 616 | $next_txn = $this->_transaction->next( |
617 | 617 | null, |
618 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
618 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
619 | 619 | 'TXN_ID' |
620 | 620 | ); |
621 | 621 | $this->_template_args['next_transaction'] = $next_txn |
622 | 622 | ? $this->_next_link( |
623 | 623 | EE_Admin_Page::add_query_args_and_nonce( |
624 | - array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ), |
|
624 | + array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']), |
|
625 | 625 | TXN_ADMIN_URL |
626 | 626 | ), |
627 | 627 | 'dashicons dashicons-arrow-right ee-icon-size-22' |
@@ -630,13 +630,13 @@ discard block |
||
630 | 630 | // previous link |
631 | 631 | $previous_txn = $this->_transaction->previous( |
632 | 632 | null, |
633 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
633 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
634 | 634 | 'TXN_ID' |
635 | 635 | ); |
636 | 636 | $this->_template_args['previous_transaction'] = $previous_txn |
637 | 637 | ? $this->_previous_link( |
638 | 638 | EE_Admin_Page::add_query_args_and_nonce( |
639 | - array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ), |
|
639 | + array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']), |
|
640 | 640 | TXN_ADMIN_URL |
641 | 641 | ), |
642 | 642 | 'dashicons dashicons-arrow-left ee-icon-size-22' |
@@ -646,16 +646,16 @@ discard block |
||
646 | 646 | // were we just redirected here after adding a new registration ??? |
647 | 647 | if ( |
648 | 648 | isset( |
649 | - $this->_req_data[ 'redirect_from' ], |
|
650 | - $this->_req_data[ 'EVT_ID' ], |
|
651 | - $this->_req_data[ 'event_name' ] |
|
649 | + $this->_req_data['redirect_from'], |
|
650 | + $this->_req_data['EVT_ID'], |
|
651 | + $this->_req_data['event_name'] |
|
652 | 652 | ) |
653 | 653 | ) { |
654 | 654 | if ( |
655 | 655 | EE_Registry::instance()->CAP->current_user_can( |
656 | 656 | 'ee_edit_registrations', |
657 | 657 | 'espresso_registrations_new_registration', |
658 | - $this->_req_data[ 'EVT_ID' ] |
|
658 | + $this->_req_data['EVT_ID'] |
|
659 | 659 | ) |
660 | 660 | ) { |
661 | 661 | $this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="'; |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | 'action' => 'new_registration', |
666 | 666 | 'return' => 'default', |
667 | 667 | 'TXN_ID' => $this->_transaction->ID(), |
668 | - 'event_id' => $this->_req_data[ 'EVT_ID' ], |
|
668 | + 'event_id' => $this->_req_data['EVT_ID'], |
|
669 | 669 | ), |
670 | 670 | REG_ADMIN_URL |
671 | 671 | ); |
@@ -673,17 +673,17 @@ discard block |
||
673 | 673 | |
674 | 674 | $this->_admin_page_title .= sprintf( |
675 | 675 | __('Add Another New Registration to Event: "%1$s" ?'), |
676 | - htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' ) |
|
676 | + htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8') |
|
677 | 677 | ); |
678 | 678 | $this->_admin_page_title .= '</a>'; |
679 | 679 | } |
680 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
680 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
681 | 681 | } |
682 | 682 | // grab messages at the last second |
683 | 683 | $this->_template_args['notices'] = EE_Error::get_notices(); |
684 | 684 | // path to template |
685 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php'; |
|
686 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
685 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php'; |
|
686 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
687 | 687 | |
688 | 688 | // the details template wrapper |
689 | 689 | $this->display_admin_page_with_sidebar(); |
@@ -702,18 +702,18 @@ discard block |
||
702 | 702 | |
703 | 703 | $this->_set_transaction_object(); |
704 | 704 | |
705 | - add_meta_box( 'edit-txn-details-mbox', __( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' ); |
|
705 | + add_meta_box('edit-txn-details-mbox', __('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high'); |
|
706 | 706 | add_meta_box( |
707 | 707 | 'edit-txn-attendees-mbox', |
708 | - __( 'Attendees Registered in this Transaction', 'event_espresso' ), |
|
709 | - array( $this, 'txn_attendees_meta_box' ), |
|
708 | + __('Attendees Registered in this Transaction', 'event_espresso'), |
|
709 | + array($this, 'txn_attendees_meta_box'), |
|
710 | 710 | $this->_wp_page_slug, |
711 | 711 | 'normal', |
712 | 712 | 'high', |
713 | - array( 'TXN_ID' => $this->_transaction->ID() ) |
|
713 | + array('TXN_ID' => $this->_transaction->ID()) |
|
714 | 714 | ); |
715 | - add_meta_box( 'edit-txn-registrant-mbox', __( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
716 | - add_meta_box( 'edit-txn-billing-info-mbox', __( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
715 | + add_meta_box('edit-txn-registrant-mbox', __('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
716 | + add_meta_box('edit-txn-billing-info-mbox', __('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
717 | 717 | |
718 | 718 | } |
719 | 719 | |
@@ -734,15 +734,15 @@ discard block |
||
734 | 734 | |
735 | 735 | //get line table |
736 | 736 | EEH_Autoloader::register_line_item_display_autoloaders(); |
737 | - $Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' ); |
|
738 | - $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() ); |
|
737 | + $Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy'); |
|
738 | + $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item()); |
|
739 | 739 | $this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code'); |
740 | 740 | |
741 | 741 | // process taxes |
742 | - $taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax ))); |
|
743 | - $this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE; |
|
742 | + $taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
743 | + $this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE; |
|
744 | 744 | |
745 | - $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE ); |
|
745 | + $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE); |
|
746 | 746 | $this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total'); |
747 | 747 | $this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID'); |
748 | 748 | |
@@ -750,63 +750,63 @@ discard block |
||
750 | 750 | |
751 | 751 | // process payment details |
752 | 752 | $payments = $this->_transaction->get_many_related('Payment'); |
753 | - if( ! empty( $payments ) ) { |
|
754 | - $this->_template_args[ 'payments' ] = $payments; |
|
755 | - $this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments ); |
|
753 | + if ( ! empty($payments)) { |
|
754 | + $this->_template_args['payments'] = $payments; |
|
755 | + $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); |
|
756 | 756 | } else { |
757 | - $this->_template_args[ 'payments' ] = false; |
|
758 | - $this->_template_args[ 'existing_reg_payments' ] = array(); |
|
757 | + $this->_template_args['payments'] = false; |
|
758 | + $this->_template_args['existing_reg_payments'] = array(); |
|
759 | 759 | } |
760 | 760 | |
761 | - $this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment' ), TXN_ADMIN_URL ); |
|
762 | - $this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL ); |
|
761 | + $this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL); |
|
762 | + $this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL); |
|
763 | 763 | |
764 | - if ( isset( $txn_details['invoice_number'] )) { |
|
764 | + if (isset($txn_details['invoice_number'])) { |
|
765 | 765 | $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; |
766 | - $this->_template_args['txn_details']['invoice_number']['label'] = __( 'Invoice Number', 'event_espresso' ); |
|
766 | + $this->_template_args['txn_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso'); |
|
767 | 767 | } |
768 | 768 | |
769 | 769 | $this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session'); |
770 | - $this->_template_args['txn_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' ); |
|
770 | + $this->_template_args['txn_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); |
|
771 | 771 | |
772 | - $this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : ''; |
|
773 | - $this->_template_args['txn_details']['ip_address']['label'] = __( 'Transaction placed from IP', 'event_espresso' ); |
|
772 | + $this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : ''; |
|
773 | + $this->_template_args['txn_details']['ip_address']['label'] = __('Transaction placed from IP', 'event_espresso'); |
|
774 | 774 | |
775 | - $this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : ''; |
|
776 | - $this->_template_args['txn_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' ); |
|
775 | + $this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''; |
|
776 | + $this->_template_args['txn_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); |
|
777 | 777 | |
778 | 778 | $reg_steps = '<ul>'; |
779 | - foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) { |
|
780 | - if ( $reg_step_status === true ) { |
|
781 | - $reg_steps .= '<li style="color:#70cc50">' . sprintf( __( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
782 | - } else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) { |
|
783 | - $reg_steps .= '<li style="color:#2EA2CC">' . sprintf( |
|
784 | - __( '%1$s : Initiated %2$s', 'event_espresso' ), |
|
785 | - ucwords( str_replace( '_', ' ', $reg_step ) ), |
|
786 | - gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ) |
|
787 | - ) . '</li>'; |
|
779 | + foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { |
|
780 | + if ($reg_step_status === true) { |
|
781 | + $reg_steps .= '<li style="color:#70cc50">'.sprintf(__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
782 | + } else if (is_numeric($reg_step_status) && $reg_step_status !== false) { |
|
783 | + $reg_steps .= '<li style="color:#2EA2CC">'.sprintf( |
|
784 | + __('%1$s : Initiated %2$s', 'event_espresso'), |
|
785 | + ucwords(str_replace('_', ' ', $reg_step)), |
|
786 | + gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS))) |
|
787 | + ).'</li>'; |
|
788 | 788 | } else { |
789 | - $reg_steps .= '<li style="color:#E76700">' . sprintf( __( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
789 | + $reg_steps .= '<li style="color:#E76700">'.sprintf(__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
790 | 790 | } |
791 | 791 | } |
792 | 792 | $reg_steps .= '</ul>'; |
793 | 793 | $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; |
794 | - $this->_template_args['txn_details']['reg_steps']['label'] = __( 'Registration Step Progress', 'event_espresso' ); |
|
794 | + $this->_template_args['txn_details']['reg_steps']['label'] = __('Registration Step Progress', 'event_espresso'); |
|
795 | 795 | |
796 | 796 | |
797 | 797 | $this->_get_registrations_to_apply_payment_to(); |
798 | - $this->_get_payment_methods( $payments ); |
|
798 | + $this->_get_payment_methods($payments); |
|
799 | 799 | $this->_get_payment_status_array(); |
800 | 800 | $this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction. |
801 | 801 | |
802 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction' ), TXN_ADMIN_URL ); |
|
803 | - $this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL ); |
|
804 | - $this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL ); |
|
802 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL); |
|
803 | + $this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL); |
|
804 | + $this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL); |
|
805 | 805 | |
806 | 806 | // 'espresso_delete_payment_nonce' |
807 | 807 | |
808 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
809 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
808 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
809 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
810 | 810 | |
811 | 811 | } |
812 | 812 | |
@@ -821,27 +821,27 @@ discard block |
||
821 | 821 | * @param EE_Payment[] $payments |
822 | 822 | * @return array |
823 | 823 | */ |
824 | - protected function _get_registration_payment_IDs( $payments = array() ) { |
|
824 | + protected function _get_registration_payment_IDs($payments = array()) { |
|
825 | 825 | $existing_reg_payments = array(); |
826 | 826 | // get all reg payments for these payments |
827 | - $reg_payments = EEM_Registration_Payment::instance()->get_all( array( |
|
827 | + $reg_payments = EEM_Registration_Payment::instance()->get_all(array( |
|
828 | 828 | array( |
829 | 829 | 'PAY_ID' => array( |
830 | 830 | 'IN', |
831 | - array_keys( $payments ) |
|
831 | + array_keys($payments) |
|
832 | 832 | ) |
833 | 833 | ) |
834 | - ) ); |
|
835 | - if ( ! empty( $reg_payments ) ) { |
|
836 | - foreach ( $payments as $payment ) { |
|
837 | - if ( ! $payment instanceof EE_Payment ) { |
|
834 | + )); |
|
835 | + if ( ! empty($reg_payments)) { |
|
836 | + foreach ($payments as $payment) { |
|
837 | + if ( ! $payment instanceof EE_Payment) { |
|
838 | 838 | continue; |
839 | - } else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) { |
|
840 | - $existing_reg_payments[ $payment->ID() ] = array(); |
|
839 | + } else if ( ! isset($existing_reg_payments[$payment->ID()])) { |
|
840 | + $existing_reg_payments[$payment->ID()] = array(); |
|
841 | 841 | } |
842 | - foreach ( $reg_payments as $reg_payment ) { |
|
843 | - if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) { |
|
844 | - $existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID(); |
|
842 | + foreach ($reg_payments as $reg_payment) { |
|
843 | + if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) { |
|
844 | + $existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID(); |
|
845 | 845 | } |
846 | 846 | } |
847 | 847 | } |
@@ -878,39 +878,39 @@ discard block |
||
878 | 878 | $registrations_to_apply_payment_to .= '<br /><div class="admin-primary-mbox-tbl-wrap">'; |
879 | 879 | $registrations_to_apply_payment_to .= '<table class="admin-primary-mbox-tbl">'; |
880 | 880 | $registrations_to_apply_payment_to .= '<thead><tr>'; |
881 | - $registrations_to_apply_payment_to .= '<td>' . __( 'ID', 'event_espresso' ) . '</td>'; |
|
882 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Registrant', 'event_espresso' ) . '</td>'; |
|
883 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Ticket', 'event_espresso' ) . '</td>'; |
|
884 | - $registrations_to_apply_payment_to .= '<td>' . __( 'Event', 'event_espresso' ) . '</td>'; |
|
885 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">' . __( 'Paid', 'event_espresso' ) . '</td>'; |
|
886 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">' . __( 'Owing', 'event_espresso' ) . '</td>'; |
|
887 | - $registrations_to_apply_payment_to .= '<td class="jst-cntr">' . __( 'Apply', 'event_espresso' ) . '</td>'; |
|
881 | + $registrations_to_apply_payment_to .= '<td>'.__('ID', 'event_espresso').'</td>'; |
|
882 | + $registrations_to_apply_payment_to .= '<td>'.__('Registrant', 'event_espresso').'</td>'; |
|
883 | + $registrations_to_apply_payment_to .= '<td>'.__('Ticket', 'event_espresso').'</td>'; |
|
884 | + $registrations_to_apply_payment_to .= '<td>'.__('Event', 'event_espresso').'</td>'; |
|
885 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-cntr">'.__('Paid', 'event_espresso').'</td>'; |
|
886 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-cntr">'.__('Owing', 'event_espresso').'</td>'; |
|
887 | + $registrations_to_apply_payment_to .= '<td class="jst-cntr">'.__('Apply', 'event_espresso').'</td>'; |
|
888 | 888 | $registrations_to_apply_payment_to .= '</tr></thead><tbody>'; |
889 | 889 | // get registrations for TXN |
890 | - $registrations = $this->_transaction->registrations( $query_params ); |
|
891 | - foreach ( $registrations as $registration ) { |
|
892 | - if ( $registration instanceof EE_Registration ) { |
|
890 | + $registrations = $this->_transaction->registrations($query_params); |
|
891 | + foreach ($registrations as $registration) { |
|
892 | + if ($registration instanceof EE_Registration) { |
|
893 | 893 | $owing = $registration->final_price() - $registration->paid(); |
894 | - $taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> ' . __( '+ tax', 'event_espresso' ) . '</span>' : ''; |
|
895 | - $checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) ? ' checked="checked"' : ''; |
|
896 | - $registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-' . $registration->ID() . '">'; |
|
894 | + $taxable = $registration->ticket()->taxable() ? ' <span class="smaller-text lt-grey-text"> '.__('+ tax', 'event_espresso').'</span>' : ''; |
|
895 | + $checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) ? ' checked="checked"' : ''; |
|
896 | + $registrations_to_apply_payment_to .= '<tr id="apply-payment-registration-row-'.$registration->ID().'">'; |
|
897 | 897 | // add html for checkbox input and label |
898 | - $registrations_to_apply_payment_to .= '<td>' . $registration->ID() . '</td>'; |
|
899 | - $registrations_to_apply_payment_to .= '<td>' . $registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' ) . '</td>'; |
|
900 | - $registrations_to_apply_payment_to .= '<td>' . $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable . '</td>'; |
|
901 | - $registrations_to_apply_payment_to .= '<td>' . $registration->event_name() . '</td>'; |
|
902 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">' . $registration->pretty_paid() . '</td>'; |
|
903 | - $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">' . EEH_Template::format_currency( $owing ) . '</td>'; |
|
898 | + $registrations_to_apply_payment_to .= '<td>'.$registration->ID().'</td>'; |
|
899 | + $registrations_to_apply_payment_to .= '<td>'.$registration->attendee() instanceof EE_Attendee ? $registration->attendee()->full_name() : __('Unknown Attendee', 'event_espresso').'</td>'; |
|
900 | + $registrations_to_apply_payment_to .= '<td>'.$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable.'</td>'; |
|
901 | + $registrations_to_apply_payment_to .= '<td>'.$registration->event_name().'</td>'; |
|
902 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-paid-td jst-rght">'.$registration->pretty_paid().'</td>'; |
|
903 | + $registrations_to_apply_payment_to .= '<td class="txn-admin-payment-owing-td jst-rght">'.EEH_Template::format_currency($owing).'</td>'; |
|
904 | 904 | $registrations_to_apply_payment_to .= '<td class="jst-cntr">'; |
905 | 905 | $disabled = $registration->final_price() > 0 ? '' : ' disabled'; |
906 | - $registrations_to_apply_payment_to .= '<input type="checkbox" value="' . $registration->ID() . '" name="txn_admin_payment[registrations]"' . $checked . $disabled . '>'; |
|
906 | + $registrations_to_apply_payment_to .= '<input type="checkbox" value="'.$registration->ID().'" name="txn_admin_payment[registrations]"'.$checked.$disabled.'>'; |
|
907 | 907 | $registrations_to_apply_payment_to .= '</td>'; |
908 | 908 | $registrations_to_apply_payment_to .= '</tr>'; |
909 | 909 | } |
910 | 910 | } |
911 | 911 | $registrations_to_apply_payment_to .= '</tbody></table></div>'; |
912 | - $registrations_to_apply_payment_to .= '<p class="clear description">' . __( 'The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso' ) . '</p></div>'; |
|
913 | - $this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to; |
|
912 | + $registrations_to_apply_payment_to .= '<p class="clear description">'.__('The payment will only be applied to the registrations that have a check mark in their corresponding check box. Checkboxes for free registrations have been disabled.', 'event_espresso').'</p></div>'; |
|
913 | + $this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to; |
|
914 | 914 | } |
915 | 915 | |
916 | 916 | |
@@ -927,9 +927,9 @@ discard block |
||
927 | 927 | $statuses = EEM_Registration::reg_status_array(array(), TRUE); |
928 | 928 | //let's add a "don't change" option. |
929 | 929 | $status_array['NAN'] = __('Leave the Same', 'event_espresso'); |
930 | - $status_array = array_merge( $status_array, $statuses ); |
|
931 | - $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' ); |
|
932 | - $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' ); |
|
930 | + $status_array = array_merge($status_array, $statuses); |
|
931 | + $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status'); |
|
932 | + $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status'); |
|
933 | 933 | |
934 | 934 | } |
935 | 935 | |
@@ -944,21 +944,21 @@ discard block |
||
944 | 944 | * @param EE_Payment[] to show on this page |
945 | 945 | * @return void |
946 | 946 | */ |
947 | - private function _get_payment_methods( $payments = array() ) { |
|
947 | + private function _get_payment_methods($payments = array()) { |
|
948 | 948 | $payment_methods_of_payments = array(); |
949 | - foreach( $payments as $payment ){ |
|
950 | - if( $payment instanceof EE_Payment ){ |
|
951 | - $payment_methods_of_payments[] = $payment->get( 'PMD_ID' ); |
|
949 | + foreach ($payments as $payment) { |
|
950 | + if ($payment instanceof EE_Payment) { |
|
951 | + $payment_methods_of_payments[] = $payment->get('PMD_ID'); |
|
952 | 952 | } |
953 | 953 | } |
954 | - if( $payment_methods_of_payments ){ |
|
955 | - $query_args = array( array( 'OR*payment_method_for_payment' => array( |
|
956 | - 'PMD_ID' => array( 'IN', $payment_methods_of_payments ), |
|
957 | - 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) ); |
|
958 | - }else{ |
|
959 | - $query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ); |
|
954 | + if ($payment_methods_of_payments) { |
|
955 | + $query_args = array(array('OR*payment_method_for_payment' => array( |
|
956 | + 'PMD_ID' => array('IN', $payment_methods_of_payments), |
|
957 | + 'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') ))); |
|
958 | + } else { |
|
959 | + $query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%'))); |
|
960 | 960 | } |
961 | - $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args ); |
|
961 | + $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | |
@@ -972,46 +972,46 @@ discard block |
||
972 | 972 | * @param array $metabox |
973 | 973 | * @return void |
974 | 974 | */ |
975 | - public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) { |
|
975 | + public function txn_attendees_meta_box($post, $metabox = array('args' => array())) { |
|
976 | 976 | |
977 | - extract( $metabox['args'] ); |
|
977 | + extract($metabox['args']); |
|
978 | 978 | $this->_template_args['post'] = $post; |
979 | 979 | $this->_template_args['event_attendees'] = array(); |
980 | 980 | // process items in cart |
981 | - $line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) ); |
|
982 | - if ( ! empty( $line_items )) { |
|
983 | - foreach ( $line_items as $item ) { |
|
984 | - if ( $item instanceof EE_Line_Item ) { |
|
985 | - switch( $item->OBJ_type() ) { |
|
981 | + $line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); |
|
982 | + if ( ! empty($line_items)) { |
|
983 | + foreach ($line_items as $item) { |
|
984 | + if ($item instanceof EE_Line_Item) { |
|
985 | + switch ($item->OBJ_type()) { |
|
986 | 986 | |
987 | 987 | case 'Event' : |
988 | 988 | break; |
989 | 989 | |
990 | 990 | case 'Ticket' : |
991 | 991 | $ticket = $item->ticket(); |
992 | - if ( empty( $ticket )) { |
|
992 | + if (empty($ticket)) { |
|
993 | 993 | continue; //right now we're only handling tickets here. Cause its expected that only tickets will have attendees right? |
994 | 994 | } |
995 | - $ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' )); |
|
995 | + $ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price')); |
|
996 | 996 | $event = $ticket->get_first_related('Registration')->get_first_related('Event'); |
997 | - $event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : ''; |
|
997 | + $event_name = $event instanceof EE_Event ? $event->get('EVT_name').' - '.$item->get('LIN_name') : ''; |
|
998 | 998 | |
999 | - $registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() ))); |
|
1000 | - foreach( $registrations as $registration ) { |
|
1001 | - $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count'); |
|
1002 | - $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1003 | - $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
999 | + $registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID()))); |
|
1000 | + foreach ($registrations as $registration) { |
|
1001 | + $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count'); |
|
1002 | + $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1003 | + $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1004 | 1004 | // attendee info |
1005 | 1005 | $attendee = $registration->get_first_related('Attendee'); |
1006 | - if ( $attendee instanceof EE_Attendee ) { |
|
1006 | + if ($attendee instanceof EE_Attendee) { |
|
1007 | 1007 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
1008 | 1008 | $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
1009 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>'; |
|
1010 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array() ); |
|
1009 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event->get('EVT_name').__(' Event', 'event_espresso').'">'.$attendee->email().'</a>'; |
|
1010 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array()); |
|
1011 | 1011 | } else { |
1012 | 1012 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = ''; |
1013 | 1013 | $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
1014 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
|
1014 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
|
1015 | 1015 | $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
1016 | 1016 | } |
1017 | 1017 | } |
@@ -1021,12 +1021,12 @@ discard block |
||
1021 | 1021 | } |
1022 | 1022 | } |
1023 | 1023 | |
1024 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees' ), TXN_ADMIN_URL ); |
|
1025 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE ); |
|
1024 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL); |
|
1025 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE); |
|
1026 | 1026 | |
1027 | 1027 | } else { |
1028 | 1028 | echo sprintf( |
1029 | - __( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ), |
|
1029 | + __('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'), |
|
1030 | 1030 | '<p class="important-notice">', |
1031 | 1031 | '</p>' |
1032 | 1032 | ); |
@@ -1045,20 +1045,20 @@ discard block |
||
1045 | 1045 | */ |
1046 | 1046 | public function txn_registrant_side_meta_box() { |
1047 | 1047 | $primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null; |
1048 | - if ( ! $primary_att instanceof EE_Attendee ) { |
|
1048 | + if ( ! $primary_att instanceof EE_Attendee) { |
|
1049 | 1049 | $this->_template_args['no_attendee_message'] = __('There is no attached contact for this transaction. The transaction either failed due to an error or was abandoned.', 'event_espresso'); |
1050 | 1050 | $primary_att = EEM_Attendee::instance()->create_default_object(); |
1051 | 1051 | } |
1052 | - $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1052 | + $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1053 | 1053 | $this->_template_args['prime_reg_fname'] = $primary_att->fname(); |
1054 | 1054 | $this->_template_args['prime_reg_lname'] = $primary_att->lname(); |
1055 | - $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1055 | + $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1056 | 1056 | $this->_template_args['prime_reg_phone'] = $primary_att->phone(); |
1057 | - $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID() ), REG_ADMIN_URL ); |
|
1057 | + $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL); |
|
1058 | 1058 | // get formatted address for registrant |
1059 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
1060 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att ); |
|
1061 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE ); |
|
1059 | + EE_Registry::instance()->load_helper('Formatter'); |
|
1060 | + $this->_template_args['formatted_address'] = EEH_Address::format($primary_att); |
|
1061 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE); |
|
1062 | 1062 | } |
1063 | 1063 | |
1064 | 1064 | |
@@ -1074,12 +1074,12 @@ discard block |
||
1074 | 1074 | |
1075 | 1075 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
1076 | 1076 | $this->_template_args['billing_form_url'] = add_query_arg( |
1077 | - array( 'action' => 'edit_transaction', 'process' => 'billing' ), |
|
1077 | + array('action' => 'edit_transaction', 'process' => 'billing'), |
|
1078 | 1078 | TXN_ADMIN_URL |
1079 | 1079 | ); |
1080 | 1080 | |
1081 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1082 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/ |
|
1081 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1082 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/ |
|
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | |
@@ -1092,42 +1092,42 @@ discard block |
||
1092 | 1092 | * @return void |
1093 | 1093 | */ |
1094 | 1094 | public function apply_payments_or_refunds() { |
1095 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1095 | + $json_response_data = array('return_data' => FALSE); |
|
1096 | 1096 | $valid_data = $this->_validate_payment_request_data(); |
1097 | - if ( ! empty( $valid_data ) ) { |
|
1098 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1097 | + if ( ! empty($valid_data)) { |
|
1098 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1099 | 1099 | //save the new payment |
1100 | - $payment = $this->_create_payment_from_request_data( $valid_data ); |
|
1100 | + $payment = $this->_create_payment_from_request_data($valid_data); |
|
1101 | 1101 | // get the TXN for this payment |
1102 | 1102 | $transaction = $payment->transaction(); |
1103 | 1103 | // verify transaction |
1104 | - if ( $transaction instanceof EE_Transaction ) { |
|
1104 | + if ($transaction instanceof EE_Transaction) { |
|
1105 | 1105 | // calculate_total_payments_and_update_status |
1106 | - $this->_process_transaction_payments( $transaction ); |
|
1107 | - $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment ); |
|
1108 | - $this->_remove_existing_registration_payments( $payment, $PAY_ID ); |
|
1106 | + $this->_process_transaction_payments($transaction); |
|
1107 | + $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment); |
|
1108 | + $this->_remove_existing_registration_payments($payment, $PAY_ID); |
|
1109 | 1109 | // apply payment to registrations (if applicable) |
1110 | - if ( ! empty( $REG_IDs ) ) { |
|
1111 | - $this->_update_registration_payments( $transaction, $payment, $REG_IDs ); |
|
1110 | + if ( ! empty($REG_IDs)) { |
|
1111 | + $this->_update_registration_payments($transaction, $payment, $REG_IDs); |
|
1112 | 1112 | $this->_maybe_send_notifications(); |
1113 | 1113 | // now process status changes for the same registrations |
1114 | - $this->_process_registration_status_change( $transaction, $REG_IDs ); |
|
1114 | + $this->_process_registration_status_change($transaction, $REG_IDs); |
|
1115 | 1115 | } |
1116 | - $this->_maybe_send_notifications( $payment ); |
|
1116 | + $this->_maybe_send_notifications($payment); |
|
1117 | 1117 | //prepare to render page |
1118 | - $json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs ); |
|
1119 | - do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment ); |
|
1118 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs); |
|
1119 | + do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment); |
|
1120 | 1120 | } else { |
1121 | 1121 | EE_Error::add_error( |
1122 | - __( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ), |
|
1122 | + __('A valid Transaction for this payment could not be retrieved.', 'event_espresso'), |
|
1123 | 1123 | __FILE__, __FUNCTION__, __LINE__ |
1124 | 1124 | ); |
1125 | 1125 | } |
1126 | 1126 | } else { |
1127 | - EE_Error::add_error( __( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1127 | + EE_Error::add_error(__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | - $notices = EE_Error::get_notices( false, false, false ); |
|
1130 | + $notices = EE_Error::get_notices(false, false, false); |
|
1131 | 1131 | $this->_template_args = array( |
1132 | 1132 | 'data' => $json_response_data, |
1133 | 1133 | 'error' => $notices['errors'], |
@@ -1144,30 +1144,30 @@ discard block |
||
1144 | 1144 | * @return array |
1145 | 1145 | */ |
1146 | 1146 | protected function _validate_payment_request_data() { |
1147 | - if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) { |
|
1147 | + if ( ! isset($this->_req_data['txn_admin_payment'])) { |
|
1148 | 1148 | return false; |
1149 | 1149 | } |
1150 | 1150 | $payment_form = $this->_generate_payment_form_section(); |
1151 | 1151 | try { |
1152 | - if ( $payment_form->was_submitted() ) { |
|
1152 | + if ($payment_form->was_submitted()) { |
|
1153 | 1153 | $payment_form->receive_form_submission(); |
1154 | - if ( ! $payment_form->is_valid() ) { |
|
1154 | + if ( ! $payment_form->is_valid()) { |
|
1155 | 1155 | $submission_error_messages = array(); |
1156 | - foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) { |
|
1157 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1156 | + foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) { |
|
1157 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1158 | 1158 | $submission_error_messages[] = sprintf( |
1159 | - _x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ), |
|
1159 | + _x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'), |
|
1160 | 1160 | $validation_error->get_form_section()->html_label_text(), |
1161 | 1161 | $validation_error->getMessage() |
1162 | 1162 | ); |
1163 | 1163 | } |
1164 | 1164 | } |
1165 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1165 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1166 | 1166 | return array(); |
1167 | 1167 | } |
1168 | 1168 | } |
1169 | - } catch ( EE_Error $e ) { |
|
1170 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1169 | + } catch (EE_Error $e) { |
|
1170 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1171 | 1171 | return array(); |
1172 | 1172 | } |
1173 | 1173 | return $payment_form->valid_data(); |
@@ -1189,63 +1189,63 @@ discard block |
||
1189 | 1189 | array( |
1190 | 1190 | 'default' => 0, |
1191 | 1191 | 'required' => false, |
1192 | - 'html_label_text' => __( 'Payment ID', 'event_espresso' ), |
|
1193 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1192 | + 'html_label_text' => __('Payment ID', 'event_espresso'), |
|
1193 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1194 | 1194 | ) |
1195 | 1195 | ), |
1196 | 1196 | 'TXN_ID' => new EE_Text_Input( |
1197 | 1197 | array( |
1198 | 1198 | 'default' => 0, |
1199 | 1199 | 'required' => true, |
1200 | - 'html_label_text' => __( 'Transaction ID', 'event_espresso' ), |
|
1201 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1200 | + 'html_label_text' => __('Transaction ID', 'event_espresso'), |
|
1201 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1202 | 1202 | ) |
1203 | 1203 | ), |
1204 | 1204 | 'type' => new EE_Text_Input( |
1205 | 1205 | array( |
1206 | 1206 | 'default' => 1, |
1207 | 1207 | 'required' => true, |
1208 | - 'html_label_text' => __( 'Payment or Refund', 'event_espresso' ), |
|
1209 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1208 | + 'html_label_text' => __('Payment or Refund', 'event_espresso'), |
|
1209 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1210 | 1210 | ) |
1211 | 1211 | ), |
1212 | 1212 | 'amount' => new EE_Text_Input( |
1213 | 1213 | array( |
1214 | 1214 | 'default' => 0, |
1215 | 1215 | 'required' => true, |
1216 | - 'html_label_text' => __( 'Payment amount', 'event_espresso' ), |
|
1217 | - 'validation_strategies' => array( new EE_Float_Normalization() ) |
|
1216 | + 'html_label_text' => __('Payment amount', 'event_espresso'), |
|
1217 | + 'validation_strategies' => array(new EE_Float_Normalization()) |
|
1218 | 1218 | ) |
1219 | 1219 | ), |
1220 | 1220 | 'status' => new EE_Text_Input( |
1221 | 1221 | array( |
1222 | 1222 | 'default' => EEM_Payment::status_id_approved, |
1223 | 1223 | 'required' => true, |
1224 | - 'html_label_text' => __( 'Payment status', 'event_espresso' ), |
|
1224 | + 'html_label_text' => __('Payment status', 'event_espresso'), |
|
1225 | 1225 | ) |
1226 | 1226 | ), |
1227 | 1227 | 'PMD_ID' => new EE_Text_Input( |
1228 | 1228 | array( |
1229 | 1229 | 'default' => 2, |
1230 | 1230 | 'required' => true, |
1231 | - 'html_label_text' => __( 'Payment Method', 'event_espresso' ), |
|
1232 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1231 | + 'html_label_text' => __('Payment Method', 'event_espresso'), |
|
1232 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1233 | 1233 | ) |
1234 | 1234 | ), |
1235 | 1235 | 'date' => new EE_Text_Input( |
1236 | 1236 | array( |
1237 | 1237 | 'default' => time(), |
1238 | 1238 | 'required' => true, |
1239 | - 'html_label_text' => __( 'Payment date', 'event_espresso' ), |
|
1239 | + 'html_label_text' => __('Payment date', 'event_espresso'), |
|
1240 | 1240 | ) |
1241 | 1241 | ), |
1242 | 1242 | 'txn_id_chq_nmbr' => new EE_Text_Input( |
1243 | 1243 | array( |
1244 | 1244 | 'default' => '', |
1245 | 1245 | 'required' => false, |
1246 | - 'html_label_text' => __( 'Transaction or Cheque Number', 'event_espresso' ), |
|
1246 | + 'html_label_text' => __('Transaction or Cheque Number', 'event_espresso'), |
|
1247 | 1247 | 'validation_strategies' => array( |
1248 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1248 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1249 | 1249 | ) |
1250 | 1250 | ) |
1251 | 1251 | ), |
@@ -1253,9 +1253,9 @@ discard block |
||
1253 | 1253 | array( |
1254 | 1254 | 'default' => '', |
1255 | 1255 | 'required' => false, |
1256 | - 'html_label_text' => __( 'Purchase Order Number', 'event_espresso' ), |
|
1256 | + 'html_label_text' => __('Purchase Order Number', 'event_espresso'), |
|
1257 | 1257 | 'validation_strategies' => array( |
1258 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1258 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1259 | 1259 | ) |
1260 | 1260 | ) |
1261 | 1261 | ), |
@@ -1263,9 +1263,9 @@ discard block |
||
1263 | 1263 | array( |
1264 | 1264 | 'default' => '', |
1265 | 1265 | 'required' => false, |
1266 | - 'html_label_text' => __( 'Extra Field for Accounting', 'event_espresso' ), |
|
1266 | + 'html_label_text' => __('Extra Field for Accounting', 'event_espresso'), |
|
1267 | 1267 | 'validation_strategies' => array( |
1268 | - new EE_Max_Length_Validation_Strategy( __('Input too long', 'event_espresso'), 100 ), |
|
1268 | + new EE_Max_Length_Validation_Strategy(__('Input too long', 'event_espresso'), 100), |
|
1269 | 1269 | ) |
1270 | 1270 | ) |
1271 | 1271 | ), |
@@ -1282,37 +1282,37 @@ discard block |
||
1282 | 1282 | * @param array $valid_data |
1283 | 1283 | * @return EE_Payment |
1284 | 1284 | */ |
1285 | - protected function _create_payment_from_request_data( $valid_data ) { |
|
1286 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1285 | + protected function _create_payment_from_request_data($valid_data) { |
|
1286 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1287 | 1287 | // get payment amount |
1288 | - $amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0; |
|
1288 | + $amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0; |
|
1289 | 1289 | // payments have a type value of 1 and refunds have a type value of -1 |
1290 | 1290 | // so multiplying amount by type will give a positive value for payments, and negative values for refunds |
1291 | - $amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount; |
|
1291 | + $amount = $valid_data['type'] < 0 ? $amount * -1 : $amount; |
|
1292 | 1292 | // for some reason the date string coming in has extra spaces between the date and time. This fixes that. |
1293 | - $date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) ); |
|
1293 | + $date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp')); |
|
1294 | 1294 | $payment = EE_Payment::new_instance( |
1295 | 1295 | array( |
1296 | - 'TXN_ID' => $valid_data[ 'TXN_ID' ], |
|
1297 | - 'STS_ID' => $valid_data[ 'status' ], |
|
1296 | + 'TXN_ID' => $valid_data['TXN_ID'], |
|
1297 | + 'STS_ID' => $valid_data['status'], |
|
1298 | 1298 | 'PAY_timestamp' => $date, |
1299 | 1299 | 'PAY_source' => EEM_Payment_Method::scope_admin, |
1300 | - 'PMD_ID' => $valid_data[ 'PMD_ID' ], |
|
1300 | + 'PMD_ID' => $valid_data['PMD_ID'], |
|
1301 | 1301 | 'PAY_amount' => $amount, |
1302 | - 'PAY_txn_id_chq_nmbr' => $valid_data[ 'txn_id_chq_nmbr' ], |
|
1303 | - 'PAY_po_number' => $valid_data[ 'po_number' ], |
|
1304 | - 'PAY_extra_accntng' => $valid_data[ 'accounting' ], |
|
1302 | + 'PAY_txn_id_chq_nmbr' => $valid_data['txn_id_chq_nmbr'], |
|
1303 | + 'PAY_po_number' => $valid_data['po_number'], |
|
1304 | + 'PAY_extra_accntng' => $valid_data['accounting'], |
|
1305 | 1305 | 'PAY_details' => $valid_data, |
1306 | 1306 | 'PAY_ID' => $PAY_ID |
1307 | 1307 | ), |
1308 | 1308 | '', |
1309 | - array( 'Y-m-d', 'g:i a' ) |
|
1309 | + array('Y-m-d', 'g:i a') |
|
1310 | 1310 | ); |
1311 | 1311 | |
1312 | - if ( ! $payment->save() ) { |
|
1312 | + if ( ! $payment->save()) { |
|
1313 | 1313 | EE_Error::add_error( |
1314 | 1314 | sprintf( |
1315 | - __( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ), |
|
1315 | + __('Payment %1$d has not been successfully saved to the database.', 'event_espresso'), |
|
1316 | 1316 | $payment->ID() |
1317 | 1317 | ), |
1318 | 1318 | __FILE__, __FUNCTION__, __LINE__ |
@@ -1329,15 +1329,15 @@ discard block |
||
1329 | 1329 | * @param \EE_Transaction $transaction |
1330 | 1330 | * @return array |
1331 | 1331 | */ |
1332 | - protected function _process_transaction_payments( EE_Transaction $transaction ) { |
|
1332 | + protected function _process_transaction_payments(EE_Transaction $transaction) { |
|
1333 | 1333 | /** @type EE_Transaction_Payments $transaction_payments */ |
1334 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1334 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1335 | 1335 | //update the transaction with this payment |
1336 | - if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) { |
|
1337 | - EE_Error::add_success( __( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1336 | + if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) { |
|
1337 | + EE_Error::add_success(__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1338 | 1338 | } else { |
1339 | 1339 | EE_Error::add_error( |
1340 | - __( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' ) |
|
1340 | + __('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso') |
|
1341 | 1341 | , __FILE__, __FUNCTION__, __LINE__ |
1342 | 1342 | ); |
1343 | 1343 | } |
@@ -1353,19 +1353,19 @@ discard block |
||
1353 | 1353 | * @param \EE_Payment $payment |
1354 | 1354 | * @return array |
1355 | 1355 | */ |
1356 | - protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) { |
|
1356 | + protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) { |
|
1357 | 1357 | $REG_IDs = array(); |
1358 | 1358 | // grab array of IDs for specific registrations to apply changes to |
1359 | - if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) { |
|
1360 | - $REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ]; |
|
1359 | + if (isset($this->_req_data['txn_admin_payment']['registrations'])) { |
|
1360 | + $REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations']; |
|
1361 | 1361 | } |
1362 | 1362 | //nothing specified ? then get all reg IDs |
1363 | - if ( empty( $REG_IDs ) ) { |
|
1363 | + if (empty($REG_IDs)) { |
|
1364 | 1364 | $registrations = $payment->transaction()->registrations(); |
1365 | - $REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1365 | + $REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1366 | 1366 | } |
1367 | 1367 | // ensure that REG_IDs are integers and NOT strings |
1368 | - return array_map( 'intval', $REG_IDs ); |
|
1368 | + return array_map('intval', $REG_IDs); |
|
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | /** |
1383 | 1383 | * @param array $existing_reg_payment_REG_IDs |
1384 | 1384 | */ |
1385 | - public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) { |
|
1385 | + public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) { |
|
1386 | 1386 | $this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs; |
1387 | 1387 | } |
1388 | 1388 | |
@@ -1397,13 +1397,13 @@ discard block |
||
1397 | 1397 | * @param \EE_Payment $payment |
1398 | 1398 | * @return array |
1399 | 1399 | */ |
1400 | - protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) { |
|
1401 | - if ( $this->existing_reg_payment_REG_IDs() === null ) { |
|
1400 | + protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) { |
|
1401 | + if ($this->existing_reg_payment_REG_IDs() === null) { |
|
1402 | 1402 | // let's get any existing reg payment records for this payment |
1403 | - $existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' ); |
|
1403 | + $existing_reg_payment_REG_IDs = $payment->get_many_related('Registration'); |
|
1404 | 1404 | // but we only want the REG IDs, so grab the array keys |
1405 | - $existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array(); |
|
1406 | - $this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs ); |
|
1405 | + $existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array(); |
|
1406 | + $this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs); |
|
1407 | 1407 | } |
1408 | 1408 | return $this->existing_reg_payment_REG_IDs(); |
1409 | 1409 | } |
@@ -1422,23 +1422,23 @@ discard block |
||
1422 | 1422 | * @param int $PAY_ID |
1423 | 1423 | * @return bool; |
1424 | 1424 | */ |
1425 | - protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) { |
|
1425 | + protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) { |
|
1426 | 1426 | // newly created payments will have nothing recorded for $PAY_ID |
1427 | - if ( $PAY_ID == 0 ) { |
|
1427 | + if ($PAY_ID == 0) { |
|
1428 | 1428 | return false; |
1429 | 1429 | } |
1430 | - $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1431 | - if ( empty( $existing_reg_payment_REG_IDs )) { |
|
1430 | + $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1431 | + if (empty($existing_reg_payment_REG_IDs)) { |
|
1432 | 1432 | return false; |
1433 | 1433 | } |
1434 | 1434 | /** @type EE_Transaction_Payments $transaction_payments */ |
1435 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1435 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1436 | 1436 | return $transaction_payments->delete_registration_payments_and_update_registrations( |
1437 | 1437 | $payment, |
1438 | 1438 | array( |
1439 | 1439 | array( |
1440 | 1440 | 'PAY_ID' => $payment->ID(), |
1441 | - 'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ), |
|
1441 | + 'REG_ID' => array('IN', $existing_reg_payment_REG_IDs), |
|
1442 | 1442 | ) |
1443 | 1443 | ) |
1444 | 1444 | ); |
@@ -1457,25 +1457,25 @@ discard block |
||
1457 | 1457 | * @param array $REG_IDs |
1458 | 1458 | * @return bool |
1459 | 1459 | */ |
1460 | - protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) { |
|
1460 | + protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) { |
|
1461 | 1461 | // we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments() |
1462 | 1462 | // so let's do that using our set of REG_IDs from the form |
1463 | 1463 | $registration_query_where_params = array( |
1464 | - 'REG_ID' => array( 'IN', $REG_IDs ) |
|
1464 | + 'REG_ID' => array('IN', $REG_IDs) |
|
1465 | 1465 | ); |
1466 | 1466 | // but add in some conditions regarding payment, |
1467 | 1467 | // so that we don't apply payments to registrations that are free or have already been paid for |
1468 | 1468 | // but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative ) |
1469 | - if ( ! $payment->is_a_refund() ) { |
|
1470 | - $registration_query_where_params[ 'REG_final_price' ] = array( '!=', 0 ); |
|
1471 | - $registration_query_where_params[ 'REG_final_price*' ] = array( '!=', 'REG_paid', true ); |
|
1469 | + if ( ! $payment->is_a_refund()) { |
|
1470 | + $registration_query_where_params['REG_final_price'] = array('!=', 0); |
|
1471 | + $registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true); |
|
1472 | 1472 | } |
1473 | 1473 | //EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ ); |
1474 | - $registrations = $transaction->registrations( array( $registration_query_where_params ) ); |
|
1475 | - if ( ! empty( $registrations ) ) { |
|
1474 | + $registrations = $transaction->registrations(array($registration_query_where_params)); |
|
1475 | + if ( ! empty($registrations)) { |
|
1476 | 1476 | /** @type EE_Payment_Processor $payment_processor */ |
1477 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1478 | - $payment_processor->process_registration_payments( $transaction, $payment, $registrations ); |
|
1477 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1478 | + $payment_processor->process_registration_payments($transaction, $payment, $registrations); |
|
1479 | 1479 | } |
1480 | 1480 | } |
1481 | 1481 | |
@@ -1491,22 +1491,22 @@ discard block |
||
1491 | 1491 | * @param array $REG_IDs |
1492 | 1492 | * @return bool |
1493 | 1493 | */ |
1494 | - protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) { |
|
1494 | + protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) { |
|
1495 | 1495 | // first if there is no change in status then we get out. |
1496 | 1496 | if ( |
1497 | - ! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ) |
|
1497 | + ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status']) |
|
1498 | 1498 | || $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN' |
1499 | 1499 | ) { |
1500 | 1500 | //no error message, no change requested, just nothing to do man. |
1501 | 1501 | return FALSE; |
1502 | 1502 | } |
1503 | 1503 | /** @type EE_Transaction_Processor $transaction_processor */ |
1504 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1504 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1505 | 1505 | // made it here dude? Oh WOW. K, let's take care of changing the statuses |
1506 | 1506 | return $transaction_processor->manually_update_registration_statuses( |
1507 | 1507 | $transaction, |
1508 | - sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ), |
|
1509 | - array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) |
|
1508 | + sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']), |
|
1509 | + array(array('REG_ID' => array('IN', $REG_IDs))) |
|
1510 | 1510 | ); |
1511 | 1511 | } |
1512 | 1512 | |
@@ -1521,16 +1521,16 @@ discard block |
||
1521 | 1521 | * @param bool | null $delete_txn_reg_status_change |
1522 | 1522 | * @return array |
1523 | 1523 | */ |
1524 | - protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) { |
|
1524 | + protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) { |
|
1525 | 1525 | // was the payment deleted ? |
1526 | - if ( is_bool( $delete_txn_reg_status_change )) { |
|
1526 | + if (is_bool($delete_txn_reg_status_change)) { |
|
1527 | 1527 | return array( |
1528 | 1528 | 'PAY_ID' => $payment->ID(), |
1529 | 1529 | 'amount' => $payment->amount(), |
1530 | 1530 | 'total_paid' => $payment->transaction()->paid(), |
1531 | 1531 | 'txn_status' => $payment->transaction()->status_ID(), |
1532 | 1532 | 'pay_status' => $payment->STS_ID(), |
1533 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1533 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1534 | 1534 | 'delete_txn_reg_status_change' => $delete_txn_reg_status_change, |
1535 | 1535 | ); |
1536 | 1536 | } else { |
@@ -1542,16 +1542,16 @@ discard block |
||
1542 | 1542 | 'pay_status' => $payment->STS_ID(), |
1543 | 1543 | 'PAY_ID' => $payment->ID(), |
1544 | 1544 | 'STS_ID' => $payment->STS_ID(), |
1545 | - 'status' => self::$_pay_status[ $payment->STS_ID() ], |
|
1546 | - 'date' => $payment->timestamp( 'Y-m-d', 'h:i a' ), |
|
1547 | - 'method' => strtoupper( $payment->source() ), |
|
1545 | + 'status' => self::$_pay_status[$payment->STS_ID()], |
|
1546 | + 'date' => $payment->timestamp('Y-m-d', 'h:i a'), |
|
1547 | + 'method' => strtoupper($payment->source()), |
|
1548 | 1548 | 'PM_ID' => $payment->payment_method() ? $payment->payment_method()->ID() : 1, |
1549 | - 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : __( "Unknown", 'event_espresso' ), |
|
1549 | + 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'), |
|
1550 | 1550 | 'gateway_response' => $payment->gateway_response(), |
1551 | 1551 | 'txn_id_chq_nmbr' => $payment->txn_id_chq_nmbr(), |
1552 | 1552 | 'po_number' => $payment->po_number(), |
1553 | 1553 | 'extra_accntng' => $payment->extra_accntng(), |
1554 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1554 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1555 | 1555 | ); |
1556 | 1556 | } |
1557 | 1557 | } |
@@ -1566,39 +1566,39 @@ discard block |
||
1566 | 1566 | * @return void |
1567 | 1567 | */ |
1568 | 1568 | public function delete_payment() { |
1569 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1570 | - $PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0; |
|
1571 | - if ( $PAY_ID ) { |
|
1572 | - $delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false; |
|
1573 | - $payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID ); |
|
1574 | - if ( $payment instanceof EE_Payment ) { |
|
1575 | - $REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1569 | + $json_response_data = array('return_data' => FALSE); |
|
1570 | + $PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0; |
|
1571 | + if ($PAY_ID) { |
|
1572 | + $delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false; |
|
1573 | + $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); |
|
1574 | + if ($payment instanceof EE_Payment) { |
|
1575 | + $REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1576 | 1576 | /** @type EE_Transaction_Payments $transaction_payments */ |
1577 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1578 | - if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) { |
|
1579 | - $json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change ); |
|
1580 | - if ( $delete_txn_reg_status_change ) { |
|
1577 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1578 | + if ($transaction_payments->delete_payment_and_update_transaction($payment)) { |
|
1579 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change); |
|
1580 | + if ($delete_txn_reg_status_change) { |
|
1581 | 1581 | $this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1582 | 1582 | //MAKE sure we also add the delete_txn_req_status_change to the |
1583 | 1583 | //$_REQUEST global because that's how messages will be looking for it. |
1584 | 1584 | $_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1585 | 1585 | $this->_maybe_send_notifications(); |
1586 | - $this->_process_registration_status_change( $payment->transaction(), $REG_IDs ); |
|
1586 | + $this->_process_registration_status_change($payment->transaction(), $REG_IDs); |
|
1587 | 1587 | } |
1588 | 1588 | } |
1589 | 1589 | } else { |
1590 | 1590 | EE_Error::add_error( |
1591 | - __( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ), |
|
1591 | + __('Valid Payment data could not be retrieved from the database.', 'event_espresso'), |
|
1592 | 1592 | __FILE__, __FUNCTION__, __LINE__ |
1593 | 1593 | ); |
1594 | 1594 | } |
1595 | 1595 | } else { |
1596 | 1596 | EE_Error::add_error( |
1597 | - __( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ), |
|
1597 | + __('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'), |
|
1598 | 1598 | __FILE__, __FUNCTION__, __LINE__ |
1599 | 1599 | ); |
1600 | 1600 | } |
1601 | - $notices = EE_Error::get_notices( false, false, false); |
|
1601 | + $notices = EE_Error::get_notices(false, false, false); |
|
1602 | 1602 | $this->_template_args = array( |
1603 | 1603 | 'data' => $json_response_data, |
1604 | 1604 | 'success' => $notices['success'], |
@@ -1618,17 +1618,17 @@ discard block |
||
1618 | 1618 | * @param array $REG_IDs |
1619 | 1619 | * @return array |
1620 | 1620 | */ |
1621 | - protected function _registration_payment_data_array( $REG_IDs ) { |
|
1621 | + protected function _registration_payment_data_array($REG_IDs) { |
|
1622 | 1622 | $registration_payment_data = array(); |
1623 | 1623 | //if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows. |
1624 | - if ( ! empty( $REG_IDs ) ) { |
|
1625 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
1626 | - $registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) ); |
|
1627 | - foreach ( $registrations as $registration ) { |
|
1628 | - if ( $registration instanceof EE_Registration ) { |
|
1629 | - $registration_payment_data[ $registration->ID() ] = array( |
|
1624 | + if ( ! empty($REG_IDs)) { |
|
1625 | + EE_Registry::instance()->load_helper('Template'); |
|
1626 | + $registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs)))); |
|
1627 | + foreach ($registrations as $registration) { |
|
1628 | + if ($registration instanceof EE_Registration) { |
|
1629 | + $registration_payment_data[$registration->ID()] = array( |
|
1630 | 1630 | 'paid' => $registration->pretty_paid(), |
1631 | - 'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ), |
|
1631 | + 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()), |
|
1632 | 1632 | ); |
1633 | 1633 | } |
1634 | 1634 | } |
@@ -1648,30 +1648,30 @@ discard block |
||
1648 | 1648 | * @access protected |
1649 | 1649 | * @param \EE_Payment | null $payment |
1650 | 1650 | */ |
1651 | - protected function _maybe_send_notifications( $payment = null ) { |
|
1652 | - switch ( $payment instanceof EE_Payment ) { |
|
1651 | + protected function _maybe_send_notifications($payment = null) { |
|
1652 | + switch ($payment instanceof EE_Payment) { |
|
1653 | 1653 | // payment notifications |
1654 | 1654 | case true : |
1655 | 1655 | if ( |
1656 | 1656 | isset( |
1657 | - $this->_req_data[ 'txn_payments' ], |
|
1658 | - $this->_req_data[ 'txn_payments' ][ 'send_notifications' ] |
|
1657 | + $this->_req_data['txn_payments'], |
|
1658 | + $this->_req_data['txn_payments']['send_notifications'] |
|
1659 | 1659 | ) && |
1660 | - filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1660 | + filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1661 | 1661 | ) { |
1662 | - $this->_process_payment_notification( $payment ); |
|
1662 | + $this->_process_payment_notification($payment); |
|
1663 | 1663 | } |
1664 | 1664 | break; |
1665 | 1665 | // registration notifications |
1666 | 1666 | case false : |
1667 | 1667 | if ( |
1668 | 1668 | isset( |
1669 | - $this->_req_data[ 'txn_reg_status_change' ], |
|
1670 | - $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] |
|
1669 | + $this->_req_data['txn_reg_status_change'], |
|
1670 | + $this->_req_data['txn_reg_status_change']['send_notifications'] |
|
1671 | 1671 | ) && |
1672 | - filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1672 | + filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1673 | 1673 | ) { |
1674 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
1674 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
1675 | 1675 | } |
1676 | 1676 | break; |
1677 | 1677 | } |
@@ -1687,11 +1687,11 @@ discard block |
||
1687 | 1687 | * @return void |
1688 | 1688 | */ |
1689 | 1689 | protected function _send_payment_reminder() { |
1690 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1691 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1692 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
|
1693 | - do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
|
1694 | - $this->_redirect_after_action( FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE ); |
|
1690 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
1691 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1692 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array(); |
|
1693 | + do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction); |
|
1694 | + $this->_redirect_after_action(FALSE, __('payment reminder', 'event_espresso'), __('sent', 'event_espresso'), $query_args, TRUE); |
|
1695 | 1695 | } |
1696 | 1696 | |
1697 | 1697 | |
@@ -1705,36 +1705,36 @@ discard block |
||
1705 | 1705 | * @param string $view |
1706 | 1706 | * @return mixed int = count || array of transaction objects |
1707 | 1707 | */ |
1708 | - public function get_transactions( $perpage, $count = FALSE, $view = '' ) { |
|
1708 | + public function get_transactions($perpage, $count = FALSE, $view = '') { |
|
1709 | 1709 | |
1710 | 1710 | $TXN = EEM_Transaction::instance(); |
1711 | 1711 | |
1712 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
1713 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
1712 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
1713 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
1714 | 1714 | |
1715 | 1715 | //make sure our timestamps start and end right at the boundaries for each day |
1716 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1717 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1716 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
1717 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
1718 | 1718 | |
1719 | 1719 | |
1720 | 1720 | //convert to timestamps |
1721 | - $start_date = strtotime( $start_date ); |
|
1722 | - $end_date = strtotime( $end_date ); |
|
1721 | + $start_date = strtotime($start_date); |
|
1722 | + $end_date = strtotime($end_date); |
|
1723 | 1723 | |
1724 | 1724 | //makes sure start date is the lowest value and vice versa |
1725 | - $start_date = min( $start_date, $end_date ); |
|
1726 | - $end_date = max( $start_date, $end_date ); |
|
1725 | + $start_date = min($start_date, $end_date); |
|
1726 | + $end_date = max($start_date, $end_date); |
|
1727 | 1727 | |
1728 | 1728 | //convert to correct format for query |
1729 | - $start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
1730 | - $end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
1729 | + $start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
1730 | + $end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
1731 | 1731 | |
1732 | 1732 | |
1733 | 1733 | |
1734 | 1734 | //set orderby |
1735 | 1735 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1736 | 1736 | |
1737 | - switch ( $this->_req_data['orderby'] ) { |
|
1737 | + switch ($this->_req_data['orderby']) { |
|
1738 | 1738 | case 'TXN_ID': |
1739 | 1739 | $orderby = 'TXN_ID'; |
1740 | 1740 | break; |
@@ -1748,66 +1748,66 @@ discard block |
||
1748 | 1748 | $orderby = 'TXN_timestamp'; |
1749 | 1749 | } |
1750 | 1750 | |
1751 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
1752 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1753 | - $per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10; |
|
1754 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1751 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
1752 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1753 | + $per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10; |
|
1754 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1755 | 1755 | |
1756 | - $offset = ($current_page-1)*$per_page; |
|
1757 | - $limit = array( $offset, $per_page ); |
|
1756 | + $offset = ($current_page - 1) * $per_page; |
|
1757 | + $limit = array($offset, $per_page); |
|
1758 | 1758 | |
1759 | 1759 | $_where = array( |
1760 | - 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ), |
|
1760 | + 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)), |
|
1761 | 1761 | 'Registration.REG_count' => 1 |
1762 | 1762 | ); |
1763 | 1763 | |
1764 | - if ( isset( $this->_req_data['EVT_ID'] ) ) { |
|
1764 | + if (isset($this->_req_data['EVT_ID'])) { |
|
1765 | 1765 | $_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID']; |
1766 | 1766 | } |
1767 | 1767 | |
1768 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1769 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1768 | + if (isset($this->_req_data['s'])) { |
|
1769 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1770 | 1770 | $_where['OR'] = array( |
1771 | - 'Registration.Event.EVT_name' => array( 'LIKE', $search_string ), |
|
1772 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ), |
|
1773 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ), |
|
1774 | - 'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ), |
|
1775 | - 'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ), |
|
1776 | - 'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ), |
|
1777 | - 'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ), |
|
1778 | - 'Registration.Attendee.ATT_email' => array('LIKE', $search_string ), |
|
1779 | - 'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ), |
|
1780 | - 'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ), |
|
1781 | - 'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ), |
|
1782 | - 'Registration.REG_final_price' => array( 'LIKE', $search_string ), |
|
1783 | - 'Registration.REG_code' => array( 'LIKE', $search_string ), |
|
1784 | - 'Registration.REG_count' => array( 'LIKE' , $search_string ), |
|
1785 | - 'Registration.REG_group_size' => array( 'LIKE' , $search_string ), |
|
1786 | - 'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ), |
|
1787 | - 'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ), |
|
1788 | - 'Payment.PAY_source' => array('LIKE', $search_string ), |
|
1789 | - 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ), |
|
1790 | - 'TXN_session_data' => array( 'LIKE', $search_string ), |
|
1791 | - 'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string ) |
|
1771 | + 'Registration.Event.EVT_name' => array('LIKE', $search_string), |
|
1772 | + 'Registration.Event.EVT_desc' => array('LIKE', $search_string), |
|
1773 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $search_string), |
|
1774 | + 'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string), |
|
1775 | + 'Registration.Attendee.ATT_fname' => array('LIKE', $search_string), |
|
1776 | + 'Registration.Attendee.ATT_lname' => array('LIKE', $search_string), |
|
1777 | + 'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string), |
|
1778 | + 'Registration.Attendee.ATT_email' => array('LIKE', $search_string), |
|
1779 | + 'Registration.Attendee.ATT_address' => array('LIKE', $search_string), |
|
1780 | + 'Registration.Attendee.ATT_address2' => array('LIKE', $search_string), |
|
1781 | + 'Registration.Attendee.ATT_city' => array('LIKE', $search_string), |
|
1782 | + 'Registration.REG_final_price' => array('LIKE', $search_string), |
|
1783 | + 'Registration.REG_code' => array('LIKE', $search_string), |
|
1784 | + 'Registration.REG_count' => array('LIKE', $search_string), |
|
1785 | + 'Registration.REG_group_size' => array('LIKE', $search_string), |
|
1786 | + 'Registration.Ticket.TKT_name' => array('LIKE', $search_string), |
|
1787 | + 'Registration.Ticket.TKT_description' => array('LIKE', $search_string), |
|
1788 | + 'Payment.PAY_source' => array('LIKE', $search_string), |
|
1789 | + 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string), |
|
1790 | + 'TXN_session_data' => array('LIKE', $search_string), |
|
1791 | + 'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string) |
|
1792 | 1792 | ); |
1793 | 1793 | } |
1794 | 1794 | |
1795 | 1795 | //failed transactions |
1796 | - $failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE; |
|
1797 | - $abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE; |
|
1796 | + $failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE; |
|
1797 | + $abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE; |
|
1798 | 1798 | |
1799 | - if ( $failed ) { |
|
1800 | - $_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code; |
|
1801 | - } else if ( $abandoned ) { |
|
1799 | + if ($failed) { |
|
1800 | + $_where['STS_ID'] = EEM_Transaction::failed_status_code; |
|
1801 | + } else if ($abandoned) { |
|
1802 | 1802 | $_where['STS_ID'] = EEM_Transaction::abandoned_status_code; |
1803 | 1803 | } else { |
1804 | - $_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code ); |
|
1805 | - $_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code ); |
|
1804 | + $_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code); |
|
1805 | + $_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code); |
|
1806 | 1806 | } |
1807 | 1807 | |
1808 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit ); |
|
1808 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit); |
|
1809 | 1809 | |
1810 | - $transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params); |
|
1810 | + $transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params); |
|
1811 | 1811 | |
1812 | 1812 | |
1813 | 1813 | return $transactions; |