Skip to content

Commit

Permalink
Simplify class inheritance
Browse files Browse the repository at this point in the history
CRM_Contribute_Import_Parser_Contribution is the only class in our universe to
extend CRM_Contribute_Import_Parser and this class only adds confusion to the
mix as functions are 'distributed' between them. This removes the inheritance,
leaving only the constant that is still used in the now-deprecated class
  • Loading branch information
eileenmcnaughton committed Apr 6, 2022
1 parent 85dba8e commit 0fe4ebe
Show file tree
Hide file tree
Showing 5 changed files with 666 additions and 685 deletions.
2 changes: 1 addition & 1 deletion .toxic.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"CRM_Contribute_Form_Contribution_Main::formRule()": "toxicAlert",
"CRM_Contribute_Form_Contribution_Main::submit()": "toxicAlert",
"CRM_Contribute_Form_Task_Invoice::printPDF()": "toxicAlert",
"CRM_Contribute_Import_Parser::run()": "toxicAlert",
"CRM_Contribute_Import_Parser_Contribution::run()": "toxicAlert",
"CRM_Core_BAO_ActionScheduleTest::setUp()": "toxicAlert",
"CRM_Core_BAO_CustomField::formatCustomField()": "toxicAlert",
"CRM_Core_BAO_CustomGroup::getTree()": "toxicAlert",
Expand Down
12 changes: 6 additions & 6 deletions CRM/Contribute/Import/Form/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ public function preProcess() {
}

if ($invalidRowCount) {
$urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Contribute_Import_Parser';
$urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Contribute_Import_Parser_Contribution';
$this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
}

if ($conflictRowCount) {
$urlParams = 'type=' . CRM_Import_Parser::CONFLICT . '&parser=CRM_Contribute_Import_Parser';
$urlParams = 'type=' . CRM_Import_Parser::CONFLICT . '&parser=CRM_Contribute_Import_Parser_Contribution';
$this->set('downloadConflictRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
}

if ($mismatchCount) {
$urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Contribute_Import_Parser';
$urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Contribute_Import_Parser_Contribution';
$this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
}

Expand Down Expand Up @@ -160,11 +160,11 @@ public function postProcess() {
fclose($fd);

$this->set('errorFile', $errorFile);
$urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Contribute_Import_Parser';
$urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Contribute_Import_Parser_Contribution';
$this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
$urlParams = 'type=' . CRM_Import_Parser::CONFLICT . '&parser=CRM_Contribute_Import_Parser';
$urlParams = 'type=' . CRM_Import_Parser::CONFLICT . '&parser=CRM_Contribute_Import_Parser_Contribution';
$this->set('downloadConflictRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
$urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Contribute_Import_Parser';
$urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Contribute_Import_Parser_Contribution';
$this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
}
}
Expand Down
8 changes: 4 additions & 4 deletions CRM/Contribute/Import/Form/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public function preProcess() {
$invalidRowCount = $this->get('invalidRowCount');
$invalidSoftCreditRowCount = $this->get('invalidSoftCreditRowCount');
if ($invalidSoftCreditRowCount) {
$urlParams = 'type=' . CRM_Contribute_Import_Parser::SOFT_CREDIT_ERROR . '&parser=CRM_Contribute_Import_Parser';
$urlParams = 'type=' . CRM_Contribute_Import_Parser_Contribution::SOFT_CREDIT_ERROR . '&parser=CRM_Contribute_Import_Parser_Contribution';
$this->set('downloadSoftCreditErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
}
$validSoftCreditRowCount = $this->get('validSoftCreditRowCount');
$invalidPledgePaymentRowCount = $this->get('invalidPledgePaymentRowCount');
if ($invalidPledgePaymentRowCount) {
$urlParams = 'type=' . CRM_Contribute_Import_Parser::PLEDGE_PAYMENT_ERROR . '&parser=CRM_Contribute_Import_Parser';
$urlParams = 'type=' . CRM_Contribute_Import_Parser_Contribution::PLEDGE_PAYMENT_ERROR . '&parser=CRM_Contribute_Import_Parser_Contribution';
$this->set('downloadPledgePaymentErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
}
$validPledgePaymentRowCount = $this->get('validPledgePaymentRowCount');
Expand All @@ -50,11 +50,11 @@ public function preProcess() {
$onDuplicate = $this->get('onDuplicate');
$mismatchCount = $this->get('unMatchCount');
if ($duplicateRowCount > 0) {
$urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Contribute_Import_Parser';
$urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Contribute_Import_Parser_Contribution';
$this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
}
elseif ($mismatchCount) {
$urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Contribute_Import_Parser';
$urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Contribute_Import_Parser_Contribution';
$this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
}
else {
Expand Down
Loading

0 comments on commit 0fe4ebe

Please sign in to comment.