Skip to content

Commit

Permalink
Merge pull request #11233 from seanmadsen/CRM-14343-import-error-limit
Browse files Browse the repository at this point in the history
CRM-14343 - Remove limit of downloading only 250 errors during CSV import
  • Loading branch information
mlutfy authored Nov 15, 2017
2 parents 901c7d7 + ca2057e commit e2157b3
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 58 deletions.
12 changes: 5 additions & 7 deletions CRM/Activity/Import/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,12 @@ public function run(

if ($returnCode & self::ERROR) {
$this->_invalidRowCount++;
if ($this->_invalidRowCount < $this->_maxErrorCount) {
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_errors[] = $values;
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_errors[] = $values;
}

if ($returnCode & self::CONFLICT) {
Expand Down
6 changes: 2 additions & 4 deletions CRM/Contact/Import/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,8 @@ public function run(

if ($returnCode & self::ERROR) {
$this->_invalidRowCount++;
if ($this->_invalidRowCount < $this->_maxErrorCount) {
array_unshift($values, $this->_rowCount);
$this->_errors[] = $values;
}
array_unshift($values, $this->_rowCount);
$this->_errors[] = $values;
}

if ($returnCode & self::CONFLICT) {
Expand Down
36 changes: 15 additions & 21 deletions CRM/Contribute/Import/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,38 +256,32 @@ public function run(

if ($returnCode == self::ERROR) {
$this->_invalidRowCount++;
if ($this->_invalidRowCount < $this->_maxErrorCount) {
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_errors[] = $values;
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_errors[] = $values;
}

if ($returnCode == self::PLEDGE_PAYMENT_ERROR) {
$this->_invalidPledgePaymentRowCount++;
if ($this->_invalidPledgePaymentRowCount < $this->_maxErrorCount) {
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_pledgePaymentErrors[] = $values;
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_pledgePaymentErrors[] = $values;
}

if ($returnCode == self::SOFT_CREDIT_ERROR) {
$this->_invalidSoftCreditRowCount++;
if ($this->_invalidSoftCreditRowCount < $this->_maxErrorCount) {
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_softCreditErrors[] = $values;
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_softCreditErrors[] = $values;
}

if ($returnCode == self::CONFLICT) {
Expand Down
12 changes: 5 additions & 7 deletions CRM/Custom/Import/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,12 @@ public function run(

if ($returnCode & self::ERROR) {
$this->_invalidRowCount++;
if ($this->_invalidRowCount < $this->_maxErrorCount) {
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_errors[] = $values;
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_errors[] = $values;
}

if ($returnCode & self::CONFLICT) {
Expand Down
12 changes: 5 additions & 7 deletions CRM/Event/Import/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,12 @@ public function run(

if ($returnCode & self::ERROR) {
$this->_invalidRowCount++;
if ($this->_invalidRowCount < $this->_maxErrorCount) {
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_errors[] = $values;
$recordNumber = $this->_lineCount;
if ($this->_haveColumnHeader) {
$recordNumber--;
}
array_unshift($values, $recordNumber);
$this->_errors[] = $values;
}

if ($returnCode & self::CONFLICT) {
Expand Down
8 changes: 1 addition & 7 deletions CRM/Import/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class CRM_Import_Parser {
/**
* Settings
*/
const MAX_ERRORS = 250, MAX_WARNINGS = 25, DEFAULT_TIMEOUT = 30;
const MAX_WARNINGS = 25, DEFAULT_TIMEOUT = 30;

/**
* Return codes
Expand Down Expand Up @@ -79,11 +79,6 @@ abstract class CRM_Import_Parser {
*/
protected $_maxLinesToProcess;

/**
* Maximum number of invalid rows to store
*/
protected $_maxErrorCount;

/**
* Array of error lines, bounded by MAX_ERROR
*/
Expand Down Expand Up @@ -192,7 +187,6 @@ abstract class CRM_Import_Parser {
*/
public function __construct() {
$this->_maxLinesToProcess = 0;
$this->_maxErrorCount = self::MAX_ERRORS;
}

/**
Expand Down
8 changes: 3 additions & 5 deletions CRM/Member/Import/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,9 @@ public function run(

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) {
Expand Down

0 comments on commit e2157b3

Please sign in to comment.