Bug fixes
This commit is contained in:
@@ -10,6 +10,10 @@ function booking_register_page() {
|
||||
$output = "";
|
||||
$return_array = array();
|
||||
|
||||
//set the page title
|
||||
$bookingTitle = !empty($event->booking_eventname) ? $event->booking_eventname : 'Event';
|
||||
drupal_set_title($bookingTitle . ' Booking Form');
|
||||
|
||||
//figure out if we're allowed to accept bookings
|
||||
$booking_times = db_query("SELECT booking_register_open, booking_register_close FROM {booking_event} where eid = :eid",
|
||||
array(':eid' => $event->eid))->fetchObject();
|
||||
@@ -125,18 +129,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
||||
'#default_value' => variable_get('booking_gender', empty($data->booking_gender) ? variable_get('booking_default_gender') : $data->booking_gender),
|
||||
'#options' => _booking_gender_options(),
|
||||
);
|
||||
/*
|
||||
$form['your-details']['booking_gender'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Gender'),
|
||||
'#required' => TRUE,
|
||||
'#default_value' => variable_get('booking_gender', empty($data->booking_gender) ? 'M' : $data->booking_gender),
|
||||
'#options' => array(
|
||||
'M' => 'Male',
|
||||
'F' => 'Female',
|
||||
),
|
||||
);
|
||||
*/
|
||||
|
||||
//If we're loading this from an existing node, we need to convert the timestamp into the proper format
|
||||
$form['your-details']['booking_dob'] = array(
|
||||
'#type' => 'date_select',
|
||||
@@ -234,34 +227,19 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
||||
'#title' => t('I am baptised'),
|
||||
'#default_value' => (!empty($data->booking_baptised) && $data->booking_baptised == 'Y') ? 1 : 0
|
||||
);
|
||||
$form['your-details']['booking_married'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('I am married'),
|
||||
'#default_value' => (!empty($data->booking_married) && $data->booking_married == 'Y') ? 1 : 0
|
||||
);
|
||||
$form['your-details']['booking_partner_name'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('If your partner is coming to !event also, please enter their name here. They must register and pay seperately.',
|
||||
array('!event' => $event->booking_eventname)),
|
||||
'#maxlength' => 120,
|
||||
'#required' => FALSE,
|
||||
'#states' => array(
|
||||
// Only show this field when the 'booking_married' checkbox is enabled.
|
||||
'visible' => array(
|
||||
':input[name="booking_married"]' => array('checked' => TRUE),
|
||||
),
|
||||
),
|
||||
'#default_value' => !empty($data->booking_partner_name) ? $data->booking_partner_name : ''
|
||||
);
|
||||
|
||||
if ($inserting == TRUE)
|
||||
|
||||
if (variable_get('booking_allow_couples', 0) == 1)
|
||||
{
|
||||
$form['your-details']['booking_partner_id'] = array(
|
||||
$form['your-details']['booking_married'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('I am married'),
|
||||
'#default_value' => (!empty($data->booking_married) && $data->booking_married == 'Y') ? 1 : 0
|
||||
);
|
||||
$form['your-details']['booking_partner_name'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('If your partner has already registered for !event, please enter their registration id (number only) from the email they were sent. Otherwise, leave blank',
|
||||
array('!event' => $event->booking_eventname)),
|
||||
'#maxlength' => 15,
|
||||
'#size' => 4,
|
||||
'#title' => t('If your partner is coming to !event also, please enter their name here. They must register and pay seperately.',
|
||||
array('!event' => $event->booking_eventname)),
|
||||
'#maxlength' => 120,
|
||||
'#required' => FALSE,
|
||||
'#states' => array(
|
||||
// Only show this field when the 'booking_married' checkbox is enabled.
|
||||
@@ -270,40 +248,58 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
||||
),
|
||||
),
|
||||
'#default_value' => !empty($data->booking_partner_name) ? $data->booking_partner_name : ''
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//add the empty element first
|
||||
$partner_options[] = '';
|
||||
);
|
||||
|
||||
//get a list of possible partners
|
||||
$partners = db_query("SELECT nid, booking_firstname, booking_lastname, booking_partner_id FROM {booking_person} " .
|
||||
"where booking_event_id = :eid and booking_married='Y' order by booking_lastname, booking_firstname",
|
||||
array(':eid' => $event->eid));
|
||||
if ($inserting == TRUE)
|
||||
{
|
||||
$form['your-details']['booking_partner_id'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('If your partner has already registered for !event, please enter their registration id (number only) from the email they were sent. Otherwise, leave blank',
|
||||
array('!event' => $event->booking_eventname)),
|
||||
'#maxlength' => 15,
|
||||
'#size' => 4,
|
||||
'#required' => FALSE,
|
||||
'#states' => array(
|
||||
// Only show this field when the 'booking_married' checkbox is enabled.
|
||||
'visible' => array(
|
||||
':input[name="booking_married"]' => array('checked' => TRUE),
|
||||
),
|
||||
),
|
||||
'#default_value' => !empty($data->booking_partner_name) ? $data->booking_partner_name : ''
|
||||
);
|
||||
}
|
||||
else //not inserting so allow administrator to choose a person
|
||||
{
|
||||
//add the empty element first
|
||||
$partner_options[] = '';
|
||||
|
||||
//convert that into an array
|
||||
foreach($partners as $row)
|
||||
$partner_options[$row->nid] = $row->booking_firstname . ' ' . $row->booking_lastname;
|
||||
//create a select field
|
||||
$form['your-details']['booking_partner_id'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Choose Spouse'),
|
||||
'#default_value' => $data->booking_partner_id,
|
||||
'#options' => $partner_options,
|
||||
);
|
||||
|
||||
//add the boyfriend/girlfriend field in here too
|
||||
$form['your-details']['booking_bf_gf_nid'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Registration ID of Boyfriend/Girlfriend to be placed in the same discussion groups as you.'),
|
||||
'#maxlength' => 15,
|
||||
'#size' => 4,
|
||||
'#required' => FALSE,
|
||||
'#default_value' => !empty($data->booking_bf_gf_nid) ? $data->booking_bf_gf_nid : '',
|
||||
);
|
||||
}
|
||||
//get a list of possible partners
|
||||
$partners = db_query("SELECT nid, booking_firstname, booking_lastname, booking_partner_id FROM {booking_person} " .
|
||||
"where booking_event_id = :eid and booking_married='Y' order by booking_lastname, booking_firstname",
|
||||
array(':eid' => $event->eid));
|
||||
|
||||
//convert that into an array
|
||||
foreach($partners as $row)
|
||||
$partner_options[$row->nid] = $row->booking_firstname . ' ' . $row->booking_lastname;
|
||||
//create a select field
|
||||
$form['your-details']['booking_partner_id'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Choose Spouse'),
|
||||
'#default_value' => $data->booking_partner_id,
|
||||
'#options' => $partner_options,
|
||||
);
|
||||
|
||||
//add the boyfriend/girlfriend field in here too
|
||||
$form['your-details']['booking_bf_gf_nid'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Registration ID of Boyfriend/Girlfriend to be placed in the same discussion groups as you.'),
|
||||
'#maxlength' => 15,
|
||||
'#size' => 4,
|
||||
'#required' => FALSE,
|
||||
'#default_value' => !empty($data->booking_bf_gf_nid) ? $data->booking_bf_gf_nid : '',
|
||||
);
|
||||
}
|
||||
} //end allow couples check
|
||||
|
||||
//watchdog('booking', 'Booking registration form payment type: @info. Payment id: !id',
|
||||
// array('@info' => $payment_type_options[$data->booking_payment_id], '!id' => $data->booking_payment_id ));
|
||||
@@ -951,7 +947,7 @@ function _booking_validate($node, &$form_state) {
|
||||
}
|
||||
|
||||
//verify partner id is in the correct format
|
||||
if ($form_state['booking_partner_id'] != '')
|
||||
if (isset($form_state['booking_partner_id']) && $form_state['booking_partner_id'] != '')
|
||||
{
|
||||
|
||||
if (! is_numeric($form_state['booking_partner_id'] ))
|
||||
|
Reference in New Issue
Block a user