Merge pull request #23691 from eileenmcnaughton/contact_type
[civicrm-core.git] / CRM / Event / 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_Event_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 $this->set('totalRowCount', $totalRowCount);
34
35 $invalidRowCount = $this->get('invalidRowCount');
36 $duplicateRowCount = $this->get('duplicateRowCount');
37 $onDuplicate = $this->get('onDuplicate');
38 if ($duplicateRowCount > 0) {
39 $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Event_Import_Parser_Participant';
40 $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
41 }
42 else {
43 $duplicateRowCount = 0;
44 $this->set('duplicateRowCount', $duplicateRowCount);
45 }
46
47 $this->assign('dupeError', FALSE);
48
49 if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) {
50 $dupeActionString = ts('These records have been updated with the imported data.');
51 }
52 elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) {
53 $dupeActionString = ts('These records have been filled in with the imported data.');
54 }
55 else {
56 /* Skip by default */
57
58 $dupeActionString = ts('These records have not been imported.');
59
60 $this->assign('dupeError', TRUE);
61
62 /* only subtract dupes from successful import if we're skipping */
63
64 $this->set('validRowCount', $totalRowCount - $invalidRowCount -
65 $duplicateRowCount
66 );
67 }
68 $this->assign('dupeActionString', $dupeActionString);
69
70 $properties = [
71 'totalRowCount',
72 'validRowCount',
73 'invalidRowCount',
74 'downloadErrorRecordsUrl',
75 'duplicateRowCount',
76 'downloadDuplicateRecordsUrl',
77 'groupAdditions',
78 ];
79 foreach ($properties as $property) {
80 $this->assign($property, $this->get($property));
81 }
82 }
83
84 }