From f26af4a0fbaa575111427a8e1811b14983097444 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Wed, 22 Jun 2016 22:45:07 +1000 Subject: [PATCH] change CSV heading description --- booking.reports.inc | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/booking.reports.inc b/booking.reports.inc index 847b82d..22eaf41 100644 --- a/booking.reports.inc +++ b/booking.reports.inc @@ -643,19 +643,13 @@ function booking_csv_report() { 'booking_rtrnflight_destination_ts', 'booking_timestamp', 'booking_flight_datetime_inbound', 'booking_flight_datetime_outbound'); $number_only_fields = array('booking_postcode', 'booking_mobile', 'booking_phone', 'booking_guardian_phone', 'booking_guardian_phone_alt'); - //this isn't required since we already have the info directly as a field - //so there is no need to rewrite the ID field with a user-friendly description - //look up room location descriptions for presenting a friendly name rather than an ID - //$room_query = db_query("SELECT * FROM {booking_room_locations} WHERE booking_roomlocation_active = 'Y'"); - //$room_locations = $room_query->fetchAllAssoc('lid'); - //look up the titles of the study groups and add to array for updating in the header $studygroup_descriptions = array(); $studygroups_query = db_query("SELECT * FROM {booking_studygroup_list} WHERE booking_eventid = :eid", array(':eid' => $event->eid)); $studygroups = $studygroups_query->fetchAllAssoc('sid'); - //update array for turning study group session IDs into the name for that group + //update array for turning study group session IDs into the name for that group foreach ($studygroups as $studygroup) { //calculate the session references $sessionid = "session" . $studygroup->sid; @@ -677,23 +671,23 @@ function booking_csv_report() { //write the header based on the first result $header_array = array(); - foreach (reset($result) as $key => $value) - { - if (in_array($key, $fields_to_skip)) + foreach (reset($result) as $key => $value) { + if (in_array($key, $fields_to_skip)) { continue; - - /* + } + //Replace headings for study group sessions and roles with the name of the study group rather than just sessionN and sessionN_role etc - if (array_key_exists($key, $studygroup_descriptions)) - { + if (array_key_exists($key, $studygroup_descriptions)) { $header_array[] = $studygroup_descriptions[$key]; continue; } - */ + $header_array[] = $key; //add in a special column for a processed version of the date of birth - if (strcmp($key,"booking_dob") == 0) + if (strcmp($key,"booking_dob") == 0) { $header_array[] = "booking_dob_processed"; + } + //add in a calculated field for amount owing if (strcmp($key, "nid") == 0) { $header_array[] = "booking_amount_owing_gross";