Skip to content

Commit db66d32

Browse files
author
Vítězslav Dvořák
committed
better name for temporary file
columns naming fix
1 parent e57313c commit db66d32

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ApiClient.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,15 @@ public function listCustomers()
229229
$responseCode = $this->doCurlRequest($this->baseEndpoint . 'ws/v10/list-excel-customers', 'POST');
230230
$customersData = [];
231231
if ($responseCode == 200) {
232-
$xls = sys_get_temp_dir() . '/' . \Ease\Functions::randomString() . '.xls';
232+
$xls = sys_get_temp_dir() . '/list-excel-customers_' . \Ease\Functions::randomString() . '.xls';
233233
file_put_contents($xls, $this->lastCurlResponse);
234234
$spreadsheet = IOFactory::load($xls);
235235
unlink($xls);
236236
$customersDataRaw = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
237+
$columns = $customersDataRaw[1];
237238
unset($customersDataRaw[1]);
238239
foreach ($customersDataRaw as $recordId => $recordData) {
239-
$customersData[$recordId] = array_combine($customersDataRaw[1], $recordData);
240+
$customersData[$recordId] = array_combine($columns, $recordData);
240241
}
241242
}
242243
return $customersData;

0 commit comments

Comments
 (0)