Merge pull request #23420 from mattwire/custombasepage
[civicrm-core.git] / CRM / Member / Import / Form / Summary.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
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 |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * This class summarizes the import results
20 */
21 class CRM_Member_Import_Form_Summary extends CRM_Import_Form_Summary {
22
23 /**
24 * Set variables up before form is built.
25 *
26 * @return void
27 */
28 public function preProcess() {
29 // set the error message path to display
30 $this->assign('errorFile', $this->get('errorFile'));
31
32 $totalRowCount = $this->get('totalRowCount');
33 $relatedCount = $this->get('relatedCount');
34 $totalRowCount += $relatedCount;
35 $this->set('totalRowCount', $totalRowCount);
36
37 $invalidRowCount = $this->get('invalidRowCount');
38 $duplicateRowCount = $this->get('duplicateRowCount');
39 $onDuplicate = $this->get('onDuplicate');
40
41 if ($duplicateRowCount > 0) {
42 $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Member_Import_Parser_Membership';
43 $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
44 }
45 else {
46 $duplicateRowCount = 0;
47 $this->set('duplicateRowCount', $duplicateRowCount);
48 }
49
50 $this->assign('dupeError', FALSE);
51
52 if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) {
53 $dupeActionString = ts('These records have been updated with the imported data.');
54 }
55 elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) {
56 $dupeActionString = ts('These records have been filled in with the imported data.');
57 }
58 else {
59 /* Skip by default */
60
61 $dupeActionString = ts('These records have not been imported.');
62
63 $this->assign('dupeError', TRUE);
64
65 /* only subtract dupes from successful import if we're skipping */
66
67 $this->set('validRowCount', $totalRowCount - $invalidRowCount -
68 $duplicateRowCount
69 );
70 }
71 $this->assign('dupeActionString', $dupeActionString);
72
73 $properties = [
74 'totalRowCount',
75 'validRowCount',
76 'invalidRowCount',
77 'downloadErrorRecordsUrl',
78 'duplicateRowCount',
79 'downloadDuplicateRecordsUrl',
80 'groupAdditions',
81 ];
82 foreach ($properties as $property) {
83 $this->assign($property, $this->get($property));
84 }
85 }
86
87 }