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 | /** | |
19 | * This class summarizes the import results | |
20 | */ | |
52892e8b | 21 | class CRM_Event_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 | * @return void | |
6a488035 TO |
27 | */ |
28 | public function preProcess() { | |
29 | // set the error message path to display | |
81c3812a | 30 | $this->assign('errorFile', $this->get('errorFile')); |
6a488035 TO |
31 | |
32 | $totalRowCount = $this->get('totalRowCount'); | |
33 | $relatedCount = $this->get('relatedCount'); | |
34 | $totalRowCount += $relatedCount; | |
35 | $this->set('totalRowCount', $totalRowCount); | |
36 | ||
719a6fec CW |
37 | $invalidRowCount = $this->get('invalidRowCount'); |
38 | $conflictRowCount = $this->get('conflictRowCount'); | |
6a488035 | 39 | $duplicateRowCount = $this->get('duplicateRowCount'); |
719a6fec CW |
40 | $onDuplicate = $this->get('onDuplicate'); |
41 | $mismatchCount = $this->get('unMatchCount'); | |
6a488035 | 42 | if ($duplicateRowCount > 0) { |
d60cd664 | 43 | $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Event_Import_Parser_Participant'; |
6a488035 TO |
44 | $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
45 | } | |
46 | elseif ($mismatchCount) { | |
d60cd664 | 47 | $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Event_Import_Parser_Participant'; |
6a488035 TO |
48 | $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
49 | } | |
50 | else { | |
51 | $duplicateRowCount = 0; | |
52 | $this->set('duplicateRowCount', $duplicateRowCount); | |
53 | } | |
54 | ||
55 | $this->assign('dupeError', FALSE); | |
56 | ||
a05662ef | 57 | if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { |
6a488035 TO |
58 | $dupeActionString = ts('These records have been updated with the imported data.'); |
59 | } | |
a05662ef | 60 | elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) { |
6a488035 TO |
61 | $dupeActionString = ts('These records have been filled in with the imported data.'); |
62 | } | |
63 | else { | |
64 | /* Skip by default */ | |
65 | ||
66 | $dupeActionString = ts('These records have not been imported.'); | |
67 | ||
68 | $this->assign('dupeError', TRUE); | |
69 | ||
ceb10dc7 | 70 | /* only subtract dupes from successful import if we're skipping */ |
6a488035 TO |
71 | |
72 | $this->set('validRowCount', $totalRowCount - $invalidRowCount - | |
73 | $conflictRowCount - $duplicateRowCount - $mismatchCount | |
74 | ); | |
75 | } | |
76 | $this->assign('dupeActionString', $dupeActionString); | |
77 | ||
be2fb01f | 78 | $properties = [ |
353ffa53 TO |
79 | 'totalRowCount', |
80 | 'validRowCount', | |
81 | 'invalidRowCount', | |
82 | 'conflictRowCount', | |
83 | 'downloadConflictRecordsUrl', | |
84 | 'downloadErrorRecordsUrl', | |
85 | 'duplicateRowCount', | |
86 | 'downloadDuplicateRecordsUrl', | |
87 | 'downloadMismatchRecordsUrl', | |
88 | 'groupAdditions', | |
d5cc0fc2 | 89 | 'unMatchCount', |
be2fb01f | 90 | ]; |
6a488035 TO |
91 | foreach ($properties as $property) { |
92 | $this->assign($property, $this->get($property)); | |
93 | } | |
94 | } | |
95 | ||
6a488035 | 96 | } |