Added dependant children option to regn form
This commit is contained in:
@@ -282,6 +282,35 @@ function booking_admin() {
|
||||
'#options' => array (0 => t('No'), t('Yes')),
|
||||
'#default_value' => variable_get('booking_allow_couples', 0),
|
||||
);
|
||||
$form['regn_options']['booking_ask_dependant_children'] = array (
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Ask whether a couple has dependant children attending?'),
|
||||
'#description' => t('Select whether to ask about dependant children of married couples in the registration form'),
|
||||
'#options' => array (0 => t('No'), t('Yes')),
|
||||
'#default_value' => variable_get('booking_ask_dependant_children', 0),
|
||||
);
|
||||
$form['regn_options']['booking_dependant_children_text_definition'] = array (
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Text to display about dependant children'),
|
||||
'#default_value' => variable_get('booking_dependant_children_text_definition', '<b>Please note that only one dependant child under the age of two is allowed.</b>'),
|
||||
'#description' => 'Text to use on registration form if married couple has said they are bringing children.',
|
||||
'#size' => 150,
|
||||
'#maxlength' => 1000,
|
||||
'#states' => array(
|
||||
// Only show this field when the 'booking_enable_dietary' radio option is set to No
|
||||
'visible' => array(
|
||||
':input[name="booking_ask_dependant_children"]' => array('value' => 1),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$form['regn_options']['booking_dependant_children_text'] = array (
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Ask whether a couple has dependant children attending?'),
|
||||
'#description' => t('Select whether to ask about dependant children of married couples in the registration form'),
|
||||
'#options' => array (0 => t('No'), t('Yes')),
|
||||
'#default_value' => variable_get('booking_ask_dependant_children', 0),
|
||||
);
|
||||
|
||||
$form['regn_options']['booking_enable_medicare'] = array (
|
||||
'#type' => 'radios',
|
||||
|
@@ -507,6 +507,14 @@ function booking_update_7229() {
|
||||
db_add_field('booking_person', 'booking_random_facts', $spec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add field for dependant children
|
||||
*/
|
||||
function booking_update_7230() {
|
||||
$spec = array('type' => 'varchar', 'length' => '1', 'not null' => TRUE, 'default' => 'N');
|
||||
db_add_field('booking_person', 'booking_dependant_children', $spec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_install().
|
||||
*/
|
||||
@@ -591,6 +599,8 @@ function booking_schema() {
|
||||
'booking_shirt_size' => array('type' => 'varchar', 'length' => '20', 'not null' => FALSE),
|
||||
'booking_dietary' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
|
||||
'booking_medical_conditions' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE),
|
||||
'booking_random_facts' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE),
|
||||
|
||||
//address details
|
||||
'booking_street' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
||||
'booking_suburb' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
||||
@@ -606,6 +616,7 @@ function booking_schema() {
|
||||
'booking_married' => array('type' => 'varchar', 'length' => '1', 'not null' => TRUE),
|
||||
'booking_partner_name' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
||||
'booking_partner_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10'),
|
||||
'booking_dependant_children' => array('type' => 'varchar', 'length' => '1', 'not null' => TRUE, 'default' => 'N'),
|
||||
'booking_bf_gf' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
||||
'booking_bf_gf_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10'),
|
||||
'booking_room_mate1' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
|
||||
|
@@ -270,6 +270,33 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
||||
'#default_value' => !empty($data->booking_partner_name) ? $data->booking_partner_name : ''
|
||||
);
|
||||
|
||||
if (variable_get('booking_ask_dependant_children', 0) == 1)
|
||||
{
|
||||
$form['your-details']['booking_dependant_children'] = array(
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Are you bringing dependant children to study week?'),
|
||||
'#options' => array (0 => t('No'), t('Yes')),
|
||||
'#default_value' => (!empty($data->booking_dependant_children) && $data->booking_dependant_children == 'Y') ? 1 : 0,
|
||||
'#required' => FALSE,
|
||||
'#states' => array(
|
||||
// Only show this field when the 'booking_married' checkbox is enabled.
|
||||
'visible' => array(
|
||||
':input[name="booking_married"]' => array('checked' => TRUE),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$form['your-details']['booking_dependant_children_warning'] = array(
|
||||
'#type' => 'container',
|
||||
'#children' => variable_get('booking_dependant_children_text_definition', "<b>Please note that only one dependant child under the age of two is allowed.</b>"),
|
||||
'#states' => array(
|
||||
'visible' => array(
|
||||
':input[name="booking_dependant_children"]' => array('value' => 1),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if ($inserting == TRUE)
|
||||
{
|
||||
$form['your-details']['booking_partner_id'] = array(
|
||||
@@ -1260,10 +1287,12 @@ function booking_form_submit($form, &$form_state) {
|
||||
//fields that may or may not have been present in the initial form
|
||||
$node->booking_barcode = empty($values['booking_barcode']) ? '' : $values['booking_barcode'];
|
||||
$node->booking_luckynum = empty($values['booking_luckynum']) ? 0 : $values['booking_luckynum'];
|
||||
$node->booking_random_facts = empty($values['booking_random_facts']) ? '' : $values['booking_random_facts'];
|
||||
$node->booking_welfare_required = empty($values['booking_welfare_required']) ? 'N' : ($values['booking_welfare_required'] == 1 ? 'Y' : 'N');
|
||||
$node->booking_committee_member = empty($values['booking_committee_member']) ? 'N' : ($values['booking_committee_member'] == 1 ? 'Y' : 'N');
|
||||
$node->booking_payment_complete = empty($values['booking_payment_complete']) ? 'N' : ($values['booking_payment_complete'] == 1 ? 'Y' : 'N');
|
||||
$node->booking_refund_processed = empty($values['booking_refund_processed']) ? 'N' : ($values['booking_refund_processed'] == 1 ? 'Y' : 'N');
|
||||
$node->booking_dependant_children = empty($values['booking_dependant_children']) ? 'N' : ($values['booking_dependant_children'] == 1 ? 'Y' : 'N');
|
||||
$node->booking_refund_due = empty($values['booking_refund_due']) ? 0 : $values['booking_refund_due'];
|
||||
$node->booking_help_music = empty($values['booking_help_music']) ? '' : $values['booking_help_music'];
|
||||
$node->booking_help_meditations = empty($values['booking_help_meditations']) ? '' : $values['booking_help_meditations'];
|
||||
|
@@ -193,6 +193,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_dependant_children' => $node->booking_dependant_children,
|
||||
'booking_bf_gf_nid' => $node->booking_bf_gf_nid == '' ? 0 : $node->booking_bf_gf_nid,
|
||||
'booking_room_mate1' => $node->booking_room_mate1,
|
||||
'booking_room_mate2' => $node->booking_room_mate2,
|
||||
@@ -298,6 +299,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_dependant_children' => $node->booking_dependant_children,
|
||||
'booking_bf_gf_nid' => $node->booking_bf_gf_nid == '' ? 0 : $node->booking_bf_gf_nid,
|
||||
'booking_room_mate1' => $node->booking_room_mate1,
|
||||
'booking_room_mate2' => $node->booking_room_mate2,
|
||||
@@ -340,6 +342,7 @@ function booking_update($node) {
|
||||
'booking_payment_complete' => ($node->booking_payment_complete == 1 ? 'Y' : 'N'),
|
||||
'booking_refund_processed' => ($node->booking_refund_processed == 1 ? 'Y' : 'N'),
|
||||
'booking_committee_member' => ($node->booking_committee_member == 1 ? 'Y' : 'N'),
|
||||
'booking_random_facts' => $node->booking_random_facts,
|
||||
'booking_status' => $node->booking_status,
|
||||
|
||||
))
|
||||
|
Reference in New Issue
Block a user