本文整理汇总了PHP中EE_Transaction::ID方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Transaction::ID方法的具体用法?PHP EE_Transaction::ID怎么用?PHP EE_Transaction::ID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Transaction
的用法示例。
在下文中一共展示了EE_Transaction::ID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
/**
* 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);
}
}
}
}
示例2: getimagesize
function espresso_replace_invoice_shortcodes($content)
{
$EE = EE_Registry::instance();
//Create the logo
if (!empty($this->invoice_settings['invoice_logo_url'])) {
$invoice_logo_url = $this->invoice_settings['invoice_logo_url'];
} else {
$invoice_logo_url = $EE->CFG->organization->logo_url;
}
if (!empty($invoice_logo_url)) {
$image_size = getimagesize($invoice_logo_url);
$invoice_logo_image = '<img class="logo screen" src="' . $invoice_logo_url . '" ' . $image_size[3] . ' alt="logo" /> ';
} else {
$invoice_logo_image = '';
}
$SearchValues = array("[organization]", "[registration_code]", "[transaction_id]", "[name]", "[base_url]", "[download_link]", "[invoice_logo_image]", "[street]", "[city]", "[state]", "[zip]", "[email]", "[vat]", "[registration_date]", "[instructions]");
$primary_attendee = $this->transaction->primary_registration()->attendee();
$org_state = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID);
if ($org_state) {
$org_state_name = $org_state->name();
} else {
$org_state_name = '';
}
$ReplaceValues = array(stripslashes($EE->CFG->organization->name), $this->registration->reg_code(), $this->transaction->ID(), $primary_attendee->full_name(), is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice') ? EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/' : EE_GATEWAYS_URL . 'Invoice/lib/templates/', $this->registration->invoice_url(), $invoice_logo_image, empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->address_1 : $EE->CFG->organization->address_1 . '<br>' . $EE->CFG->organization->address_2, $EE->CFG->organization->city, $org_state_name, $EE->CFG->organization->zip, $EE->CFG->organization->email, $EE->CFG->organization->vat, date_i18n(get_option('date_format'), strtotime($this->registration->date())), $this->invoice_settings['pdf_instructions']);
return str_replace($SearchValues, $ReplaceValues, $content);
}
示例3: get_payment_details
/**
* get_payment_details
*
* @access public
* @param array $payments
* @return string
*/
public function get_payment_details($payments = array())
{
//prepare variables for displaying
$template_args = array();
$template_args['transaction'] = $this->_current_txn;
$template_args['reg_url_link'] = $this->_reg_url_link;
$template_args['payments'] = array();
foreach ($payments as $payment) {
$template_args['payments'][] = $this->get_payment_row_html($payment);
}
//create a hacky payment object, but dont save it
$payment = EE_Payment::new_instance(array('TXN_ID' => $this->_current_txn->ID(), 'STS_ID' => EEM_Payment::status_id_pending, 'PAY_timestamp' => time(), 'PAY_amount' => $this->_current_txn->total(), 'PMD_ID' => $this->_current_txn->payment_method_ID()));
$payment_method = $this->_current_txn->payment_method();
if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj() instanceof EE_PMT_Base) {
$template_args['gateway_content'] = $payment_method->type_obj()->payment_overview_content($payment);
} else {
$template_args['gateway_content'] = '';
}
// link to SPCO payment_options
$template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link;
$template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url;
// verify template arguments
EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction');
EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments');
EEH_Template_Validator::verify_isnt_null($template_args['show_try_pay_again_link'], '$show_try_pay_again_link');
EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content');
EEH_Template_Validator::verify_isnt_null($template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url');
return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', $template_args, TRUE, TRUE);
}
示例4: array
/**
* generates HTML for the Attendees Transaction main meta box
* @access private
* @return void
*/
function _txn_attendees_meta_box($post, $metabox = array('args' => array()))
{
global $wpdb;
extract($metabox['args']);
// process items in cart
$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
$this->_template_args['event_attendees'] = array();
if (!empty($line_items)) {
foreach ($line_items as $item) {
$ticket = $item->ticket();
if (empty($ticket)) {
continue;
}
//right now we're only handling tickets here. Cause its expected that only tickets will have attendees right?
$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
$event = $ticket->get_first_related('Registration')->get_first_related('Event');
foreach ($registrations as $registration) {
$attendee = $registration->get_first_related('Attendee');
$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event->get('EVT_name') . ' - ' . $item->get('LIN_name');
$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name();
$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = EEH_Template::format_currency($item->get('LIN_unit_price'));
$this->_template_args['event_attendees'][$registration->ID()]['email'] = $attendee->email();
$this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array());
$this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID();
}
}
$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php';
echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
}
}
示例5: process_shortcode
/**
* process_shortcode - EES_Espresso_Txn_Page
*
* @access public
* @param array $attributes
* @return void
*/
public function process_shortcode($attributes = array())
{
if ($this->_current_txn) {
printf(__("IPN successfully received for Transaction with ID '%d'", "event_espresso"), $this->_current_txn->ID());
} else {
printf(__("No IPN (or incomplete IPN) received.", "event_espresso"));
}
}
示例6: txn_attendees_meta_box
/**
* txn_attendees_meta_box
* generates HTML for the Attendees Transaction main meta box
*
* @access public
* @param WP_Post $post
* @param array $metabox
* @return void
*/
public function txn_attendees_meta_box($post, $metabox = array('args' => array()))
{
extract($metabox['args']);
$this->_template_args['post'] = $post;
$this->_template_args['event_attendees'] = array();
// process items in cart
$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
if (!empty($line_items)) {
foreach ($line_items as $item) {
if ($item instanceof EE_Line_Item) {
switch ($item->OBJ_type()) {
case 'Event':
break;
case 'Ticket':
$ticket = $item->ticket();
if (empty($ticket)) {
continue;
//right now we're only handling tickets here. Cause its expected that only tickets will have attendees right?
}
$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
$event = $ticket->get_first_related('Registration')->get_first_related('Event');
$event_name = $event instanceof EE_Event ? $event->get('EVT_name') . ' - ' . $item->get('LIN_name') : '';
$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
foreach ($registrations as $registration) {
$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->get('REG_count');
$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
// attendee info
$attendee = $registration->get_first_related('Attendee');
if ($attendee instanceof EE_Attendee) {
$this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID();
$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name();
$this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:' . $attendee->email() . '?subject=' . $event->get('EVT_name') . __(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>';
$this->_template_args['event_attendees'][$registration->ID()]['address'] = implode(',<br>', $attendee->full_address_as_array());
} else {
$this->_template_args['event_attendees'][$registration->ID()]['att_id'] = '';
$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = '';
$this->_template_args['event_attendees'][$registration->ID()]['email'] = '';
$this->_template_args['event_attendees'][$registration->ID()]['address'] = '';
}
}
break;
}
}
}
$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
echo EEH_Template::display_template(TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
} else {
echo sprintf(__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'), '<p class="important-notice">', '</p>');
}
}
示例7: thank_you_page_logic
/**
* Updates the transaction in the session to acknowledge the registrant is done
* the registration process, all that remains is for them ot make the offline
* payment. Was renamed from 'set_transaction_details' to 'thank_you_page()', because it served the same purpose
* as it's parent's 'thank_you_page()', which is to update the transaction (but not the payment
* because in this case no payment has been made)
* @global type $EE_Session
* @param EE_Transaction
* @return void
*/
public function thank_you_page_logic(EE_Transaction $transaction)
{
do_action('AHEE_log', __FILE__, __FUNCTION__, '');
//check for an existing payment from this gateway
$payments = $this->_PAY->get_all(array(array('PAY_gateway' => $this->gateway(), 'TXN_ID' => $transaction->ID())));
//if it already exists, short-circuit updating the transaction
if (empty($payments)) {
$this->update_transaction_with_payment($transaction, null);
$transaction->save();
}
//createa hackey payment object, but dont save it
$payment = EE_Payment::new_instance(array('TXN_ID' => $transaction->ID(), 'STS_ID' => EEM_Payment::status_id_pending, 'PAY_timestamp' => current_time('timestamp'), 'PAY_amount' => $transaction->total(), 'PAY_gateway' => $this->_gateway_name));
do_action('AHEE_EE_Gateway__update_transaction_with_payment__done', $transaction, $payment);
parent::thank_you_page_logic($transaction);
}
示例8: _process_finalize_registration
/**
* _process_finalize_registration
*
* @access private
* @return void
*/
private function _process_finalize_registration()
{
do_action('AHEE_log', __FILE__, __FUNCTION__, '');
// save everything
if ($this->_continue_reg && $this->_save_all_registration_information()) {
// echo '<h2 style="color:#E76700;">_process_finalize_registration<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>';
// save TXN data to the cart
$this->_cart->get_grand_total()->save_this_and_descendants_to_txn($this->_transaction->ID());
do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->_transaction);
// if Default REG Status is set to REQUIRES APPROVAL... then payments are NOT allowed
if (EE_Registry::instance()->REQ->is_set('selected_gateway') && EE_Registry::instance()->REQ->get('selected_gateway') == 'payments_closed') {
// echo '<h2 style="color:#E76700;">payments_closed<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>';
// set TXN Status to Open
$this->_transaction->set_status(EEM_Transaction::incomplete_status_code);
$this->_transaction->save();
$this->_transaction->finalize();
$notices = EE_Error::get_notices(FALSE);
$response = array('msg' => array('success' => isset($notices['success']) ? $notices['success'] : '', 'errors' => isset($notices['errors']) ? $notices['errors'] : ''));
$this->_thank_you_page_url = add_query_arg(array('e_reg_url_link' => $this->_transaction->primary_registration()->reg_url_link()), get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
// Default REG Status is set to PENDING PAYMENT OR APPROVED, and payments are allowed
} else {
// attempt to perform transaction via payment gateway
$response = EE_Registry::instance()->load_model('Gateways')->process_payment_start($this->_cart->get_grand_total(), $this->_transaction);
$this->_thank_you_page_url = $response['forward_url'];
}
if (isset($response['msg']['success'])) {
$response_data = array('success' => $response['msg']['success'], 'return_data' => array('redirect-to-thank-you-page' => $this->_thank_you_page_url));
$response_data = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $response_data);
// printr( $response_data, '$response_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
// echo '<h4>thank_you_page_url : ' . $this->_thank_you_page_url . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
if (EE_Registry::instance()->REQ->front_ajax) {
echo json_encode($response_data);
die;
} else {
wp_safe_redirect($this->_thank_you_page_url);
exit;
}
} else {
EE_Error::add_error($response['msg']['error'], __FILE__, __FUNCTION__, __LINE__);
}
// printr( $response, '$response <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
}
$this->go_to_next_step(__FUNCTION__);
}
示例9: getimagesize
function espresso_replace_invoice_shortcodes($content)
{
$EE = EE_Registry::instance();
//Create the logo
$invoice_logo_url = $this->invoice_payment_method->get_extra_meta('pdf_logo_image', TRUE, $EE->CFG->organization->logo_url);
if (!empty($invoice_logo_url)) {
$image_size = getimagesize($invoice_logo_url);
$invoice_logo_image = '<img class="logo screen" src="' . $invoice_logo_url . '" ' . $image_size[3] . ' alt="logo" /> ';
} else {
$invoice_logo_image = '';
}
$SearchValues = array("[organization]", "[registration_code]", "[transaction_id]", "[name]", "[base_url]", "[download_link]", "[invoice_logo_image]", "[street]", "[city]", "[state]", "[zip]", "[email]", "[vat]", "[registration_date]", "[instructions]");
$primary_attendee = $this->transaction->primary_registration()->attendee();
$org_state = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID);
if ($org_state) {
$org_state_name = $org_state->name();
} else {
$org_state_name = '';
}
$ReplaceValues = array($EE->CFG->organization->get_pretty('name'), $this->registration->reg_code(), $this->transaction->ID(), $primary_attendee->full_name(), is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice') ? EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/' : EE_GATEWAYS_URL . 'Invoice/lib/templates/', $this->registration->invoice_url(), $invoice_logo_image, empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1') . '<br>' . $EE->CFG->organization->get_pretty('address_2'), $EE->CFG->organization->get_pretty('city'), $org_state_name, $EE->CFG->organization->get_pretty('zip'), $EE->CFG->organization->get_pretty('email'), $EE->CFG->organization->vat, $this->registration->get_i18n_datetime('REG_date', get_option('date_format')), $this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE));
return str_replace($SearchValues, $ReplaceValues, $content);
}
示例10: transaction_list_table_events_column_content
/**
* Callback for transaction list table column action for new events column.
*
* @param EE_Transaction $transaction
* @return string
*/
public function transaction_list_table_events_column_content($transaction)
{
if (!$transaction instanceof EE_Transaction) {
return;
}
//get event ids
$registrations = $transaction->registrations();
$event_IDs = array();
foreach ($registrations as $registration) {
if ($registration instanceof EE_Registration) {
if ($registration->event_ID() && !in_array($registration->event_ID(), $event_IDs)) {
$event_IDs[] = $registration->event_ID();
}
}
}
if (!empty($event_IDs)) {
$count = count($event_IDs);
$event_IDs = implode(',', $event_IDs);
$url = add_query_arg(array('EVT_IDs' => $event_IDs, 'TXN_ID' => $transaction->ID(), 'page' => 'espresso_events', 'action' => 'default'), admin_url('admin.php'));
echo '<a href="' . $url . '">' . sprintf(_n('1 Event', '%d Events', $count, 'event_espresso'), $count) . '</a>';
}
}
示例11: get_order_id
/**
* Get order ID
*
* @see Pronamic_Pay_PaymentDataInterface::get_order_id()
* @return string
*/
public function get_order_id()
{
return $this->transaction->ID();
}
示例12: recalculate_total_payments_for_transaction
/**
* recalculate_total_payments_for_transaction
*
* @access public
* @param EE_Transaction $transaction
* @param string $payment_status One of EEM_Payment's statuses, like 'PAP' (Approved).
* By default, searches for approved payments
* @return float|false float on success, false on fail
* @throws \EE_Error
*/
public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved)
{
// verify transaction
if (!$transaction instanceof EE_Transaction) {
EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
return false;
}
// ensure Payment model is loaded
EE_Registry::instance()->load_model('Payment');
// calls EEM_Base::sum()
return EEM_Payment::instance()->sum(array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)), 'PAY_amount');
}
示例13: _ensure_txn_on_line_item_and_children
/**
* Checks line item and children list $txn as their transaction.
* Used by E_UnitTestCase_Test::test_new_typical_transaction()
* @param EE_Transaction $txn
* @param EE_Line_Item $line_item
*/
private function _ensure_txn_on_line_item_and_children($txn, $line_item)
{
$this->assertEquals($txn->ID(), $line_item->TXN_ID());
foreach ($line_item->children() as $child_line_item) {
$this->_ensure_txn_on_line_item_and_children($txn, $child_line_item);
}
}
示例14: _assemble_data
/**
* This helper method can be used by any incoming data handlers to setup the data correctly. All that is required is that $this->reg_objs be set.
* @throws \EE_Error
*/
protected function _assemble_data()
{
//verify that reg_objs is set
if (!is_array($this->reg_objs) && !reset($this->reg_objs) instanceof EE_Registration) {
throw new EE_Error(__('In order to assemble the data correctly, the "reg_objs" property must be an array of EE_Registration objects', 'event_espresso'));
}
//get all attendee and events associated with the registrations in this transaction
$events = $event_setup = $evtcache = $tickets = $datetimes = array();
$answers = $questions = $attendees = $line_items = $registrations = array();
$total_ticket_count = 0;
if (!empty($this->reg_objs)) {
$event_attendee_count = array();
foreach ($this->reg_objs as $reg) {
//account for filtered registrations by status.
if (!empty($this->filtered_reg_status) && $this->filtered_reg_status !== $reg->status_ID()) {
continue;
}
$evt_id = $reg->event_ID();
/** @type EE_Ticket $ticket */
$ticket = $reg->get_first_related('Ticket');
$relateddatetime = $ticket->datetimes();
$total_ticket_count++;
$tickets[$ticket->ID()]['ticket'] = $ticket;
$tickets[$ticket->ID()]['count'] = is_array($tickets[$ticket->ID()]) && isset($tickets[$ticket->ID()]['count']) ? $tickets[$ticket->ID()]['count'] + 1 : 1;
$tickets[$ticket->ID()]['att_objs'][$reg->attendee_ID()] = $reg->attendee();
$tickets[$ticket->ID()]['dtt_objs'] = $relateddatetime;
$tickets[$ticket->ID()]['reg_objs'][$reg->ID()] = $reg;
$event = $reg->event();
$tickets[$ticket->ID()]['EE_Event'] = $event;
$evtcache[$evt_id] = $event;
$eventsetup[$evt_id]['reg_objs'][$reg->ID()] = $reg;
$eventsetup[$evt_id]['tkt_objs'][$ticket->ID()] = $ticket;
$eventsetup[$evt_id]['att_objs'][$reg->attendee_ID()] = $reg->attendee();
$event_attendee_count[$evt_id] = isset($event_attendee_count[$evt_id]) ? $event_attendee_count[$evt_id] + 1 : 0;
$attendees[$reg->attendee_ID()]['line_ref'][] = $evt_id;
$attendees[$reg->attendee_ID()]['att_obj'] = $reg->attendee();
$attendees[$reg->attendee_ID()]['reg_objs'][$reg->ID()] = $reg;
//$attendees[ $reg->attendee_ID() ]['registration_id'] = $reg->ID();
$attendees[$reg->attendee_ID()]['attendee_email'] = $reg->attendee() instanceof EE_Attendee ? $reg->attendee()->email() : '';
$attendees[$reg->attendee_ID()]['tkt_objs'][$ticket->ID()] = $ticket;
$attendees[$reg->attendee_ID()]['evt_objs'][$evt_id] = $event;
//registrations
$registrations[$reg->ID()]['tkt_obj'] = $ticket;
$registrations[$reg->ID()]['evt_obj'] = $event;
$registrations[$reg->ID()]['reg_obj'] = $reg;
$registrations[$reg->ID()]['att_obj'] = $reg->attendee();
//set up answer objects
$rel_ans = $reg->get_many_related('Answer');
foreach ($rel_ans as $ansid => $answer) {
if (!isset($questions[$ansid])) {
$questions[$ansid] = $answer->get_first_related('Question');
}
$answers[$ansid] = $answer;
$registrations[$reg->ID()]['ans_objs'][$ansid] = $answer;
}
foreach ($relateddatetime as $dtt_id => $datetime) {
$eventsetup[$evt_id]['dtt_objs'][$dtt_id] = $datetime;
$registrations[$reg->ID()]['dtt_objs'][$dtt_id] = $datetime;
if (isset($datetimes[$dtt_id])) {
continue;
//already have this info in the datetimes array.
}
$datetimes[$dtt_id]['tkt_objs'][] = $ticket;
$datetimes[$dtt_id]['datetime'] = $datetime;
$datetimes[$dtt_id]['evt_objs'][$evt_id] = $event;
$datetimes[$dtt_id]['reg_objs'][$reg->ID()] = $reg;
}
}
//let's loop through the unique event=>reg items and setup data on them
if (!empty($eventsetup)) {
foreach ($eventsetup as $evt_id => $items) {
if ($this->txn instanceof EE_Transaction) {
$ticket_line_items_for_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID' => $evt_id, 'TXN_ID' => $this->txn->ID()), 'default_where_conditions' => 'none'));
} else {
$ticket_line_items_for_event = array();
}
$events[$evt_id] = array('ID' => $evt_id, 'event' => $evtcache[$evt_id], 'name' => $evtcache[$evt_id] instanceof EE_Event ? $evtcache[$evt_id]->name() : '', 'total_attendees' => $event_attendee_count[$evt_id], 'reg_objs' => $items['reg_objs'], 'tkt_objs' => $items['tkt_objs'], 'att_objs' => $items['att_objs'], 'dtt_objs' => isset($items['dtt_objs']) ? $items['dtt_objs'] : array(), 'line_items' => $ticket_line_items_for_event);
//make sure the tickets have the line items setup for them.
foreach ($ticket_line_items_for_event as $line_id => $line_item) {
if ($line_item instanceof EE_Line_Item) {
$tickets[$line_item->ticket()->ID()]['line_item'] = $line_item;
$tickets[$line_item->ticket()->ID()]['sub_line_items'] = $line_item->children();
$line_items[$line_item->ID()]['children'] = $line_item->children();
$line_items[$line_item->ID()]['EE_Ticket'] = $line_item->ticket();
}
}
}
}
$this->grand_total_line_item = $this->txn instanceof EE_Transaction ? $this->txn->total_line_item() : null;
}
//lets set the attendees and events properties
$this->attendees = $attendees;
$this->events = $events;
$this->tickets = $tickets;
$this->line_items_with_children = $line_items;
$this->datetimes = $datetimes;
//.........这里部分代码省略.........
示例15: fix_reg_final_price_rounding_issue
/**
* Makes sure there is no rounding errors for the REG_final_prices.
* Eg, if we have 3 registrations for $1, and there is a $0.01 discount between the three of them,
* they will each be for $0.99333333, which gets rounded to $1 again.
* So the transaction total will be $2.99, but each registration will be for $1,
* so if each registrant paid individually they will have overpaid by $0.01.
* So in order to overcome this, we check for any difference, and if there is a difference
* we just grab one registrant at random and make them responsible for it.
* This should be used after setting REG_final_prices (it's done automatically as part of
* EE_Registration_Processor::update_registration_final_prices())
* @param EE_Transaction $transaction
* @return boolean success verifying that there is NO difference after this method is done
*/
public function fix_reg_final_price_rounding_issue($transaction)
{
$reg_final_price_sum = EEM_Registration::instance()->sum(array(array('TXN_ID' => $transaction->ID())), 'REG_final_price');
$diff = $transaction->total() - floatval($reg_final_price_sum);
//ok then, just grab one of the registrations
if ($diff != 0) {
$a_reg = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $transaction->ID())));
$success = $a_reg instanceof EE_Registration ? $a_reg->save(array('REG_final_price' => $a_reg->final_price() + $diff)) : false;
return $success ? true : false;
} else {
return true;
}
}