minor tweaks
This commit is contained in:
@@ -38,7 +38,8 @@ function booking_report_summary() {
|
||||
array('data' => t('Id'), 'field' => 'nid', 'sort' => 'asc'),
|
||||
array('data' => t('Name'), 'field' => 'booking_lastname'),
|
||||
array('data' => t('Booking Status'), 'field' => 'booking_status'),
|
||||
array('data' => t('Edit Studygroups')),
|
||||
array('data' => t('Studygroups')),
|
||||
array('data' => t('Room')),
|
||||
array('data' => t('Email'), 'field' => 'booking_email'),
|
||||
array('data' => t('Payment To Date'), 'field' => 'booking_amount_paid'),
|
||||
array('data' => t('Total Payment Required')),
|
||||
@@ -113,7 +114,8 @@ function booking_report_summary() {
|
||||
t('node/!id/edit', array('!id' => $person->nid))
|
||||
),
|
||||
_booking_status_generate($person->booking_status),
|
||||
l(t('Edit Groups'), t('admin/booking/!id/edit-studygroup', array('!id' => $person->nid))),
|
||||
l(t('Groups'), t('admin/booking/!id/edit-studygroup', array('!id' => $person->nid))),
|
||||
l(t('Room'), t('admin/booking/!id/edit-room', array('!id' => $person->nid))),
|
||||
t('!email', array('!email' => $person->booking_email)),
|
||||
t('!payment', array('!payment' => $person->booking_amount_paid)),
|
||||
t('!payment', array('!payment' => $amount_owing == 0 ? $person->booking_total_pay_reqd : _booking_total_due($person))),
|
||||
|
@@ -199,6 +199,10 @@ function booking_room_edit_form($node, &$form_state, $nid) {
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Submit'),
|
||||
);
|
||||
$form['remove'] = array (
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Remove'),
|
||||
);
|
||||
|
||||
return array (
|
||||
'first_para' => array (
|
||||
@@ -257,6 +261,9 @@ function _booking_get_roomedit_bedtype_options($location_id, $room_num) {
|
||||
$details = db_query("SELECT * FROM {booking_room_definition} WHERE booking_room_location_id = :lid AND booking_room_number = :num",
|
||||
array(':lid' => $location_id, ':num' => $room_num))->fetchObject();
|
||||
|
||||
//check we got a response from the query
|
||||
if ($details)
|
||||
{
|
||||
//go through the bed options
|
||||
if ($details->booking_room_singlebeds > 0)
|
||||
{
|
||||
@@ -270,6 +277,7 @@ function _booking_get_roomedit_bedtype_options($location_id, $room_num) {
|
||||
{
|
||||
$bed_options[3] = "Queen";
|
||||
}
|
||||
}
|
||||
|
||||
//watchdog('booking', "<pre>Room Number Options:\n@info</pre>", array('@info' => print_r( $bed_options, true)));
|
||||
|
||||
@@ -324,14 +332,40 @@ function booking_room_edit_form_submit($form, &$form_state) {
|
||||
global $event;
|
||||
$values = $form_state['input'];
|
||||
|
||||
//check if we should remove the room allocation
|
||||
if ($form_state['values']['op'] == 'Remove')
|
||||
{
|
||||
$message = t("Removing id !nid from room number !number in location !location",
|
||||
array('!nid' => $values['personid'], '!location' => $values['booking_room_location_id'],
|
||||
'!number' => $values['booking_room_number'])
|
||||
);
|
||||
watchdog('booking', $message);
|
||||
drupal_set_message($message, 'status', FALSE);
|
||||
|
||||
db_delete('booking_room_mapping')
|
||||
->condition('booking_eventid', $event->eid)
|
||||
->condition('booking_nodeid', $values['personid'])
|
||||
->execute();
|
||||
|
||||
return;
|
||||
}
|
||||
//otherwise, continue with adding/updating the room allocation
|
||||
else
|
||||
{
|
||||
$details = db_query("SELECT * FROM {booking_room_definition} WHERE booking_room_location_id = :lid AND booking_room_number = :num",
|
||||
array(':lid' => $values['booking_room_location_id'], ':num' => $values['booking_room_number']))->fetchObject();
|
||||
|
||||
$check = db_query("SELECT * FROM {booking_room_mapping} WHERE booking_eventid = :eid AND booking_nodeid = :nid",
|
||||
array(':eid' => $event->eid, ':nid' => $values['personid']))->fetchObject();
|
||||
|
||||
//this person already exists in mapping table
|
||||
if ($check)
|
||||
{
|
||||
$message = t("Updating person id !nid to room id !id with bedtype !type",
|
||||
array('!nid' => $values['personid'], '!id' => $details->rid, '!type' => $values['booking_room_bedtype'],
|
||||
'!number' => $values['booking_room_number'])
|
||||
);
|
||||
|
||||
//there is an existing mapping to update
|
||||
$result = db_update('booking_room_mapping')
|
||||
->fields(array(
|
||||
@@ -341,10 +375,16 @@ function booking_room_edit_form_submit($form, &$form_state) {
|
||||
->condition('booking_eventid', $event->eid)
|
||||
->condition('booking_nodeid', $values['personid'])
|
||||
->execute();
|
||||
drupal_set_message("Successfully updated " . $result . " row(s) in the room allocation table.", $type = 'status');
|
||||
//drupal_set_message("Successfully updated " . $result . " row(s) in the room allocation table.", $type = 'status');
|
||||
}
|
||||
//create a new record in the mapping table
|
||||
else
|
||||
{
|
||||
$message = t("Allocating person id !nid to room id !id with bedtype !type",
|
||||
array('!nid' => $values['personid'], '!id' => $details->rid, '!type' => $values['booking_room_bedtype'],
|
||||
'!number' => $values['booking_room_number'])
|
||||
);
|
||||
|
||||
//create a new room mapping for this person
|
||||
$result = db_insert('booking_room_mapping')
|
||||
->fields(array(
|
||||
@@ -354,8 +394,12 @@ function booking_room_edit_form_submit($form, &$form_state) {
|
||||
'booking_room_bedtype' => $values['booking_room_bedtype'],
|
||||
))
|
||||
->execute();
|
||||
drupal_set_message("Successfully added " . $result . " row(s) to the room allocation table.", $type = 'status');
|
||||
//drupal_set_message("Successfully added id " . $values['personid'] . " to the room allocation table.", $type = 'status');
|
||||
}
|
||||
watchdog('booking', $message);
|
||||
drupal_set_message($message, 'status', FALSE);
|
||||
|
||||
} //end operation check
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user