Travel form tweaks

This commit is contained in:
2014-06-11 12:37:07 +10:00
parent 18ce42a14f
commit 5267f368b2
3 changed files with 61 additions and 24 deletions

View File

@@ -309,36 +309,42 @@ function travel_form_validate($form, &$form_state) {
if (! is_numeric($form_state['values']['booking_bf_gf_nid'] ))
{
form_set_error('booking_bf_gf_nid',
t('You have entered an invalid registration id for your boyfriend/girlfriend. Please ensure you are using only the registration reference number your boyfriend/girlfriend received via email. If you believe this to be incorrect, please !contact using the details provided.',
array('!contact' => l('contact us', 'contact')))
t('You have entered an invalid registration id for your boyfriend/girlfriend. ' .
'Please ensure you are using only the registration reference number your boyfriend/girlfriend received via email. For example, your registration ID is !id. ' .
'If you believe this to be incorrect, please !contact using the details provided.',
array('!id' => $form_state['values']['personid'], '!contact' => l('contact us', 'contact')))
);
watchdog('booking', "<pre>Travel form non-numeric bf/gf\n@info</pre>", array('@info' => print_r( $form_state['values'], true)));
}
//don't allow them to specify their own node id
if ($form_state['values']['personid'] == $form_state['values']['booking_bf_gf_nid'])
elseif ($form_state['values']['personid'] == $form_state['values']['booking_bf_gf_nid'])
{
form_set_error('booking_bf_gf_nid',
t('You have entered your own registration id. Please ensure you enter only the registration reference number your boyfriend/girlfriend received via email when registering, not your own registration id.')
t('You have entered your own registration id.' .
'Please ensure you enter only the registration reference number your boyfriend/girlfriend received via email when registering, not your own registration id.')
);
watchdog('booking', "<pre>Travel form bf/gf same as person id\n@info</pre>", array('@info' => print_r( $form_state['values'], true)));
}
//check that the partner exists
$partner = db_query("SELECT person.nid " .
"FROM {booking_person} person " .
"WHERE nid = :nid",
array(':nid' => $form_state['values']['booking_bf_gf_nid']))
->fetchObject();
if (! $partner)
else
{
form_set_error('booking_bf_gf_nid',
t('We cannot find a matching registration id for your boyfriend/girlfriend. Please ensure you are using only the number that relates to their registration. If you believe this to be incorrect, please !contact using the details provided.',
array('!contact' => l('contact us', 'contact')))
);
watchdog('booking', "<pre>Travel form unknown bf/gf id\n@info</pre>", array('@info' => print_r( $form_state['values'], true)));
}
}
//check that the partner exists
$partner = db_query("SELECT person.nid " .
"FROM {booking_person} person " .
"WHERE nid = :nid",
array(':nid' => $form_state['values']['booking_bf_gf_nid']))
->fetchObject();
if (! $partner)
{
form_set_error('booking_bf_gf_nid',
t('We cannot find a matching registration id for your boyfriend/girlfriend. ' .
'Please ensure you are using only the number that relates to their registration. For example, your registration ID is !id. ' .
'If you believe this to be incorrect, please !contact using the details provided.',
array('!id' => $form_state['values']['personid'], '!contact' => l('contact us', 'contact')))
);
watchdog('booking', "<pre>Travel form unknown bf/gf id\n@info</pre>", array('@info' => print_r( $form_state['values'], true)));
} //end missing partner handling
} //end bf/gf validation
} //end bf/gf checking
//check to make sure flight info is entered if it is selected
if (isset($form_state['values']['booking_transport_type']) && $form_state['values']['booking_transport_type'] == 'Flying')