fix header array

This commit is contained in:
2017-06-29 14:49:20 +10:00
parent d75b946bdb
commit 1f31169ca6

View File

@@ -129,7 +129,7 @@ function booking_getToken($length) {
function booking_earlyaccess_csv_report() {
global $event;
$data = array();
$header_array = array();
//set options for the CSV file
$name = 'bookings-earlyaccesscodes-' . format_date(time(), 'custom', 'Y-m-d-His');
$filename = file_directory_temp() . '/' . $name;
@@ -148,10 +148,15 @@ function booking_earlyaccess_csv_report() {
->orderBy('cid');
$result = $codelist_query->execute();
foreach ($result as $record) {
$header_array[] = $record->key;
}
watchdog('booking_debug', "EarlyAccess CSV query result: @info", array('@info' => var_export( $result, TRUE)));
watchdog('booking_debug', "EarlyAccess CSV array keys: @info", array('@info' => var_export( array_keys($result), TRUE)));
watchdog('booking_debug', "EarlyAccess CSV header: @info", array('@info' => var_export($header_array, TRUE)));
//calculate the header row for CSV
$header = implode($delimiter, array_keys($result));
$header = implode($delimiter, $header_array);
$csv .= $header . "\n";
//add the records