diff --git a/booking.emails.inc b/booking.emails.inc index 0c14c51..e8df4ea 100644 --- a/booking.emails.inc +++ b/booking.emails.inc @@ -60,9 +60,13 @@ function booking_manual_email() if (variable_get('booking_enable_studygroups', 0) == 1) { - //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)); - $group_mapping = $group_mapping_query->fetchAllAssoc('sid'); + //select entries from the study groups mapping table + $query = db_select('booking_studygroup_mapping', 'm'); + $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')); } @@ -109,7 +113,7 @@ function booking_manual_email() if ($group->booking_node_id == $data->nid && $role > 0) { $text = _booking_studygroup_role_lookup($role); - $group_text .= "" . $text . " group " . $group->booking_studygroup_id . " #" . $group->booking_session_id . "; "; + $group_text .= "" . $text . " for " . $group->booking_studygroup_descrip . " #" . $group->booking_session_id . "; "; } } $options[$data->nid]['group_roles'] = $group_text; diff --git a/booking.regn_form.inc b/booking.regn_form.inc index 3095db1..904f1e4 100644 --- a/booking.regn_form.inc +++ b/booking.regn_form.inc @@ -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_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_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_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'); @@ -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_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_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 //$node->booking_payment_method = $payment_method; $node->booking_room_mate1 = empty($values['booking_room_mate1']) ? '' : $values['booking_room_mate1']; diff --git a/booking.reports.inc b/booking.reports.inc index d5fbb14..85764db 100644 --- a/booking.reports.inc +++ b/booking.reports.inc @@ -636,6 +636,7 @@ function booking_csv_report() { //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', '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 $studygroup_descriptions = array(); @@ -760,6 +761,12 @@ function booking_csv_report() { continue; } + //handle numerical fields + if (in_array($key, $number_only_fields)) { + $output[] = $value . "\t"; + continue; + } + //booking status if ($key == 'booking_status') { $output[] = _booking_status_generate($value); diff --git a/booking.test_rooms.inc b/booking.test_rooms.inc index 3d0f18b..8e52cac 100644 --- a/booking.test_rooms.inc +++ b/booking.test_rooms.inc @@ -380,9 +380,10 @@ function _booking_rooms_allocate_generate_singlebeds($data, $existing_beds, $def '#title' => 'Name', '#title_display' => 'invisible', '#name' => 'booking_room_singlebed[' . $data->rid . '][' . $i . ']', - '#size' => 50, + '#size' => 100, '#autocomplete_path' => 'booking/rooms/autocomplete', '#value' => (!empty($existing_beds[1][$i])) ? $existing_beds[1][$i] : '', + '#attributes' => array('style' => array('width:200px')), ); $form['rooms'][$data->rid][$counter] = array( @@ -414,9 +415,10 @@ function _booking_rooms_allocate_generate_doublebeds($data, $existing_beds, $def '#title' => 'Name', '#title_display' => 'invisible', '#name' => 'booking_room_doublebed_p1[' . $data->rid . '][' . $i . ']', - '#size' => 50, + '#size' => 100, '#autocomplete_path' => 'booking/rooms/autocomplete', '#value' => (!empty($existing_beds[2][$j])) ? $existing_beds[2][$j++] : '', + '#attributes' => array('style' => array('width:200px')), ); $double_bed_p2 = array ( '#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_display' => 'invisible', '#name' => 'booking_room_doublebed_p2[' . $data->rid . '][' . $i . ']', - '#size' => 50, + '#size' => 100, '#autocomplete_path' => 'booking/rooms/autocomplete', '#value' => (!empty($existing_beds[2][$j])) ? $existing_beds[2][$j++] : '', + '#attributes' => array('style' => array('width:200px')), ); //include fields for rendering @@ -463,9 +466,10 @@ function _booking_rooms_allocate_generate_queenbeds($data, $existing_beds, $defa '#title' => 'Name', '#title_display' => 'invisible', '#name' => 'booking_room_queenbed_p1[' . $data->rid . '][' . $i . ']', - '#size' => 50, + '#size' => 100, '#autocomplete_path' => 'booking/rooms/autocomplete', '#value' => (!empty($existing_beds[3][$j])) ? $existing_beds[3][$j++] : '', + '#attributes' => array('style' => array('width:200px')), ); $queen_bed_p2 = array ( '#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_display' => 'invisible', '#name' => 'booking_room_queenbed_p2[' . $data->rid . '][' . $i . ']', - '#size' => 50, + '#size' => 100, '#autocomplete_path' => 'booking/rooms/autocomplete', '#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