Skip to content

Commit a63107e

Browse files
authored
Merge pull request #73 from kent-state-university-libraries/skip-blank
Skip blank rows
2 parents 58cca27 + 48ef09e commit a63107e

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

models/CsvImport/Import.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,20 @@ protected function _undoImportLoop()
678678
*/
679679
protected function _addItemFromRow($row)
680680
{
681+
// check if this row is all blank cells
682+
$blank = TRUE;
683+
foreach ($row as $value) {
684+
if (trim($value) !== '') {
685+
$blank = FALSE;
686+
break;
687+
}
688+
}
689+
// if nothing but blank cells, skip this row
690+
if ($blank) {
691+
$this->_log('Blank row.', Zend_Log::ERR);
692+
return FALSE;
693+
}
694+
681695
$result = $this->getColumnMaps()->map($row);
682696
$tags = $result[CsvImport_ColumnMap::TYPE_TAG];
683697
$itemMetadata = array(

0 commit comments

Comments
 (0)