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