diff --git a/booking.balance.inc b/booking.balance.inc index bdca1fb..86fc820 100644 --- a/booking.balance.inc +++ b/booking.balance.inc @@ -82,166 +82,3 @@ function booking_balance_page() { return $return_array; } - - -/** - * Confirmation page for event registration - */ - -/* -function old_booking_balance_page() { - global $event; - $output = ""; - $waiting_list = False; - $already_paid = false; - $amount_owing = 0; - $return_array = array(); - $output = ""; - - //verify that arg(1) is a uuid - if (! preg_match('/^[0-9A-Fa-f\-]+$/', arg(1))) { - //parameter from url is not what we were expecting - drupal_set_message("Error: Invalid session ID supplied. Please use the contact us form to let us know.", 'error', FALSE); - return ""; - } - - //fetch details about the person - $person = db_query("SELECT person.nid, person.booking_event_id, person.booking_lastname, person.booking_firstname, price.booking_buttonid, price.booking_price, price.booking_price_descrip, " . - " person.booking_married, person.booking_partner_name, booking_partner_id, person.booking_amount_paid, person.booking_status " . - "FROM {booking_person} person, {booking_price} price " . - "WHERE booking_tempid = :tempid " . - "AND person.booking_payment_id = price.pid", - array(':tempid' => arg(1))) - ->fetchObject(); - - if ($person) { - //maximum length for invoice id is 127 characters - $invoiceid = $person->nid . '_bal' . REQUEST_TIME . '_' . $person->booking_lastname . '-' . $person->booking_firstname; - $invoiceid = substr($invoiceid, 0, 126); - } else { - drupal_set_message("Unable to find matching session ID " . arg(1), 'error', FALSE); - return ""; - } - - //set a flag for married couple - $married = $person->booking_partner_id > 0 ? TRUE : FALSE; - - if ($married) - $output .= t("


Hi Mr and Mrs !lastname. Welcome to the payment page for !event, God willing.

", - array('!firstname' => $person->booking_firstname, '!lastname' => $person->booking_lastname, '!event' => $event->booking_eventname)); - else - $output .= t("


Hi !firstname !lastname. Welcome to the payment page for !event, God willing.

", - array('!firstname' => $person->booking_firstname, '!lastname' => $person->booking_lastname, '!event' => $event->booking_eventname)); - - //figure out if we're in the right time period for discounted registration rates - $early = db_query("SELECT booking_earlybird_close FROM {booking_event} where eid = :eid", array( - ':eid' => $event->eid)) - ->fetchObject(); - if ($early->booking_earlybird_close > time()) - $earlybird_flag = TRUE; - else - $earlybird_flag = FALSE; - - //Calculate the amount outstanding - $amount_owing = _booking_amount_owing($person->nid); - - //If the amount outstanding is zero, then display information to that effect. - if ($amount_owing == 0) - { - $output .= t("

Our records indicate that you have already fully paid, so there is no need for you to take any further action.

"); - $return_array[] = array('paragraph' => array('#type' => 'markup', '#markup' => $output)); - return $return_array; - } - else - { - if ($earlybird_flag) - { - $output .= t("

Our records indicate that you have a balance owing of $!owing (including Paypal transaction fees) in order to secure your spot at !event.

", - array('!owing' => number_format($amount_owing, 2, '.', ''), '!event' => $event->booking_eventname)); - } - else - { - //this payment has missed the early bird rate - $output .= t("

Our records indicate that you currently have $!amount outstanding (including Paypal transaction fees) to complete your payment for !event," . - " since you have missed the earlybird-rate cutoff date.

", - array('!amount' => number_format($amount_owing, 2, '.', ''), '!event' => $event->booking_eventname, - '!earlybird-cutoff' => format_date($early->booking_earlybird_close, 'custom', 'd/m/Y') )); - } - - //$output .= t("

Our records indicate that you have a balance owing of $!owing in order to secure your spot at !event. ", - // array('!owing' => number_format($amount_owing, 2, '.', ''), '!event' => $event->booking_eventname)); - - if ($person->booking_status == 2) - { - $output .= t("

However, you are currently on the waiting list, and are not required to pay the balance until your place at !event is confirmed.

", - array('!event' => $event->booking_eventname)); - } - $output .= t("

Please use the button below to submit your final payment securely via Paypal.

"); - $output .= t("

Once we have received your payment, you will be sent an automatic confirmation email thanking you for paying your outstanding fees. " . - "If you are paying via Paypal's eCheque feature, please be aware that payments take 3-5 working days to clear, and you will not receive the confirmation email until that has occurred.

"); - } - - //put all the bits together - $return_array[] = array('paragraph' => array('#type' => 'markup', '#markup' => $output)); - $return_array[] = array('form' => drupal_get_form('balance_form', arg(1), $person, $invoiceid, $amount_owing)); - - //return the form - return $return_array; -} - - -function balance_form($node, &$form_state, $tempid, $person, $invoiceid, $amount_owing) { - - global $event; - //paypal specific settings - $vars = array( - 'module' => 'Booking System', - 'type' => $event->booking_eventname, - //'custom' => $data, - 'item_name' => $event->booking_eventname . ' ' . $person->booking_price_descrip . ' balance', - 'invoice' => $invoiceid, - 'no_shipping' => TRUE, - 'no_note' => TRUE, - 'currency_code' => 'AUD', - 'return' => url('bookingfinal', array('absolute' => TRUE)), - 'cancel_return' => url('balance/' . $tempid, array('absolute' => TRUE)), - 'rm' => '2', - 'amount' => $amount_owing, - 'last_name' => $person->booking_lastname, - 'first_name' => $person->booking_firstname, - 'cmd' => '_xclick', - 'notify_url' => url(BOOKING_PAYPAL_IPN_PATH, array('absolute' => TRUE)), - 'business' => variable_get('booking_paypal_account', '') - ); - - $form['#action'] = url(variable_get('booking_paypal_sandbox', 0) ? BOOKING_PAYPAL_SUBMIT_URL_SANDBOX : BOOKING_PAYPAL_SUBMIT_URL, array('absolute' => TRUE)); - - - foreach($vars as $name => $value) { - - // is this field a forms api element, or just a value? - - // if(is_array($value)) { - // $form[$name] = $value; - // $form[$name]['#name'] = $name; - // } - //else { - $form[$name] = array( - '#type' => 'hidden', - '#value' => $value, - ); - //} - } - - $form['submit'] = array( - '#type' => 'button', - '#value' => t('Continue to Paypal'), - ); - - watchdog('booking', 'Booking Balance payment: @info', array ('@info' => var_export($form, TRUE))); - - return $form; - -} - -*/ \ No newline at end of file