From 5d848794b9cf9c19f7ba5e0504dd66c51cfb5931 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Tue, 10 Sep 2019 09:34:49 +1000 Subject: [PATCH] add db field for previous sw coun --- booking.admin.inc | 74 ++++++++++++++++++++++++++--------------------- booking.install | 13 +++++++++ 2 files changed, 54 insertions(+), 33 deletions(-) diff --git a/booking.admin.inc b/booking.admin.inc index fec4366..e890962 100644 --- a/booking.admin.inc +++ b/booking.admin.inc @@ -584,36 +584,6 @@ function booking_admin() { ), '#default_value' => variable_get('booking_enable_roommate', 0) ); - $form['regn_options']['booking_enable_songchoice'] = array( - '#type' => 'radios', - '#title' => t('Enable attendee to specify song choice?'), - '#description' => t('Select whether to include questions about song choice in the booking form.'), - '#options' => array( - 0 => t('No'), - t('Yes') - ), - '#default_value' => variable_get('booking_enable_songchoice', 0) - ); - $form['regn_options']['booking_enable_freestyle'] = array( - '#type' => 'radios', - '#title' => t('Enable attendee to enter freestyle text'), - '#description' => t('Select whether to include freestyle text field in the booking form.'), - '#options' => array( - 0 => t('No'), - t('Yes') - ), - '#default_value' => variable_get('booking_enable_freestyle', 0) - ); - $form['regn_options']['booking_require_freestyle'] = array( - '#type' => 'radios', - '#title' => t('Require attendees to enter some freestyle text?'), - '#description' => t('Select whether to require attendees to enter some freestyle text when they register. Doesn\'t have any effect if freestyle text is not enabled above.'), - '#options' => array( - 0 => t('No'), - t('Yes') - ), - '#default_value' => variable_get('booking_require_freestyle', 0) - ); $form['regn_options']['booking_enable_dietary'] = array( '#type' => 'radios', '#title' => t('Allow attendee to specify dietary requirements?'), @@ -686,18 +656,56 @@ function booking_admin() { '#maxlength' => 3, '#default_value' => variable_get('booking_earlyaccess_codes_count', '0'), ); - + $form['regn_options']['booking_enable_songchoice'] = array( + '#type' => 'radios', + '#title' => t('Enable attendee to specify song choice?'), + '#description' => t('Select whether to include questions about song choice in the booking form.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_songchoice', 0) + ); $form['regn_options']['booking_require_songchoice'] = array( '#type' => 'radios', '#title' => t('Require attendees to enter a song?'), - '#description' => t('Select whether to require attendees to enter a song choice for the week when they register.'), + '#description' => t('Select whether to require attendees to enter a song choice for the week when they register. Doesn\'t have any effect if song choice is not enabled above.'), '#options' => array( 0 => t('No'), t('Yes') ), '#default_value' => variable_get('booking_require_songchoice', 0) + ); + $form['regn_options']['booking_enable_freestyle'] = array( + '#type' => 'radios', + '#title' => t('Enable attendee to enter freestyle text'), + '#description' => t('Select whether to include freestyle text field in the booking form.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_freestyle', 0) + ); + $form['regn_options']['booking_require_freestyle'] = array( + '#type' => 'radios', + '#title' => t('Require attendees to enter some freestyle text?'), + '#description' => t('Select whether to require attendees to enter some freestyle text when they register. Doesn\'t have any effect if freestyle text is not enabled above.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_require_freestyle', 0) + ); + $form['regn_options']['booking_enable_previous_studyweeks'] = array( + '#type' => 'radios', + '#title' => t('Ask attendee to specify previous study weeks?'), + '#description' => t('Select whether to ask the attendee how many study weeks they\'ve been to previously in the booking form.'), + '#options' => array( + 0 => t('No'), + t('Yes') + ), + '#default_value' => variable_get('booking_enable_previous_studyweeks', 0) ); - $form['management'] = array( '#type' => 'fieldset', '#title' => 'Data Management Options', diff --git a/booking.install b/booking.install index 9a38096..d81af75 100644 --- a/booking.install +++ b/booking.install @@ -822,6 +822,16 @@ function booking_update_7257() { _booking_node_create_mysqlview(); } +/** +* Add field to store number of previous study weeks +*/ +function booking_update_7258() { + $spec = array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE); + db_add_field('booking_person', 'booking_prev_sw_count', $spec); + //update the view to match the new table definition + _booking_node_create_mysqlview(); +} + /** * Implementation of hook_install(). */ @@ -985,6 +995,9 @@ function booking_schema() { 'booking_firstaid' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE), 'booking_nurse' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE), 'booking_doctor' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE), + 'booking_song_choice' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE), + 'booking_freestyle_text' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE), + 'booking_prev_sw_count' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE), /* ), 'foreign keys' => array(