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 | * $Id$ |
17 | * | |
18 | */ | |
19 | ||
20 | /** | |
21 | * This class summarizes the import results | |
22 | */ | |
52892e8b | 23 | class CRM_Member_Import_Form_Summary extends CRM_Import_Form_Summary { |
6a488035 TO |
24 | |
25 | /** | |
fe482240 | 26 | * Set variables up before form is built. |
6a488035 TO |
27 | * |
28 | * @return void | |
6a488035 TO |
29 | */ |
30 | public function preProcess() { | |
6a488035 | 31 | // set the error message path to display |
bb3a214a | 32 | $this->assign('errorFile', $this->get('errorFile')); |
6a488035 TO |
33 | |
34 | $totalRowCount = $this->get('totalRowCount'); | |
35 | $relatedCount = $this->get('relatedCount'); | |
36 | $totalRowCount += $relatedCount; | |
37 | $this->set('totalRowCount', $totalRowCount); | |
38 | ||
719a6fec CW |
39 | $invalidRowCount = $this->get('invalidRowCount'); |
40 | $conflictRowCount = $this->get('conflictRowCount'); | |
6a488035 | 41 | $duplicateRowCount = $this->get('duplicateRowCount'); |
719a6fec CW |
42 | $onDuplicate = $this->get('onDuplicate'); |
43 | $mismatchCount = $this->get('unMatchCount'); | |
6a488035 | 44 | if ($duplicateRowCount > 0) { |
a05662ef | 45 | $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Member_Import_Parser'; |
6a488035 TO |
46 | $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
47 | } | |
48 | elseif ($mismatchCount) { | |
a05662ef | 49 | $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Member_Import_Parser'; |
6a488035 TO |
50 | $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
51 | } | |
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 | ||
ceb10dc7 | 72 | /* only subtract dupes from successful import if we're skipping */ |
6a488035 TO |
73 | |
74 | $this->set('validRowCount', $totalRowCount - $invalidRowCount - | |
75 | $conflictRowCount - $duplicateRowCount - $mismatchCount | |
76 | ); | |
77 | } | |
78 | $this->assign('dupeActionString', $dupeActionString); | |
79 | ||
be2fb01f | 80 | $properties = [ |
353ffa53 TO |
81 | 'totalRowCount', |
82 | 'validRowCount', | |
83 | 'invalidRowCount', | |
84 | 'conflictRowCount', | |
85 | 'downloadConflictRecordsUrl', | |
86 | 'downloadErrorRecordsUrl', | |
87 | 'duplicateRowCount', | |
88 | 'downloadDuplicateRecordsUrl', | |
89 | 'downloadMismatchRecordsUrl', | |
90 | 'groupAdditions', | |
af9b09df | 91 | 'unMatchCount', |
be2fb01f | 92 | ]; |
6a488035 TO |
93 | foreach ($properties as $property) { |
94 | $this->assign($property, $this->get($property)); | |
95 | } | |
96 | } | |
97 | ||
6a488035 | 98 | } |