Finish adding schema updates to initial install function

This commit is contained in:
2014-11-16 19:56:16 +11:00
parent eab80a1fdf
commit 0d5245af30
4 changed files with 57 additions and 10 deletions

View File

@@ -178,11 +178,19 @@ function booking_admin() {
);
$form['misc']['booking_enable_tshirts'] = array (
'#type' => 'radios',
'#title' => t('Enable t-shirt information?'),
'#description' => t('Select whether to include tshirt sizing in the booking form.'),
'#title' => t('Enable sizing information?'),
'#description' => t('Select whether to include clothe sizing in the booking form.'),
'#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_enable_tshirts', 0),
);
$form['misc']['booking_tshirts_text_definition'] = array (
'#type' => 'textfield',
'#title' => t('Clothes Sizing Text Definition'),
'#default_value' => variable_get('booking_tshirts_text_definition', 'Preferred t-shirt size'),
'#description' => 'Text to use on registration form to request clothing size (eg t-shirt or hoodie).',
'#size' => 150,
'#maxlength' => 2000,
);
$form['misc']['booking_enable_passport'] = array (
'#type' => 'radios',
'#title' => t('Enable passport information?'),

View File

@@ -334,6 +334,12 @@ function _booking_max_dob_ts()
*/
function _booking_avg_age($sum, $count, $reference_ts)
{
//handle condition where count is zero
if ($count == 0)
{
return "Zero";
}
global $event;
//calculate the average age timestamp
$average = $sum / $count;

View File

@@ -532,6 +532,7 @@ function booking_schema() {
'booking_committee_member' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N'),
'booking_welfare_required' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N'),
'booking_barcode' => array('type' => 'varchar', 'length' => '20', 'not null' => FALSE),
'booking_luckynum' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
'booking_firstname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
'booking_lastname' => array('type' => 'varchar', 'length' => '50', 'not null' => TRUE),
'booking_gender' => array('type' => 'varchar', 'length' => '1', 'not null' => TRUE),
@@ -605,6 +606,8 @@ function booking_schema() {
'booking_passport_issue_location' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_passport_issue_name' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
//flight info
'booking_destination_country' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_travel_insurance' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_outflight_bookingnum' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_outflight_flightnum' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_outflight_origin' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
@@ -612,8 +615,7 @@ function booking_schema() {
'booking_outflight_origin_ts' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_outflight_connecting_flightnum' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_outflight_destination' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_outflight_destination_ts' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_outflight_destination_ts' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_rtrnflight_bookingnum' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_rtrnflight_flightnum' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_rtrnflight_origin' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
@@ -622,7 +624,7 @@ function booking_schema() {
'booking_rtrnflight_destination' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_rtrnflight_destination_ts' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
),
),
'primary key' => array('nid'),
);
$schema['booking_event'] = array(
@@ -747,12 +749,45 @@ function booking_schema() {
'booking_node_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_studygroup_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_session_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10', default => 0),
'booking_is_leader' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_is_helper' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
//'booking_is_leader' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
//'booking_is_helper' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_studygroup_role' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE, 'default' => 0),
),
'primary key' => array('sid'),
);
$schema['booking_readinggroup_definition'] = array(
'fields' => array(
'rid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_readinggroup_descrip' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_readinggroup_location' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
),
'primary key' => array('rid'),
);
$schema['booking_room_definition'] = array(
'fields' => array(
'rid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_room_location_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
'booking_room_number' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_room_singlebeds' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
'booking_room_doublebeds' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
'booking_room_queenbeds' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
'booking_room_ensuite' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N'),
),
'primary key' => array('rid'),
);
$schema['booking_room_mapping'] = array(
'fields' => array(
'mid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_roomid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
'booking_nodeid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
'booking_room_bedtype' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
),
'primary key' => array('mid'),
);
return $schema;
}

View File

@@ -208,7 +208,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
{
$form['your-details']['booking_shirt_size'] = array(
'#type' => 'select',
'#title' => t('Preferred hoodie size'),
'#title' => t(variable_get('booking_tshirts_text_definition', 'Preferred hoodie size')),
'#required' => FALSE,
'#default_value' => variable_get('booking_shirt_size', empty($data->booking_shirt_size) ? '' : $data->booking_shirt_size),
'#options' => _get_tshirt_options(),
@@ -1225,8 +1225,6 @@ function booking_load_query($node_ids = NULL, $fetchAssoc = FALSE)
global $event;
$studygroup_count = variable_get('booking_studygroup_count','0');
//TODO: only add room info if the feature is enabled
$query = db_select('booking_person', 'p');
//add price info
$query->join('booking_price', 'pr', 'p.booking_payment_id = pr.pid');