Various tweaks and fixes

This commit is contained in:
2014-04-25 22:17:48 +10:00
parent 596b64aa8d
commit 84ec125c80
6 changed files with 250 additions and 68 deletions

View File

@@ -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))
// ->fetchObject();
for ($i = 1; $i <= 7; $i++)
for ($i = 1; $i <= STUDYGROUP_COUNT; $i++)
{
$query->leftJoin('booking_studygroup_mapping', 's' . $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'));
//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_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)
{
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
_booking_demoted_to_notcoming_email($node->nid);
//TODO: Calculate refund
//check if there is room on the booked-in list
if (_booking_check_bookings_full() == False)
{
@@ -1303,7 +1305,9 @@ function _booking_update($node) {
{
watchdog('booking', 'Detected person moving from waiting list to No Longer Coming');
//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
//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(
'#markup' => theme('table', array('header' => $header, 'rows' => $rows)),