Implementation of travel form
This commit is contained in:
@@ -915,6 +915,8 @@ function booking_form_submit($form, &$form_state) {
|
||||
$node->booking_married = ($values['booking_married'] == 1 ? 'Y' : 'N');
|
||||
$node->booking_partner_name = ucwords($values['booking_partner_name']);
|
||||
$node->booking_partner_id = empty($values['booking_partner_id']) ? 0 : $values['booking_partner_id'];
|
||||
$node->booking_bf_gf_nid = empty($values['booking_bf_gf_nid']) ? 0 : $values['booking_bf_gf_nid'];
|
||||
|
||||
//allow for user-entered value if the state is not already listed
|
||||
if ($values['booking_state'] == 'Other') {
|
||||
$node->booking_state = $values['booking_other_state'];
|
||||
@@ -1021,9 +1023,11 @@ function booking_load($nodes) {
|
||||
$query = db_select('booking_person', 'p');
|
||||
//perform an inner join
|
||||
$query->join('booking_price', 'pr', 'p.booking_payment_id = pr.pid');
|
||||
$query->leftJoin('booking_travel', 't', 'p.nid = t.booking_person_nid');
|
||||
//filter the results and select the appropriate fields
|
||||
$query->condition('p.nid', array_keys($nodes), 'IN')
|
||||
->fields('p')
|
||||
->fields('t')
|
||||
->fields('pr', array('booking_price', 'booking_price_descrip'));
|
||||
//get the query result
|
||||
$result = $query->execute();
|
||||
@@ -1033,7 +1037,7 @@ function booking_load($nodes) {
|
||||
//add that data to the array of node references
|
||||
foreach ($result as $record)
|
||||
{
|
||||
//watchdog('booking', 'This node looks like: @info', array('@info' => var_export($record, TRUE)));
|
||||
//watchdog('booking', "<pre>Loading node:\n@info</pre>", array('@info' => print_r( $record, true)));
|
||||
// run through each result row and add in the needed attributes
|
||||
foreach ($record as $key => $value)
|
||||
{
|
||||
@@ -1074,6 +1078,7 @@ function _booking_insert($node) {
|
||||
'booking_married' => $node->booking_married,
|
||||
'booking_partner_name' => $node->booking_partner_name,
|
||||
'booking_partner_id' => $node->booking_partner_id,
|
||||
'booking_bf_gf_nid' => $node->booking_bf_gf_nid,
|
||||
'booking_room_mate1' => $node->booking_room_mate1,
|
||||
'booking_room_mate2' => $node->booking_room_mate2,
|
||||
'booking_shirt_size' => empty($node->booking_shirt_size) ? 'N/A' : $node->booking_shirt_size,
|
||||
@@ -1154,6 +1159,7 @@ function _booking_update($node) {
|
||||
'booking_married' => ($node->booking_married == 1 ? 'Y' : 'N'),
|
||||
'booking_partner_name' => $node->booking_partner_name,
|
||||
'booking_partner_id' => $node->booking_partner_id,
|
||||
'booking_bf_gf_nid' => $node->booking_bf_gf_nid,
|
||||
'booking_room_mate1' => $node->booking_room_mate1,
|
||||
'booking_room_mate2' => $node->booking_room_mate2,
|
||||
'booking_shirt_size' => $node->booking_shirt_size,
|
||||
@@ -1356,15 +1362,27 @@ function booking_view($node, $view_mode) {
|
||||
$price = _booking_is_earlybird() == true ? $price_lookup->booking_price : $price_lookup->booking_late_price;
|
||||
$payment_type = $price_lookup->booking_price_descrip . ' ($' . $price . ')';
|
||||
|
||||
//look up the actual name for a linked partner
|
||||
if ($node->booking_partner_id != 0)
|
||||
{
|
||||
$partner = db_query("Select booking_firstname, booking_lastname from {booking_person} where nid = :nid",
|
||||
$query = db_query("Select booking_firstname, booking_lastname from {booking_person} where nid = :nid",
|
||||
array(':nid' => $node->booking_partner_id))
|
||||
->fetchObject();
|
||||
$partner_name = $partner->booking_firstname . " " . $partner->booking_lastname;
|
||||
$partner_name = $query->booking_firstname . " " . $query->booking_lastname;
|
||||
}
|
||||
else
|
||||
$partner_name = "N/A";
|
||||
|
||||
//also look up the actual name if a boyfriend/girlfriend is defined
|
||||
if ($node->booking_bf_gf_nid != 0)
|
||||
{
|
||||
$query = db_query("Select booking_firstname, booking_lastname from {booking_person} where nid = :nid",
|
||||
array(':nid' => $node->booking_bf_gf_nid))
|
||||
->fetchObject();
|
||||
$bf_gf = $query->booking_firstname . " " . $query->booking_lastname;
|
||||
}
|
||||
else
|
||||
$bf_gf = "N/A";
|
||||
|
||||
$header = array('Attribute', 'Value');
|
||||
$rows = array();
|
||||
@@ -1406,6 +1424,7 @@ function booking_view($node, $view_mode) {
|
||||
$rows[] = array(t('Married:'), t('!ans', array('!ans' => ($node->booking_married == 'Y' ? 'Yes' : 'No'))));
|
||||
//$rows[] = array(t("If married, attending partner's name:"), t('!name', array('!name' => $node->booking_partner_name)));
|
||||
$rows[] = array(t('Linked Partner:'), t($partner_name));
|
||||
$rows[] = array(t('Linked Boyfriend/Girlfriend:'), t($bf_gf));
|
||||
$rows[] = array(t('Emergency Contact Name:'), $node->booking_guardian_name);
|
||||
$rows[] = array(t('Emergency Contact Relationship:'), $node->booking_guardian_type);
|
||||
$rows[] = array(t('Emergency Contact Phone:'), $node->booking_guardian_phone);
|
||||
|
Reference in New Issue
Block a user