X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FMember%2FImport%2FParser.php;h=b8ffc0f91ee0773b80bd32631af61ccfccb82014;hb=8cebffb2608fb2f197bae07a6093fa8576b7dd14;hp=fe2ae708ada4e7fd3c9b5d025c97e71e78c43381;hpb=bf7b3b5aa92c51136343886c944ec0212c013338;p=civicrm-core.git diff --git a/CRM/Member/Import/Parser.php b/CRM/Member/Import/Parser.php index fe2ae708ad..b8ffc0f91e 100644 --- a/CRM/Member/Import/Parser.php +++ b/CRM/Member/Import/Parser.php @@ -81,7 +81,9 @@ abstract class CRM_Member_Import_Parser extends CRM_Import_Parser { $skipColumnHeader = FALSE, $mode = self::MODE_PREVIEW, $contactType = self::CONTACT_INDIVIDUAL, - $onDuplicate = self::DUPLICATE_SKIP + $onDuplicate = self::DUPLICATE_SKIP, + $statusID = NULL, + $totalRowCount = NULL ) { if (!is_array($fileName)) { CRM_Core_Error::fatal(); @@ -128,6 +130,10 @@ abstract class CRM_Member_Import_Parser extends CRM_Import_Parser { else { $this->_activeFieldCount = count($this->_activeFields); } + if ($statusID) { + $this->progressImport($statusID); + $startTimestamp = $currTimestamp = $prevTimestamp = time(); + } while (!feof($fd)) { $this->_lineCount++; @@ -146,7 +152,6 @@ abstract class CRM_Member_Import_Parser extends CRM_Import_Parser { } /* trim whitespace around the values */ - $empty = TRUE; foreach ($values as $k => $v) { $values[$k] = trim($v, " \t\r\n"); @@ -168,6 +173,9 @@ abstract class CRM_Member_Import_Parser extends CRM_Import_Parser { } elseif ($mode == self::MODE_IMPORT) { $returnCode = $this->import($onDuplicate, $values); + if ($statusID && (($this->_lineCount % 50) == 0)) { + $prevTimestamp = $this->progressImport($statusID, FALSE, $startTimestamp, $prevTimestamp, $totalRowCount); + } } else { $returnCode = self::ERROR; @@ -191,11 +199,9 @@ abstract class CRM_Member_Import_Parser extends CRM_Import_Parser { if ($returnCode & self::ERROR) { $this->_invalidRowCount++; - if ($this->_invalidRowCount < $this->_maxErrorCount) { - $recordNumber = $this->_lineCount; - array_unshift($values, $recordNumber); - $this->_errors[] = $values; - } + $recordNumber = $this->_lineCount; + array_unshift($values, $recordNumber); + $this->_errors[] = $values; } if ($returnCode & self::CONFLICT) {