From 50dae617402a055b1d76428659d6182b51d5a088 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Thu, 30 Jan 2014 20:58:25 +1100 Subject: [PATCH] More code to support welfare required flag --- booking.register.inc | 11 +++++++++++ booking.reports.inc | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/booking.register.inc b/booking.register.inc index 19ff4f5..05b3c96 100644 --- a/booking.register.inc +++ b/booking.register.inc @@ -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))); diff --git a/booking.reports.inc b/booking.reports.inc index 4716643..feb1784 100644 --- a/booking.reports.inc +++ b/booking.reports.inc @@ -32,6 +32,7 @@ function booking_report_summary() { array('data' => t('Email'), 'field' => 'booking_email', '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('Welfare Required?'), 'field' => 'booking_welfare_required', 'sort' => 'asc'), ); $rows = array(); @@ -116,7 +117,8 @@ function booking_report_summary() { t('!first !last', array('!first' => ucwords($person->booking_firstname), '!last' => ucwords($person->booking_lastname))), t('!email', array('!email' => $person->booking_email)), 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;