add song choice

This commit is contained in:
2017-08-18 10:24:45 +10:00
parent 9294e17e3f
commit e324071ad9
3 changed files with 22 additions and 1 deletions

View File

@@ -708,6 +708,16 @@ function booking_update_7246() {
}
*/
/**
* Add field for attendee's music choice
*/
function booking_update_7247() {
$spec = array('type' => 'varchar', 'length' => '500', 'not null' => FALSE);
db_add_field('booking_person', 'booking_song_choice', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Implementation of hook_install().
*/

View File

@@ -910,7 +910,14 @@ function booking_form($node, &$form_state, $inserting = FALSE, $early_access_all
'#required' => FALSE,
'#default_value' => !empty($data->booking_random_facts) ? $data->booking_random_facts : ''
);
$form['misc-areas']['booking_song_choice'] = array(
'#type' => 'textfield',
'#title' => t("Let us know if there's a song you'd love to sing during the week."),
'#maxlength' => 200,
'#required' => FALSE,
'#default_value' => !empty($data->booking_song_choice) ? $data->booking_song_choice : ''
);
if ($inserting == TRUE) {
$form['submit'] = array(
@@ -1256,6 +1263,7 @@ function booking_form_submit($form, &$form_state)
$node->booking_skills_other = empty($values['booking_skills_other']) ? 'N' : ($values['booking_skills_other'] == 1 ? 'Y' : 'N');
$node->booking_skills_other_details = empty($values['booking_skills_other_details']) ? 'N/A' : $values['booking_skills_other_details'];
$node->booking_earlyaccess_code_id = empty($values['booking_earlyaccess_code']) ? '' : $earlyaccess_query->cid;
$node->booking_song_choice = empty($values['booking_song_choice']) ? '' : $values['booking_song_choice'];
//remove newlines from these fields so the CSV output doesn't get messed up
$medical = empty($values['booking_medical_conditions']) ? 'N/A' : $values['booking_medical_conditions'];

View File

@@ -287,6 +287,7 @@ function booking_insert($node) {
//TODO: Generalise this by using the keys from $node instead of hard coding everything
$data = array();
//$default_keys = array('nid', 'type', 'language', 'created', 'promote', 'changed', 'status', 'title');
foreach ($node as $key => $value) {
//check if the key is a field that belongs in the database
if ((strpos($key, "booking_") === 0) || $key === "nid") {
@@ -457,6 +458,7 @@ function booking_update($node) {
'booking_random_facts' => $node->booking_random_facts,
'booking_status' => $node->booking_status,
'booking_comment_field' => $node->booking_comment_field,
'booking_song_choice' => $node->booking_song_choice,
))
->condition('nid', $node->nid)
->execute();
@@ -772,6 +774,7 @@ function booking_view($node, $view_mode) {
$rows[] = array(t('Refund Due:'), t('!amount_due', array('!amount_due' => $node->booking_refund_due)));
$rows[] = array(t('Refund Processed:'), t('!ans', array('!ans' => ($node->booking_refund_processed == 'Y' ? 'Yes' : 'No'))));
$rows[] = array(t('Random Facts:'), t('!facts', array('!facts' => $node->booking_random_facts)));
$rows[] = array(t('Song Choice:'), t('!song', array('!song' => $node->booking_song_choice)));
if (variable_get('booking_enable_tshirts', 0) == 1) {
$rows[] = array(t('Hoodie Size:'), $node->booking_shirt_size);