Commit 24482010 authored by claudiu.cristea's avatar claudiu.cristea

Issue #2817481 by cruno, claudiu.cristea: Incorrect row selected for headers,...

Issue #2817481 by cruno, claudiu.cristea: Incorrect row selected for headers, incorrect header row number returned from getHeaderRow().
parent 909f0c66
......@@ -36,7 +36,7 @@ source:
# key column.
row_index_column: 'Row index'
# This points to the column or columns that provides the primary key. If is
# missed, the current row position will be returned as primaru key.
# missed, the current row position will be returned as primary key.
keys:
- ID
destination:
......
......@@ -235,7 +235,7 @@ class SpreadsheetIterator implements SpreadsheetIteratorInterface {
* {@inheritdoc}
*/
public function getHeaderRow() {
$this->headerRow;
return $this->headerRow;
}
/**
......@@ -258,7 +258,7 @@ class SpreadsheetIterator implements SpreadsheetIteratorInterface {
public function getHeaders() {
if (!isset($this->headers)) {
for ($col = 0; $col < $this->getColumnsCount(); ++$col) {
$value = $this->getWorksheet()->getCellByColumnAndRow($col, $this->getHeaderRow() + 2)->getValue();
$value = $this->getWorksheet()->getCellByColumnAndRow($col, $this->getHeaderRow() + 1)->getValue();
if (isset($this->headers[$value])) {
throw new \RuntimeException("Table header '{$value}' is duplicated.");
}
......
......@@ -3,7 +3,6 @@
namespace Drupal\Tests\migrate_spreadsheet\Unit;
use Drupal\migrate_spreadsheet\SpreadsheetIterator;
use Drupal\migrate_spreadsheet\SpreadsheetIteratorInterface;
use Drupal\Tests\UnitTestCase;
use PhpOffice\PhpSpreadsheet\Worksheet;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment