diff --git a/booking.confirm.inc b/booking.confirm.inc index cb80020..73bb083 100644 --- a/booking.confirm.inc +++ b/booking.confirm.inc @@ -1,5 +1,4 @@ '); return ""; } - //TODO: if the person says they're married, query to see if they're listed partner has already registered and paid + //@TODO if the person says they're married, query to see if they're listed partner has already registered and paid //if they have, then let the new registration person know their partner has already paid, and send them the confirmation email //fetch details about the person $query = db_select('booking_person', 'p'); - $query->condition('p.booking_tempid', arg(1), '=') + $query->condition('p.booking_tempid', $uuid, '=') ->fields('p', array('nid')); $person = $query->execute() ->fetchObject(); - - if ($person) - { + if ($person) { //load all the fields $node = node_load($person->nid); //maximum length for invoice id is 127 characters $invoiceid = $person->nid . '_' . $node->booking_eventid . '_' . $node->booking_lastname . '-' . $node->booking_firstname; $invoiceid = substr($invoiceid, 0, 126); - } else { - drupal_set_message("Unable to find matching session ID " . arg(1), 'error', FALSE); + } + else { + drupal_set_message("Unable to find matching session ID " . $uuid, 'error', FALSE); + drupal_goto(''); return ""; } - //check if this registration will be on the waiting list - if (_booking_check_bookings_full() == True || $node->booking_status == 2) - $waiting_list = TRUE; - //populate tokens $tokens = booking_define_personspecific_tokens($node); @@ -54,29 +50,27 @@ function booking_confirm_page() { $tokens['paypal-total-form'] = _booking_paypal_form($node, $invoiceid, $tokens['paypal-total-amount'], "Pay Full Amount"); //watchdog('booking', 'Paypal form "@info"', array ('@info' => var_export($tokens['paypal-total-form'], TRUE))); + + //check if this registration will be on the waiting list + if (_booking_check_bookings_full() == True || $node->booking_status == 2) { + $waiting_list = TRUE; + } - //$tokens['paypal-total-form'] = drupal_get_form('_booking_paypal_form', arg(1), $person, $invoiceid, $tokens['paypal-total-amount']); - - if ($waiting_list == FALSE) - { + if ($waiting_list == FALSE) { //watchdog('booking', 'Waiting list is false. Un-tokenised text is "@info"', array ('@info' => variable_get('booking_regn_confirm_page'))); $output = token_replace(variable_get('booking_regn_confirm_page'), $tokens); - //$paypal_form = drupal_get_form('_booking_paypal_form_builder', $person, $invoiceid, $amount_owing, "Pay Full Amount"); } - else - { + else { $output = token_replace(variable_get('booking_regn_confirm_waiting_page'), $tokens); } //optional additional text for married people - if ($node->booking_married == 'Y') - { + if ($node->booking_married == 'Y') { $output .= token_replace(variable_get('booking_regn_confirm_married_text'), $tokens); } - //put all the bits together + //create the render array $return_array[] = array('paragraph' => array('#type' => 'markup', '#markup' => $output)); - //$return_array[] = array('form' => $paypal_form); //return the form return $return_array; diff --git a/booking.reports.inc b/booking.reports.inc index 085257d..c3a1c99 100644 --- a/booking.reports.inc +++ b/booking.reports.inc @@ -561,7 +561,7 @@ function booking_waitinglist_page() { FROM ( SELECT p.nid, p.booking_firstname, p.booking_lastname, p.booking_state, p.booking_country, p.booking_readinggroup, pay.booking_payment_date, p.booking_status FROM {booking_person} p, {booking_payment} pay - WHERE booking_eventid = :eid and p.nid = pay.booking_person_nid and ( booking_status = 2 or booking_status = 4) + WHERE p.booking_eventid = :eid and p.nid = pay.booking_person_nid and ( booking_status = 2 or booking_status = 4) ) AS booking ORDER BY booking_status, booking_payment_date', array(':eid' => $event->eid)); @@ -820,4 +820,4 @@ function booking_csv_report() { //@unlink($filename); exit(0); -} \ No newline at end of file +}