Modifications so unpaid people can move to bottom of waiting list
This commit is contained in:
@@ -21,14 +21,18 @@ function _booking_state_options() {
|
||||
* @param $input integer containing status id
|
||||
* @return string for corresponding booking status
|
||||
*/
|
||||
function _booking_status_generate($input)
|
||||
function _booking_status_generate($input = NULL)
|
||||
{
|
||||
$status_options[0] = t('Not Paid');
|
||||
$status_options[1] = t('Booked In');
|
||||
$status_options[2] = t('Waiting List');
|
||||
$status_options[3] = t('No Longer Coming');
|
||||
$status_options[4] = t('Missed Payment Deadline');
|
||||
|
||||
if ($input != NULL)
|
||||
return $status_options[$input];
|
||||
else
|
||||
return $status_options;
|
||||
}
|
||||
/**
|
||||
* Helper function to look up booking status id based on status text
|
||||
@@ -37,12 +41,15 @@ function _booking_status_generate($input)
|
||||
*/
|
||||
function _booking_status_lookup($input)
|
||||
{
|
||||
/*
|
||||
$status_options[0] = t('Not Paid');
|
||||
$status_options[1] = t('Booked In');
|
||||
$status_options[2] = t('Waiting List');
|
||||
$status_options[3] = t('No Longer Coming');
|
||||
$status_options[4] = t('Missed Payment Deadline');
|
||||
*/
|
||||
|
||||
return array_search($input, $status_options);
|
||||
return array_search($input, _booking_status_generate());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -392,7 +392,7 @@ function booking_menu() {
|
||||
|
||||
//configure rooms
|
||||
$items['admin/booking/rooms'] = array(
|
||||
'title' => 'View Rooms',
|
||||
'title' => 'View Room Locations',
|
||||
'description' => 'View Room Locations',
|
||||
'page callback' => 'booking_room_view_summary',
|
||||
'access arguments' => array("view room allocations"),
|
||||
@@ -405,11 +405,17 @@ function booking_menu() {
|
||||
'description' => 'Assign attendees to rooms',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('booking_rooms_allocate_form', 3),
|
||||
//'page arguments' => array('booking_rooms_allocate_form'),
|
||||
'access arguments' => array('edit room allocations'),
|
||||
//'type' => MENU_NORMAL_ITEM,
|
||||
);
|
||||
|
||||
$items['admin/booking/rooms/%/view'] = array(
|
||||
'title' => 'View Allocated Rooms',
|
||||
'description' => 'Assign attendees to rooms',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('booking_rooms_view_form', 3),
|
||||
'access arguments' => array('view room allocations'),
|
||||
);
|
||||
|
||||
//Configure prices
|
||||
$items['admin/config/booking/prices/create'] = array(
|
||||
|
@@ -151,7 +151,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
||||
$form['your-details']['booking_status'] = array(
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Registration Status'),
|
||||
'#options' => $status_options,
|
||||
'#options' => _booking_status_generate(),
|
||||
'#default_value' => !empty($data->booking_status) ? $data->booking_status : '',
|
||||
);
|
||||
|
||||
|
@@ -371,6 +371,7 @@ function booking_waitinglist_page() {
|
||||
$booking_limit = variable_get('booking_regn_limit','350');
|
||||
$rows = array();
|
||||
|
||||
/*
|
||||
$result = db_query('SELECT DISTINCT nid, booking_firstname, booking_lastname, booking_state, booking_readinggroup, booking_country
|
||||
FROM (
|
||||
SELECT p.nid, p.booking_firstname, p.booking_lastname, p.booking_state, p.booking_country, p.booking_readinggroup, pay.booking_payment_date
|
||||
@@ -379,6 +380,16 @@ function booking_waitinglist_page() {
|
||||
) AS booking
|
||||
ORDER BY booking_payment_date',
|
||||
array(':eid' => $event->eid));
|
||||
*/
|
||||
|
||||
$result = db_query('SELECT DISTINCT nid, booking_firstname, booking_lastname, booking_state, booking_readinggroup, booking_country, booking_status
|
||||
FROM (
|
||||
SELECT p.nid, p.booking_firstname, p.booking_lastname, p.booking_state, p.booking_country, p.booking_readinggroup, pay.booking_payment_date, p.booking_status
|
||||
FROM {booking_person} p, {booking_payment} pay
|
||||
WHERE booking_event_id = :eid and p.nid = pay.booking_person_nid and ( booking_status = 2 or booking_status = 4)
|
||||
) AS booking
|
||||
ORDER BY booking_status, booking_payment_date',
|
||||
array(':eid' => $event->eid));
|
||||
|
||||
//watchdog('booking', "Who's coming query: @info", array('@info' => var_export($result, TRUE)));
|
||||
|
||||
|
@@ -313,18 +313,26 @@ function booking_rooms_allocate_form($node, &$form_state, $location_id) {
|
||||
for ($i = 1; $i <= $data->booking_room_queenbeds; $i++)
|
||||
{
|
||||
$row = _booking_clone_array($default_row);
|
||||
$default = (!empty($existing_beds[3][$j])) ? $existing_beds[3][$j++] : 0;
|
||||
|
||||
$row['booking_room_queenbed_p1'] = array('data' => array(
|
||||
'#type' => 'select',
|
||||
'#options' => $attendee_select,
|
||||
'#name' => 'booking_room_queenbed_p1[' . $data->rid . '][' . $i . ']',
|
||||
'#value' => (!empty($existing_beds[3][$j])) ? $existing_beds[3][$j++] : 0,
|
||||
'#value' => $default,
|
||||
));
|
||||
|
||||
//find the default for the second bed
|
||||
$default = (!empty($existing_beds[3][$j])) ? $existing_beds[3][$j++] : 0;
|
||||
|
||||
$row['booking_room_queenbed_p2'] = array('data' => array(
|
||||
'#type' => 'select',
|
||||
'#options' => $attendee_select,
|
||||
'#name' => 'booking_room_queenbed_p2[' . $data->rid . '][' . $i . ']',
|
||||
'#value' => (!empty($existing_beds[3][$j])) ? $existing_beds[3][$j++] : 0,
|
||||
'#value' => $default,
|
||||
));
|
||||
|
||||
//add this row to the table
|
||||
$options[$counter++] = $row;
|
||||
}
|
||||
|
||||
@@ -451,3 +459,11 @@ function booking_rooms_allocate_form_submit($form, &$form_state) {
|
||||
} //each bed type
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for viewing room report
|
||||
*/
|
||||
function booking_rooms_view_form($node, &$form_state, $location_id) {
|
||||
global $event;
|
||||
|
||||
}
|
Reference in New Issue
Block a user