diff --git a/booking.earlyaccess_admin.inc b/booking.earlyaccess_admin.inc index 5aaab7c..89c86a2 100644 --- a/booking.earlyaccess_admin.inc +++ b/booking.earlyaccess_admin.inc @@ -148,17 +148,22 @@ function booking_earlyaccess_csv_report() { ->orderBy('cid'); $result = $codelist_query->execute(); - foreach (reset($result) as $record) { + $firstresult = reset($result); + watchdog('booking', "CSV firstresult: @info", array('@info' => var_export($firstresult, TRUE))); + foreach ($firstresult as $record) { + watchdog('booking', "CSV first record for header: @info", array('@info' => var_export($record, TRUE))); foreach ($record as $key => $value) { $header_array[] = $key; } break; } - + //calculate the header row for CSV $header = implode($delimiter, $header_array); $csv .= $header . "\n"; + watchdog('booking', "CSV before: @info", array('@info' => var_export($csv, TRUE))); + //add the records foreach ($result as $record) { $output = array(); @@ -175,6 +180,8 @@ function booking_earlyaccess_csv_report() { $row = implode($delimiter, $output) . "\n"; $csv .= $row; } + + watchdog('booking', "CSV after: @info", array('@info' => var_export($csv, TRUE))); //output the CSV to the browser drupal_add_http_header("Content-type", "application/octet-stream; charset=utf-8");