Various tweaks and fixes
This commit is contained in:
@@ -337,7 +337,7 @@ function _booking_travelform_confirmation_email($nid)
|
|||||||
$subject = t('!event Travel Details Received', array('!event' => $event->booking_eventname));
|
$subject = t('!event Travel Details Received', array('!event' => $event->booking_eventname));
|
||||||
|
|
||||||
$params['subject'] = $subject;
|
$params['subject'] = $subject;
|
||||||
$params['headers']['Bcc'] = "it@coadcorp.com, " . variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from')));
|
$params['headers']['Bcc'] = "it@coadcorp.com, " . variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from')));
|
||||||
|
|
||||||
//retrieve the body of the email
|
//retrieve the body of the email
|
||||||
$params['body'] = token_replace(variable_get('booking_email_travel_complete_text'), $tokens);
|
$params['body'] = token_replace(variable_get('booking_email_travel_complete_text'), $tokens);
|
||||||
|
@@ -22,6 +22,7 @@ define('BOOKING_PAYPAL_IPN_PATH', 'system/booking_paypal/ipn');
|
|||||||
define('TIMEZONE', 'Australia/Sydney');
|
define('TIMEZONE', 'Australia/Sydney');
|
||||||
define('BOOKING_DEFAULT_STATE', 'NSW');
|
define('BOOKING_DEFAULT_STATE', 'NSW');
|
||||||
define('CUSTOM_EMAIL_COUNT', 5);
|
define('CUSTOM_EMAIL_COUNT', 5);
|
||||||
|
define('STUDYGROUP_COUNT', 7);
|
||||||
|
|
||||||
// Load the include for various constants
|
// Load the include for various constants
|
||||||
module_load_include('inc', 'booking', 'booking.constants');
|
module_load_include('inc', 'booking', 'booking.constants');
|
||||||
@@ -319,7 +320,7 @@ function booking_menu() {
|
|||||||
if (variable_get('booking_enable_studygroups', 0) == 1)
|
if (variable_get('booking_enable_studygroups', 0) == 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
$items['admin/config/booking/studygroups'] = array(
|
$items['admin/booking/studygroups'] = array(
|
||||||
'title' => 'View Study Groups',
|
'title' => 'View Study Groups',
|
||||||
'description' => 'View Study Group memberships',
|
'description' => 'View Study Group memberships',
|
||||||
'page callback' => 'booking_studygroups_view_summary',
|
'page callback' => 'booking_studygroups_view_summary',
|
||||||
@@ -327,16 +328,25 @@ function booking_menu() {
|
|||||||
'type' => MENU_NORMAL_ITEM,
|
'type' => MENU_NORMAL_ITEM,
|
||||||
);
|
);
|
||||||
|
|
||||||
$items['admin/config/booking/studygroups/%/view'] = array(
|
$items['admin/booking/studygroups/%/view'] = array(
|
||||||
'title' => 'View Study Group',
|
'title' => 'View Study Group',
|
||||||
'description' => 'View Study Group memberships',
|
'description' => 'View Study Group memberships',
|
||||||
'page callback' => 'drupal_get_form',
|
'page callback' => 'drupal_get_form',
|
||||||
'page arguments' => array('booking_studygroups_view_form', 4),
|
'page arguments' => array('booking_studygroups_view_form', 3),
|
||||||
'access arguments' => array('view study groups'),
|
'access arguments' => array('view study groups'),
|
||||||
//'type' => MENU_NORMAL_ITEM,
|
//'type' => MENU_NORMAL_ITEM,
|
||||||
);
|
);
|
||||||
|
|
||||||
$items['admin/config/booking/studygroups/selectleaders'] = array(
|
$items['admin/booking/studygroups/%/view/print'] = array(
|
||||||
|
'title' => 'Print Study Group',
|
||||||
|
'description' => 'Print Study Group memberships',
|
||||||
|
'page callback' => 'drupal_get_form',
|
||||||
|
'page arguments' => array('booking_studygroups_printview_form', 3),
|
||||||
|
'access arguments' => array('view study groups'),
|
||||||
|
//'type' => MENU_NORMAL_ITEM,
|
||||||
|
);
|
||||||
|
|
||||||
|
$items['admin/booking/studygroups/selectleaders'] = array(
|
||||||
'title' => 'Select Study Group Leaders',
|
'title' => 'Select Study Group Leaders',
|
||||||
'description' => 'Define attendees to lead or help study groups',
|
'description' => 'Define attendees to lead or help study groups',
|
||||||
'page callback' => 'drupal_get_form',
|
'page callback' => 'drupal_get_form',
|
||||||
@@ -345,7 +355,7 @@ function booking_menu() {
|
|||||||
'type' => MENU_LOCAL_ACTION,
|
'type' => MENU_LOCAL_ACTION,
|
||||||
);
|
);
|
||||||
|
|
||||||
$items['admin/config/booking/studygroups/calculate'] = array(
|
$items['admin/booking/studygroups/calculate'] = array(
|
||||||
'title' => 'Calculate Study Groups',
|
'title' => 'Calculate Study Groups',
|
||||||
'description' => 'Calculate Study Group memberships',
|
'description' => 'Calculate Study Group memberships',
|
||||||
'page callback' => 'drupal_get_form',
|
'page callback' => 'drupal_get_form',
|
||||||
@@ -556,6 +566,19 @@ function booking_theme() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add custom templates to the list of theme hooks
|
||||||
|
* Don't use http://www.metachunk.com/comment/166#comment-166
|
||||||
|
* Use http://www.metachunk.com/blog/adding-module-path-drupal-7-theme-registry
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
function booking_preprocess_page(&$vars) {
|
||||||
|
watchdog('booking', "<pre>Preprocess hook:\n@info</pre>", array('@info' => print_r( $vars, true)));
|
||||||
|
//$vars['theme_hook_suggestions'][] = 'studygroups-print';
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of hook_mail().
|
* Implementation of hook_mail().
|
||||||
*/
|
*/
|
||||||
|
@@ -1044,7 +1044,7 @@ function booking_load($nodes) {
|
|||||||
//$count = db_query("SELECT count(*) as num_groups FROM {booking_studygroup_list} where booking_eventid = :eventid", array(':eventid' => $event->eid))
|
//$count = db_query("SELECT count(*) as num_groups FROM {booking_studygroup_list} where booking_eventid = :eventid", array(':eventid' => $event->eid))
|
||||||
// ->fetchObject();
|
// ->fetchObject();
|
||||||
|
|
||||||
for ($i = 1; $i <= 7; $i++)
|
for ($i = 1; $i <= STUDYGROUP_COUNT; $i++)
|
||||||
{
|
{
|
||||||
$query->leftJoin('booking_studygroup_mapping', 's' . $i,
|
$query->leftJoin('booking_studygroup_mapping', 's' . $i,
|
||||||
'p.nid = s' . $i . '.booking_node_id and s' . $i . '.booking_studygroup_id = ' . $i);
|
'p.nid = s' . $i . '.booking_node_id and s' . $i . '.booking_studygroup_id = ' . $i);
|
||||||
@@ -1057,7 +1057,7 @@ function booking_load($nodes) {
|
|||||||
->fields('pr', array('booking_price', 'booking_price_descrip','booking_late_price'));
|
->fields('pr', array('booking_price', 'booking_price_descrip','booking_late_price'));
|
||||||
|
|
||||||
//now add the study group fields
|
//now add the study group fields
|
||||||
for ($i = 1; $i <= 7; $i++)
|
for ($i = 1; $i <= STUDYGROUP_COUNT; $i++)
|
||||||
{
|
{
|
||||||
$query->addField('s' . $i, 'booking_session_id', 'session' . $i);
|
$query->addField('s' . $i, 'booking_session_id', 'session' . $i);
|
||||||
$query->addField('s' . $i, 'booking_is_leader', 'session' . $i . '_leader');
|
$query->addField('s' . $i, 'booking_is_leader', 'session' . $i . '_leader');
|
||||||
@@ -1271,7 +1271,7 @@ function _booking_update($node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if someone needs to move from the waiting list to the booked in list
|
//check if someone has moved to not-coming list from the booked-in list
|
||||||
if ($previous_status->booking_status == 1 && $node->booking_status == 3)
|
if ($previous_status->booking_status == 1 && $node->booking_status == 3)
|
||||||
{
|
{
|
||||||
watchdog('booking', 'Detected person moving from Booked In list to No Longer Coming');
|
watchdog('booking', 'Detected person moving from Booked In list to No Longer Coming');
|
||||||
@@ -1279,6 +1279,8 @@ function _booking_update($node) {
|
|||||||
//let this person know their request has been processed
|
//let this person know their request has been processed
|
||||||
_booking_demoted_to_notcoming_email($node->nid);
|
_booking_demoted_to_notcoming_email($node->nid);
|
||||||
|
|
||||||
|
//TODO: Calculate refund
|
||||||
|
|
||||||
//check if there is room on the booked-in list
|
//check if there is room on the booked-in list
|
||||||
if (_booking_check_bookings_full() == False)
|
if (_booking_check_bookings_full() == False)
|
||||||
{
|
{
|
||||||
@@ -1304,6 +1306,8 @@ function _booking_update($node) {
|
|||||||
watchdog('booking', 'Detected person moving from waiting list to No Longer Coming');
|
watchdog('booking', 'Detected person moving from waiting list to No Longer Coming');
|
||||||
//let this person know their request has been processed
|
//let this person know their request has been processed
|
||||||
_booking_demoted_to_notcoming_email($node->nid);
|
_booking_demoted_to_notcoming_email($node->nid);
|
||||||
|
|
||||||
|
//TODO: Calculate refund
|
||||||
}
|
}
|
||||||
//if we're not automatically sending emails on registration
|
//if we're not automatically sending emails on registration
|
||||||
//and someone moved from not-paid to booked-in (ie, manual payment process)
|
//and someone moved from not-paid to booked-in (ie, manual payment process)
|
||||||
@@ -1566,7 +1570,46 @@ function booking_view($node, $view_mode) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Put study group info here too
|
//display study session data if enabled
|
||||||
|
if (variable_get('booking_enable_studygroups', 0) == 1)
|
||||||
|
{
|
||||||
|
|
||||||
|
//look up the titles of the study groups
|
||||||
|
$studygroups_query = db_query("SELECT * FROM {booking_studygroup_list} WHERE booking_eventid = :eid",
|
||||||
|
array(':eid' => $event->eid));
|
||||||
|
$studygroups = $studygroups_query->fetchAllAssoc('sid');
|
||||||
|
|
||||||
|
for ($i = 1; $i <= STUDYGROUP_COUNT; $i++)
|
||||||
|
{
|
||||||
|
$role = "";
|
||||||
|
|
||||||
|
//calculate the session references
|
||||||
|
$sessionid = "session" . $i;
|
||||||
|
$leaderid = $sessionid . "_leader";
|
||||||
|
$helperid = $sessionid . "_helper";
|
||||||
|
$reserveleaderid = $sessionid . "_reserveleader";
|
||||||
|
|
||||||
|
if ($node->$leaderid == 'Y')
|
||||||
|
$role = "Leader";
|
||||||
|
elseif ($node->$helperid == 'Y')
|
||||||
|
$role = "Helper";
|
||||||
|
elseif ($node->$reserveleaderid == 'Y')
|
||||||
|
$role = "Reserve Leader";
|
||||||
|
|
||||||
|
$group_rows[] = array(t('<b>' . $studygroups[$i]->booking_studygroup_descrip . '</b> group number'), $node->$sessionid);
|
||||||
|
$group_rows[] = array(t('Role'), $role);
|
||||||
|
}
|
||||||
|
|
||||||
|
$node->content['group-heading'] = array(
|
||||||
|
'#markup' => "<h2>Study Groups</h2>",
|
||||||
|
'#weight' => 4,
|
||||||
|
);
|
||||||
|
|
||||||
|
$node->content['group-details'] = array(
|
||||||
|
'#markup' => theme('table', array('header' => $header, 'rows' => $group_rows)),
|
||||||
|
'#weight' => 5,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$node->content['details'] = array(
|
$node->content['details'] = array(
|
||||||
'#markup' => theme('table', array('header' => $header, 'rows' => $rows)),
|
'#markup' => theme('table', array('header' => $header, 'rows' => $rows)),
|
||||||
|
@@ -107,6 +107,7 @@ function booking_report_summary() {
|
|||||||
t('!fullypaid', array('!fullypaid' => $amount_owing == 0 ? 'Yes' : 'No')),
|
t('!fullypaid', array('!fullypaid' => $amount_owing == 0 ? 'Yes' : 'No')),
|
||||||
t($person->booking_welfare_required == 'Y' ? 'Yes' : 'No'),
|
t($person->booking_welfare_required == 'Y' ? 'Yes' : 'No'),
|
||||||
);
|
);
|
||||||
|
//add up the total paid
|
||||||
$total_paid += $person->booking_amount_paid;
|
$total_paid += $person->booking_amount_paid;
|
||||||
|
|
||||||
//booking status
|
//booking status
|
||||||
@@ -509,8 +510,7 @@ function booking_csv_report() {
|
|||||||
if ($key == 'nid')
|
if ($key == 'nid')
|
||||||
{
|
{
|
||||||
$output[] = $value;
|
$output[] = $value;
|
||||||
//this is really hacky since it does another massive database query for each person
|
//this is really hacky since it does another database query for each person
|
||||||
//$person = node_load($value);
|
|
||||||
$output[] = _booking_amount_owing($value, 0, FALSE);
|
$output[] = _booking_amount_owing($value, 0, FALSE);
|
||||||
//$output[] = _booking_amount_owing($value);
|
//$output[] = _booking_amount_owing($value);
|
||||||
continue;
|
continue;
|
||||||
@@ -525,51 +525,8 @@ function booking_csv_report() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$row = implode($delimiter, $output) . "\n";
|
$row = implode($delimiter, $output) . "\n";
|
||||||
|
|
||||||
|
|
||||||
//watchdog('booking', "Report filename: " . $filename . ".");
|
|
||||||
/*
|
|
||||||
|
|
||||||
//$header = "Barcode,Timestamp,First Name,Last Name,Gender,Date of Birth,Street,Suburb,Postcode,State,Country,Home Phone Number,Mobile Phone Number,Email,Second Email,Ecclesia,Baptised,Married,Partner Name,Room Mate 1,Room Mate 2,Help Areas,Attending Post Conference,Payment Method,Deposit Payment Deadline,Amount Paid,Discount,Status,T-shirt size";
|
|
||||||
$header = "First Name,Last Name,Gender,Date of Birth,Married,Partner Name,Email Address,Mobile Phone,Home Phone,Baptised,";
|
|
||||||
|
|
||||||
if (variable_get('booking_enable_passport', 1) == 1)
|
|
||||||
$header .= "Passport Number,Passport Expiry,Passport Issue Name,Passport Issue Location,";
|
|
||||||
|
|
||||||
if (variable_get('booking_enable_tshirts', 0) == 1)
|
|
||||||
$header .= "T-Shirt size,";
|
|
||||||
|
|
||||||
$header .= "Ecclesia,Street,Suburb,Post Code,State,Country,Emergency Contact Name,Emergency Contact Type,Emergency Contact Phone," .
|
|
||||||
"Emergency Contact Phone Alt,Medicare Number,Help Reading,Help Chairing,Help Music,Dietary Requirements,First Aid,Nurse," .
|
|
||||||
"Booking Status,Date Paid,Amount Due,Amount Paid";
|
|
||||||
|
|
||||||
if (variable_get('booking_enable_skills', 1) == 1)
|
|
||||||
$header .= ",Building Skills,Cooking Skills,Child Minding Skills,Other Languages,Mission Experience";
|
|
||||||
|
|
||||||
$query = db_query("SELECT * FROM {booking_person} p WHERE p.booking_event_id = :eid",
|
|
||||||
array(':eid' => $event->eid));
|
|
||||||
$result = $query->fetchAll();
|
|
||||||
|
|
||||||
$music_help = empty($r->booking_help_music) ? '' : $r->booking_help_music;
|
|
||||||
$row = ucwords($r->booking_firstname) . ',' . ucwords($r->booking_lastname) . ',' . $r->booking_gender . ',' . format_date($r->booking_dob, 'custom', 'd/m/Y') . ',' .
|
|
||||||
$r->booking_married . ',' . $r->booking_partner_name . ',' . $r->booking_email . ',"' . $r->booking_mobile . '","' . $r->booking_phone . '",' .
|
|
||||||
$r->booking_baptised . ',';
|
|
||||||
|
|
||||||
if (variable_get('booking_enable_passport', 1) == 1)
|
|
||||||
$row .= $r->booking_passport_num . ',' .
|
|
||||||
|
|
||||||
$row .= '"' . $r->booking_ecclesia . '","' . $r->booking_street . '","' . $r->booking_suburb . '",' . $r->booking_postcode . ',' .
|
|
||||||
$r->booking_state . ',' . $r->booking_country . ',"' .
|
|
||||||
$r->booking_guardian_name . '",' . $r->booking_guardian_type . ',"' . $r->booking_guardian_phone . '","' . $r->booking_guardian_phone_alt . '",' .
|
|
||||||
$r->booking_medicare . ',' .
|
|
||||||
$r->booking_help_reading . ',' . $r->booking_help_chairing . ',"' . $music_help . '","' .
|
|
||||||
$r->booking_dietary . '",' . $r->booking_firstaid . ',' . $r->booking_nurse . ',' .
|
|
||||||
_booking_status_generate($r->booking_status) . ',' . format_date(_booking_datepaid_ts($r->nid), 'custom', 'd/m/Y H:i') . ',' .
|
|
||||||
$r->booking_total_pay_reqd . ',' . $r->booking_amount_paid . "\n";
|
|
||||||
*/
|
|
||||||
|
|
||||||
@fwrite($handle, $row);
|
@fwrite($handle, $row);
|
||||||
//$index++;
|
//$index++;
|
||||||
}
|
}
|
||||||
|
@@ -426,7 +426,7 @@ function booking_studygroups_calculate() {
|
|||||||
//delete from booking_studygroup_mapping;
|
//delete from booking_studygroup_mapping;
|
||||||
//alter table booking_studygroup_mapping AUTO_INCREMENT=1;
|
//alter table booking_studygroup_mapping AUTO_INCREMENT=1;
|
||||||
|
|
||||||
//consider using a lock as per https://api.drupal.org/api/drupal/includes!lock.inc/group/lock/7
|
//TODO: consider using a lock as per https://api.drupal.org/api/drupal/includes!lock.inc/group/lock/7
|
||||||
|
|
||||||
//select all the study groups for this event id
|
//select all the study groups for this event id
|
||||||
$studygroups_query = db_query("SELECT * FROM {booking_studygroup_list} WHERE booking_eventid = :eid", array(':eid' => $event->eid));
|
$studygroups_query = db_query("SELECT * FROM {booking_studygroup_list} WHERE booking_eventid = :eid", array(':eid' => $event->eid));
|
||||||
@@ -464,6 +464,8 @@ function booking_studygroups_calculate() {
|
|||||||
$group_mapping_query = db_query("SELECT * FROM {booking_studygroup_mapping} WHERE booking_eventid = :eid", array(':eid' => $event->eid));
|
$group_mapping_query = db_query("SELECT * FROM {booking_studygroup_mapping} WHERE booking_eventid = :eid", array(':eid' => $event->eid));
|
||||||
$group_mapping = $group_mapping_query->fetchAllAssoc('sid');
|
$group_mapping = $group_mapping_query->fetchAllAssoc('sid');
|
||||||
|
|
||||||
|
//TODO: search for entries already in the mapping table that have a booking_status of 3 (not coming) and remove them from the mapping table
|
||||||
|
|
||||||
//iterate over the attendee associative array and add some fields
|
//iterate over the attendee associative array and add some fields
|
||||||
foreach ($attendees as $person)
|
foreach ($attendees as $person)
|
||||||
{
|
{
|
||||||
@@ -749,7 +751,7 @@ function booking_studygroups_view_summary() {
|
|||||||
|
|
||||||
foreach ($result as $group) {
|
foreach ($result as $group) {
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
l(t('!id', array('!id' => $group->sid)), t('admin/config/booking/studygroups/!id/view', array('!id' => $group->sid))),
|
l(t('!id', array('!id' => $group->sid)), t('admin/booking/studygroups/!id/view', array('!id' => $group->sid))),
|
||||||
$group->booking_studygroup_descrip,
|
$group->booking_studygroup_descrip,
|
||||||
$group->booking_num_group_sessions,
|
$group->booking_num_group_sessions,
|
||||||
);
|
);
|
||||||
@@ -763,6 +765,112 @@ function booking_studygroups_view_summary() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for viewing a printable format of who belongs to which study group
|
||||||
|
*/
|
||||||
|
function booking_studygroups_printview_form($node, &$form_state, $group_id) {
|
||||||
|
global $event;
|
||||||
|
|
||||||
|
$form = array();
|
||||||
|
$rows = array();
|
||||||
|
$last_session = "";
|
||||||
|
|
||||||
|
//attach the custom css
|
||||||
|
$form['#attached']['css'] = array(
|
||||||
|
drupal_get_path('module', 'booking') . '/booking.css',
|
||||||
|
);
|
||||||
|
|
||||||
|
//verify that $group_id is a number
|
||||||
|
if (! preg_match('/^[0-9]+$/', $group_id)) {
|
||||||
|
drupal_set_message("Error: Invalid study group ID '" . $group_id . "' supplied. Unable to view group membership.", 'error', FALSE);
|
||||||
|
drupal_goto('admin/config/booking');
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
//collect information on the study group
|
||||||
|
$group = db_query("SELECT * FROM {booking_studygroup_list} WHERE booking_eventid = :eid and sid = :sid",
|
||||||
|
array(':eid' => $event->eid, ':sid' => $group_id))
|
||||||
|
->fetchObject();
|
||||||
|
|
||||||
|
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 "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$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'),
|
||||||
|
'booking_is_leader' => array('data' => t('Leader?'), 'field' => 'm.booking_is_leader'),
|
||||||
|
'booking_is_helper' => array('data' => t('Helper?'), 'field' => 'm.booking_is_helper'),
|
||||||
|
'booking_is_reserveleader' => array('data' => t('Reserve Leader?'), 'field' => 'm.booking_is_reserveleader'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$query = db_select('booking_person', 'p');
|
||||||
|
$query->leftJoin('booking_studygroup_mapping', 'm', 'm.booking_node_id = p.nid');
|
||||||
|
$db_and = db_and();
|
||||||
|
$db_and->condition('p.booking_event_id', $event->eid, '=');
|
||||||
|
$db_and->condition('m.booking_studygroup_id', $group_id, '=');
|
||||||
|
$query->condition($db_and);
|
||||||
|
$query->fields('p')->fields('m')->orderBy('p.booking_lastname', 'ASC');
|
||||||
|
$result = $query->execute();
|
||||||
|
|
||||||
|
//watchdog('booking', 'Study groups raw data: @info', array ('@info' => var_export($result, TRUE)));
|
||||||
|
|
||||||
|
foreach($result as $data)
|
||||||
|
{
|
||||||
|
$class = "";
|
||||||
|
|
||||||
|
//apply theme as required
|
||||||
|
if ($data->booking_is_leader == 'Y')
|
||||||
|
$class = "leader-row";
|
||||||
|
elseif ($data->booking_is_helper == 'Y')
|
||||||
|
$class = "helper-row";
|
||||||
|
elseif ($data->booking_is_reserveleader == 'Y')
|
||||||
|
$class = "helper-row";
|
||||||
|
else
|
||||||
|
$class = "normal-row";
|
||||||
|
|
||||||
|
$rows[] = array (
|
||||||
|
'data' => array(
|
||||||
|
$data->booking_session_id,
|
||||||
|
$data->booking_firstname . " " . $data->booking_lastname,
|
||||||
|
$data->booking_is_leader == 'Y' ? 'Yes' : 'No',
|
||||||
|
$data->booking_is_helper == 'Y' ? 'Yes' : 'No',
|
||||||
|
$data->booking_is_reserveleader == 'Y' ? 'Yes' : 'No',
|
||||||
|
),
|
||||||
|
'class' => $class,
|
||||||
|
'no_striping' => TRUE,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$prefix = t("<h2>Study Group !descrip</h2>", array('!descrip' => $group->booking_studygroup_descrip));
|
||||||
|
|
||||||
|
/*
|
||||||
|
$form['table'] = array (
|
||||||
|
'#type' => 'tableselect',
|
||||||
|
'#header' => $header,
|
||||||
|
'#options' => $options,
|
||||||
|
//'#attributes' => array('id' => 'sort-table'),
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
return array (
|
||||||
|
'first_para' => array (
|
||||||
|
'#type' => 'markup',
|
||||||
|
'#markup' => $prefix,
|
||||||
|
),
|
||||||
|
'table' => array (
|
||||||
|
'#theme' => 'table',
|
||||||
|
'#header' => $header,
|
||||||
|
'#rows' => $rows,
|
||||||
|
'#sticky' => FALSE,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function for viewing who belongs to which study group
|
* Function for viewing who belongs to which study group
|
||||||
*/
|
*/
|
||||||
@@ -780,7 +888,7 @@ function booking_studygroups_view_form($node, &$form_state, $group_id) {
|
|||||||
|
|
||||||
//verify that $group_id is a number
|
//verify that $group_id is a number
|
||||||
if (! preg_match('/^[0-9]+$/', $group_id)) {
|
if (! preg_match('/^[0-9]+$/', $group_id)) {
|
||||||
drupal_set_message("Error: Invalid study group ID supplied. Unable to view group membership.", 'error', FALSE);
|
drupal_set_message("Error: Invalid study group ID '" . $group_id . "' supplied. Unable to view group membership.", 'error', FALSE);
|
||||||
drupal_goto('admin/config/booking');
|
drupal_goto('admin/config/booking');
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@@ -264,6 +264,9 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
|||||||
);
|
);
|
||||||
//only show the room mate field if we're allowed to
|
//only show the room mate field if we're allowed to
|
||||||
if (variable_get('booking_enable_roommate', 0) == 1 || $inserting == FALSE)
|
if (variable_get('booking_enable_roommate', 0) == 1 || $inserting == FALSE)
|
||||||
|
{
|
||||||
|
//married people won't need to select a room mate
|
||||||
|
if ((variable_get('booking_enable_combined_pricing', 0) == 1) && $person->booking_partner_id == 0)
|
||||||
{
|
{
|
||||||
$form['requirements']['booking_room_mate1'] = array(
|
$form['requirements']['booking_room_mate1'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
@@ -273,6 +276,7 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
|||||||
'#default_value' => !empty($data->booking_room_mate1) ? $data->booking_room_mate1 : $booking_roommate,
|
'#default_value' => !empty($data->booking_room_mate1) ? $data->booking_room_mate1 : $booking_roommate,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//only show this field if this person isn't married
|
//only show this field if this person isn't married
|
||||||
if ((variable_get('booking_enable_combined_pricing', 0) == 1) && $person->booking_partner_id == 0)
|
if ((variable_get('booking_enable_combined_pricing', 0) == 1) && $person->booking_partner_id == 0)
|
||||||
{
|
{
|
||||||
@@ -333,6 +337,51 @@ function travel_form_validate($form, &$form_state) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check to make sure flight info is entered if it is selected
|
||||||
|
if (isset($form_state['values']['booking_transport_type']) && $form_state['values']['booking_transport_type'] == 'Flying')
|
||||||
|
{
|
||||||
|
if ( (! isset($form_state['values']['booking_flightnum_inbound'])) || ($form_state['values']['booking_flightnum_inbound'] == '') )
|
||||||
|
{
|
||||||
|
form_set_error('booking_flightnum_inbound',
|
||||||
|
t('Please enter the flight number associated with your arrival flight.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
$form_state['values']['booking_flight_datetime_inbound']['day'] == '' ||
|
||||||
|
$form_state['values']['booking_flight_datetime_inbound']['month'] == '' ||
|
||||||
|
$form_state['values']['booking_flight_datetime_inbound']['year'] == '' ||
|
||||||
|
$form_state['values']['booking_flight_datetime_inbound']['hour'] == '' ||
|
||||||
|
$form_state['values']['booking_flight_datetime_inbound']['minute'] == ''
|
||||||
|
)
|
||||||
|
{
|
||||||
|
form_set_error('booking_flight_datetime_inbound',
|
||||||
|
t('Please enter the arrival time associated with your flight.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (! isset($form_state['values']['booking_flightnum_outbound'])) || ($form_state['values']['booking_flightnum_outbound'] == '') )
|
||||||
|
{
|
||||||
|
form_set_error('booking_flightnum_outbound',
|
||||||
|
t('Please enter the flight number associated with your departing flight.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
$form_state['values']['booking_flight_datetime_outbound']['day'] == '' ||
|
||||||
|
$form_state['values']['booking_flight_datetime_outbound']['month'] == '' ||
|
||||||
|
$form_state['values']['booking_flight_datetime_outbound']['year'] == '' ||
|
||||||
|
$form_state['values']['booking_flight_datetime_outbound']['hour'] == '' ||
|
||||||
|
$form_state['values']['booking_flight_datetime_outbound']['minute'] == ''
|
||||||
|
)
|
||||||
|
{
|
||||||
|
form_set_error('booking_flight_datetime_outbound',
|
||||||
|
t('Please enter the departure time associated with your flight.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function travel_form_submit($form, &$form_state) {
|
function travel_form_submit($form, &$form_state) {
|
||||||
@@ -387,7 +436,9 @@ function travel_form_submit($form, &$form_state) {
|
|||||||
|
|
||||||
//optional fields
|
//optional fields
|
||||||
$node->booking_dietary = variable_get('booking_enable_dietary', 0) == 1 ? $values['booking_dietary'] : $person->booking_dietary;
|
$node->booking_dietary = variable_get('booking_enable_dietary', 0) == 1 ? $values['booking_dietary'] : $person->booking_dietary;
|
||||||
$node->booking_room_mate1 = variable_get('booking_enable_roommate', 0) == 1 ? $values['booking_room_mate1'] : $person->booking_room_mate1;
|
//room mate field might be enabled but not displayed for a married couple so calculate whether the field is empty or not first
|
||||||
|
$room_mate = empty($values['booking_room_mate1']) ? $person->booking_room_mate1 : $values['booking_room_mate1'];
|
||||||
|
$node->booking_room_mate1 = variable_get('booking_enable_roommate', 0) == 1 ? $room_mate : $person->booking_room_mate1;
|
||||||
|
|
||||||
//watchdog('booking', "<pre>Travel data to save:\n@info</pre>", array('@info' => print_r( $node, true)));
|
//watchdog('booking', "<pre>Travel data to save:\n@info</pre>", array('@info' => print_r( $node, true)));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user