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