* Set variables up before form is built.
*/
public function preProcess() {
- // set the error message path to display
- $this->assign('errorFile', $this->get('errorFile'));
-
- $totalRowCount = $this->get('totalRowCount');
- $this->set('totalRowCount', $totalRowCount);
-
- $invalidRowCount = $this->get('invalidRowCount');
- $invalidSoftCreditRowCount = $this->get('invalidSoftCreditRowCount');
- if ($invalidSoftCreditRowCount) {
- $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_Contribution::PLEDGE_PAYMENT_ERROR . '&parser=CRM_Contribute_Import_Parser_Contribution';
- $this->set('downloadPledgePaymentErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
- }
- $validPledgePaymentRowCount = $this->get('validPledgePaymentRowCount');
- $duplicateRowCount = $this->get('duplicateRowCount');
- $onDuplicate = $this->get('onDuplicate');
- if ($duplicateRowCount > 0) {
- $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Contribute_Import_Parser_Contribution';
- $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
- }
- else {
- $duplicateRowCount = 0;
- $this->set('duplicateRowCount', $duplicateRowCount);
- }
-
- $this->assign('dupeError', FALSE);
-
- if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) {
- $dupeActionString = ts('These records have been updated with the imported data.');
- }
- elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) {
- $dupeActionString = ts('These records have been filled in with the imported data.');
- }
- else {
- /* Skip by default */
-
- $dupeActionString = ts('These records have not been imported.');
-
- $this->assign('dupeError', TRUE);
-
- /* only subtract dupes from successful import if we're skipping */
-
- $this->set('validRowCount', $totalRowCount - $invalidRowCount -
- $duplicateRowCount - $invalidSoftCreditRowCount - $invalidPledgePaymentRowCount
- );
- }
- $this->assign('dupeActionString', $dupeActionString);
-
- $properties = [
- 'totalRowCount',
- 'validRowCount',
- 'invalidRowCount',
- 'validSoftCreditRowCount',
- 'invalidSoftCreditRowCount',
- 'downloadErrorRecordsUrl',
- 'duplicateRowCount',
- 'downloadDuplicateRecordsUrl',
- 'groupAdditions',
- 'validPledgePaymentRowCount',
- 'invalidPledgePaymentRowCount',
- 'downloadPledgePaymentErrorRecordsUrl',
- 'downloadSoftCreditErrorRecordsUrl',
- ];
- foreach ($properties as $property) {
- $this->assign($property, $this->get($property));
- }
+ parent::preProcess();
}
}
" . $this->getAdditionalTrackingFields() . "
ADD COLUMN _status VARCHAR(32) DEFAULT 'NEW' NOT NULL,
ADD COLUMN _status_message TEXT,
- ADD COLUMN _id INT PRIMARY KEY NOT NULL AUTO_INCREMENT"
+ ADD COLUMN _id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
+ ADD INDEX(_id),
+ ADD INDEX(_status)
+ "
);
}
*/
protected function getStatusMapping(): array {
return [
- CRM_Import_Parser::VALID => ['imported', 'new'],
- CRM_Import_Parser::ERROR => ['error', 'invalid'],
+ CRM_Import_Parser::VALID => ['imported', 'new', 'soft_credit_imported', 'pledge_payment_imported'],
+ CRM_Import_Parser::ERROR => ['error', 'invalid', 'soft_credit_error', 'pledge_payment_error'],
CRM_Import_Parser::DUPLICATE => ['duplicate'],
CRM_Import_Parser::NO_MATCH => ['invalid_no_match'],
CRM_Import_Parser::UNPARSED_ADDRESS_WARNING => ['warning_unparsed_address'],
+ CRM_Contribute_Import_Parser_Contribution::SOFT_CREDIT_ERROR => ['soft_credit_error'],
+ CRM_Contribute_Import_Parser_Contribution::SOFT_CREDIT => ['soft_credit_imported'],
+ CRM_Contribute_Import_Parser_Contribution::PLEDGE_PAYMENT => ['pledge_payment_imported'],
+ CRM_Contribute_Import_Parser_Contribution::PLEDGE_PAYMENT_ERROR => ['pledge_payment_error'],
'new' => ['new'],
];
}
$this->assign('invalidRowCount', $this->getRowCount(CRM_Import_Parser::ERROR));
$this->assign('duplicateRowCount', $this->getRowCount(CRM_Import_Parser::DUPLICATE));
$this->assign('unMatchCount', $this->getRowCount(CRM_Import_Parser::NO_MATCH));
+ $this->assign('validSoftCreditRowCount', $this->getRowCount(CRM_Contribute_Import_Parser_Contribution::SOFT_CREDIT));
+ $this->assign('invalidSoftCreditRowCount', $this->getRowCount(CRM_Contribute_Import_Parser_Contribution::SOFT_CREDIT_ERROR));
+ $this->assign('validPledgePaymentRowCount', $this->getRowCount(CRM_Contribute_Import_Parser_Contribution::PLEDGE_PAYMENT));
+ $this->assign('invalidPledgePaymentRowCount', $this->getRowCount(CRM_Contribute_Import_Parser_Contribution::PLEDGE_PAYMENT_ERROR));
$this->assign('unparsedAddressCount', $this->getRowCount(CRM_Import_Parser::UNPARSED_ADDRESS_WARNING));
$this->assign('downloadDuplicateRecordsUrl', $this->getDownloadURL(CRM_Import_Parser::DUPLICATE));
$this->assign('downloadErrorRecordsUrl', $this->getDownloadURL(CRM_Import_Parser::ERROR));
$this->assign('downloadMismatchRecordsUrl', $this->getDownloadURL(CRM_Import_Parser::NO_MATCH));
$this->assign('downloadAddressRecordsUrl', $this->getDownloadURL(CRM_Import_Parser::UNPARSED_ADDRESS_WARNING));
+ $this->assign('downloadPledgePaymentErrorRecordsUrl', $this->getDownloadURL(CRM_Contribute_Import_Parser_Contribution::PLEDGE_PAYMENT_ERROR));
+ $this->assign('downloadSoftCreditErrorRecordsUrl', $this->getDownloadURL(CRM_Contribute_Import_Parser_Contribution::SOFT_CREDIT_ERROR));
$userJobID = CRM_Utils_Request::retrieve('user_job_id', 'String', $this, TRUE);
$userJob = UserJob::get(TRUE)->addWhere('id', '=', $userJobID)->execute()->first();
$onDuplicate = (int) $userJob['metadata']['submitted_values']['onDuplicate'];
--- /dev/null
+,eileen,eileen-laptop,08.06.2022 11:54,file:///home/eileen/.config/libreoffice/4;
\ No newline at end of file
--- /dev/null
+Email,Amount,Pledge ID,Receive date,Financial Type
+mum@example.com,5,1,2022-01-07,Donation