Change CSV processing and studygroup display info
This commit is contained in:
@@ -60,9 +60,13 @@ function booking_manual_email()
|
|||||||
|
|
||||||
if (variable_get('booking_enable_studygroups', 0) == 1)
|
if (variable_get('booking_enable_studygroups', 0) == 1)
|
||||||
{
|
{
|
||||||
//select entries from the study groups mapping table
|
//select entries from the study groups mapping table
|
||||||
$group_mapping_query = db_query("SELECT * FROM {booking_studygroup_mapping} WHERE booking_eventid = :eid", array(':eid' => $event->eid));
|
$query = db_select('booking_studygroup_mapping', 'm');
|
||||||
$group_mapping = $group_mapping_query->fetchAllAssoc('sid');
|
$query->join('booking_studygroup_list', 's', 's.sid = m.booking_studygroup_id');
|
||||||
|
$query->condition('m.booking_eventid', $event->eid, '=');
|
||||||
|
$query->fields('m')->fields('s', array('booking_studygroup_descrip'));
|
||||||
|
$group_mapping = $query->execute()->fetchAllAssoc('sid');
|
||||||
|
//add a column to the table header
|
||||||
$header['group_roles'] = array('data' => t('Group Role'));
|
$header['group_roles'] = array('data' => t('Group Role'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +113,7 @@ function booking_manual_email()
|
|||||||
if ($group->booking_node_id == $data->nid && $role > 0)
|
if ($group->booking_node_id == $data->nid && $role > 0)
|
||||||
{
|
{
|
||||||
$text = _booking_studygroup_role_lookup($role);
|
$text = _booking_studygroup_role_lookup($role);
|
||||||
$group_text .= "<b>" . $text . "</b> group " . $group->booking_studygroup_id . " #" . $group->booking_session_id . "; ";
|
$group_text .= "<b>" . $text . "</b> for " . $group->booking_studygroup_descrip . " #" . $group->booking_session_id . "; ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$options[$data->nid]['group_roles'] = $group_text;
|
$options[$data->nid]['group_roles'] = $group_text;
|
||||||
|
@@ -1362,7 +1362,6 @@ function booking_form_submit($form, &$form_state) {
|
|||||||
$node->booking_lifesaver = empty($values['booking_lifesaver']) ? 'N' : ($values['booking_lifesaver'] == 1 ? 'Y' : 'N');
|
$node->booking_lifesaver = empty($values['booking_lifesaver']) ? 'N' : ($values['booking_lifesaver'] == 1 ? 'Y' : 'N');
|
||||||
$node->booking_doctor = empty($values['booking_doctor']) ? 'N' : ($values['booking_doctor'] == 1 ? 'Y' : 'N');
|
$node->booking_doctor = empty($values['booking_doctor']) ? 'N' : ($values['booking_doctor'] == 1 ? 'Y' : 'N');
|
||||||
$node->booking_dietary = empty($values['booking_dietary']) ? 'N/A' : $values['booking_dietary'];
|
$node->booking_dietary = empty($values['booking_dietary']) ? 'N/A' : $values['booking_dietary'];
|
||||||
$node->booking_medical_conditions = empty($values['booking_medical_conditions']) ? 'N/A' : $values['booking_medical_conditions'];
|
|
||||||
$node->booking_mission_experience_details = empty($values['booking_mission_experience_details']) ? 'N/A' : $values['booking_mission_experience_details'];
|
$node->booking_mission_experience_details = empty($values['booking_mission_experience_details']) ? 'N/A' : $values['booking_mission_experience_details'];
|
||||||
$node->booking_has_mission_experience = empty($values['booking_has_mission_experience']) ? 'N' : ($values['booking_has_mission_experience'] == 1 ? 'Y' : 'N');
|
$node->booking_has_mission_experience = empty($values['booking_has_mission_experience']) ? 'N' : ($values['booking_has_mission_experience'] == 1 ? 'Y' : 'N');
|
||||||
$node->booking_skills_builder = empty($values['booking_skills_builder']) ? 'N' : ($values['booking_skills_builder'] == 1 ? 'Y' : 'N');
|
$node->booking_skills_builder = empty($values['booking_skills_builder']) ? 'N' : ($values['booking_skills_builder'] == 1 ? 'Y' : 'N');
|
||||||
@@ -1372,8 +1371,13 @@ function booking_form_submit($form, &$form_state) {
|
|||||||
$node->booking_skills_language_details = empty($values['booking_skills_language_details']) ? 'N/A' : $values['booking_skills_language_details'];
|
$node->booking_skills_language_details = empty($values['booking_skills_language_details']) ? 'N/A' : $values['booking_skills_language_details'];
|
||||||
$node->booking_skills_other = empty($values['booking_skills_other']) ? 'N' : ($values['booking_skills_other'] == 1 ? 'Y' : 'N');
|
$node->booking_skills_other = empty($values['booking_skills_other']) ? 'N' : ($values['booking_skills_other'] == 1 ? 'Y' : 'N');
|
||||||
$node->booking_skills_other_details = empty($values['booking_skills_other_details']) ? 'N/A' : $values['booking_skills_other_details'];
|
$node->booking_skills_other_details = empty($values['booking_skills_other_details']) ? 'N/A' : $values['booking_skills_other_details'];
|
||||||
$node->booking_comment_field = empty($values['booking_comment_field']) ? '' : $values['booking_comment_field'];
|
|
||||||
|
|
||||||
|
//remove newlines from these fields so the CSV output doesn't get messed up
|
||||||
|
$medical = empty($values['booking_medical_conditions']) ? 'N/A' : $values['booking_medical_conditions'];
|
||||||
|
$comment = empty($values['booking_comment_field']) ? '' : $values['booking_comment_field'];
|
||||||
|
$node->booking_medical_conditions = str_replace(PHP_EOL, '', $medical);
|
||||||
|
$node->booking_comment_field = str_replace(PHP_EOL, '', $comment);
|
||||||
|
|
||||||
//potential fields for future
|
//potential fields for future
|
||||||
//$node->booking_payment_method = $payment_method;
|
//$node->booking_payment_method = $payment_method;
|
||||||
$node->booking_room_mate1 = empty($values['booking_room_mate1']) ? '' : $values['booking_room_mate1'];
|
$node->booking_room_mate1 = empty($values['booking_room_mate1']) ? '' : $values['booking_room_mate1'];
|
||||||
|
@@ -636,6 +636,7 @@ function booking_csv_report() {
|
|||||||
//keep a list of any fields that we need to handle as dates
|
//keep a list of any fields that we need to handle as dates
|
||||||
$datetime_fields = array('booking_outflight_origin_ts', 'booking_outflight_destination_ts', 'booking_rtrnflight_origin_ts',
|
$datetime_fields = array('booking_outflight_origin_ts', 'booking_outflight_destination_ts', 'booking_rtrnflight_origin_ts',
|
||||||
'booking_rtrnflight_destination_ts', 'booking_timestamp', 'booking_flight_datetime_inbound', 'booking_flight_datetime_outbound');
|
'booking_rtrnflight_destination_ts', 'booking_timestamp', 'booking_flight_datetime_inbound', 'booking_flight_datetime_outbound');
|
||||||
|
$number_only_fields = array('booking_postcode', 'booking_mobile', 'booking_phone');
|
||||||
|
|
||||||
//look up the titles of the study groups and add to array for updating in the header
|
//look up the titles of the study groups and add to array for updating in the header
|
||||||
$studygroup_descriptions = array();
|
$studygroup_descriptions = array();
|
||||||
@@ -760,6 +761,12 @@ function booking_csv_report() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//handle numerical fields
|
||||||
|
if (in_array($key, $number_only_fields)) {
|
||||||
|
$output[] = $value . "\t";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//booking status
|
//booking status
|
||||||
if ($key == 'booking_status') {
|
if ($key == 'booking_status') {
|
||||||
$output[] = _booking_status_generate($value);
|
$output[] = _booking_status_generate($value);
|
||||||
|
@@ -380,9 +380,10 @@ function _booking_rooms_allocate_generate_singlebeds($data, $existing_beds, $def
|
|||||||
'#title' => 'Name',
|
'#title' => 'Name',
|
||||||
'#title_display' => 'invisible',
|
'#title_display' => 'invisible',
|
||||||
'#name' => 'booking_room_singlebed[' . $data->rid . '][' . $i . ']',
|
'#name' => 'booking_room_singlebed[' . $data->rid . '][' . $i . ']',
|
||||||
'#size' => 50,
|
'#size' => 100,
|
||||||
'#autocomplete_path' => 'booking/rooms/autocomplete',
|
'#autocomplete_path' => 'booking/rooms/autocomplete',
|
||||||
'#value' => (!empty($existing_beds[1][$i])) ? $existing_beds[1][$i] : '',
|
'#value' => (!empty($existing_beds[1][$i])) ? $existing_beds[1][$i] : '',
|
||||||
|
'#attributes' => array('style' => array('width:200px')),
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['rooms'][$data->rid][$counter] = array(
|
$form['rooms'][$data->rid][$counter] = array(
|
||||||
@@ -414,9 +415,10 @@ function _booking_rooms_allocate_generate_doublebeds($data, $existing_beds, $def
|
|||||||
'#title' => 'Name',
|
'#title' => 'Name',
|
||||||
'#title_display' => 'invisible',
|
'#title_display' => 'invisible',
|
||||||
'#name' => 'booking_room_doublebed_p1[' . $data->rid . '][' . $i . ']',
|
'#name' => 'booking_room_doublebed_p1[' . $data->rid . '][' . $i . ']',
|
||||||
'#size' => 50,
|
'#size' => 100,
|
||||||
'#autocomplete_path' => 'booking/rooms/autocomplete',
|
'#autocomplete_path' => 'booking/rooms/autocomplete',
|
||||||
'#value' => (!empty($existing_beds[2][$j])) ? $existing_beds[2][$j++] : '',
|
'#value' => (!empty($existing_beds[2][$j])) ? $existing_beds[2][$j++] : '',
|
||||||
|
'#attributes' => array('style' => array('width:200px')),
|
||||||
);
|
);
|
||||||
$double_bed_p2 = array (
|
$double_bed_p2 = array (
|
||||||
'#id' => 'booking-room-doublebed-p2-' . $data->rid . '-' . $i,
|
'#id' => 'booking-room-doublebed-p2-' . $data->rid . '-' . $i,
|
||||||
@@ -424,9 +426,10 @@ function _booking_rooms_allocate_generate_doublebeds($data, $existing_beds, $def
|
|||||||
'#title' => 'Name',
|
'#title' => 'Name',
|
||||||
'#title_display' => 'invisible',
|
'#title_display' => 'invisible',
|
||||||
'#name' => 'booking_room_doublebed_p2[' . $data->rid . '][' . $i . ']',
|
'#name' => 'booking_room_doublebed_p2[' . $data->rid . '][' . $i . ']',
|
||||||
'#size' => 50,
|
'#size' => 100,
|
||||||
'#autocomplete_path' => 'booking/rooms/autocomplete',
|
'#autocomplete_path' => 'booking/rooms/autocomplete',
|
||||||
'#value' => (!empty($existing_beds[2][$j])) ? $existing_beds[2][$j++] : '',
|
'#value' => (!empty($existing_beds[2][$j])) ? $existing_beds[2][$j++] : '',
|
||||||
|
'#attributes' => array('style' => array('width:200px')),
|
||||||
);
|
);
|
||||||
|
|
||||||
//include fields for rendering
|
//include fields for rendering
|
||||||
@@ -463,9 +466,10 @@ function _booking_rooms_allocate_generate_queenbeds($data, $existing_beds, $defa
|
|||||||
'#title' => 'Name',
|
'#title' => 'Name',
|
||||||
'#title_display' => 'invisible',
|
'#title_display' => 'invisible',
|
||||||
'#name' => 'booking_room_queenbed_p1[' . $data->rid . '][' . $i . ']',
|
'#name' => 'booking_room_queenbed_p1[' . $data->rid . '][' . $i . ']',
|
||||||
'#size' => 50,
|
'#size' => 100,
|
||||||
'#autocomplete_path' => 'booking/rooms/autocomplete',
|
'#autocomplete_path' => 'booking/rooms/autocomplete',
|
||||||
'#value' => (!empty($existing_beds[3][$j])) ? $existing_beds[3][$j++] : '',
|
'#value' => (!empty($existing_beds[3][$j])) ? $existing_beds[3][$j++] : '',
|
||||||
|
'#attributes' => array('style' => array('width:200px')),
|
||||||
);
|
);
|
||||||
$queen_bed_p2 = array (
|
$queen_bed_p2 = array (
|
||||||
'#id' => 'booking-room-queenbed-p2-' . $data->rid . '-' . $i,
|
'#id' => 'booking-room-queenbed-p2-' . $data->rid . '-' . $i,
|
||||||
@@ -473,9 +477,10 @@ function _booking_rooms_allocate_generate_queenbeds($data, $existing_beds, $defa
|
|||||||
'#title' => 'Name',
|
'#title' => 'Name',
|
||||||
'#title_display' => 'invisible',
|
'#title_display' => 'invisible',
|
||||||
'#name' => 'booking_room_queenbed_p2[' . $data->rid . '][' . $i . ']',
|
'#name' => 'booking_room_queenbed_p2[' . $data->rid . '][' . $i . ']',
|
||||||
'#size' => 50,
|
'#size' => 100,
|
||||||
'#autocomplete_path' => 'booking/rooms/autocomplete',
|
'#autocomplete_path' => 'booking/rooms/autocomplete',
|
||||||
'#value' => (!empty($existing_beds[3][$j])) ? $existing_beds[3][$j++] : '',
|
'#value' => (!empty($existing_beds[3][$j])) ? $existing_beds[3][$j++] : '',
|
||||||
|
'#attributes' => array('style' => array('width:200px')),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Include the fields so they'll be rendered and named
|
// Include the fields so they'll be rendered and named
|
||||||
|
Reference in New Issue
Block a user