better now

This commit is contained in:
2017-06-29 15:06:56 +10:00
parent 1111b91b73
commit acfbd806ef

View File

@@ -144,13 +144,11 @@ function booking_earlyaccess_csv_report() {
//get a list of all the early access codes for this event //get a list of all the early access codes for this event
$codelist_query = db_select('booking_regn_earlyaccess_codes', 'c'); $codelist_query = db_select('booking_regn_earlyaccess_codes', 'c');
$codelist_query->condition('c.booking_eventid', $event->eid, '=') $codelist_query->condition('c.booking_eventid', $event->eid, '=')
->fields('c') ->fields('c', array('booking_regn_earlyaccess_code', 'booking_regn_earlyaccess_code_avail'))
->orderBy('cid'); ->orderBy('cid');
$result = $codelist_query->execute(); $result = $codelist_query->execute();
watchdog('booking', "CSV firstresult: @info", array('@info' => var_export($firstresult, TRUE)));
foreach ($result as $record) { foreach ($result as $record) {
watchdog('booking', "CSV first record for header: @info", array('@info' => var_export($record, TRUE)));
foreach ($record as $key => $value) { foreach ($record as $key => $value) {
$header_array[] = $key; $header_array[] = $key;
} }
@@ -161,8 +159,6 @@ function booking_earlyaccess_csv_report() {
$header = implode($delimiter, $header_array); $header = implode($delimiter, $header_array);
$csv .= $header . "\n"; $csv .= $header . "\n";
watchdog('booking', "CSV before: @info", array('@info' => var_export($csv, TRUE)));
//add the records //add the records
reset($result); reset($result);
foreach ($result as $record) { foreach ($result as $record) {
@@ -181,8 +177,6 @@ function booking_earlyaccess_csv_report() {
$csv .= $row; $csv .= $row;
} }
watchdog('booking', "CSV after: @info", array('@info' => var_export($csv, TRUE)));
//output the CSV to the browser //output the CSV to the browser
drupal_add_http_header("Content-type", "application/octet-stream; charset=utf-8"); drupal_add_http_header("Content-type", "application/octet-stream; charset=utf-8");
drupal_add_http_header("Content-Disposition", "attachment; filename=" . $name . ".csv"); drupal_add_http_header("Content-Disposition", "attachment; filename=" . $name . ".csv");