Added beginning code for room allocation, changing studygroup role field

This commit is contained in:
Nathan Coad
2014-05-26 22:03:32 +10:00
parent c07605ab73
commit 7e464bca59
8 changed files with 463 additions and 52 deletions

View File

@@ -306,7 +306,73 @@ function booking_update_7213() {
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(
'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),
),
);
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);
}
/**