/** * debug * * @param string $class * @param string $func * @param string $line * @param \EE_Transaction $transaction * @param array $info * @param bool $display_request */ protected function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) { if (WP_DEBUG && false) { if ($transaction instanceof EE_Transaction) { // don't serialize objects $info = EEH_Debug_Tools::strip_objects($info); if ($transaction->ID()) { $info['TXN_status'] = $transaction->status_ID(); $info['TXN_reg_steps'] = $transaction->reg_steps(); $index = 'EE_Transaction: ' . $transaction->ID(); EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index); } } } }
/** * debug * * @param string $class * @param string $func * @param string $line * @param array $info * @param bool $display_request */ function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) { if (WP_DEBUG && false) { $debug_data = get_option('EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array()); $default_data = array($class => $func . '() : ' . $line, 'request->step' => $this->step, 'request->action' => $this->action, 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? $this->current_step->slug() : '', 'current_step->completed' => $this->current_step instanceof EE_SPCO_Reg_Step ? $this->current_step->completed() : '', 'txn_status_updated' => $this->txn_status_updated, 'reg_status_updated' => $this->reg_status_updated, 'reg_url_link' => $this->reg_url_link, 'REQ' => $display_request ? $_REQUEST : ''); if ($this->transaction instanceof EE_Transaction) { $default_data['TXN_status'] = $this->transaction->status_ID(); $default_data['TXN_reg_steps'] = $this->transaction->reg_steps(); foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) { $default_data['registrations'][$REG_ID] = $registration->status_ID(); } if ($this->transaction->ID()) { $TXN_ID = 'EE_Transaction: ' . $this->transaction->ID(); // don't serialize objects $info = $this->_strip_objects($info); if (!isset($debug_data[$TXN_ID])) { $debug_data[$TXN_ID] = array(); } $debug_data[$TXN_ID][microtime()] = array_merge($default_data, $info); update_option('EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data); } } } }
/** * txn_details_meta_box * generates HTML for the Transaction main meta box * * @access public * @return void */ public function txn_details_meta_box() { $this->_set_transaction_object(); $this->_template_args['TXN_ID'] = $this->_transaction->ID(); $this->_template_args['attendee'] = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->attendee() : null; //get line items from transaction $this->_template_args['line_items'] = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); $this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code'); // process taxes $taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); $this->_template_args['taxes'] = !empty($taxes) ? $taxes : FALSE; $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE); $this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total'); $this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID'); // $txn_status_class = 'status-' . $this->_transaction->get('STS_ID'); // process payment details $payments = $this->_transaction->get_many_related('Payment'); if (!empty($payments)) { $this->_template_args['payments'] = $payments; $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); } else { $this->_template_args['payments'] = false; $this->_template_args['existing_reg_payments'] = array(); } $this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL); $this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL); if (isset($txn_details['invoice_number'])) { $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; $this->_template_args['txn_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso'); } $this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session'); $this->_template_args['txn_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); $this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : ''; $this->_template_args['txn_details']['ip_address']['label'] = __('Transaction placed from IP', 'event_espresso'); $this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''; $this->_template_args['txn_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); $reg_steps = '<ul>'; foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { if ($reg_step_status === true) { $reg_steps .= '<li style="color:#70cc50">' . sprintf(__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))) . '</li>'; } else { if (is_numeric($reg_step_status) && $reg_step_status !== false) { $reg_steps .= '<li style="color:#2EA2CC">' . sprintf(__('%1$s : Initiated %2$s', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step)), gmdate(get_option('date_format') . ' ' . get_option('time_format'), $reg_step_status + get_option('gmt_offset') * HOUR_IN_SECONDS)) . '</li>'; } else { $reg_steps .= '<li style="color:#E76700">' . sprintf(__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))) . '</li>'; } } } $reg_steps .= '</ul>'; $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; $this->_template_args['txn_details']['reg_steps']['label'] = __('Registration Step Progress', 'event_espresso'); $this->_get_registrations_to_apply_payment_to(); $this->_get_payment_methods($payments); $this->_get_payment_status_array(); $this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction. $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL); $this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL); $this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL); // 'espresso_delete_payment_nonce' $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); }
/** * remove_reg_step * given a valid TXN_reg_step slug, this will remove (unset) * the reg step from the TXN reg step array * * @access public * @param \EE_Transaction $transaction * @param string $reg_step_slug * @return void */ public function remove_reg_step(EE_Transaction $transaction, $reg_step_slug) { // get reg steps array $txn_reg_steps = $transaction->reg_steps(); unset($txn_reg_steps[$reg_step_slug]); $transaction->set_reg_steps($txn_reg_steps); }