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, '#options' => $status_options,
'#default_value' => !empty($data->booking_status) ? $data->booking_status : '', '#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 } //end inserting check for booking status
//tshirts //tshirts
@@ -920,6 +927,7 @@ function booking_form_submit($form, &$form_state) {
$node->booking_medicare = empty($values['booking_medicare']) ? 0 : $values['booking_medicare']; $node->booking_medicare = empty($values['booking_medicare']) ? 0 : $values['booking_medicare'];
//fields that may or may not have been present in the initial form //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_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_meditations = empty($values['booking_help_meditations']) ? '' : $values['booking_help_meditations'];
$node->booking_help_praying = empty($values['booking_help_praying']) ? '' : $values['booking_help_praying']; $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' => $node->booking_skills_other,
'booking_skills_other_details' => $node->booking_skills_other_details, 'booking_skills_other_details' => $node->booking_skills_other_details,
'booking_status' => $node->booking_status, 'booking_status' => $node->booking_status,
'booking_welfare_required' => $node->booking_welfare_required,
)) ))
->execute(); ->execute();
} }
@@ -1179,6 +1188,7 @@ function _booking_update($node) {
'booking_skills_other' => ($node->booking_skills_other == 1 ? 'Y' : 'N'), 'booking_skills_other' => ($node->booking_skills_other == 1 ? 'Y' : 'N'),
'booking_skills_other_details' => $node->booking_skills_other_details, 'booking_skills_other_details' => $node->booking_skills_other_details,
'booking_status' => $node->booking_status, 'booking_status' => $node->booking_status,
'booking_welfare_required' => $node->booking_welfare_required,
)) ))
->condition('nid', $node->nid) ->condition('nid', $node->nid)
->execute(); ->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('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('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('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('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('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))); $rows[] = array(t('Email address:'), t('!email', array('!email' => $node->booking_email)));

View File

@@ -32,6 +32,7 @@ function booking_report_summary() {
array('data' => t('Email'), 'field' => 'booking_email', 'sort' => 'asc'), array('data' => t('Email'), 'field' => 'booking_email', 'sort' => 'asc'),
array('data' => t('Payment To Date'), 'field' => 'booking_amount_paid', 'sort' => 'asc'), array('data' => t('Payment To Date'), 'field' => 'booking_amount_paid', 'sort' => 'asc'),
array('data' => t('Total Payment Required'), 'field' => 'booking_total_pay_reqd', 'sort' => 'asc'), array('data' => t('Total Payment Required'), 'field' => 'booking_total_pay_reqd', 'sort' => 'asc'),
array('data' => t('Welfare Required?'), 'field' => 'booking_welfare_required', 'sort' => 'asc'),
); );
$rows = array(); $rows = array();
@@ -117,6 +118,7 @@ function booking_report_summary() {
t('!email', array('!email' => $person->booking_email)), t('!email', array('!email' => $person->booking_email)),
t('!payment', array('!payment' => $person->booking_amount_paid)), t('!payment', array('!payment' => $person->booking_amount_paid)),
t('!payment', array('!payment' => $person->booking_total_pay_reqd)), t('!payment', array('!payment' => $person->booking_total_pay_reqd)),
t($person->booking_welfare_required == 'Y' ? 'Yes' : 'No'),
); );
$total_paid += $person->booking_amount_paid; $total_paid += $person->booking_amount_paid;