@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | |
107 | 107 | /** |
108 | 108 | * grab url requests and route them |
109 | - * @access private |
|
110 | - * @return void |
|
111 | - */ |
|
109 | + * @access private |
|
110 | + * @return void |
|
111 | + */ |
|
112 | 112 | public function _set_page_routes() { |
113 | 113 | |
114 | 114 | $this->_set_transaction_status_array(); |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | /** |
264 | 264 | * _set_transaction_status_array |
265 | 265 | * sets list of transaction statuses |
266 | - * |
|
266 | + * |
|
267 | 267 | * @access private |
268 | - * @return void |
|
269 | - */ |
|
268 | + * @return void |
|
269 | + */ |
|
270 | 270 | private function _set_transaction_status_array() { |
271 | 271 | self::$_txn_status = EEM_Transaction::instance()->status_array(TRUE); |
272 | 272 | } |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | |
289 | 289 | /** |
290 | 290 | * get list of payment statuses |
291 | - * |
|
291 | + * |
|
292 | 292 | * @access private |
293 | - * @return void |
|
294 | - */ |
|
293 | + * @return void |
|
294 | + */ |
|
295 | 295 | private function _get_payment_status_array() { |
296 | 296 | self::$_pay_status = EEM_Payment::instance()->status_array(TRUE); |
297 | 297 | $this->_template_args['payment_status'] = self::$_pay_status; |
@@ -399,18 +399,18 @@ discard block |
||
399 | 399 | if ( is_object( $this->_transaction) ) |
400 | 400 | return; //get out we've already set the object |
401 | 401 | |
402 | - $TXN = EEM_Transaction::instance(); |
|
402 | + $TXN = EEM_Transaction::instance(); |
|
403 | 403 | |
404 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
404 | + $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
405 | 405 | |
406 | - //get transaction object |
|
407 | - $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
|
408 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
406 | + //get transaction object |
|
407 | + $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
|
408 | + $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
409 | 409 | |
410 | 410 | if ( empty( $this->_transaction ) ) { |
411 | - $error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . esc_html__(' could not be retrieved.', 'event_espresso'); |
|
411 | + $error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . esc_html__(' could not be retrieved.', 'event_espresso'); |
|
412 | 412 | EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
413 | - } |
|
413 | + } |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
@@ -525,12 +525,12 @@ discard block |
||
525 | 525 | |
526 | 526 | |
527 | 527 | /** |
528 | - * _transaction_details |
|
528 | + * _transaction_details |
|
529 | 529 | * generates HTML for the View Transaction Details Admin page |
530 | - * |
|
530 | + * |
|
531 | 531 | * @access protected |
532 | - * @return void |
|
533 | - */ |
|
532 | + * @return void |
|
533 | + */ |
|
534 | 534 | protected function _transaction_details() { |
535 | 535 | do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
536 | 536 | |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | 'button secondary-button right', |
582 | 582 | 'dashicons dashicons-email-alt' |
583 | 583 | ) |
584 | - : ''; |
|
584 | + : ''; |
|
585 | 585 | } else { |
586 | 586 | $this->_template_args['send_payment_reminder_button'] = ''; |
587 | 587 | } |
@@ -735,10 +735,10 @@ discard block |
||
735 | 735 | /** |
736 | 736 | * txn_details_meta_box |
737 | 737 | * generates HTML for the Transaction main meta box |
738 | - * |
|
738 | + * |
|
739 | 739 | * @access public |
740 | - * @return void |
|
741 | - */ |
|
740 | + * @return void |
|
741 | + */ |
|
742 | 742 | public function txn_details_meta_box() { |
743 | 743 | |
744 | 744 | $this->_set_transaction_object(); |
@@ -1039,15 +1039,15 @@ discard block |
||
1039 | 1039 | if ( ! $registration instanceof EE_Registration ) { |
1040 | 1040 | continue; |
1041 | 1041 | } |
1042 | - try { |
|
1043 | - $event = $registration->event(); |
|
1044 | - $event_name = $event instanceof EE_Event |
|
1045 | - ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') |
|
1046 | - : ''; |
|
1047 | - } catch (Exception $e) { |
|
1048 | - EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1049 | - $event_name = esc_html__('Unknown', 'event_espresso'); |
|
1050 | - } |
|
1042 | + try { |
|
1043 | + $event = $registration->event(); |
|
1044 | + $event_name = $event instanceof EE_Event |
|
1045 | + ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') |
|
1046 | + : ''; |
|
1047 | + } catch (Exception $e) { |
|
1048 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1049 | + $event_name = esc_html__('Unknown', 'event_espresso'); |
|
1050 | + } |
|
1051 | 1051 | $this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] = $registration->status_ID(); |
1052 | 1052 | $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->count(); |
1053 | 1053 | $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
@@ -1116,10 +1116,10 @@ discard block |
||
1116 | 1116 | /** |
1117 | 1117 | * txn_billing_info_side_meta_box |
1118 | 1118 | * generates HTML for the Edit Transaction side meta box |
1119 | - * |
|
1119 | + * |
|
1120 | 1120 | * @access public |
1121 | - * @return void |
|
1122 | - */ |
|
1121 | + * @return void |
|
1122 | + */ |
|
1123 | 1123 | public function txn_billing_info_side_meta_box() { |
1124 | 1124 | |
1125 | 1125 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
@@ -1137,10 +1137,10 @@ discard block |
||
1137 | 1137 | /** |
1138 | 1138 | * apply_payments_or_refunds |
1139 | 1139 | * registers a payment or refund made towards a transaction |
1140 | - * |
|
1140 | + * |
|
1141 | 1141 | * @access public |
1142 | - * @return void |
|
1143 | - */ |
|
1142 | + * @return void |
|
1143 | + */ |
|
1144 | 1144 | public function apply_payments_or_refunds() { |
1145 | 1145 | $json_response_data = array( 'return_data' => FALSE ); |
1146 | 1146 | $valid_data = $this->_validate_payment_request_data(); |
@@ -1294,9 +1294,9 @@ discard block |
||
1294 | 1294 | 'default' => '', |
1295 | 1295 | 'required' => false, |
1296 | 1296 | 'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ), |
1297 | - 'validation_strategies' => array( |
|
1298 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1299 | - ) |
|
1297 | + 'validation_strategies' => array( |
|
1298 | + new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1299 | + ) |
|
1300 | 1300 | ) |
1301 | 1301 | ), |
1302 | 1302 | 'po_number' => new EE_Text_Input( |
@@ -1304,9 +1304,9 @@ discard block |
||
1304 | 1304 | 'default' => '', |
1305 | 1305 | 'required' => false, |
1306 | 1306 | 'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ), |
1307 | - 'validation_strategies' => array( |
|
1308 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1309 | - ) |
|
1307 | + 'validation_strategies' => array( |
|
1308 | + new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1309 | + ) |
|
1310 | 1310 | ) |
1311 | 1311 | ), |
1312 | 1312 | 'accounting' => new EE_Text_Input( |
@@ -1314,9 +1314,9 @@ discard block |
||
1314 | 1314 | 'default' => '', |
1315 | 1315 | 'required' => false, |
1316 | 1316 | 'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ), |
1317 | - 'validation_strategies' => array( |
|
1318 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1319 | - ) |
|
1317 | + 'validation_strategies' => array( |
|
1318 | + new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1319 | + ) |
|
1320 | 1320 | ) |
1321 | 1321 | ), |
1322 | 1322 | ) |
@@ -1611,10 +1611,10 @@ discard block |
||
1611 | 1611 | /** |
1612 | 1612 | * delete_payment |
1613 | 1613 | * delete a payment or refund made towards a transaction |
1614 | - * |
|
1614 | + * |
|
1615 | 1615 | * @access public |
1616 | - * @return void |
|
1617 | - */ |
|
1616 | + * @return void |
|
1617 | + */ |
|
1618 | 1618 | public function delete_payment() { |
1619 | 1619 | $json_response_data = array( 'return_data' => FALSE ); |
1620 | 1620 | $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; |
@@ -1731,12 +1731,12 @@ discard block |
||
1731 | 1731 | /** |
1732 | 1732 | * _send_payment_reminder |
1733 | 1733 | * generates HTML for the View Transaction Details Admin page |
1734 | - * |
|
1734 | + * |
|
1735 | 1735 | * @access protected |
1736 | - * @return void |
|
1737 | - */ |
|
1736 | + * @return void |
|
1737 | + */ |
|
1738 | 1738 | protected function _send_payment_reminder() { |
1739 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1739 | + $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1740 | 1740 | $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
1741 | 1741 | $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
1742 | 1742 | do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
@@ -1758,29 +1758,29 @@ discard block |
||
1758 | 1758 | |
1759 | 1759 | $TXN = EEM_Transaction::instance(); |
1760 | 1760 | |
1761 | - $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' )); |
|
1762 | - $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' ); |
|
1761 | + $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' )); |
|
1762 | + $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' ); |
|
1763 | 1763 | |
1764 | - //make sure our timestamps start and end right at the boundaries for each day |
|
1765 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1766 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1764 | + //make sure our timestamps start and end right at the boundaries for each day |
|
1765 | + $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1766 | + $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1767 | 1767 | |
1768 | 1768 | |
1769 | - //convert to timestamps |
|
1770 | - $start_date = strtotime( $start_date ); |
|
1771 | - $end_date = strtotime( $end_date ); |
|
1769 | + //convert to timestamps |
|
1770 | + $start_date = strtotime( $start_date ); |
|
1771 | + $end_date = strtotime( $end_date ); |
|
1772 | 1772 | |
1773 | - //makes sure start date is the lowest value and vice versa |
|
1774 | - $start_date = min( $start_date, $end_date ); |
|
1775 | - $end_date = max( $start_date, $end_date ); |
|
1773 | + //makes sure start date is the lowest value and vice versa |
|
1774 | + $start_date = min( $start_date, $end_date ); |
|
1775 | + $end_date = max( $start_date, $end_date ); |
|
1776 | 1776 | |
1777 | - //convert to correct format for query |
|
1777 | + //convert to correct format for query |
|
1778 | 1778 | $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' ); |
1779 | 1779 | $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' ); |
1780 | 1780 | |
1781 | 1781 | |
1782 | 1782 | |
1783 | - //set orderby |
|
1783 | + //set orderby |
|
1784 | 1784 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1785 | 1785 | |
1786 | 1786 | switch ( $this->_req_data['orderby'] ) { |
@@ -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' => esc_html__('Add New Transaction', 'event_espresso'), |
99 | 99 | 'edit' => esc_html__('Edit Transaction', 'event_espresso'), |
100 | - 'delete' => esc_html__('Delete Transaction','event_espresso'), |
|
100 | + 'delete' => esc_html__('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' => esc_html__('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,23 +237,23 @@ 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' ] = esc_html__( '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' ] = esc_html__( '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 | - EE_Registry::$i18n_js_strings[ 'payments_total' ] = esc_html__( 'Payments Total', 'event_espresso' ); |
|
256 | - EE_Registry::$i18n_js_strings[ 'transaction_overpaid' ] = esc_html__( 'This transaction has been overpaid ! Payments Total', 'event_espresso' ); |
|
251 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = esc_html__('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'] = esc_html__('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 | + EE_Registry::$i18n_js_strings['payments_total'] = esc_html__('Payments Total', 'event_espresso'); |
|
256 | + EE_Registry::$i18n_js_strings['transaction_overpaid'] = esc_html__('This transaction has been overpaid ! Payments Total', 'event_espresso'); |
|
257 | 257 | } |
258 | 258 | public function admin_notices() {} |
259 | 259 | public function admin_footer_scripts() {} |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function load_scripts_styles() { |
322 | 322 | //enqueue style |
323 | - wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
323 | + wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
324 | 324 | wp_enqueue_style('espresso_txn'); |
325 | 325 | |
326 | 326 | //scripts |
327 | 327 | add_filter('FHEE_load_accounting_js', '__return_true'); |
328 | 328 | |
329 | 329 | //scripts |
330 | - 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); |
|
330 | + 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); |
|
331 | 331 | wp_enqueue_script('espresso_txn'); |
332 | 332 | |
333 | 333 | } |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | * @return void |
368 | 368 | */ |
369 | 369 | protected function _set_list_table_views_default() { |
370 | - $this->_views = array ( |
|
371 | - 'all' => array ( |
|
370 | + $this->_views = array( |
|
371 | + 'all' => array( |
|
372 | 372 | 'slug' => 'all', |
373 | 373 | 'label' => esc_html__('View All Transactions', 'event_espresso'), |
374 | 374 | 'count' => 0 |
@@ -396,20 +396,20 @@ discard block |
||
396 | 396 | * @return void |
397 | 397 | */ |
398 | 398 | private function _set_transaction_object() { |
399 | - if ( is_object( $this->_transaction) ) |
|
399 | + if (is_object($this->_transaction)) |
|
400 | 400 | return; //get out we've already set the object |
401 | 401 | |
402 | 402 | $TXN = EEM_Transaction::instance(); |
403 | 403 | |
404 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
404 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
405 | 405 | |
406 | 406 | //get transaction object |
407 | 407 | $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
408 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
408 | + $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
409 | 409 | |
410 | - if ( empty( $this->_transaction ) ) { |
|
411 | - $error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . esc_html__(' could not be retrieved.', 'event_espresso'); |
|
412 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
410 | + if (empty($this->_transaction)) { |
|
411 | + $error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.esc_html__(' could not be retrieved.', 'event_espresso'); |
|
412 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
@@ -422,12 +422,12 @@ discard block |
||
422 | 422 | * @return array |
423 | 423 | */ |
424 | 424 | protected function _transaction_legend_items() { |
425 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
425 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
426 | 426 | $items = array(); |
427 | 427 | |
428 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
429 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
430 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
428 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
429 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
430 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
431 | 431 | $items['view_related_messages'] = array( |
432 | 432 | 'class' => $related_for_icon['css_class'], |
433 | 433 | 'desc' => $related_for_icon['label'], |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | |
438 | 438 | $items = apply_filters( |
439 | 439 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__items', |
440 | - array_merge( $items, |
|
440 | + array_merge($items, |
|
441 | 441 | array( |
442 | 442 | 'view_details' => array( |
443 | 443 | 'class' => 'dashicons dashicons-cart', |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | ), |
450 | 450 | 'view_receipt' => array( |
451 | 451 | 'class' => 'dashicons dashicons-media-default', |
452 | - 'desc' => esc_html__('View Transaction Receipt', 'event_espresso' ) |
|
452 | + 'desc' => esc_html__('View Transaction Receipt', 'event_espresso') |
|
453 | 453 | ), |
454 | 454 | 'view_registration' => array( |
455 | 455 | 'class' => 'dashicons dashicons-clipboard', |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | ) |
460 | 460 | ); |
461 | 461 | |
462 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) { |
|
463 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
462 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) { |
|
463 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
464 | 464 | $items['send_payment_reminder'] = array( |
465 | 465 | 'class' => 'dashicons dashicons-email-alt', |
466 | 466 | 'desc' => esc_html__('Send Payment Reminder', 'event_espresso') |
@@ -481,29 +481,29 @@ discard block |
||
481 | 481 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items', |
482 | 482 | array( |
483 | 483 | 'overpaid' => array( |
484 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code, |
|
485 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' ) |
|
484 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code, |
|
485 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence') |
|
486 | 486 | ), |
487 | 487 | 'complete' => array( |
488 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code, |
|
489 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' ) |
|
488 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code, |
|
489 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence') |
|
490 | 490 | ), |
491 | 491 | 'incomplete' => array( |
492 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code, |
|
493 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' ) |
|
492 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code, |
|
493 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence') |
|
494 | 494 | ), |
495 | 495 | 'abandoned' => array( |
496 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code, |
|
497 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' ) |
|
496 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code, |
|
497 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence') |
|
498 | 498 | ), |
499 | 499 | 'failed' => array( |
500 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code, |
|
501 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' ) |
|
500 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code, |
|
501 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence') |
|
502 | 502 | ) |
503 | 503 | ) |
504 | 504 | ); |
505 | 505 | |
506 | - return array_merge( $items, $more_items); |
|
506 | + return array_merge($items, $more_items); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -516,9 +516,9 @@ discard block |
||
516 | 516 | */ |
517 | 517 | protected function _transactions_overview_list_table() { |
518 | 518 | $this->_admin_page_title = esc_html__('Transactions', 'event_espresso'); |
519 | - $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL; |
|
520 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( esc_html__('%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>' ) : ''; |
|
521 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() ); |
|
519 | + $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL; |
|
520 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(esc_html__('%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>') : ''; |
|
521 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items()); |
|
522 | 522 | $this->display_admin_list_table_page_with_no_sidebar(); |
523 | 523 | } |
524 | 524 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * @return void |
533 | 533 | */ |
534 | 534 | protected function _transaction_details() { |
535 | - do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
|
535 | + do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction); |
|
536 | 536 | |
537 | 537 | $this->_set_transaction_status_array(); |
538 | 538 | |
@@ -545,14 +545,14 @@ discard block |
||
545 | 545 | $attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL; |
546 | 546 | |
547 | 547 | $this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID(); |
548 | - $this->_template_args['txn_nmbr']['label'] = esc_html__( 'Transaction Number', 'event_espresso' ); |
|
548 | + $this->_template_args['txn_nmbr']['label'] = esc_html__('Transaction Number', 'event_espresso'); |
|
549 | 549 | |
550 | 550 | $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp'); |
551 | - $this->_template_args['txn_datetime']['label'] = esc_html__( 'Date', 'event_espresso' ); |
|
551 | + $this->_template_args['txn_datetime']['label'] = esc_html__('Date', 'event_espresso'); |
|
552 | 552 | |
553 | - $this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ]; |
|
554 | - $this->_template_args['txn_status']['label'] = esc_html__( 'Transaction Status', 'event_espresso' ); |
|
555 | - $this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID'); |
|
553 | + $this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')]; |
|
554 | + $this->_template_args['txn_status']['label'] = esc_html__('Transaction Status', 'event_espresso'); |
|
555 | + $this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID'); |
|
556 | 556 | |
557 | 557 | $this->_template_args['grand_total'] = $this->_transaction->get('TXN_total'); |
558 | 558 | $this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid'); |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | ) |
566 | 566 | ) { |
567 | 567 | $this->_template_args['send_payment_reminder_button'] = |
568 | - EEH_MSG_Template::is_mt_active( 'payment_reminder' ) |
|
568 | + EEH_MSG_Template::is_mt_active('payment_reminder') |
|
569 | 569 | && $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code |
570 | 570 | && $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code |
571 | 571 | ? EEH_Template::get_button_or_link( |
@@ -587,40 +587,40 @@ discard block |
||
587 | 587 | } |
588 | 588 | |
589 | 589 | $amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid'); |
590 | - $this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE ); |
|
591 | - if ( EE_Registry::instance()->CFG->currency->sign_b4 ) { |
|
592 | - $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due']; |
|
590 | + $this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE); |
|
591 | + if (EE_Registry::instance()->CFG->currency->sign_b4) { |
|
592 | + $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due']; |
|
593 | 593 | } else { |
594 | - $this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign; |
|
594 | + $this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign; |
|
595 | 595 | } |
596 | - $this->_template_args['amount_due_class'] = ''; |
|
596 | + $this->_template_args['amount_due_class'] = ''; |
|
597 | 597 | |
598 | - if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) { |
|
598 | + if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) { |
|
599 | 599 | // paid in full |
600 | - $this->_template_args['amount_due'] = FALSE; |
|
601 | - } elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) { |
|
600 | + $this->_template_args['amount_due'] = FALSE; |
|
601 | + } elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) { |
|
602 | 602 | // overpaid |
603 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
604 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) { |
|
603 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
604 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) { |
|
605 | 605 | // monies owing |
606 | - $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
607 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) { |
|
606 | + $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
607 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) { |
|
608 | 608 | // no payments made yet |
609 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
610 | - } elseif ( $this->_transaction->get('TXN_total') == 0 ) { |
|
609 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
610 | + } elseif ($this->_transaction->get('TXN_total') == 0) { |
|
611 | 611 | // free event |
612 | - $this->_template_args['amount_due'] = FALSE; |
|
612 | + $this->_template_args['amount_due'] = FALSE; |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | $payment_method = $this->_transaction->payment_method(); |
616 | 616 | |
617 | 617 | $this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method |
618 | 618 | ? $payment_method->admin_name() |
619 | - : esc_html__( 'Unknown', 'event_espresso' ); |
|
619 | + : esc_html__('Unknown', 'event_espresso'); |
|
620 | 620 | |
621 | 621 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
622 | 622 | // link back to overview |
623 | - $this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] ) |
|
623 | + $this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER']) |
|
624 | 624 | ? $_SERVER['HTTP_REFERER'] |
625 | 625 | : TXN_ADMIN_URL; |
626 | 626 | |
@@ -628,13 +628,13 @@ discard block |
||
628 | 628 | // next link |
629 | 629 | $next_txn = $this->_transaction->next( |
630 | 630 | null, |
631 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
631 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
632 | 632 | 'TXN_ID' |
633 | 633 | ); |
634 | 634 | $this->_template_args['next_transaction'] = $next_txn |
635 | 635 | ? $this->_next_link( |
636 | 636 | EE_Admin_Page::add_query_args_and_nonce( |
637 | - array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ), |
|
637 | + array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']), |
|
638 | 638 | TXN_ADMIN_URL |
639 | 639 | ), |
640 | 640 | 'dashicons dashicons-arrow-right ee-icon-size-22' |
@@ -643,13 +643,13 @@ discard block |
||
643 | 643 | // previous link |
644 | 644 | $previous_txn = $this->_transaction->previous( |
645 | 645 | null, |
646 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
646 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
647 | 647 | 'TXN_ID' |
648 | 648 | ); |
649 | 649 | $this->_template_args['previous_transaction'] = $previous_txn |
650 | 650 | ? $this->_previous_link( |
651 | 651 | EE_Admin_Page::add_query_args_and_nonce( |
652 | - array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ), |
|
652 | + array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']), |
|
653 | 653 | TXN_ADMIN_URL |
654 | 654 | ), |
655 | 655 | 'dashicons dashicons-arrow-left ee-icon-size-22' |
@@ -659,16 +659,16 @@ discard block |
||
659 | 659 | // were we just redirected here after adding a new registration ??? |
660 | 660 | if ( |
661 | 661 | isset( |
662 | - $this->_req_data[ 'redirect_from' ], |
|
663 | - $this->_req_data[ 'EVT_ID' ], |
|
664 | - $this->_req_data[ 'event_name' ] |
|
662 | + $this->_req_data['redirect_from'], |
|
663 | + $this->_req_data['EVT_ID'], |
|
664 | + $this->_req_data['event_name'] |
|
665 | 665 | ) |
666 | 666 | ) { |
667 | 667 | if ( |
668 | 668 | EE_Registry::instance()->CAP->current_user_can( |
669 | 669 | 'ee_edit_registrations', |
670 | 670 | 'espresso_registrations_new_registration', |
671 | - $this->_req_data[ 'EVT_ID' ] |
|
671 | + $this->_req_data['EVT_ID'] |
|
672 | 672 | ) |
673 | 673 | ) { |
674 | 674 | $this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="'; |
@@ -678,25 +678,25 @@ discard block |
||
678 | 678 | 'action' => 'new_registration', |
679 | 679 | 'return' => 'default', |
680 | 680 | 'TXN_ID' => $this->_transaction->ID(), |
681 | - 'event_id' => $this->_req_data[ 'EVT_ID' ], |
|
681 | + 'event_id' => $this->_req_data['EVT_ID'], |
|
682 | 682 | ), |
683 | 683 | REG_ADMIN_URL |
684 | 684 | ); |
685 | 685 | $this->_admin_page_title .= '">'; |
686 | 686 | |
687 | 687 | $this->_admin_page_title .= sprintf( |
688 | - esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso' ), |
|
689 | - htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' ) |
|
688 | + esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso'), |
|
689 | + htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8') |
|
690 | 690 | ); |
691 | 691 | $this->_admin_page_title .= '</a>'; |
692 | 692 | } |
693 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
693 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
694 | 694 | } |
695 | 695 | // grab messages at the last second |
696 | 696 | $this->_template_args['notices'] = EE_Error::get_notices(); |
697 | 697 | // path to template |
698 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php'; |
|
699 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
698 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php'; |
|
699 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
700 | 700 | |
701 | 701 | // the details template wrapper |
702 | 702 | $this->display_admin_page_with_sidebar(); |
@@ -715,18 +715,18 @@ discard block |
||
715 | 715 | |
716 | 716 | $this->_set_transaction_object(); |
717 | 717 | |
718 | - add_meta_box( 'edit-txn-details-mbox', esc_html__( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' ); |
|
718 | + add_meta_box('edit-txn-details-mbox', esc_html__('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high'); |
|
719 | 719 | add_meta_box( |
720 | 720 | 'edit-txn-attendees-mbox', |
721 | - esc_html__( 'Attendees Registered in this Transaction', 'event_espresso' ), |
|
722 | - array( $this, 'txn_attendees_meta_box' ), |
|
721 | + esc_html__('Attendees Registered in this Transaction', 'event_espresso'), |
|
722 | + array($this, 'txn_attendees_meta_box'), |
|
723 | 723 | $this->_wp_page_slug, |
724 | 724 | 'normal', |
725 | 725 | 'high', |
726 | - array( 'TXN_ID' => $this->_transaction->ID() ) |
|
726 | + array('TXN_ID' => $this->_transaction->ID()) |
|
727 | 727 | ); |
728 | - add_meta_box( 'edit-txn-registrant-mbox', esc_html__( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
729 | - add_meta_box( 'edit-txn-billing-info-mbox', esc_html__( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
728 | + add_meta_box('edit-txn-registrant-mbox', esc_html__('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
729 | + add_meta_box('edit-txn-billing-info-mbox', esc_html__('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
730 | 730 | |
731 | 731 | } |
732 | 732 | |
@@ -747,15 +747,15 @@ discard block |
||
747 | 747 | |
748 | 748 | //get line table |
749 | 749 | EEH_Autoloader::register_line_item_display_autoloaders(); |
750 | - $Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' ); |
|
751 | - $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() ); |
|
750 | + $Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy'); |
|
751 | + $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item()); |
|
752 | 752 | $this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code'); |
753 | 753 | |
754 | 754 | // process taxes |
755 | - $taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax ))); |
|
756 | - $this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE; |
|
755 | + $taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
756 | + $this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE; |
|
757 | 757 | |
758 | - $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE ); |
|
758 | + $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE); |
|
759 | 759 | $this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total'); |
760 | 760 | $this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID'); |
761 | 761 | |
@@ -763,63 +763,63 @@ discard block |
||
763 | 763 | |
764 | 764 | // process payment details |
765 | 765 | $payments = $this->_transaction->get_many_related('Payment'); |
766 | - if( ! empty( $payments ) ) { |
|
767 | - $this->_template_args[ 'payments' ] = $payments; |
|
768 | - $this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments ); |
|
766 | + if ( ! empty($payments)) { |
|
767 | + $this->_template_args['payments'] = $payments; |
|
768 | + $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); |
|
769 | 769 | } else { |
770 | - $this->_template_args[ 'payments' ] = false; |
|
771 | - $this->_template_args[ 'existing_reg_payments' ] = array(); |
|
770 | + $this->_template_args['payments'] = false; |
|
771 | + $this->_template_args['existing_reg_payments'] = array(); |
|
772 | 772 | } |
773 | 773 | |
774 | - $this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment' ), TXN_ADMIN_URL ); |
|
775 | - $this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL ); |
|
774 | + $this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL); |
|
775 | + $this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL); |
|
776 | 776 | |
777 | - if ( isset( $txn_details['invoice_number'] )) { |
|
777 | + if (isset($txn_details['invoice_number'])) { |
|
778 | 778 | $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; |
779 | - $this->_template_args['txn_details']['invoice_number']['label'] = esc_html__( 'Invoice Number', 'event_espresso' ); |
|
779 | + $this->_template_args['txn_details']['invoice_number']['label'] = esc_html__('Invoice Number', 'event_espresso'); |
|
780 | 780 | } |
781 | 781 | |
782 | 782 | $this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session'); |
783 | - $this->_template_args['txn_details']['registration_session']['label'] = esc_html__( 'Registration Session', 'event_espresso' ); |
|
783 | + $this->_template_args['txn_details']['registration_session']['label'] = esc_html__('Registration Session', 'event_espresso'); |
|
784 | 784 | |
785 | - $this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : ''; |
|
786 | - $this->_template_args['txn_details']['ip_address']['label'] = esc_html__( 'Transaction placed from IP', 'event_espresso' ); |
|
785 | + $this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : ''; |
|
786 | + $this->_template_args['txn_details']['ip_address']['label'] = esc_html__('Transaction placed from IP', 'event_espresso'); |
|
787 | 787 | |
788 | - $this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : ''; |
|
789 | - $this->_template_args['txn_details']['user_agent']['label'] = esc_html__( 'Registrant User Agent', 'event_espresso' ); |
|
788 | + $this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''; |
|
789 | + $this->_template_args['txn_details']['user_agent']['label'] = esc_html__('Registrant User Agent', 'event_espresso'); |
|
790 | 790 | |
791 | 791 | $reg_steps = '<ul>'; |
792 | - foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) { |
|
793 | - if ( $reg_step_status === true ) { |
|
794 | - $reg_steps .= '<li style="color:#70cc50">' . sprintf( esc_html__( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
795 | - } else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) { |
|
796 | - $reg_steps .= '<li style="color:#2EA2CC">' . sprintf( |
|
797 | - esc_html__( '%1$s : Initiated %2$s', 'event_espresso' ), |
|
798 | - ucwords( str_replace( '_', ' ', $reg_step ) ), |
|
799 | - gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ) |
|
800 | - ) . '</li>'; |
|
792 | + foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { |
|
793 | + if ($reg_step_status === true) { |
|
794 | + $reg_steps .= '<li style="color:#70cc50">'.sprintf(esc_html__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
795 | + } else if (is_numeric($reg_step_status) && $reg_step_status !== false) { |
|
796 | + $reg_steps .= '<li style="color:#2EA2CC">'.sprintf( |
|
797 | + esc_html__('%1$s : Initiated %2$s', 'event_espresso'), |
|
798 | + ucwords(str_replace('_', ' ', $reg_step)), |
|
799 | + gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS))) |
|
800 | + ).'</li>'; |
|
801 | 801 | } else { |
802 | - $reg_steps .= '<li style="color:#E76700">' . sprintf( esc_html__( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
802 | + $reg_steps .= '<li style="color:#E76700">'.sprintf(esc_html__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
803 | 803 | } |
804 | 804 | } |
805 | 805 | $reg_steps .= '</ul>'; |
806 | 806 | $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; |
807 | - $this->_template_args['txn_details']['reg_steps']['label'] = esc_html__( 'Registration Step Progress', 'event_espresso' ); |
|
807 | + $this->_template_args['txn_details']['reg_steps']['label'] = esc_html__('Registration Step Progress', 'event_espresso'); |
|
808 | 808 | |
809 | 809 | |
810 | 810 | $this->_get_registrations_to_apply_payment_to(); |
811 | - $this->_get_payment_methods( $payments ); |
|
811 | + $this->_get_payment_methods($payments); |
|
812 | 812 | $this->_get_payment_status_array(); |
813 | 813 | $this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction. |
814 | 814 | |
815 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction' ), TXN_ADMIN_URL ); |
|
816 | - $this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL ); |
|
817 | - $this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL ); |
|
815 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL); |
|
816 | + $this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL); |
|
817 | + $this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL); |
|
818 | 818 | |
819 | 819 | // 'espresso_delete_payment_nonce' |
820 | 820 | |
821 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
822 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
821 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
822 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
823 | 823 | |
824 | 824 | } |
825 | 825 | |
@@ -834,27 +834,27 @@ discard block |
||
834 | 834 | * @param EE_Payment[] $payments |
835 | 835 | * @return array |
836 | 836 | */ |
837 | - protected function _get_registration_payment_IDs( $payments = array() ) { |
|
837 | + protected function _get_registration_payment_IDs($payments = array()) { |
|
838 | 838 | $existing_reg_payments = array(); |
839 | 839 | // get all reg payments for these payments |
840 | - $reg_payments = EEM_Registration_Payment::instance()->get_all( array( |
|
840 | + $reg_payments = EEM_Registration_Payment::instance()->get_all(array( |
|
841 | 841 | array( |
842 | 842 | 'PAY_ID' => array( |
843 | 843 | 'IN', |
844 | - array_keys( $payments ) |
|
844 | + array_keys($payments) |
|
845 | 845 | ) |
846 | 846 | ) |
847 | - ) ); |
|
848 | - if ( ! empty( $reg_payments ) ) { |
|
849 | - foreach ( $payments as $payment ) { |
|
850 | - if ( ! $payment instanceof EE_Payment ) { |
|
847 | + )); |
|
848 | + if ( ! empty($reg_payments)) { |
|
849 | + foreach ($payments as $payment) { |
|
850 | + if ( ! $payment instanceof EE_Payment) { |
|
851 | 851 | continue; |
852 | - } else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) { |
|
853 | - $existing_reg_payments[ $payment->ID() ] = array(); |
|
852 | + } else if ( ! isset($existing_reg_payments[$payment->ID()])) { |
|
853 | + $existing_reg_payments[$payment->ID()] = array(); |
|
854 | 854 | } |
855 | - foreach ( $reg_payments as $reg_payment ) { |
|
856 | - if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) { |
|
857 | - $existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID(); |
|
855 | + foreach ($reg_payments as $reg_payment) { |
|
856 | + if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) { |
|
857 | + $existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID(); |
|
858 | 858 | } |
859 | 859 | } |
860 | 860 | } |
@@ -887,54 +887,54 @@ discard block |
||
887 | 887 | ) |
888 | 888 | ) |
889 | 889 | ); |
890 | - $registrations_to_apply_payment_to = EEH_HTML::br() . EEH_HTML::div( |
|
890 | + $registrations_to_apply_payment_to = EEH_HTML::br().EEH_HTML::div( |
|
891 | 891 | '', 'txn-admin-apply-payment-to-registrations-dv', '', 'clear: both; margin: 1.5em 0 0; display: none;' |
892 | 892 | ); |
893 | - $registrations_to_apply_payment_to .= EEH_HTML::br() . EEH_HTML::div( '', '', 'admin-primary-mbox-tbl-wrap' ); |
|
894 | - $registrations_to_apply_payment_to .= EEH_HTML::table( '', '', 'admin-primary-mbox-tbl' ); |
|
893 | + $registrations_to_apply_payment_to .= EEH_HTML::br().EEH_HTML::div('', '', 'admin-primary-mbox-tbl-wrap'); |
|
894 | + $registrations_to_apply_payment_to .= EEH_HTML::table('', '', 'admin-primary-mbox-tbl'); |
|
895 | 895 | $registrations_to_apply_payment_to .= EEH_HTML::thead( |
896 | 896 | EEH_HTML::tr( |
897 | - EEH_HTML::th( esc_html__( 'ID', 'event_espresso' ) ) . |
|
898 | - EEH_HTML::th( esc_html__( 'Registrant', 'event_espresso' ) ) . |
|
899 | - EEH_HTML::th( esc_html__( 'Ticket', 'event_espresso' ) ) . |
|
900 | - EEH_HTML::th( esc_html__( 'Event', 'event_espresso' ) ) . |
|
901 | - EEH_HTML::th( esc_html__( 'Paid', 'event_espresso' ), '', 'txn-admin-payment-paid-td jst-cntr' ) . |
|
902 | - EEH_HTML::th( esc_html__( 'Owing', 'event_espresso' ), '', 'txn-admin-payment-owing-td jst-cntr' ) . |
|
903 | - EEH_HTML::th( esc_html__( 'Apply', 'event_espresso' ), '', 'jst-cntr' ) |
|
897 | + EEH_HTML::th(esc_html__('ID', 'event_espresso')). |
|
898 | + EEH_HTML::th(esc_html__('Registrant', 'event_espresso')). |
|
899 | + EEH_HTML::th(esc_html__('Ticket', 'event_espresso')). |
|
900 | + EEH_HTML::th(esc_html__('Event', 'event_espresso')). |
|
901 | + EEH_HTML::th(esc_html__('Paid', 'event_espresso'), '', 'txn-admin-payment-paid-td jst-cntr'). |
|
902 | + EEH_HTML::th(esc_html__('Owing', 'event_espresso'), '', 'txn-admin-payment-owing-td jst-cntr'). |
|
903 | + EEH_HTML::th(esc_html__('Apply', 'event_espresso'), '', 'jst-cntr') |
|
904 | 904 | ) |
905 | 905 | ); |
906 | 906 | $registrations_to_apply_payment_to .= EEH_HTML::tbody(); |
907 | 907 | // get registrations for TXN |
908 | - $registrations = $this->_transaction->registrations( $query_params ); |
|
909 | - foreach ( $registrations as $registration ) { |
|
910 | - if ( $registration instanceof EE_Registration ) { |
|
908 | + $registrations = $this->_transaction->registrations($query_params); |
|
909 | + foreach ($registrations as $registration) { |
|
910 | + if ($registration instanceof EE_Registration) { |
|
911 | 911 | $attendee_name = $registration->attendee() instanceof EE_Attendee |
912 | 912 | ? $registration->attendee()->full_name() |
913 | - : esc_html__( 'Unknown Attendee', 'event_espresso' ); |
|
913 | + : esc_html__('Unknown Attendee', 'event_espresso'); |
|
914 | 914 | $owing = $registration->final_price() - $registration->paid(); |
915 | 915 | $taxable = $registration->ticket()->taxable() |
916 | - ? ' <span class="smaller-text lt-grey-text"> ' . esc_html__( '+ tax', 'event_espresso' ) . '</span>' |
|
916 | + ? ' <span class="smaller-text lt-grey-text"> '.esc_html__('+ tax', 'event_espresso').'</span>' |
|
917 | 917 | : ''; |
918 | - $checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) |
|
918 | + $checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) |
|
919 | 919 | ? ' checked="checked"' |
920 | 920 | : ''; |
921 | 921 | $disabled = $registration->final_price() > 0 ? '' : ' disabled'; |
922 | 922 | $registrations_to_apply_payment_to .= EEH_HTML::tr( |
923 | - EEH_HTML::td( $registration->ID() ) . |
|
924 | - EEH_HTML::td( $attendee_name ) . |
|
923 | + EEH_HTML::td($registration->ID()). |
|
924 | + EEH_HTML::td($attendee_name). |
|
925 | 925 | EEH_HTML::td( |
926 | - $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable |
|
927 | - ) . |
|
928 | - EEH_HTML::td( $registration->event_name() ) . |
|
929 | - EEH_HTML::td( $registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr' ) . |
|
930 | - EEH_HTML::td( EEH_Template::format_currency( $owing ), '', 'txn-admin-payment-owing-td jst-cntr' ) . |
|
926 | + $registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable |
|
927 | + ). |
|
928 | + EEH_HTML::td($registration->event_name()). |
|
929 | + EEH_HTML::td($registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr'). |
|
930 | + EEH_HTML::td(EEH_Template::format_currency($owing), '', 'txn-admin-payment-owing-td jst-cntr'). |
|
931 | 931 | EEH_HTML::td( |
932 | - '<input type="checkbox" value="' . $registration->ID() |
|
932 | + '<input type="checkbox" value="'.$registration->ID() |
|
933 | 933 | . '" name="txn_admin_payment[registrations]"' |
934 | - . $checked . $disabled . '>', |
|
934 | + . $checked.$disabled.'>', |
|
935 | 935 | '', 'jst-cntr' |
936 | 936 | ), |
937 | - 'apply-payment-registration-row-' . $registration->ID() |
|
937 | + 'apply-payment-registration-row-'.$registration->ID() |
|
938 | 938 | ); |
939 | 939 | } |
940 | 940 | } |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | '', 'clear description' |
950 | 950 | ); |
951 | 951 | $registrations_to_apply_payment_to .= EEH_HTML::divx(); |
952 | - $this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to; |
|
952 | + $this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to; |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -966,9 +966,9 @@ discard block |
||
966 | 966 | $statuses = EEM_Registration::reg_status_array(array(), TRUE); |
967 | 967 | //let's add a "don't change" option. |
968 | 968 | $status_array['NAN'] = esc_html__('Leave the Same', 'event_espresso'); |
969 | - $status_array = array_merge( $status_array, $statuses ); |
|
970 | - $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' ); |
|
971 | - $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' ); |
|
969 | + $status_array = array_merge($status_array, $statuses); |
|
970 | + $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'); |
|
971 | + $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'); |
|
972 | 972 | |
973 | 973 | } |
974 | 974 | |
@@ -983,21 +983,21 @@ discard block |
||
983 | 983 | * @param EE_Payment[] to show on this page |
984 | 984 | * @return void |
985 | 985 | */ |
986 | - private function _get_payment_methods( $payments = array() ) { |
|
986 | + private function _get_payment_methods($payments = array()) { |
|
987 | 987 | $payment_methods_of_payments = array(); |
988 | - foreach( $payments as $payment ){ |
|
989 | - if( $payment instanceof EE_Payment ){ |
|
990 | - $payment_methods_of_payments[] = $payment->get( 'PMD_ID' ); |
|
988 | + foreach ($payments as $payment) { |
|
989 | + if ($payment instanceof EE_Payment) { |
|
990 | + $payment_methods_of_payments[] = $payment->get('PMD_ID'); |
|
991 | 991 | } |
992 | 992 | } |
993 | - if( $payment_methods_of_payments ){ |
|
994 | - $query_args = array( array( 'OR*payment_method_for_payment' => array( |
|
995 | - 'PMD_ID' => array( 'IN', $payment_methods_of_payments ), |
|
996 | - 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) ); |
|
997 | - }else{ |
|
998 | - $query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ); |
|
993 | + if ($payment_methods_of_payments) { |
|
994 | + $query_args = array(array('OR*payment_method_for_payment' => array( |
|
995 | + 'PMD_ID' => array('IN', $payment_methods_of_payments), |
|
996 | + 'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') ))); |
|
997 | + } else { |
|
998 | + $query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%'))); |
|
999 | 999 | } |
1000 | - $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args ); |
|
1000 | + $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args); |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | |
@@ -1011,17 +1011,17 @@ discard block |
||
1011 | 1011 | * @param array $metabox |
1012 | 1012 | * @return void |
1013 | 1013 | */ |
1014 | - public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) { |
|
1014 | + public function txn_attendees_meta_box($post, $metabox = array('args' => array())) { |
|
1015 | 1015 | |
1016 | - extract( $metabox['args'] ); |
|
1016 | + extract($metabox['args']); |
|
1017 | 1017 | $this->_template_args['post'] = $post; |
1018 | 1018 | $this->_template_args['event_attendees'] = array(); |
1019 | 1019 | // process items in cart |
1020 | - $line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) ); |
|
1021 | - if ( ! empty( $line_items )) { |
|
1022 | - foreach ( $line_items as $item ) { |
|
1023 | - if ( $item instanceof EE_Line_Item ) { |
|
1024 | - switch( $item->OBJ_type() ) { |
|
1020 | + $line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); |
|
1021 | + if ( ! empty($line_items)) { |
|
1022 | + foreach ($line_items as $item) { |
|
1023 | + if ($item instanceof EE_Line_Item) { |
|
1024 | + switch ($item->OBJ_type()) { |
|
1025 | 1025 | |
1026 | 1026 | case 'Event' : |
1027 | 1027 | break; |
@@ -1029,41 +1029,41 @@ discard block |
||
1029 | 1029 | case 'Ticket' : |
1030 | 1030 | $ticket = $item->ticket(); |
1031 | 1031 | //right now we're only handling tickets here. Cause its expected that only tickets will have attendees right? |
1032 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
1032 | + if ( ! $ticket instanceof EE_Ticket) { |
|
1033 | 1033 | continue; |
1034 | 1034 | } |
1035 | - $ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' )); |
|
1035 | + $ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price')); |
|
1036 | 1036 | |
1037 | - $registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() ))); |
|
1038 | - foreach( $registrations as $registration ) { |
|
1039 | - if ( ! $registration instanceof EE_Registration ) { |
|
1037 | + $registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID()))); |
|
1038 | + foreach ($registrations as $registration) { |
|
1039 | + if ( ! $registration instanceof EE_Registration) { |
|
1040 | 1040 | continue; |
1041 | 1041 | } |
1042 | 1042 | try { |
1043 | 1043 | $event = $registration->event(); |
1044 | 1044 | $event_name = $event instanceof EE_Event |
1045 | - ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') |
|
1045 | + ? $event->get('EVT_name').' - '.$item->get('LIN_name') |
|
1046 | 1046 | : ''; |
1047 | 1047 | } catch (Exception $e) { |
1048 | 1048 | EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
1049 | 1049 | $event_name = esc_html__('Unknown', 'event_espresso'); |
1050 | 1050 | } |
1051 | - $this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] = $registration->status_ID(); |
|
1052 | - $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->count(); |
|
1053 | - $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1054 | - $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1051 | + $this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] = $registration->status_ID(); |
|
1052 | + $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->count(); |
|
1053 | + $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1054 | + $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1055 | 1055 | // attendee info |
1056 | 1056 | $attendee = $registration->get_first_related('Attendee'); |
1057 | - if ( $attendee instanceof EE_Attendee ) { |
|
1058 | - $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
|
1059 | - $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
|
1060 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:' . $attendee->email() . '?subject=' . $event_name . esc_html__(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>'; |
|
1061 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array() ); |
|
1057 | + if ($attendee instanceof EE_Attendee) { |
|
1058 | + $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
|
1059 | + $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
|
1060 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event_name.esc_html__(' Event', 'event_espresso').'">'.$attendee->email().'</a>'; |
|
1061 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array()); |
|
1062 | 1062 | } else { |
1063 | 1063 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = ''; |
1064 | - $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
|
1064 | + $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
|
1065 | 1065 | $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
1066 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
|
1066 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
|
1067 | 1067 | } |
1068 | 1068 | } |
1069 | 1069 | break; |
@@ -1072,12 +1072,12 @@ discard block |
||
1072 | 1072 | } |
1073 | 1073 | } |
1074 | 1074 | |
1075 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees' ), TXN_ADMIN_URL ); |
|
1076 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE ); |
|
1075 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL); |
|
1076 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE); |
|
1077 | 1077 | |
1078 | 1078 | } else { |
1079 | 1079 | echo sprintf( |
1080 | - esc_html__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ), |
|
1080 | + esc_html__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'), |
|
1081 | 1081 | '<p class="important-notice">', |
1082 | 1082 | '</p>' |
1083 | 1083 | ); |
@@ -1096,19 +1096,19 @@ discard block |
||
1096 | 1096 | */ |
1097 | 1097 | public function txn_registrant_side_meta_box() { |
1098 | 1098 | $primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null; |
1099 | - if ( ! $primary_att instanceof EE_Attendee ) { |
|
1099 | + if ( ! $primary_att instanceof EE_Attendee) { |
|
1100 | 1100 | $this->_template_args['no_attendee_message'] = esc_html__('There is no attached contact for this transaction. The transaction either failed due to an error or was abandoned.', 'event_espresso'); |
1101 | 1101 | $primary_att = EEM_Attendee::instance()->create_default_object(); |
1102 | 1102 | } |
1103 | - $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1103 | + $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1104 | 1104 | $this->_template_args['prime_reg_fname'] = $primary_att->fname(); |
1105 | 1105 | $this->_template_args['prime_reg_lname'] = $primary_att->lname(); |
1106 | - $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1106 | + $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1107 | 1107 | $this->_template_args['prime_reg_phone'] = $primary_att->phone(); |
1108 | - $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 ); |
|
1108 | + $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); |
|
1109 | 1109 | // get formatted address for registrant |
1110 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att ); |
|
1111 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE ); |
|
1110 | + $this->_template_args['formatted_address'] = EEH_Address::format($primary_att); |
|
1111 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE); |
|
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | |
@@ -1124,12 +1124,12 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
1126 | 1126 | $this->_template_args['billing_form_url'] = add_query_arg( |
1127 | - array( 'action' => 'edit_transaction', 'process' => 'billing' ), |
|
1127 | + array('action' => 'edit_transaction', 'process' => 'billing'), |
|
1128 | 1128 | TXN_ADMIN_URL |
1129 | 1129 | ); |
1130 | 1130 | |
1131 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1132 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/ |
|
1131 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1132 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/ |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | |
@@ -1142,42 +1142,42 @@ discard block |
||
1142 | 1142 | * @return void |
1143 | 1143 | */ |
1144 | 1144 | public function apply_payments_or_refunds() { |
1145 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1145 | + $json_response_data = array('return_data' => FALSE); |
|
1146 | 1146 | $valid_data = $this->_validate_payment_request_data(); |
1147 | - if ( ! empty( $valid_data ) ) { |
|
1148 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1147 | + if ( ! empty($valid_data)) { |
|
1148 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1149 | 1149 | //save the new payment |
1150 | - $payment = $this->_create_payment_from_request_data( $valid_data ); |
|
1150 | + $payment = $this->_create_payment_from_request_data($valid_data); |
|
1151 | 1151 | // get the TXN for this payment |
1152 | 1152 | $transaction = $payment->transaction(); |
1153 | 1153 | // verify transaction |
1154 | - if ( $transaction instanceof EE_Transaction ) { |
|
1154 | + if ($transaction instanceof EE_Transaction) { |
|
1155 | 1155 | // calculate_total_payments_and_update_status |
1156 | - $this->_process_transaction_payments( $transaction ); |
|
1157 | - $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment ); |
|
1158 | - $this->_remove_existing_registration_payments( $payment, $PAY_ID ); |
|
1156 | + $this->_process_transaction_payments($transaction); |
|
1157 | + $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment); |
|
1158 | + $this->_remove_existing_registration_payments($payment, $PAY_ID); |
|
1159 | 1159 | // apply payment to registrations (if applicable) |
1160 | - if ( ! empty( $REG_IDs ) ) { |
|
1161 | - $this->_update_registration_payments( $transaction, $payment, $REG_IDs ); |
|
1160 | + if ( ! empty($REG_IDs)) { |
|
1161 | + $this->_update_registration_payments($transaction, $payment, $REG_IDs); |
|
1162 | 1162 | $this->_maybe_send_notifications(); |
1163 | 1163 | // now process status changes for the same registrations |
1164 | - $this->_process_registration_status_change( $transaction, $REG_IDs ); |
|
1164 | + $this->_process_registration_status_change($transaction, $REG_IDs); |
|
1165 | 1165 | } |
1166 | - $this->_maybe_send_notifications( $payment ); |
|
1166 | + $this->_maybe_send_notifications($payment); |
|
1167 | 1167 | //prepare to render page |
1168 | - $json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs ); |
|
1169 | - do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment ); |
|
1168 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs); |
|
1169 | + do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment); |
|
1170 | 1170 | } else { |
1171 | 1171 | EE_Error::add_error( |
1172 | - esc_html__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ), |
|
1172 | + esc_html__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'), |
|
1173 | 1173 | __FILE__, __FUNCTION__, __LINE__ |
1174 | 1174 | ); |
1175 | 1175 | } |
1176 | 1176 | } else { |
1177 | - EE_Error::add_error( esc_html__( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1177 | + EE_Error::add_error(esc_html__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1178 | 1178 | } |
1179 | 1179 | |
1180 | - $notices = EE_Error::get_notices( false, false, false ); |
|
1180 | + $notices = EE_Error::get_notices(false, false, false); |
|
1181 | 1181 | $this->_template_args = array( |
1182 | 1182 | 'data' => $json_response_data, |
1183 | 1183 | 'error' => $notices['errors'], |
@@ -1194,30 +1194,30 @@ discard block |
||
1194 | 1194 | * @return array |
1195 | 1195 | */ |
1196 | 1196 | protected function _validate_payment_request_data() { |
1197 | - if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) { |
|
1197 | + if ( ! isset($this->_req_data['txn_admin_payment'])) { |
|
1198 | 1198 | return false; |
1199 | 1199 | } |
1200 | 1200 | $payment_form = $this->_generate_payment_form_section(); |
1201 | 1201 | try { |
1202 | - if ( $payment_form->was_submitted() ) { |
|
1202 | + if ($payment_form->was_submitted()) { |
|
1203 | 1203 | $payment_form->receive_form_submission(); |
1204 | - if ( ! $payment_form->is_valid() ) { |
|
1204 | + if ( ! $payment_form->is_valid()) { |
|
1205 | 1205 | $submission_error_messages = array(); |
1206 | - foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) { |
|
1207 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1206 | + foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) { |
|
1207 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1208 | 1208 | $submission_error_messages[] = sprintf( |
1209 | - _x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ), |
|
1209 | + _x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'), |
|
1210 | 1210 | $validation_error->get_form_section()->html_label_text(), |
1211 | 1211 | $validation_error->getMessage() |
1212 | 1212 | ); |
1213 | 1213 | } |
1214 | 1214 | } |
1215 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1215 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1216 | 1216 | return array(); |
1217 | 1217 | } |
1218 | 1218 | } |
1219 | - } catch ( EE_Error $e ) { |
|
1220 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1219 | + } catch (EE_Error $e) { |
|
1220 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1221 | 1221 | return array(); |
1222 | 1222 | } |
1223 | 1223 | return $payment_form->valid_data(); |
@@ -1239,63 +1239,63 @@ discard block |
||
1239 | 1239 | array( |
1240 | 1240 | 'default' => 0, |
1241 | 1241 | 'required' => false, |
1242 | - 'html_label_text' => esc_html__( 'Payment ID', 'event_espresso' ), |
|
1243 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1242 | + 'html_label_text' => esc_html__('Payment ID', 'event_espresso'), |
|
1243 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1244 | 1244 | ) |
1245 | 1245 | ), |
1246 | 1246 | 'TXN_ID' => new EE_Text_Input( |
1247 | 1247 | array( |
1248 | 1248 | 'default' => 0, |
1249 | 1249 | 'required' => true, |
1250 | - 'html_label_text' => esc_html__( 'Transaction ID', 'event_espresso' ), |
|
1251 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1250 | + 'html_label_text' => esc_html__('Transaction ID', 'event_espresso'), |
|
1251 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1252 | 1252 | ) |
1253 | 1253 | ), |
1254 | 1254 | 'type' => new EE_Text_Input( |
1255 | 1255 | array( |
1256 | 1256 | 'default' => 1, |
1257 | 1257 | 'required' => true, |
1258 | - 'html_label_text' => esc_html__( 'Payment or Refund', 'event_espresso' ), |
|
1259 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1258 | + 'html_label_text' => esc_html__('Payment or Refund', 'event_espresso'), |
|
1259 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1260 | 1260 | ) |
1261 | 1261 | ), |
1262 | 1262 | 'amount' => new EE_Text_Input( |
1263 | 1263 | array( |
1264 | 1264 | 'default' => 0, |
1265 | 1265 | 'required' => true, |
1266 | - 'html_label_text' => esc_html__( 'Payment amount', 'event_espresso' ), |
|
1267 | - 'validation_strategies' => array( new EE_Float_Normalization() ) |
|
1266 | + 'html_label_text' => esc_html__('Payment amount', 'event_espresso'), |
|
1267 | + 'validation_strategies' => array(new EE_Float_Normalization()) |
|
1268 | 1268 | ) |
1269 | 1269 | ), |
1270 | 1270 | 'status' => new EE_Text_Input( |
1271 | 1271 | array( |
1272 | 1272 | 'default' => EEM_Payment::status_id_approved, |
1273 | 1273 | 'required' => true, |
1274 | - 'html_label_text' => esc_html__( 'Payment status', 'event_espresso' ), |
|
1274 | + 'html_label_text' => esc_html__('Payment status', 'event_espresso'), |
|
1275 | 1275 | ) |
1276 | 1276 | ), |
1277 | 1277 | 'PMD_ID' => new EE_Text_Input( |
1278 | 1278 | array( |
1279 | 1279 | 'default' => 2, |
1280 | 1280 | 'required' => true, |
1281 | - 'html_label_text' => esc_html__( 'Payment Method', 'event_espresso' ), |
|
1282 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1281 | + 'html_label_text' => esc_html__('Payment Method', 'event_espresso'), |
|
1282 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1283 | 1283 | ) |
1284 | 1284 | ), |
1285 | 1285 | 'date' => new EE_Text_Input( |
1286 | 1286 | array( |
1287 | 1287 | 'default' => time(), |
1288 | 1288 | 'required' => true, |
1289 | - 'html_label_text' => esc_html__( 'Payment date', 'event_espresso' ), |
|
1289 | + 'html_label_text' => esc_html__('Payment date', 'event_espresso'), |
|
1290 | 1290 | ) |
1291 | 1291 | ), |
1292 | 1292 | 'txn_id_chq_nmbr' => new EE_Text_Input( |
1293 | 1293 | array( |
1294 | 1294 | 'default' => '', |
1295 | 1295 | 'required' => false, |
1296 | - 'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ), |
|
1296 | + 'html_label_text' => esc_html__('Transaction or Cheque Number', 'event_espresso'), |
|
1297 | 1297 | 'validation_strategies' => array( |
1298 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1298 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1299 | 1299 | ) |
1300 | 1300 | ) |
1301 | 1301 | ), |
@@ -1303,9 +1303,9 @@ discard block |
||
1303 | 1303 | array( |
1304 | 1304 | 'default' => '', |
1305 | 1305 | 'required' => false, |
1306 | - 'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ), |
|
1306 | + 'html_label_text' => esc_html__('Purchase Order Number', 'event_espresso'), |
|
1307 | 1307 | 'validation_strategies' => array( |
1308 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1308 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1309 | 1309 | ) |
1310 | 1310 | ) |
1311 | 1311 | ), |
@@ -1313,9 +1313,9 @@ discard block |
||
1313 | 1313 | array( |
1314 | 1314 | 'default' => '', |
1315 | 1315 | 'required' => false, |
1316 | - 'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ), |
|
1316 | + 'html_label_text' => esc_html__('Extra Field for Accounting', 'event_espresso'), |
|
1317 | 1317 | 'validation_strategies' => array( |
1318 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1318 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1319 | 1319 | ) |
1320 | 1320 | ) |
1321 | 1321 | ), |
@@ -1332,37 +1332,37 @@ discard block |
||
1332 | 1332 | * @param array $valid_data |
1333 | 1333 | * @return EE_Payment |
1334 | 1334 | */ |
1335 | - protected function _create_payment_from_request_data( $valid_data ) { |
|
1336 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1335 | + protected function _create_payment_from_request_data($valid_data) { |
|
1336 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1337 | 1337 | // get payment amount |
1338 | - $amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0; |
|
1338 | + $amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0; |
|
1339 | 1339 | // payments have a type value of 1 and refunds have a type value of -1 |
1340 | 1340 | // so multiplying amount by type will give a positive value for payments, and negative values for refunds |
1341 | - $amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount; |
|
1341 | + $amount = $valid_data['type'] < 0 ? $amount * -1 : $amount; |
|
1342 | 1342 | // for some reason the date string coming in has extra spaces between the date and time. This fixes that. |
1343 | - $date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) ); |
|
1343 | + $date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp')); |
|
1344 | 1344 | $payment = EE_Payment::new_instance( |
1345 | 1345 | array( |
1346 | - 'TXN_ID' => $valid_data[ 'TXN_ID' ], |
|
1347 | - 'STS_ID' => $valid_data[ 'status' ], |
|
1346 | + 'TXN_ID' => $valid_data['TXN_ID'], |
|
1347 | + 'STS_ID' => $valid_data['status'], |
|
1348 | 1348 | 'PAY_timestamp' => $date, |
1349 | 1349 | 'PAY_source' => EEM_Payment_Method::scope_admin, |
1350 | - 'PMD_ID' => $valid_data[ 'PMD_ID' ], |
|
1350 | + 'PMD_ID' => $valid_data['PMD_ID'], |
|
1351 | 1351 | 'PAY_amount' => $amount, |
1352 | - 'PAY_txn_id_chq_nmbr' => $valid_data[ 'txn_id_chq_nmbr' ], |
|
1353 | - 'PAY_po_number' => $valid_data[ 'po_number' ], |
|
1354 | - 'PAY_extra_accntng' => $valid_data[ 'accounting' ], |
|
1352 | + 'PAY_txn_id_chq_nmbr' => $valid_data['txn_id_chq_nmbr'], |
|
1353 | + 'PAY_po_number' => $valid_data['po_number'], |
|
1354 | + 'PAY_extra_accntng' => $valid_data['accounting'], |
|
1355 | 1355 | 'PAY_details' => $valid_data, |
1356 | 1356 | 'PAY_ID' => $PAY_ID |
1357 | 1357 | ), |
1358 | 1358 | '', |
1359 | - array( 'Y-m-d', 'g:i a' ) |
|
1359 | + array('Y-m-d', 'g:i a') |
|
1360 | 1360 | ); |
1361 | 1361 | |
1362 | - if ( ! $payment->save() ) { |
|
1362 | + if ( ! $payment->save()) { |
|
1363 | 1363 | EE_Error::add_error( |
1364 | 1364 | sprintf( |
1365 | - esc_html__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ), |
|
1365 | + esc_html__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'), |
|
1366 | 1366 | $payment->ID() |
1367 | 1367 | ), |
1368 | 1368 | __FILE__, __FUNCTION__, __LINE__ |
@@ -1379,15 +1379,15 @@ discard block |
||
1379 | 1379 | * @param \EE_Transaction $transaction |
1380 | 1380 | * @return array |
1381 | 1381 | */ |
1382 | - protected function _process_transaction_payments( EE_Transaction $transaction ) { |
|
1382 | + protected function _process_transaction_payments(EE_Transaction $transaction) { |
|
1383 | 1383 | /** @type EE_Transaction_Payments $transaction_payments */ |
1384 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1384 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1385 | 1385 | //update the transaction with this payment |
1386 | - if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) { |
|
1387 | - EE_Error::add_success( esc_html__( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1386 | + if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) { |
|
1387 | + EE_Error::add_success(esc_html__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1388 | 1388 | } else { |
1389 | 1389 | EE_Error::add_error( |
1390 | - esc_html__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' ) |
|
1390 | + esc_html__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso') |
|
1391 | 1391 | , __FILE__, __FUNCTION__, __LINE__ |
1392 | 1392 | ); |
1393 | 1393 | } |
@@ -1403,19 +1403,19 @@ discard block |
||
1403 | 1403 | * @param \EE_Payment $payment |
1404 | 1404 | * @return array |
1405 | 1405 | */ |
1406 | - protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) { |
|
1406 | + protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) { |
|
1407 | 1407 | $REG_IDs = array(); |
1408 | 1408 | // grab array of IDs for specific registrations to apply changes to |
1409 | - if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) { |
|
1410 | - $REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ]; |
|
1409 | + if (isset($this->_req_data['txn_admin_payment']['registrations'])) { |
|
1410 | + $REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations']; |
|
1411 | 1411 | } |
1412 | 1412 | //nothing specified ? then get all reg IDs |
1413 | - if ( empty( $REG_IDs ) ) { |
|
1413 | + if (empty($REG_IDs)) { |
|
1414 | 1414 | $registrations = $payment->transaction()->registrations(); |
1415 | - $REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1415 | + $REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1416 | 1416 | } |
1417 | 1417 | // ensure that REG_IDs are integers and NOT strings |
1418 | - return array_map( 'intval', $REG_IDs ); |
|
1418 | + return array_map('intval', $REG_IDs); |
|
1419 | 1419 | } |
1420 | 1420 | |
1421 | 1421 | |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | /** |
1433 | 1433 | * @param array $existing_reg_payment_REG_IDs |
1434 | 1434 | */ |
1435 | - public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) { |
|
1435 | + public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) { |
|
1436 | 1436 | $this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs; |
1437 | 1437 | } |
1438 | 1438 | |
@@ -1447,13 +1447,13 @@ discard block |
||
1447 | 1447 | * @param \EE_Payment $payment |
1448 | 1448 | * @return array |
1449 | 1449 | */ |
1450 | - protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) { |
|
1451 | - if ( $this->existing_reg_payment_REG_IDs() === null ) { |
|
1450 | + protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) { |
|
1451 | + if ($this->existing_reg_payment_REG_IDs() === null) { |
|
1452 | 1452 | // let's get any existing reg payment records for this payment |
1453 | - $existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' ); |
|
1453 | + $existing_reg_payment_REG_IDs = $payment->get_many_related('Registration'); |
|
1454 | 1454 | // but we only want the REG IDs, so grab the array keys |
1455 | - $existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array(); |
|
1456 | - $this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs ); |
|
1455 | + $existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array(); |
|
1456 | + $this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs); |
|
1457 | 1457 | } |
1458 | 1458 | return $this->existing_reg_payment_REG_IDs(); |
1459 | 1459 | } |
@@ -1472,23 +1472,23 @@ discard block |
||
1472 | 1472 | * @param int $PAY_ID |
1473 | 1473 | * @return bool; |
1474 | 1474 | */ |
1475 | - protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) { |
|
1475 | + protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) { |
|
1476 | 1476 | // newly created payments will have nothing recorded for $PAY_ID |
1477 | - if ( $PAY_ID == 0 ) { |
|
1477 | + if ($PAY_ID == 0) { |
|
1478 | 1478 | return false; |
1479 | 1479 | } |
1480 | - $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1481 | - if ( empty( $existing_reg_payment_REG_IDs )) { |
|
1480 | + $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1481 | + if (empty($existing_reg_payment_REG_IDs)) { |
|
1482 | 1482 | return false; |
1483 | 1483 | } |
1484 | 1484 | /** @type EE_Transaction_Payments $transaction_payments */ |
1485 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1485 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1486 | 1486 | return $transaction_payments->delete_registration_payments_and_update_registrations( |
1487 | 1487 | $payment, |
1488 | 1488 | array( |
1489 | 1489 | array( |
1490 | 1490 | 'PAY_ID' => $payment->ID(), |
1491 | - 'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ), |
|
1491 | + 'REG_ID' => array('IN', $existing_reg_payment_REG_IDs), |
|
1492 | 1492 | ) |
1493 | 1493 | ) |
1494 | 1494 | ); |
@@ -1507,25 +1507,25 @@ discard block |
||
1507 | 1507 | * @param array $REG_IDs |
1508 | 1508 | * @return bool |
1509 | 1509 | */ |
1510 | - protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) { |
|
1510 | + protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) { |
|
1511 | 1511 | // we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments() |
1512 | 1512 | // so let's do that using our set of REG_IDs from the form |
1513 | 1513 | $registration_query_where_params = array( |
1514 | - 'REG_ID' => array( 'IN', $REG_IDs ) |
|
1514 | + 'REG_ID' => array('IN', $REG_IDs) |
|
1515 | 1515 | ); |
1516 | 1516 | // but add in some conditions regarding payment, |
1517 | 1517 | // so that we don't apply payments to registrations that are free or have already been paid for |
1518 | 1518 | // but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative ) |
1519 | - if ( ! $payment->is_a_refund() ) { |
|
1520 | - $registration_query_where_params[ 'REG_final_price' ] = array( '!=', 0 ); |
|
1521 | - $registration_query_where_params[ 'REG_final_price*' ] = array( '!=', 'REG_paid', true ); |
|
1519 | + if ( ! $payment->is_a_refund()) { |
|
1520 | + $registration_query_where_params['REG_final_price'] = array('!=', 0); |
|
1521 | + $registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true); |
|
1522 | 1522 | } |
1523 | 1523 | //EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ ); |
1524 | - $registrations = $transaction->registrations( array( $registration_query_where_params ) ); |
|
1525 | - if ( ! empty( $registrations ) ) { |
|
1524 | + $registrations = $transaction->registrations(array($registration_query_where_params)); |
|
1525 | + if ( ! empty($registrations)) { |
|
1526 | 1526 | /** @type EE_Payment_Processor $payment_processor */ |
1527 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1528 | - $payment_processor->process_registration_payments( $transaction, $payment, $registrations ); |
|
1527 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1528 | + $payment_processor->process_registration_payments($transaction, $payment, $registrations); |
|
1529 | 1529 | } |
1530 | 1530 | } |
1531 | 1531 | |
@@ -1541,22 +1541,22 @@ discard block |
||
1541 | 1541 | * @param array $REG_IDs |
1542 | 1542 | * @return bool |
1543 | 1543 | */ |
1544 | - protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) { |
|
1544 | + protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) { |
|
1545 | 1545 | // first if there is no change in status then we get out. |
1546 | 1546 | if ( |
1547 | - ! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ) |
|
1547 | + ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status']) |
|
1548 | 1548 | || $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN' |
1549 | 1549 | ) { |
1550 | 1550 | //no error message, no change requested, just nothing to do man. |
1551 | 1551 | return FALSE; |
1552 | 1552 | } |
1553 | 1553 | /** @type EE_Transaction_Processor $transaction_processor */ |
1554 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1554 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1555 | 1555 | // made it here dude? Oh WOW. K, let's take care of changing the statuses |
1556 | 1556 | return $transaction_processor->manually_update_registration_statuses( |
1557 | 1557 | $transaction, |
1558 | - sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ), |
|
1559 | - array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) |
|
1558 | + sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']), |
|
1559 | + array(array('REG_ID' => array('IN', $REG_IDs))) |
|
1560 | 1560 | ); |
1561 | 1561 | } |
1562 | 1562 | |
@@ -1571,16 +1571,16 @@ discard block |
||
1571 | 1571 | * @param bool | null $delete_txn_reg_status_change |
1572 | 1572 | * @return array |
1573 | 1573 | */ |
1574 | - protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) { |
|
1574 | + protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) { |
|
1575 | 1575 | // was the payment deleted ? |
1576 | - if ( is_bool( $delete_txn_reg_status_change )) { |
|
1576 | + if (is_bool($delete_txn_reg_status_change)) { |
|
1577 | 1577 | return array( |
1578 | 1578 | 'PAY_ID' => $payment->ID(), |
1579 | 1579 | 'amount' => $payment->amount(), |
1580 | 1580 | 'total_paid' => $payment->transaction()->paid(), |
1581 | 1581 | 'txn_status' => $payment->transaction()->status_ID(), |
1582 | 1582 | 'pay_status' => $payment->STS_ID(), |
1583 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1583 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1584 | 1584 | 'delete_txn_reg_status_change' => $delete_txn_reg_status_change, |
1585 | 1585 | ); |
1586 | 1586 | } else { |
@@ -1592,16 +1592,16 @@ discard block |
||
1592 | 1592 | 'pay_status' => $payment->STS_ID(), |
1593 | 1593 | 'PAY_ID' => $payment->ID(), |
1594 | 1594 | 'STS_ID' => $payment->STS_ID(), |
1595 | - 'status' => self::$_pay_status[ $payment->STS_ID() ], |
|
1596 | - 'date' => $payment->timestamp( 'Y-m-d', 'h:i a' ), |
|
1597 | - 'method' => strtoupper( $payment->source() ), |
|
1595 | + 'status' => self::$_pay_status[$payment->STS_ID()], |
|
1596 | + 'date' => $payment->timestamp('Y-m-d', 'h:i a'), |
|
1597 | + 'method' => strtoupper($payment->source()), |
|
1598 | 1598 | 'PM_ID' => $payment->payment_method() ? $payment->payment_method()->ID() : 1, |
1599 | - 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__( "Unknown", 'event_espresso' ), |
|
1599 | + 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__("Unknown", 'event_espresso'), |
|
1600 | 1600 | 'gateway_response' => $payment->gateway_response(), |
1601 | 1601 | 'txn_id_chq_nmbr' => $payment->txn_id_chq_nmbr(), |
1602 | 1602 | 'po_number' => $payment->po_number(), |
1603 | 1603 | 'extra_accntng' => $payment->extra_accntng(), |
1604 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1604 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1605 | 1605 | ); |
1606 | 1606 | } |
1607 | 1607 | } |
@@ -1616,39 +1616,39 @@ discard block |
||
1616 | 1616 | * @return void |
1617 | 1617 | */ |
1618 | 1618 | public function delete_payment() { |
1619 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1620 | - $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; |
|
1621 | - if ( $PAY_ID ) { |
|
1622 | - $delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false; |
|
1623 | - $payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID ); |
|
1624 | - if ( $payment instanceof EE_Payment ) { |
|
1625 | - $REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1619 | + $json_response_data = array('return_data' => FALSE); |
|
1620 | + $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; |
|
1621 | + if ($PAY_ID) { |
|
1622 | + $delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false; |
|
1623 | + $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); |
|
1624 | + if ($payment instanceof EE_Payment) { |
|
1625 | + $REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1626 | 1626 | /** @type EE_Transaction_Payments $transaction_payments */ |
1627 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1628 | - if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) { |
|
1629 | - $json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change ); |
|
1630 | - if ( $delete_txn_reg_status_change ) { |
|
1627 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1628 | + if ($transaction_payments->delete_payment_and_update_transaction($payment)) { |
|
1629 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change); |
|
1630 | + if ($delete_txn_reg_status_change) { |
|
1631 | 1631 | $this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1632 | 1632 | //MAKE sure we also add the delete_txn_req_status_change to the |
1633 | 1633 | //$_REQUEST global because that's how messages will be looking for it. |
1634 | 1634 | $_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1635 | 1635 | $this->_maybe_send_notifications(); |
1636 | - $this->_process_registration_status_change( $payment->transaction(), $REG_IDs ); |
|
1636 | + $this->_process_registration_status_change($payment->transaction(), $REG_IDs); |
|
1637 | 1637 | } |
1638 | 1638 | } |
1639 | 1639 | } else { |
1640 | 1640 | EE_Error::add_error( |
1641 | - esc_html__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ), |
|
1641 | + esc_html__('Valid Payment data could not be retrieved from the database.', 'event_espresso'), |
|
1642 | 1642 | __FILE__, __FUNCTION__, __LINE__ |
1643 | 1643 | ); |
1644 | 1644 | } |
1645 | 1645 | } else { |
1646 | 1646 | EE_Error::add_error( |
1647 | - esc_html__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ), |
|
1647 | + esc_html__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'), |
|
1648 | 1648 | __FILE__, __FUNCTION__, __LINE__ |
1649 | 1649 | ); |
1650 | 1650 | } |
1651 | - $notices = EE_Error::get_notices( false, false, false); |
|
1651 | + $notices = EE_Error::get_notices(false, false, false); |
|
1652 | 1652 | $this->_template_args = array( |
1653 | 1653 | 'data' => $json_response_data, |
1654 | 1654 | 'success' => $notices['success'], |
@@ -1668,16 +1668,16 @@ discard block |
||
1668 | 1668 | * @param array $REG_IDs |
1669 | 1669 | * @return array |
1670 | 1670 | */ |
1671 | - protected function _registration_payment_data_array( $REG_IDs ) { |
|
1671 | + protected function _registration_payment_data_array($REG_IDs) { |
|
1672 | 1672 | $registration_payment_data = array(); |
1673 | 1673 | //if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows. |
1674 | - if ( ! empty( $REG_IDs ) ) { |
|
1675 | - $registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) ); |
|
1676 | - foreach ( $registrations as $registration ) { |
|
1677 | - if ( $registration instanceof EE_Registration ) { |
|
1678 | - $registration_payment_data[ $registration->ID() ] = array( |
|
1674 | + if ( ! empty($REG_IDs)) { |
|
1675 | + $registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs)))); |
|
1676 | + foreach ($registrations as $registration) { |
|
1677 | + if ($registration instanceof EE_Registration) { |
|
1678 | + $registration_payment_data[$registration->ID()] = array( |
|
1679 | 1679 | 'paid' => $registration->pretty_paid(), |
1680 | - 'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ), |
|
1680 | + 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()), |
|
1681 | 1681 | ); |
1682 | 1682 | } |
1683 | 1683 | } |
@@ -1697,30 +1697,30 @@ discard block |
||
1697 | 1697 | * @access protected |
1698 | 1698 | * @param \EE_Payment | null $payment |
1699 | 1699 | */ |
1700 | - protected function _maybe_send_notifications( $payment = null ) { |
|
1701 | - switch ( $payment instanceof EE_Payment ) { |
|
1700 | + protected function _maybe_send_notifications($payment = null) { |
|
1701 | + switch ($payment instanceof EE_Payment) { |
|
1702 | 1702 | // payment notifications |
1703 | 1703 | case true : |
1704 | 1704 | if ( |
1705 | 1705 | isset( |
1706 | - $this->_req_data[ 'txn_payments' ], |
|
1707 | - $this->_req_data[ 'txn_payments' ][ 'send_notifications' ] |
|
1706 | + $this->_req_data['txn_payments'], |
|
1707 | + $this->_req_data['txn_payments']['send_notifications'] |
|
1708 | 1708 | ) && |
1709 | - filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1709 | + filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1710 | 1710 | ) { |
1711 | - $this->_process_payment_notification( $payment ); |
|
1711 | + $this->_process_payment_notification($payment); |
|
1712 | 1712 | } |
1713 | 1713 | break; |
1714 | 1714 | // registration notifications |
1715 | 1715 | case false : |
1716 | 1716 | if ( |
1717 | 1717 | isset( |
1718 | - $this->_req_data[ 'txn_reg_status_change' ], |
|
1719 | - $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] |
|
1718 | + $this->_req_data['txn_reg_status_change'], |
|
1719 | + $this->_req_data['txn_reg_status_change']['send_notifications'] |
|
1720 | 1720 | ) && |
1721 | - filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1721 | + filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1722 | 1722 | ) { |
1723 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
1723 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
1724 | 1724 | } |
1725 | 1725 | break; |
1726 | 1726 | } |
@@ -1736,11 +1736,11 @@ discard block |
||
1736 | 1736 | * @return void |
1737 | 1737 | */ |
1738 | 1738 | protected function _send_payment_reminder() { |
1739 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1740 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1741 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
|
1742 | - do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
|
1743 | - $this->_redirect_after_action( FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE ); |
|
1739 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
1740 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1741 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array(); |
|
1742 | + do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction); |
|
1743 | + $this->_redirect_after_action(FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE); |
|
1744 | 1744 | } |
1745 | 1745 | |
1746 | 1746 | |
@@ -1754,36 +1754,36 @@ discard block |
||
1754 | 1754 | * @param string $view |
1755 | 1755 | * @return mixed int = count || array of transaction objects |
1756 | 1756 | */ |
1757 | - public function get_transactions( $perpage, $count = FALSE, $view = '' ) { |
|
1757 | + public function get_transactions($perpage, $count = FALSE, $view = '') { |
|
1758 | 1758 | |
1759 | 1759 | $TXN = EEM_Transaction::instance(); |
1760 | 1760 | |
1761 | - $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' )); |
|
1762 | - $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' ); |
|
1761 | + $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')); |
|
1762 | + $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'); |
|
1763 | 1763 | |
1764 | 1764 | //make sure our timestamps start and end right at the boundaries for each day |
1765 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1766 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1765 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
1766 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
1767 | 1767 | |
1768 | 1768 | |
1769 | 1769 | //convert to timestamps |
1770 | - $start_date = strtotime( $start_date ); |
|
1771 | - $end_date = strtotime( $end_date ); |
|
1770 | + $start_date = strtotime($start_date); |
|
1771 | + $end_date = strtotime($end_date); |
|
1772 | 1772 | |
1773 | 1773 | //makes sure start date is the lowest value and vice versa |
1774 | - $start_date = min( $start_date, $end_date ); |
|
1775 | - $end_date = max( $start_date, $end_date ); |
|
1774 | + $start_date = min($start_date, $end_date); |
|
1775 | + $end_date = max($start_date, $end_date); |
|
1776 | 1776 | |
1777 | 1777 | //convert to correct format for query |
1778 | - $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' ); |
|
1779 | - $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' ); |
|
1778 | + $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'); |
|
1779 | + $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'); |
|
1780 | 1780 | |
1781 | 1781 | |
1782 | 1782 | |
1783 | 1783 | //set orderby |
1784 | 1784 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1785 | 1785 | |
1786 | - switch ( $this->_req_data['orderby'] ) { |
|
1786 | + switch ($this->_req_data['orderby']) { |
|
1787 | 1787 | case 'TXN_ID': |
1788 | 1788 | $orderby = 'TXN_ID'; |
1789 | 1789 | break; |
@@ -1797,66 +1797,66 @@ discard block |
||
1797 | 1797 | $orderby = 'TXN_timestamp'; |
1798 | 1798 | } |
1799 | 1799 | |
1800 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
1801 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1802 | - $per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10; |
|
1803 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1800 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
1801 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1802 | + $per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10; |
|
1803 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1804 | 1804 | |
1805 | - $offset = ($current_page-1)*$per_page; |
|
1806 | - $limit = array( $offset, $per_page ); |
|
1805 | + $offset = ($current_page - 1) * $per_page; |
|
1806 | + $limit = array($offset, $per_page); |
|
1807 | 1807 | |
1808 | 1808 | $_where = array( |
1809 | - 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ), |
|
1809 | + 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)), |
|
1810 | 1810 | 'Registration.REG_count' => 1 |
1811 | 1811 | ); |
1812 | 1812 | |
1813 | - if ( isset( $this->_req_data['EVT_ID'] ) ) { |
|
1813 | + if (isset($this->_req_data['EVT_ID'])) { |
|
1814 | 1814 | $_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID']; |
1815 | 1815 | } |
1816 | 1816 | |
1817 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1818 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1817 | + if (isset($this->_req_data['s'])) { |
|
1818 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1819 | 1819 | $_where['OR'] = array( |
1820 | - 'Registration.Event.EVT_name' => array( 'LIKE', $search_string ), |
|
1821 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ), |
|
1822 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ), |
|
1823 | - 'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ), |
|
1824 | - 'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ), |
|
1825 | - 'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ), |
|
1826 | - 'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ), |
|
1827 | - 'Registration.Attendee.ATT_email' => array('LIKE', $search_string ), |
|
1828 | - 'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ), |
|
1829 | - 'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ), |
|
1830 | - 'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ), |
|
1831 | - 'Registration.REG_final_price' => array( 'LIKE', $search_string ), |
|
1832 | - 'Registration.REG_code' => array( 'LIKE', $search_string ), |
|
1833 | - 'Registration.REG_count' => array( 'LIKE' , $search_string ), |
|
1834 | - 'Registration.REG_group_size' => array( 'LIKE' , $search_string ), |
|
1835 | - 'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ), |
|
1836 | - 'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ), |
|
1837 | - 'Payment.PAY_source' => array('LIKE', $search_string ), |
|
1838 | - 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ), |
|
1839 | - 'TXN_session_data' => array( 'LIKE', $search_string ), |
|
1840 | - 'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string ) |
|
1820 | + 'Registration.Event.EVT_name' => array('LIKE', $search_string), |
|
1821 | + 'Registration.Event.EVT_desc' => array('LIKE', $search_string), |
|
1822 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $search_string), |
|
1823 | + 'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string), |
|
1824 | + 'Registration.Attendee.ATT_fname' => array('LIKE', $search_string), |
|
1825 | + 'Registration.Attendee.ATT_lname' => array('LIKE', $search_string), |
|
1826 | + 'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string), |
|
1827 | + 'Registration.Attendee.ATT_email' => array('LIKE', $search_string), |
|
1828 | + 'Registration.Attendee.ATT_address' => array('LIKE', $search_string), |
|
1829 | + 'Registration.Attendee.ATT_address2' => array('LIKE', $search_string), |
|
1830 | + 'Registration.Attendee.ATT_city' => array('LIKE', $search_string), |
|
1831 | + 'Registration.REG_final_price' => array('LIKE', $search_string), |
|
1832 | + 'Registration.REG_code' => array('LIKE', $search_string), |
|
1833 | + 'Registration.REG_count' => array('LIKE', $search_string), |
|
1834 | + 'Registration.REG_group_size' => array('LIKE', $search_string), |
|
1835 | + 'Registration.Ticket.TKT_name' => array('LIKE', $search_string), |
|
1836 | + 'Registration.Ticket.TKT_description' => array('LIKE', $search_string), |
|
1837 | + 'Payment.PAY_source' => array('LIKE', $search_string), |
|
1838 | + 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string), |
|
1839 | + 'TXN_session_data' => array('LIKE', $search_string), |
|
1840 | + 'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string) |
|
1841 | 1841 | ); |
1842 | 1842 | } |
1843 | 1843 | |
1844 | 1844 | //failed transactions |
1845 | - $failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE; |
|
1846 | - $abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE; |
|
1845 | + $failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE; |
|
1846 | + $abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE; |
|
1847 | 1847 | |
1848 | - if ( $failed ) { |
|
1849 | - $_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code; |
|
1850 | - } else if ( $abandoned ) { |
|
1848 | + if ($failed) { |
|
1849 | + $_where['STS_ID'] = EEM_Transaction::failed_status_code; |
|
1850 | + } else if ($abandoned) { |
|
1851 | 1851 | $_where['STS_ID'] = EEM_Transaction::abandoned_status_code; |
1852 | 1852 | } else { |
1853 | - $_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code ); |
|
1854 | - $_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code ); |
|
1853 | + $_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code); |
|
1854 | + $_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code); |
|
1855 | 1855 | } |
1856 | 1856 | |
1857 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit ); |
|
1857 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit); |
|
1858 | 1858 | |
1859 | - $transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params); |
|
1859 | + $transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params); |
|
1860 | 1860 | |
1861 | 1861 | |
1862 | 1862 | return $transactions; |