Merge branch 'master' of gitlab.coadcorp.com:drupal/booking

This commit is contained in:
2016-06-23 16:28:26 +10:00
3 changed files with 46 additions and 28 deletions

View File

@@ -566,6 +566,15 @@ function booking_update_7235() {
//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();
}
/**
* Implementation of hook_install().
@@ -577,10 +586,10 @@ function booking_install() {
->fields(array(
'booking_eventid' => 1,
'booking_price' => '50.00',
'booking_price_descrip' => 'Deposit',
'booking_buttonid' => '',
'booking_price_active' => 1,
'booking_depositonly' => 1,
'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
@@ -840,20 +849,20 @@ function booking_schema() {
$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),
),
'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'),
);
@@ -877,11 +886,13 @@ function booking_schema() {
'booking_node_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_studygroup_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
'booking_session_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10', 'default' => 0),
'booking_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'),

View File

@@ -343,6 +343,12 @@ function booking_studygroup_leadhelp_edit_form($node, &$form_state, $group_id) {
unset($reserveleader);
}
//record whether this was a reading group, so we can update colours if necessary
$form['booking_readinggroup'] = array (
'#type' => 'hidden',
'#value' => $studygroup->booking_is_readinggroup,
);
//close out the form
$form['submit'] = array (
'#type' => 'submit',
@@ -454,6 +460,11 @@ function booking_studygroup_leadhelp_edit_form_submit($form, &$form_state) {
} //iterate session
} //iterate role type
//do we need to update colours for reading group?
if ($form_state['values']['booking_readinggroup']) == 'Y') {
booking_studygroups_process_colours();
}
$final_message = "Made $counter updates leader/helper roles for study group id $group_id. Changing one person to another counts as two updates.";
drupal_set_message($final_message, 'status', FALSE);
watchdog('booking', "<pre>" . $final_message . "\n" . implode("\n", $update_messages) . "</pre>");

View File

@@ -560,6 +560,7 @@ function booking_studygroups_edit_form_submit($form, &$form_state) {
foreach ($reading_groups as $group) {
if ($group->sid == $key) {
booking_studygroups_process_colours();
break;
}
}
}
@@ -585,6 +586,7 @@ function booking_studygroups_edit_form_submit($form, &$form_state) {
foreach ($reading_groups as $group) {
if ($group->sid == $key) {
booking_studygroups_process_colours();
break;
}
}
} //end new value check
@@ -1545,7 +1547,7 @@ function booking_studygroups_printview_form($node, &$form_state, $group_id) {
*/
function booking_studygroups_view_form($node, &$form_state, $group_id) {
global $event;
$is_reading_group = FALSE;
//$is_reading_group = FALSE;
$form = array();
$options = array();
$rows = array();
@@ -1575,18 +1577,12 @@ function booking_studygroups_view_form($node, &$form_state, $group_id) {
array(':eid' => $event->eid, ':sid' => $group_id))
->fetchObject();
if (! $group)
{
if (! $group) {
drupal_set_message("Error: Could not find matching study group ID. Unable to view group membership.", 'error', FALSE);
drupal_goto('admin/config/booking');
return "";
}
/*
if ($group_id == variable_get('booking_readinggroup_id','7'))
{
$is_reading_group = TRUE;
}
*/
$header = array(
'booking_session_id' => array('data' => t('Study Group Session'), 'field' => 'm.booking_session_id', 'sort' => 'asc'),
'booking_name' => array('data' => t('Name'), 'field' => 'p.booking_lastname'),