Files
booking/booking.install
2018-05-03 09:38:33 +10:00

1206 lines
56 KiB
Plaintext

<?php
function booking_update_7100() {
$spec = array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2');
db_add_field( 'booking_price', 'booking_late_price', $spec);
}
function booking_update_7101() {
$spec = array('type' => 'varchar', 'length' => '50', 'not null' => FALSE);
db_add_field( 'booking_price', 'booking_late_buttonid', $spec);
}
function booking_update_7102() {
$spec = array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11');
db_add_field( 'booking_person', 'booking_deposit_timestamp', $spec);
}
function booking_update_7103() {
$spec = array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11');
db_add_field( 'booking_event', 'booking_event_start', $spec);
$spec = array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11');
db_add_field( 'booking_event', 'booking_event_end', $spec);
}
function booking_update_7104() {
$spec = array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11');
db_change_field('booking_person', 'booking_deposit_timestamp', 'booking_deposit_timestamp', $spec);
}
function booking_update_7105() {
//remove no longer used earlybird rate flag, replaced by regular and late prices
db_drop_field('booking_price', 'booking_earlybird_rate');
}
function booking_update_7106() {
//add passport details
$spec = array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11');
db_add_field( 'booking_person', 'booking_passport_issue_date', $spec);
db_add_field( 'booking_person', 'booking_passport_expiry_date', $spec);
$spec = array('type' => 'varchar', 'length' => '50', 'not null' => FALSE);
db_add_field( 'booking_person', 'booking_passport_num', $spec);
//add mission area experience details
$spec = array('type' => 'varchar', 'length' => '1', 'not null' => FALSE);
db_add_field( 'booking_person', 'booking_has_mission_experience', $spec);
$spec = array('type' => 'varchar', 'length' => '200', 'not null' => FALSE);
db_add_field( 'booking_person', 'booking_mission_experience_details', $spec);
}
function booking_update_7107() {
$spec = array('type' => 'varchar', 'length' => '500', 'not null' => FALSE);
db_change_field('booking_person', 'booking_mission_experience_details', 'booking_mission_experience_details', $spec);
}
/**
* Add special skills section, update passport info
*/
function booking_update_7108() {
//passport updates
$spec = array('type' => 'varchar', 'length' => '200', 'not null' => FALSE);
db_add_field( 'booking_person', 'booking_passport_issue_location', $spec);
db_add_field( 'booking_person', 'booking_passport_issue_name', $spec);
db_drop_field('booking_price', 'booking_passport_issue_date');
//skills type flags
$spec_flag = array('type' => 'varchar', 'length' => '1', 'not null' => FALSE);
db_add_field( 'booking_person', 'booking_skills_builder', $spec_flag);
db_add_field( 'booking_person', 'booking_skills_cooking', $spec_flag);
db_add_field( 'booking_person', 'booking_skills_childminding', $spec_flag);
db_add_field( 'booking_person', 'booking_skills_language', $spec_flag);
db_add_field( 'booking_person', 'booking_skills_language_details', $spec);
db_add_field( 'booking_person', 'booking_skills_other', $spec_flag);
db_add_field( 'booking_person', 'booking_skills_other_details', $spec);
}
/**
* Make varchar fields bigger
*/
function booking_update_7109() {
$spec = array('type' => 'varchar', 'length' => '500', 'not null' => FALSE);
db_change_field('booking_person', 'booking_passport_issue_location', 'booking_passport_issue_location', $spec);
db_change_field('booking_person', 'booking_skills_language_details', 'booking_skills_language_details', $spec);
db_change_field('booking_person', 'booking_skills_other_details', 'booking_skills_other_details', $spec);
}
/**
* Add event ID field to the payments table
*/
function booking_update_7201() {
//$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10');
//db_add_field( 'booking_payment', 'booking_eventid', $spec);
}
/**
* Add table for variety sessions
*/
function booking_update_7202() {
$booking_variety_sessions = array(
'fields' => array(
'vid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_variety_status' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'booking_variety_timeslot_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_variety_descrip' => array('type' => 'varchar', 'length' => '500', 'not null' => TRUE),
'booking_variety_maxsize' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_variety_regncount' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
),
'primary key' => array('vid'),
);
$booking_variety_timeslots = array(
'fields' => array(
'tid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_variety_status' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'booking_variety_time_descrip' => array('type' => 'varchar', 'length' => '500', 'not null' => TRUE),
'booking_variety_start' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_variety_end' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
),
'primary key' => array('tid'),
);
$booking_variety_regn = array(
'fields' => array(
'rid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_variety_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_node_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
),
'primary key' => array('rid'),
);
db_create_table('booking_variety_sessions', $booking_variety_sessions);
db_create_table('booking_variety_timeslots', $booking_variety_timeslots);
db_create_table('booking_variety_regn', $booking_variety_regn);
//TODO: create tables for variety session timeslots and variety session registrations (map user to variety session id)
//admin forms to create timeslots, then add variety sessions to each timeslot
//user form to register for a given variety session
}
/**
* Add tables for study group calculations
*/
function booking_update_7203() {
//This lists all the study groups
$booking_studygroup_list = array(
'fields' => array(
'sid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_studygroup_descrip' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_num_group_sessions' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10', 'default' => 1),
),
'primary key' => array('sid'),
);
//this maps people to particular study groups
$booking_studygroup_mapping = array(
'fields' => array(
'sid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'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'),
'booking_is_leader' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_is_helper' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
),
'primary key' => array('sid'),
);
db_create_table('booking_studygroup_list', $booking_studygroup_list);
db_create_table('booking_studygroup_mapping', $booking_studygroup_mapping);
//db_create_table('booking_leadhelp_list', $booking_leadhelp_list);
}
/**
* Pre-populate the study group sessions table
*/
function booking_update_7204() {
/*
$result = db_insert('booking_studygroup_list')
->fields(array(
'booking_eventid' => 2,
'booking_studygroup_descrip' => 'Monday',
'booking_num_group_sessions' => 16,
))
->execute();
$result = db_insert('booking_studygroup_list')
->fields(array(
'booking_eventid' => 2,
'booking_studygroup_descrip' => 'Tuesday',
'booking_num_group_sessions' => 16,
))
->execute();
$result = db_insert('booking_studygroup_list')
->fields(array(
'booking_eventid' => 2,
'booking_studygroup_descrip' => 'Wednesday',
'booking_num_group_sessions' => 16,
))
->execute();
$result = db_insert('booking_studygroup_list')
->fields(array(
'booking_eventid' => 2,
'booking_studygroup_descrip' => 'Thursday',
'booking_num_group_sessions' => 16,
))
->execute();
$result = db_insert('booking_studygroup_list')
->fields(array(
'booking_eventid' => 2,
'booking_studygroup_descrip' => 'Friday',
'booking_num_group_sessions' => 16,
))
->execute();
$result = db_insert('booking_studygroup_list')
->fields(array(
'booking_eventid' => 2,
'booking_studygroup_descrip' => 'Saturday',
'booking_num_group_sessions' => 16,
))
->execute();
*/
}
/**
* Add extra field to the study group sessions table
*/
function booking_update_7205() {
}
/**
* Add another field to the booking_studygroup_mapping table
*/
function booking_update_7206() {
$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10', 'default' => 0);
db_add_field( 'booking_studygroup_mapping', 'booking_session_id', $spec);
}
/**
* Add field to support welfare required flag
*/
function booking_update_7207() {
$spec = array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE);
db_add_field( 'booking_person', 'booking_welfare_required', $spec);
}
/**
* Update definition for welfare required flag
*/
function booking_update_7208() {
$spec = array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N');
db_change_field('booking_person', 'booking_welfare_required', 'booking_welfare_required', $spec);
}
/**
* Add field for reserve leader
*/
function booking_update_7209() {
$spec = array('type' => 'varchar', 'length' => '1', 'not null' => FALSE);
db_add_field( 'booking_studygroup_mapping', 'booking_is_reserveleader', $spec);
}
/**
* Update database to allow payments up to $10000
*/
function booking_update_7210() {
$spec = array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2');
db_change_field('booking_person', 'booking_amount_paid', 'booking_amount_paid', $spec);
db_change_field('booking_person', 'booking_total_pay_reqd', 'booking_total_pay_reqd', $spec);
db_change_field('booking_price', 'booking_price', 'booking_price', $spec);
db_change_field('booking_payment', 'booking_mc_gross', 'booking_mc_gross', $spec);
db_change_field('booking_payment', 'booking_mc_fee', 'booking_mc_fee', $spec);
return "Updated maximum payment successfully.";
}
/**
* Add boyfriend or girlfriend node ID field
*/
function booking_update_7211() {
$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0);
db_add_field( 'booking_person', 'booking_bf_gf_nid', $spec);
}
/**
* Add refund fields to booking registration table
*/
function booking_update_7212() {
$spec = array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2');
db_add_field( 'booking_person', 'booking_amount_refunded', $spec);
$spec2 = array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N');
db_add_field( 'booking_person', 'booking_refund_processed', $spec2);
}
/**
* Rename refund field
*/
function booking_update_7213() {
$spec = array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2');
db_change_field('booking_person', 'booking_amount_refunded', 'booking_refund_due', $spec);
}
/**
* Add flag to indicate committee member
*/
function booking_update_7214() {
$spec = array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N');
db_add_field('booking_person', 'booking_committee_member', $spec);
}
/**
* Add table to define reading groups and rooms at rathmines
*/
function booking_update_7215() {
//This gives a label to each reading group (ie, the colour)
$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'),
);
$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_ensuite' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N'),
),
'primary key' => array('rid'),
);
db_create_table('booking_readinggroup_definition', $booking_readinggroup_definition);
db_create_table('booking_room_definition', $booking_room_definition);
$result = db_insert('booking_room_definition')
->fields(array(
'booking_room_location_id' => 0,
'booking_room_number' => 1,
'booking_room_singlebeds' => 2,
'booking_room_doublebeds' => 0,
'booking_room_ensuite' => 'N',
))
->execute();
}
/**
* Add table for mapping people to rooms and a role field to the studygroup mapping table
*/
function booking_update_7216() {
$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),
),
'primary key' => array('mid'),
);
db_create_table('booking_room_mapping', $booking_room_mapping);
//also add a role column to the studygroup mapping table
$spec = array('type' => 'varchar', 'length' => '100', 'not null' => FALSE, 'default' => 0);
db_add_field( 'booking_studygroup_mapping', 'booking_studygroup_role', $spec);
}
/**
* Add queen bed option
*/
function booking_update_7217() {
$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0);
db_add_field('booking_room_definition', 'booking_room_queenbeds', $spec);
}
/**
* Add bed type to mapping table
*/
function booking_update_7218() {
$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0);
db_add_field('booking_room_mapping', 'booking_room_bedtype', $spec);
}
/**
* Add index to room mapping table
*/
function booking_update_7219() {
//couldn't get this to work, added via mysql directly
//ALTER TABLE booking_room_mapping ADD mid Int NOT NULL AUTO_INCREMENT PRIMARY KEY;
//$spec = array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10');
//db_add_field('booking_room_mapping', 'rid', $spec);
//db_add_index('booking_room_mapping', 'rid', array('booking_roomid', 'booking_eventid', 'booking_nodeid'));
}
/**
* Add field for "lucky number" on the lanyard
*/
function booking_update_7220() {
$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0);
db_add_field('booking_person', 'booking_luckynum', $spec);
}
/**
* Add field for destination country when collecting passport informaiton
*/
function booking_update_7221() {
$spec = array('type' => 'varchar', 'length' => '500', 'not null' => FALSE);
db_add_field('booking_person', 'booking_destination_country', $spec);
}
/**
* Add field for travel insurance info when collecting passport information
*/
function booking_update_7222() {
$spec = array('type' => 'varchar', 'length' => '500', 'not null' => FALSE);
db_add_field('booking_person', 'booking_travel_insurance', $spec);
}
/**
* Add fields for flight details when collecting passport information
*/
function booking_update_7223() {
$spec = array('type' => 'varchar', 'length' => '500', 'not null' => FALSE);
db_add_field('booking_person', 'booking_internal_flight_outbound', $spec);
db_add_field('booking_person', 'booking_internal_flight_inbound', $spec);
}
/**
* More fields for flight details
*/
function booking_update_7224() {
db_drop_field('booking_person', 'booking_internal_flight_outbound');
db_drop_field('booking_person', 'booking_internal_flight_inbound');
$text_spec = array('type' => 'varchar', 'length' => '200', 'not null' => FALSE);
$date_spec = array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11');
db_add_field('booking_person', 'booking_outflight_bookingnum', $text_spec);
db_add_field('booking_person', 'booking_outflight_flightnum', $text_spec);
db_add_field('booking_person', 'booking_outflight_origin', $text_spec);
db_add_field('booking_person', 'booking_outflight_origin_ts', $date_spec);
db_add_field('booking_person', 'booking_outflight_connecting_flightnum', $text_spec);
db_add_field('booking_person', 'booking_outflight_destination', $text_spec);
db_add_field('booking_person', 'booking_outflight_destination_ts', $date_spec);
db_add_field('booking_person', 'booking_rtrnflight_bookingnum', $text_spec);
db_add_field('booking_person', 'booking_rtrnflight_flightnum', $text_spec);
db_add_field('booking_person', 'booking_rtrnflight_origin', $text_spec);
db_add_field('booking_person', 'booking_rtrnflight_origin_ts', $date_spec);
db_add_field('booking_person', 'booking_rtrnflight_connecting_flightnum', $text_spec);
db_add_field('booking_person', 'booking_rtrnflight_destination', $text_spec);
db_add_field('booking_person', 'booking_rtrnflight_destination_ts', $date_spec);
}
/**
* Add reading group flag to study group table
*/
function booking_update_7225() {
$spec = array('type' => 'varchar', 'length' => '1', 'not null' => FALSE);
db_add_field('booking_studygroup_list', 'booking_is_readinggroup', $spec);
}
/**
* Add table for defining room location layouts rather than hard coding
*/
function booking_update_7226() {
//NOTE: This doesn't need a reference to the current event, since it is not anticipated that successive events will have a different room layout
$booking_room_locations = array(
'fields' => array(
'lid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_roomlocation_descrip' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_roomlocation_active' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'Y'),
),
'primary key' => array('lid'),
);
db_create_table('booking_room_locations', $booking_room_locations);
}
/**
* Add payment complete flag to simplify payment management
*/
function booking_update_7227() {
$spec = array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N');
db_add_field('booking_person', 'booking_payment_complete', $spec);
}
/**
* Increase maximum length of booking_medical_conditions field to 1000 characters
*/
function booking_update_7228() {
$spec = array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE);
db_change_field('booking_person', 'booking_medical_conditions', 'booking_medical_conditions', $spec);
}
/**
* Add field for random facts
*/
function booking_update_7229() {
$spec = array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE);
db_add_field('booking_person', 'booking_random_facts', $spec);
}
/**
* Add field for dependant children
*/
function booking_update_7230() {
$spec = array('type' => 'varchar', 'length' => '1', 'not null' => TRUE, 'default' => 'N');
db_add_field('booking_person', 'booking_dependant_children', $spec);
}
/**
* Add comment field to registration record
*/
function booking_update_7231() {
$spec = array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE);
db_add_field('booking_person', 'booking_comment_field', $spec);
}
/**
* Rename booking_event_id in booking_person table to booking_eventid
*/
function booking_update_7232() {
$spec = array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE);
db_change_field('booking_person', 'booking_event_id', 'booking_eventid', $spec);
}
/**
* Ensure SQL View booking_person_view is created
*/
function booking_update_7233() {
_booking_node_create_mysqlview();
}
/**
* Remove deprecated passport and flight details
*/
function booking_update_7234() {
$fields = array(
'booking_passport_expiry_date', 'booking_passport_num', 'booking_passport_issue_location',
'booking_passport_issue_name', 'booking_destination_country', 'booking_travel_insurance',
'booking_outflight_bookingnum', 'booking_outflight_flightnum', 'booking_outflight_origin',
'booking_outflight_origin_ts', 'booking_outflight_connecting_flightnum', 'booking_outflight_destination',
'booking_outflight_destination_ts', 'booking_rtrnflight_bookingnum', 'booking_rtrnflight_flightnum',
'booking_rtrnflight_origin', 'booking_rtrnflight_origin_ts', 'booking_rtrnflight_connecting_flightnum',
'booking_rtrnflight_destination', 'booking_rtrnflight_destination_ts'
);
foreach ($fields as $field) {
db_drop_field('booking_person', $field);
}
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Add email address for guardian contact info
*/
function booking_update_7235() {
$spec = array('type' => 'varchar', 'length' => '250', 'not null' => FALSE);
db_add_field('booking_person', 'booking_guardian_email', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Add flag to indicate a studygroup session has been manually assigned
*/
function booking_update_7236() {
$spec = array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N');
db_add_field('booking_studygroup_mapping', 'booking_session_manually_allocated', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Add flag to indicate an attendee that should be kept separate for automated group calculations
*/
function booking_update_7237() {
$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0);
db_add_field('booking_person', 'booking_keepseparate_id', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Add description field to room definitions
*/
function booking_update_7238() {
$spec = array('type' => 'varchar', 'length' => '200', 'not null' => FALSE);
db_add_field('booking_room_definition', 'booking_room_description', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Change room number field in room definitions to integer
*/
function booking_update_7239() {
$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0);
db_change_field('booking_room_definition', 'booking_room_number', 'booking_room_number', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Add stripe token field to booking_payments table
*/
function booking_update_7240() {
$spec = array('type' => 'varchar', 'length' => '200', 'not null' => FALSE);
db_add_field('booking_payment', 'booking_stripe_token', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Change stripe token field to store stripe charge response as JSON
*/
function booking_update_7241() {
$spec = array('type' => 'text', 'not null' => FALSE);
db_change_field('booking_payment', 'booking_stripe_token', 'booking_stripe_response', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Add support for early registration code
*/
function booking_update_7242() {
//add field to booking_person table
$spec = array('type' => 'int', 'length' => '11', 'not null' => FALSE);
db_add_field('booking_person', 'booking_earlyaccess_code_id', $spec);
//create new table to store the valid codes
$booking_earlyaccess_codes = array(
'fields' => array(
'cid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_earlyaccess_code' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_earlyaccess_code_avail' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_earlyaccess_code_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10'),
),
'primary key' => array('cid'),
);
db_create_table('booking_earlyaccess_codes', $booking_earlyaccess_codes);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Add support for html emails
*/
function booking_update_7243() {
$current = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
$addition = array('booking' => 'BookingMailSystem');
variable_set('mail_system', array_merge($current, $addition));
}
/**
* Rename booking_regn_earlyaccess_codes table to booking_earlyaccess_codes
*/
function booking_update_7244() {
db_drop_table('booking_regn_earlyaccess_codes');
//create new table to store the valid codes
$booking_earlyaccess_codes = array(
'fields' => array(
'cid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_earlyaccess_code' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_earlyaccess_code_avail' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_earlyaccess_code_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10'),
),
'primary key' => array('cid'),
);
//db_create_table('booking_earlyaccess_codes', $booking_earlyaccess_codes);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Rename booking_earlyaccess_code back to booking_earlyaccess_code_id in booking_person table
*/
/*
function booking_update_7245() {
$spec = array('type' => 'int', 'length' => '11', 'not null' => FALSE);
db_change_field('booking_person', 'booking_earlyaccess_code', 'booking_earlyaccess_code_id', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
*/
/**
* Add node id to booking_earlyaccess_codes table
*/
/*
function booking_update_7246() {
$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10');
db_add_field('booking_earlyaccess_codes', 'booking_earlyaccess_code_nid', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
*/
/**
* 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();
}
/**
* Increase maximum length of booking_medical_conditions field to 5000 characters
*/
function booking_update_7248() {
$spec = array('type' => 'varchar', 'length' => '5000', 'not null' => FALSE);
db_change_field('booking_person', 'booking_medical_conditions', 'booking_medical_conditions', $spec);
}
/**
* Add field for attendee's freestyle text entry
*/
function booking_update_7249() {
$spec = array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE);
db_add_field('booking_person', 'booking_freestyle_text', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Deprecated - Create table to store configuration for HTML email templates
*/
/*
function booking_update_7250() {
$booking_mailtemplate_fields = array(
'fields' => array(
'mid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_mailtemplate_media_type' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_mailtemplate_link_title' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_mailtemplate_icon_url' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE),
'booking_mailtemplate_link_url' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE),
'booking_mailtemplate_link_active' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
),
'primary key' => array('mid'),
);
db_create_table('booking_mailtemplate_fields', $booking_mailtemplate_fields);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
*/
/**
* Add custom cache table
*/
function booking_update_7252() {
if (!db_table_exists('cache_booking')) {
$schema = drupal_get_schema_unprocessed('system', 'cache');
$schema['description'] = 'Cache table used by booking module.';
db_create_table('cache_booking', $schema);
}
}
/**
* Add field to store waiting list position
*/
function booking_update_7253() {
$spec = array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE);
db_add_field('booking_person', 'booking_waitlist_pos', $spec);
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
/**
* Change booking_variety_regn field type and rename some tables
*/
function booking_update_7254() {
$spec = array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE);
db_change_field('booking_variety_regn', 'booking_variety_id', 'booking_variety_ids', $spec);
db_rename_table('booking_variety_times', 'booking_variety_timeslots');
db_rename_table('booking_variety_options', 'booking_variety_sessions');
}
/**
* Fix incorrect field name in booking_variety_regn table
*/
function booking_update_7255() {
$spec = array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10');
db_change_field('booking_variety_regn', 'booking_node_id', 'booking_person_nid', $spec);
_booking_node_create_mysqlview();
}
/**
* Implementation of hook_install().
*/
function booking_install() {
// Create some sample data
// TODO: Set default values for the config pages too
$result = db_insert('booking_price')
->fields(array(
'booking_eventid' => 1,
'booking_price' => '50.00',
'booking_price_descrip' => 'Deposit',
'booking_buttonid' => '',
'booking_price_active' => 1,
'booking_depositonly' => 1,
))
->execute();
//earlybird close is 31st Jan 2012 at 13:59:59 UTC
$result = db_insert('booking_event')
->fields(array(
'booking_eventname' => 'Sample Event',
'booking_event_active' => 1,
'booking_register_open' => 1312207199,
'booking_register_close' => 1340459999,
'booking_earlybird_close' => 1328018399,
))
->execute();
//create the sql view booking_person_view when first installing this module
_booking_node_create_mysqlview();
}
/**
* Implementation of hook_uninstall()
*/
function booking_uninstall() {
// Remove tables.
//drupal_uninstall_schema('booking');
}
/**
* Implement hook_enable()
* Based on https://drupal.stackexchange.com/questions/23821/email-a-whole-node-including-template-contents
*/
function booking_enable() {
drupal_set_message($message = t('The Booking System module was successfully enabled.'), $type = 'status');
$current = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
$addition = array('booking' => 'BookingMailSystem');
variable_set('mail_system', array_merge($current, $addition));
}
/**
* Implement hook_disable()
*/
function booking_disable() {
drupal_set_message($message = t('The Booking System module was successfully disabled.'), $type = 'status');
$mail_system = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
unset($mail_system['booking']);
variable_set('mail_system', $mail_system);
}
/**
* Implementation of hook_schema().
*/
function booking_schema() {
//configure our own cache table
$schema['cache_booking'] = drupal_get_schema_unprocessed('system', 'cache');
$schema['booking_person'] = array(
'fields' => array(
//identifiers
'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'booking_tempid' => array('type' => 'varchar', 'length' => '40', 'not null' => FALSE),
'booking_earlyaccess_code_id' => array('type' => 'int', 'length' => '11', 'not null' => FALSE),
'booking_timestamp' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '11'),
'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),
'booking_dob' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '11'),
'booking_status' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'booking_waitlist_pos' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'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_readinggroup' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_shirt_size' => array('type' => 'varchar', 'length' => '20', 'not null' => FALSE),
'booking_dietary' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_medical_conditions' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE),
'booking_random_facts' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE),
'booking_comment_field' => array('type' => 'varchar', 'length' => '1000', 'not null' => FALSE),
//address details
'booking_street' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
'booking_suburb' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
'booking_postcode' => array('type' => 'varchar', 'length' => '8', 'not null' => FALSE),
'booking_state' => array('type' => 'varchar', 'length' => '30', 'not null' => FALSE),
'booking_country' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
'booking_phone' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
'booking_mobile' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
'booking_email' => array('type' => 'varchar', 'length' => '200', 'not null' => TRUE),
'booking_ecclesia' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
'booking_baptised' => array('type' => 'varchar', 'length' => '1', 'not null' => TRUE),
//relationships
'booking_married' => array('type' => 'varchar', 'length' => '1', 'not null' => TRUE),
'booking_partner_name' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
'booking_partner_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10'),
'booking_dependant_children' => array('type' => 'varchar', 'length' => '1', 'not null' => TRUE, 'default' => 'N'),
'booking_bf_gf' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
'booking_bf_gf_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10'),
'booking_keepseparate_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
'booking_room_mate1' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_room_mate2' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
//payment info
'booking_payment_id' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'booking_payment_complete' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N'),
//'booking_payment_method' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE),
'booking_total_pay_reqd' => array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2'),
'booking_amount_paid' => array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2'),
'booking_deposit_timestamp' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_refund_processed' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N'),
'booking_refund_due' => array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2'),
//emergency contact info
'booking_guardian_name' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE),
'booking_guardian_type' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE),
'booking_guardian_email' => array('type' => 'varchar', 'length' => '250', 'not null' => FALSE),
'booking_guardian_phone' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
'booking_guardian_phone_alt' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
'booking_medicare' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
/*
),
'primary key' => array('nid'),
);
$schema['booking_person_helpareas'] = array(
'fields' => array(
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
*/
'booking_help_music' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_help_reading' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_help_chairing' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_help_discussgroup_lead' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_help_readgroup_lead' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_help_praying' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_help_meditations' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_has_mission_experience' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_mission_experience_details' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_skills_builder' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_skills_cooking' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_skills_childminding' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_skills_language' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_skills_language_details' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_skills_other' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_skills_other_details' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_lifesaver' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'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),
/*
),
'foreign keys' => array(
'person_reference' => array(
'table' => 'booking_person',
'columns' => array('nid' => 'nid'),
),
),
);
$schema['booking_person_flightinfo'] = array(
'fields' => array(
'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
*/
/*
//passport info
'booking_passport_expiry_date' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_passport_num' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
'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),
'booking_outflight_origin' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'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_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),
'booking_rtrnflight_origin_ts' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_rtrnflight_connecting_flightnum' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_rtrnflight_destination' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_rtrnflight_destination_ts' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
*/
/*
),
'foreign keys' => array(
'person_reference' => array(
'table' => 'booking_person',
'columns' => array('nid' => 'nid'),
),
),
);
*/
),
'primary key' => array('nid'),
);
$schema['booking_event'] = array(
'fields' => array(
'eid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventname' => array('type' => 'varchar', 'length' => '200', 'not null' => TRUE),
'booking_event_active' => array('type' => 'varchar', 'length' => '1', 'default' => 0, 'not null' => TRUE),
'booking_register_open' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_register_close' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_earlybird_close' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_event_start' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_event_end' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
),
'primary key' => array('eid'),
);
$schema['booking_price'] = array(
'fields' => array(
'pid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_price' => array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2'),
'booking_late_price' => array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2'),
'booking_price_descrip' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE),
'booking_buttonid' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
'booking_late_buttonid' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
'booking_price_active' => array('type' => 'varchar', 'length' => '1', 'default' => 0, 'not null' => TRUE),
'booking_earlybird_rate' => array('type' => 'varchar', 'length' => '1', 'default' => 0, 'not null' => TRUE),
'booking_depositonly' => array('type' => 'varchar', 'length' => '1', 'default' => 0, 'not null' => TRUE),
),
'primary key' => array('pid'),
);
$schema['booking_payment'] = array(
'fields' => array(
'payid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_person_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_mc_gross' => array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2'),
'booking_mc_currency' => array('type' => 'varchar', 'length' => '10', 'not null' => FALSE),
'booking_mc_fee' => array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2'),
'booking_quantity' => array('type' => 'int', 'length' => 11, 'not null' => FALSE, 'default' => 0),
'booking_invoice' => array('type' => 'varchar', 'length' => '150', 'not null' => FALSE),
'booking_payer_id' => array('type' => 'varchar', 'length' => '150', 'not null' => FALSE),
'booking_payment_date' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_payment_status' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
'booking_first_name' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
'booking_last_name' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
'booking_buyer_email' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_payer_status' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
'booking_item_name' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_ipn_track_id' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_stripe_token' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
),
'primary key' => array('payid'),
);
$schema['booking_variety_sessions'] = array(
'fields' => array(
'vid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_variety_status' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'booking_variety_timeslot_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_variety_descrip' => array('type' => 'varchar', 'length' => '500', 'not null' => TRUE),
'booking_variety_maxsize' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_variety_regncount' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
),
'primary key' => array('vid'),
);
$schema['booking_variety_timeslots'] = array(
'fields' => array(
'tid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_variety_status' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'booking_variety_time_descrip' => array('type' => 'varchar', 'length' => '500', 'not null' => TRUE),
'booking_variety_start' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_variety_end' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
),
'primary key' => array('tid'),
);
$schema['booking_variety_regn'] = array(
'fields' => array(
'rid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_variety_ids' => array('type' => 'varchar', 'length' => '1000', 'not null' => TRUE),
'booking_person_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
),
'primary key' => array('rid'),
);
$schema['booking_travel'] = array(
'fields' => array(
'tid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_person_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_transport_type' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
'booking_transport_from_morriset_reqd' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_transport_to_morriset_reqd' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_flightnum_inbound' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
'booking_flight_datetime_inbound' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_flightnum_outbound' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
'booking_flight_datetime_outbound' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
'booking_accom_before_reqd' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_accom_before_staying_with' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
'booking_accom_after_reqd' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_accom_after_staying_with' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
),
'primary key' => array('tid'),
);
//This lists all the study groups
$schema['booking_studygroup_list'] = array(
'fields' => array(
'sid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_studygroup_descrip' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_num_group_sessions' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10', 'default' => 1),
'booking_is_readinggroup' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
),
'primary key' => array('sid'),
);
//this maps people to particular study groups
$schema['booking_studygroup_mapping'] = array(
'fields' => array(
'sid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'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_session_manually_allocated' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N'),
'booking_studygroup_role' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE, 'default' => 0),
),
'primary key' => array('sid'),
);
//this table isn't currently in use
$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' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10', 'default' => 0),
'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'),
'booking_room_description' => array('type' => 'varchar', 'length' => '200', 'not null' => TRUE),
),
'primary key' => array('rid'),
);
$schema['booking_room_locations'] = array(
'fields' => array(
'lid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_roomlocation_descrip' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_roomlocation_active' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE, 'default' => 'N'),
),
'primary key' => array('lid'),
);
$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'),
);
//This lists all the early registration access codes
$schema['booking_earlyaccess_codes'] = array(
'fields' => array(
'cid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_earlyaccess_code' => array('type' => 'varchar', 'length' => '500', 'not null' => FALSE),
'booking_earlyaccess_code_avail' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
'booking_earlyaccess_code_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10'),
),
'primary key' => array('cid'),
);
return $schema;
}