Files
booking/booking.install

870 lines
43 KiB
Plaintext

<?php
// $Id$
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_options = 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_times = 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_options', $booking_variety_options);
db_create_table('booking_variety_times', $booking_variety_times);
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);
}
/**
* Implementation of hook_install().
*/
function booking_install() {
// Create tables.
//not needed for d7
//drupal_install_schema('booking');
//TODO: Don't hard code this
//define('EVENTID', 1);
/*
limit bookings to 350
non workers $260
workers $300
married $540
full payment after 28 feb
$380 pp
*/
$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();
$result = db_insert('booking_event')
->fields(array(
'booking_eventname' => 'Study Weekend 2012',
'booking_event_active' => 1,
'booking_register_open' => 1312207199,
'booking_register_close' => 1340459999,
'booking_earlybird_close' => 1328018399,
))
->execute();
//earlybird close is 31st Jan 2012 at 13:59:59 UTC
}
/**
* Implementation of hook_uninstall()
*/
function booking_uninstall() {
// Remove tables.
//drupal_uninstall_schema('booking');
}
/**
* Implementation of hook_schema().
*/
function booking_schema() {
$schema['booking_person'] = array(
'fields' => array(
//identifiers
'nid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_event_id' => array('type' => 'int', 'length' => '11', 'default' => 0, 'not null' => FALSE),
'booking_tempid' => array('type' => 'varchar', 'length' => '40', '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_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' => '200', '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_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_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_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)),
'primary key' => array('payid'),
);
$schema['booking_variety_options'] = 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_times'] = 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_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'),
);
$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_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_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'),
);
return $schema;
}