'); return ""; } //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 //work out the node id from the session id $query = db_select('booking_person', 'p'); $query->condition('p.booking_tempid', arg(1), '=') ->fields('p', array('nid')); $person = $query->execute() ->fetchObject(); if ($person) { //load all the fields $node = node_load($person->nid); //calculate the invoice ID $invoiceid = $person->nid . '_bal' . REQUEST_TIME . '_' . $node->booking_lastname . '-' . $node->booking_firstname; //maximum length for invoice id in paypal is 127 characters so truncate if necessary $invoiceid = substr($invoiceid, 0, 126); } else { drupal_set_message("Error: Invalid token supplied to the balance payment page. Please use the contact us form to let us know.", 'error', FALSE); drupal_goto(''); return ""; } //populate tokens and paypal form $tokens = booking_define_personspecific_tokens($node); $tokens['paypal-total-form'] = _booking_paypal_form($node, $invoiceid, $tokens['paypal-total-amount'], "Pay Balance"); //Calculate the amount outstanding //watchdog('booking', 'Booking Balance form calculating amount owing'); //$amount_owing = _booking_amount_owing($person->nid); //If the amount outstanding is zero, then display information to that effect. if ($tokens['paypal-total-amount'] == 0) { $output = token_replace(variable_get('booking_regn_balance_page_paid'), $tokens); } else { $output = token_replace(variable_get('booking_regn_balance_page'), $tokens); //optional additional text for married people if ($node->booking_married == 'Y') $output .= token_replace(variable_get('booking_regn_balance_married_text'), $tokens); } //put all the bits together $return_array[] = array('paragraph' => array('#type' => 'markup', '#markup' => $output)); //$return_array[] = array('form' => $paypal_form); //return the form return $return_array; }