More code to support welfare required flag

This commit is contained in:
2014-01-30 20:58:25 +11:00
parent d36a027a00
commit 50dae61740
2 changed files with 14 additions and 1 deletions

View File

@@ -154,6 +154,13 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#options' => $status_options,
'#default_value' => !empty($data->booking_status) ? $data->booking_status : '',
);
$form['your-details']['booking_welfare_required'] = array(
'#type' => 'checkbox',
'#title' => t('Welfare Required?'),
'#default_value' => (!empty($data->booking_welfare_required) && $data->booking_welfare_required == 'Y') ? 1 : 0
);
} //end inserting check for booking status
//tshirts
@@ -920,6 +927,7 @@ function booking_form_submit($form, &$form_state) {
$node->booking_medicare = empty($values['booking_medicare']) ? 0 : $values['booking_medicare'];
//fields that may or may not have been present in the initial form
$node->booking_welfare_required = empty($values['booking_welfare_required']) ? 'N' : ($values['booking_welfare_required'] == 1 ? 'Y' : 'N');
$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'];
$node->booking_help_praying = empty($values['booking_help_praying']) ? '' : $values['booking_help_praying'];
@@ -1100,6 +1108,7 @@ function _booking_insert($node) {
'booking_skills_other' => $node->booking_skills_other,
'booking_skills_other_details' => $node->booking_skills_other_details,
'booking_status' => $node->booking_status,
'booking_welfare_required' => $node->booking_welfare_required,
))
->execute();
}
@@ -1179,6 +1188,7 @@ function _booking_update($node) {
'booking_skills_other' => ($node->booking_skills_other == 1 ? 'Y' : 'N'),
'booking_skills_other_details' => $node->booking_skills_other_details,
'booking_status' => $node->booking_status,
'booking_welfare_required' => $node->booking_welfare_required,
))
->condition('nid', $node->nid)
->execute();
@@ -1359,6 +1369,7 @@ function booking_view($node, $view_mode) {
$rows[] = array(t('Name:'), t('!first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname)));
$rows[] = array(t('Gender:'), t('!gender', array('!gender' => $node->booking_gender == 'M' ? 'Male' : 'Female')));
$rows[] = array(t('Status:'), t('!status', array('!status' => _booking_status_generate($node->booking_status))));
$rows[] = array(t('Welfare Required:'), $node->booking_welfare_required == 'Y' ? 'Yes' : 'No');
$rows[] = array(t('Barcode:'), t('!id', array('!id' => $node->booking_barcode)));
$rows[] = array(t('Date of birth:'), t('!dob', array('!dob' => format_date($node->booking_dob, 'custom', 'd/m/Y'))));
$rows[] = array(t('Email address:'), t('!email', array('!email' => $node->booking_email)));