Some tweaks
This commit is contained in:
@@ -194,6 +194,13 @@ function booking_admin() {
|
||||
'#default_value' => variable_get('booking_dietary_text_definition', ''),
|
||||
'#description' => 'Text to use if attendee may not specify dietary requirements (as above).',
|
||||
);
|
||||
$form['misc']['booking_enable_studygroups'] = array (
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Enable study group calculations?'),
|
||||
'#description' => t('Select whether to enable the creation and management of study groups.'),
|
||||
'#options' => array (0 => t('No'), t('Yes')),
|
||||
'#default_value' => variable_get('booking_enable_studygroups', 0),
|
||||
);
|
||||
$form['misc']['booking_csv_exclude_fields'] = array (
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Fields to exclude from CSV report'),
|
||||
|
@@ -306,40 +306,44 @@ function booking_menu() {
|
||||
);
|
||||
|
||||
//configure study groups
|
||||
$items['admin/config/booking/studygroups'] = array(
|
||||
'title' => 'View Study Groups',
|
||||
'description' => 'View Study Group memberships',
|
||||
'page callback' => 'booking_studygroups_view_summary',
|
||||
'access arguments' => array("view study groups"),
|
||||
'type' => MENU_NORMAL_ITEM,
|
||||
);
|
||||
if (variable_get('booking_enable_studygroups', 0) == 1)
|
||||
{
|
||||
|
||||
$items['admin/config/booking/studygroups/%/view'] = array(
|
||||
'title' => 'View Study Group',
|
||||
'description' => 'View Study Group memberships',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('booking_studygroups_view_form', 4),
|
||||
'access arguments' => array('view study groups'),
|
||||
//'type' => MENU_NORMAL_ITEM,
|
||||
);
|
||||
$items['admin/config/booking/studygroups'] = array(
|
||||
'title' => 'View Study Groups',
|
||||
'description' => 'View Study Group memberships',
|
||||
'page callback' => 'booking_studygroups_view_summary',
|
||||
'access arguments' => array("view study groups"),
|
||||
'type' => MENU_NORMAL_ITEM,
|
||||
);
|
||||
|
||||
$items['admin/config/booking/studygroups/selectleaders'] = array(
|
||||
'title' => 'Study Group Leaders',
|
||||
'description' => 'Define attendees to lead or help study groups',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('booking_available_leadhelp_select_form'),
|
||||
'access arguments' => array('edit study groups'),
|
||||
'type' => MENU_LOCAL_ACTION,
|
||||
);
|
||||
$items['admin/config/booking/studygroups/%/view'] = array(
|
||||
'title' => 'View Study Group',
|
||||
'description' => 'View Study Group memberships',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('booking_studygroups_view_form', 4),
|
||||
'access arguments' => array('view study groups'),
|
||||
//'type' => MENU_NORMAL_ITEM,
|
||||
);
|
||||
|
||||
$items['admin/config/booking/studygroups/calculate'] = array(
|
||||
'title' => 'Study Group Definitions',
|
||||
'description' => 'Calculate Study Group memberships',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('booking_studygroups_calculate'),
|
||||
'access arguments' => array('edit study groups'),
|
||||
'type' => MENU_LOCAL_ACTION,
|
||||
);
|
||||
$items['admin/config/booking/studygroups/selectleaders'] = array(
|
||||
'title' => 'Select Study Group Leaders',
|
||||
'description' => 'Define attendees to lead or help study groups',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('booking_available_leadhelp_select_form'),
|
||||
'access arguments' => array('edit study groups'),
|
||||
'type' => MENU_LOCAL_ACTION,
|
||||
);
|
||||
|
||||
$items['admin/config/booking/studygroups/calculate'] = array(
|
||||
'title' => 'Calculate Study Groups',
|
||||
'description' => 'Calculate Study Group memberships',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('booking_studygroups_calculate'),
|
||||
'access arguments' => array('edit study groups'),
|
||||
'type' => MENU_LOCAL_ACTION,
|
||||
);
|
||||
}
|
||||
|
||||
//Configure prices
|
||||
$items['admin/config/booking/prices/create'] = array(
|
||||
|
@@ -91,8 +91,6 @@ function _booking_process_payment($data) {
|
||||
$balance_payment = false;
|
||||
$amount_owing = 0;
|
||||
|
||||
//TODO: verify $data['receiver_email'] matches variable_get('booking_paypal_account', '')
|
||||
|
||||
//extract the person node id from the invoice
|
||||
$pos = strpos($data['invoice'], "_");
|
||||
if (($pos === false) || ($pos == 0))
|
||||
|
@@ -1025,6 +1025,7 @@ function booking_form_submit($form, &$form_state) {
|
||||
}
|
||||
|
||||
function booking_load($nodes) {
|
||||
global $event;
|
||||
//watchdog('booking', 'Loading node with params: @info', array('@info' => var_export($nodes, TRUE)));
|
||||
|
||||
// note that $nodes is an array of object references, keyed by nid
|
||||
@@ -1035,11 +1036,46 @@ function booking_load($nodes) {
|
||||
//perform an inner join
|
||||
$query->join('booking_price', 'pr', 'p.booking_payment_id = pr.pid');
|
||||
$query->leftJoin('booking_travel', 't', 'p.nid = t.booking_person_nid');
|
||||
//filter the results and select the appropriate fields
|
||||
$query->condition('p.nid', array_keys($nodes), 'IN')
|
||||
->fields('p')
|
||||
->fields('t')
|
||||
->fields('pr', array('booking_price', 'booking_price_descrip'));
|
||||
|
||||
//add the fields for study groups
|
||||
if (variable_get('booking_enable_studygroups', 0) == 1)
|
||||
{
|
||||
//work out how many study groups there are
|
||||
//$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++)
|
||||
{
|
||||
$query->leftJoin('booking_studygroup_mapping', 's' . $i,
|
||||
'p.nid = s' . $i . '.booking_node_id and s' . $i . '.booking_studygroup_id = ' . $i);
|
||||
}
|
||||
|
||||
//filter the results and select the appropriate fields
|
||||
$query->condition('p.nid', array_keys($nodes), 'IN')
|
||||
->fields('p')
|
||||
->fields('t')
|
||||
->fields('pr', array('booking_price', 'booking_price_descrip'));
|
||||
|
||||
//now add the study group fields
|
||||
for ($i = 1; $i <= 7; $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_reserveleader', 'session' . $i . '_reserveleader');
|
||||
$query->addField('s' . $i, 'booking_is_helper', 'session' . $i . '_helper');
|
||||
}
|
||||
}
|
||||
//not looking after study groups so don't add all the extra fields
|
||||
else
|
||||
{
|
||||
//filter the results and select the appropriate fields
|
||||
$query->condition('p.nid', array_keys($nodes), 'IN')
|
||||
->fields('p')
|
||||
->fields('t')
|
||||
->fields('pr', array('booking_price', 'booking_price_descrip'));
|
||||
}
|
||||
|
||||
|
||||
//get the query result
|
||||
$result = $query->execute();
|
||||
|
||||
@@ -1048,7 +1084,7 @@ function booking_load($nodes) {
|
||||
//add that data to the array of node references
|
||||
foreach ($result as $record)
|
||||
{
|
||||
watchdog('booking', "<pre>Loading node:\n@info</pre>", array('@info' => print_r( $record, true)));
|
||||
//watchdog('booking', "<pre>Loading node:\n@info</pre>", array('@info' => print_r( $record, true)));
|
||||
// run through each result row and add in the needed attributes
|
||||
foreach ($record as $key => $value)
|
||||
{
|
||||
|
Reference in New Issue
Block a user