Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
6 | | This work is published under the GNU AGPLv3 license with some | |
7 | | permitted exceptions and without any warranty. For full license | | |
8 | | and copyright information, see https://civicrm.org/licensing | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | ||
18 | /** | |
347e061b | 19 | * This class summarizes the import results. |
6a488035 | 20 | */ |
52892e8b | 21 | class CRM_Contribute_Import_Form_Summary extends CRM_Import_Form_Summary { |
6a488035 TO |
22 | |
23 | /** | |
fe482240 | 24 | * Set variables up before form is built. |
6a488035 TO |
25 | */ |
26 | public function preProcess() { | |
27 | // set the error message path to display | |
81c3812a | 28 | $this->assign('errorFile', $this->get('errorFile')); |
6a488035 TO |
29 | |
30 | $totalRowCount = $this->get('totalRowCount'); | |
6a488035 TO |
31 | $this->set('totalRowCount', $totalRowCount); |
32 | ||
33 | $invalidRowCount = $this->get('invalidRowCount'); | |
34 | $invalidSoftCreditRowCount = $this->get('invalidSoftCreditRowCount'); | |
35 | if ($invalidSoftCreditRowCount) { | |
8dc9763a | 36 | $urlParams = 'type=' . CRM_Contribute_Import_Parser_Contribution::SOFT_CREDIT_ERROR . '&parser=CRM_Contribute_Import_Parser_Contribution'; |
6a488035 TO |
37 | $this->set('downloadSoftCreditErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
38 | } | |
39 | $validSoftCreditRowCount = $this->get('validSoftCreditRowCount'); | |
40 | $invalidPledgePaymentRowCount = $this->get('invalidPledgePaymentRowCount'); | |
41 | if ($invalidPledgePaymentRowCount) { | |
8dc9763a | 42 | $urlParams = 'type=' . CRM_Contribute_Import_Parser_Contribution::PLEDGE_PAYMENT_ERROR . '&parser=CRM_Contribute_Import_Parser_Contribution'; |
6a488035 TO |
43 | $this->set('downloadPledgePaymentErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
44 | } | |
45 | $validPledgePaymentRowCount = $this->get('validPledgePaymentRowCount'); | |
6a488035 TO |
46 | $duplicateRowCount = $this->get('duplicateRowCount'); |
47 | $onDuplicate = $this->get('onDuplicate'); | |
6a488035 | 48 | if ($duplicateRowCount > 0) { |
8dc9763a | 49 | $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Contribute_Import_Parser_Contribution'; |
6a488035 TO |
50 | $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
51 | } | |
6a488035 TO |
52 | else { |
53 | $duplicateRowCount = 0; | |
54 | $this->set('duplicateRowCount', $duplicateRowCount); | |
55 | } | |
56 | ||
57 | $this->assign('dupeError', FALSE); | |
58 | ||
a05662ef | 59 | if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { |
6a488035 TO |
60 | $dupeActionString = ts('These records have been updated with the imported data.'); |
61 | } | |
a05662ef | 62 | elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) { |
6a488035 TO |
63 | $dupeActionString = ts('These records have been filled in with the imported data.'); |
64 | } | |
65 | else { | |
66 | /* Skip by default */ | |
67 | ||
68 | $dupeActionString = ts('These records have not been imported.'); | |
69 | ||
70 | $this->assign('dupeError', TRUE); | |
71 | ||
719a6fec | 72 | /* only subtract dupes from successful import if we're skipping */ |
6a488035 TO |
73 | |
74 | $this->set('validRowCount', $totalRowCount - $invalidRowCount - | |
67fa4d56 | 75 | $duplicateRowCount - $invalidSoftCreditRowCount - $invalidPledgePaymentRowCount |
6a488035 TO |
76 | ); |
77 | } | |
78 | $this->assign('dupeActionString', $dupeActionString); | |
79 | ||
be2fb01f | 80 | $properties = [ |
353ffa53 TO |
81 | 'totalRowCount', |
82 | 'validRowCount', | |
83 | 'invalidRowCount', | |
84 | 'validSoftCreditRowCount', | |
85 | 'invalidSoftCreditRowCount', | |
353ffa53 TO |
86 | 'downloadErrorRecordsUrl', |
87 | 'duplicateRowCount', | |
88 | 'downloadDuplicateRecordsUrl', | |
353ffa53 | 89 | 'groupAdditions', |
353ffa53 TO |
90 | 'validPledgePaymentRowCount', |
91 | 'invalidPledgePaymentRowCount', | |
92 | 'downloadPledgePaymentErrorRecordsUrl', | |
87a890cc | 93 | 'downloadSoftCreditErrorRecordsUrl', |
be2fb01f | 94 | ]; |
6a488035 TO |
95 | foreach ($properties as $property) { |
96 | $this->assign($property, $this->get($property)); | |
97 | } | |
98 | } | |
99 | ||
6a488035 | 100 | } |