/** * generates HTML for the Registration main meta box * @access public * @return void */ public function _reg_details_meta_box() { $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); $this->_template_args['line_items'] = $transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); // process taxes if ($transaction) { //get all "tax" line items for this transaction and we'll use them for the tax display. $taxes = $transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); $this->_template_args['taxes'] = !empty($taxes) ? $taxes : array(); } else { $this->_template_args['taxes'] = array(); } $this->_template_args['view_transaction_button'] = EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart'); $this->_template_args['resend_registration_button'] = EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'resend_registration', '_REG_ID' => $this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt'); $this->_template_args['grand_total'] = EEH_Template::format_currency($transaction->total()); $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; $reg_status_class = 'status-' . $this->_registration->status_ID(); $payment = $transaction->get_first_related('Payment'); $reg_details = !empty($payment) ? maybe_unserialize($payment->details()) : NULL; //REG_ID will NOT be retrieved from $payment! $reg_details['registration_id'] = $this->_registration->get('REG_code'); if (!is_array($reg_details) || is_array($reg_details) && isset($reg_details['REDO_TXN']) && $reg_details['REDO_TXN']) { $reg_details = array(); $reg_details['method'] = ''; $reg_details['response_msg'] = ''; $reg_details['invoice_number'] = ''; } $card_type = isset($reg_details['card_type']) ? ' : ' . $reg_details['card_type'] : ''; if (isset($reg_details['registration_id'])) { $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; } if (isset($reg_details['invoice_number'])) { $this->_template_args['reg_details']['invoice_number']['value'] = isset($reg_details['invoice_number']) ? $reg_details['invoice_number'] : ''; $this->_template_args['reg_details']['invoice_number']['label'] = __('Invoice Number', 'event_espresso'); $this->_template_args['reg_details']['invoice_number']['class'] = 'regular-text'; } $this->_template_args['reg_details']['registration_session']['value'] = $this->_registration->session_ID(); $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; $this->_template_args['reg_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : ''; $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; $this->_template_args['reg_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''; $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; $this->_template_args['full_session'] = $this->_session; $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); }
/** * generates HTML for the Registration main meta box * @access public * @return void */ public function _reg_details_meta_box() { EEH_Autoloader::register_line_item_display_autoloaders(); EEH_Autoloader::register_line_item_filter_autoloaders(); EE_Registry::instance()->load_Helper('Line_Item'); $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); $this->_session = $transaction->session_data(); $filters = new EE_Line_Item_Filter_Collection(); $filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration)); $filters->add(new EE_Non_Zero_Line_Item_Filter()); $line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item()); $filtered_line_item_tree = $line_item_filter_processor->process(); $this->_template_args['REG_ID'] = $this->_registration->ID(); $line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy'); $this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration)); $attendee = $this->_registration->attendee(); $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'resend_registration', '_REG_ID' => $this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; $payment = $transaction->get_first_related('Payment'); $payment = !$payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; $payment_method = $payment->get_first_related('Payment_Method'); $payment_method = !$payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; $reg_status_class = 'status-' . $this->_registration->status_ID(); $reg_details = array('payment_method' => $payment_method->name(), 'response_msg' => $payment->gateway_response(), 'registration_id' => $this->_registration->get('REG_code'), 'registration_session' => $this->_registration->session_ID(), 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''); if (isset($reg_details['registration_id'])) { $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; } if (isset($reg_details['payment_method'])) { $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; } $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); }
/** * generates HTML for the Registration main meta box * @access public * @return void */ public function _reg_details_meta_box() { $transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance(); $this->_session = $transaction->session_data(); $this->_template_args['REG_ID'] = $this->_registration->ID(); $this->_template_args['line_items'] = $transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); $attendee = $this->_registration->attendee(); // process taxes if ($transaction) { //get all "tax" line items for this transaction and we'll use them for the tax display. $taxes = $transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); $this->_template_args['taxes'] = !empty($taxes) ? $taxes : array(); } else { $this->_template_args['taxes'] = array(); } $this->_template_args['view_transaction_button'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_transaction', 'TXN_ID' => $transaction->ID()), TXN_ADMIN_URL), __(' View Transaction'), 'button secondary-button right', 'dashicons dashicons-cart') : ''; $this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration') ? EEH_Template::get_button_or_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'resend_registration', '_REG_ID' => $this->_registration->ID(), 'redirect_to' => 'view_registration'), REG_ADMIN_URL), __(' Resend Registration'), 'button secondary-button right', 'dashicons dashicons-email-alt') : ''; $this->_template_args['grand_total'] = EEH_Template::format_currency($transaction->total()); $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; $payment = $transaction->get_first_related('Payment'); $payment = !$payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment; $payment_method = $payment->get_first_related('Payment_Method'); $payment_method = !$payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method; $reg_status_class = 'status-' . $this->_registration->status_ID(); $reg_details = array('payment_method' => $payment_method->name(), 'response_msg' => $payment->gateway_response(), 'registration_id' => $this->_registration->get('REG_code'), 'registration_session' => $this->_registration->session_ID(), 'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '', 'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''); if (isset($reg_details['registration_id'])) { $this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id']; $this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso'); $this->_template_args['reg_details']['registration_id']['class'] = 'regular-text'; } if (isset($reg_details['payment_method'])) { $this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method']; $this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso'); $this->_template_args['reg_details']['payment_method']['class'] = 'regular-text'; $this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg']; $this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso'); $this->_template_args['reg_details']['response_msg']['class'] = 'regular-text'; } $this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session']; $this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso'); $this->_template_args['reg_details']['registration_session']['class'] = 'regular-text'; $this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address']; $this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso'); $this->_template_args['reg_details']['ip_address']['class'] = 'regular-text'; $this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent']; $this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso'); $this->_template_args['reg_details']['user_agent']['class'] = 'large-text'; $this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL); $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php'; echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); }
/** * This is a helper method used to very whether a registration notification should be sent or * not. Prevents duplicate notifications going out for registration context notifications. * * @param EE_Registration $registration [description] * @param array $extra_details [description] * * @return bool true = send away, false = nope halt the presses. */ protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) { //self::log( // __CLASS__, __FUNCTION__, __LINE__, // $registration->transaction(), // array( '$extra_details' => $extra_details ) //); // currently only using this to send messages for the primary registrant if (!$registration->is_primary_registrant()) { return false; } if (!apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && $registration->status_ID() !== EEM_Registration::status_id_not_approved) { return false; } // release the kraken return true; }
function column_ATT_name(EE_Registration $item) { $attendee = $item->attendee(); if (!$attendee instanceof EE_Attendee) { return __('No contact record for this registration.', 'event_espresso'); } // edit attendee link $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL); $name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('Edit Contact', 'event_espresso') . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name(); $name_link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup> ' : ''; //add group details $name_link .= ' ' . sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size()); //add regcode $link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL); $name_link .= '<br>'; $name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID()) ? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">' . $item->reg_code() . '</a>' : $item->reg_code(); //status $name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status($item->status_ID(), false, 'sentence') . '</span>'; $actions = array(); $DTT_ID = !empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL; $DTT_ID = empty($DTT_ID) && !empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID; if (!empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) { $checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)); $actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso') . '">' . __('View', 'event_espresso') . '</a>'; } return !empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link; }
/** * column__Reg_Status * * @access public * @param \EE_Registration $item * @return string */ function column__Reg_Status(EE_Registration $item) { return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>'; }
/** * sets reg status based either on passed param or on transaction status and event pre-approval setting * * @param \EE_Registration $registration * @param array $additional_details * @return bool */ public function update_registration_after_checkout_or_payment(EE_Registration $registration, $additional_details = array()) { // set initial REG_Status $this->set_old_reg_status($registration->ID(), $registration->status_ID()); // if the registration status gets updated, then save the registration if ($this->toggle_registration_status_for_default_approved_events($registration, false) || $this->toggle_registration_status_if_no_monies_owing($registration, false, $additional_details)) { $registration->save(); } // set new REG_Status $this->set_new_reg_status($registration->ID(), $registration->status_ID()); return $this->reg_status_updated($registration->ID()) && $this->new_reg_status($registration->ID()) == EEM_Registration::status_id_approved ? true : false; }
/** * column_ATT_fname * * @access public * @param \EE_Registration $item * @return string */ function column_ATT_fname(EE_Registration $item) { $attendee = $item->attendee(); $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL); $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : ''; $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $item->ID()) ? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '">' . $attendee_name . '</a>' : $attendee_name; $link .= $item->count() == 1 ? ' <sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : ''; $t = $item->get_first_related('Transaction'); $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0; //append group count to name $link .= ' ' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size()); //append reg_code $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code')); //reg status text for accessibility $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status($item->status_ID(), false, 'sentence') . '</span>'; //trash/restore/delete actions $actions = array(); if ($this->_view != 'trash' && $payment_count === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_trash_registrations', $item->ID())) { $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'trash_registrations', '_REG_ID' => $item->ID()), REG_ADMIN_URL); $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . esc_attr__('Trash Registration', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; } elseif ($this->_view == 'trash') { // restore registration link if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_restore_registrations', $item->ID())) { $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'restore_registrations', '_REG_ID' => $item->ID()), REG_ADMIN_URL); $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' . esc_attr__('Restore Registration', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>'; } if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration', 'espresso_registrations_ee_delete_registrations', $item->ID())) { $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'delete_registrations', '_REG_ID' => $item->ID()), REG_ADMIN_URL); $actions['delete'] = '<a href="' . $delete_lnk_url . '" title="' . esc_attr__('Delete Registration Permanently', 'event_espresso') . '">' . __('Delete', 'event_espresso') . '</a>'; } } return sprintf('%1$s %2$s', $link, $this->row_actions($actions)); }
/** * This is a helper method used to very whether a registration notification should be sent or * not. Prevents duplicate notifications going out for registration context notifications. * * @param EE_Registration $registration [description] * @param array $extra_details [description] * * @return bool true = send away, false = nope halt the presses. */ protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) { //self::log( // __CLASS__, __FUNCTION__, __LINE__, // $registration->transaction(), // array( '$extra_details' => $extra_details ) //); // currently only using this to send messages for the primary registrant if (!$registration->is_primary_registrant()) { return false; } // first we check if we're in admin and not doing front ajax if (is_admin() && !EE_FRONT_AJAX) { //make sure appropriate admin params are set for sending messages if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || !absint($_REQUEST['txn_reg_status_change']['send_notifications'])) { //no messages sent please. return false; } } else { // frontend request (either regular or via AJAX) // TXN is NOT finalized ? if (!isset($extra_details['finalized']) || $extra_details['finalized'] === false) { return false; } // return visit but nothing changed ??? if (isset($extra_details['revisit'], $extra_details['status_updates']) && $extra_details['revisit'] && !$extra_details['status_updates']) { return false; } // NOT sending messages && reg status is something other than "Not-Approved" if (!apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && $registration->status_ID() !== EEM_Registration::status_id_not_approved) { return false; } } // release the kraken return true; }