Merge pull request #23698 from seamuslee001/fix_price_set_entity_since
[civicrm-core.git] / CRM / Member / Import / Form / Summary.php
CommitLineData
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 21class CRM_Member_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() {
6a488035 29 // set the error message path to display
bb3a214a 30 $this->assign('errorFile', $this->get('errorFile'));
6a488035
TO
31
32 $totalRowCount = $this->get('totalRowCount');
6a488035
TO
33 $this->set('totalRowCount', $totalRowCount);
34
719a6fec 35 $invalidRowCount = $this->get('invalidRowCount');
6a488035 36 $duplicateRowCount = $this->get('duplicateRowCount');
719a6fec 37 $onDuplicate = $this->get('onDuplicate');
67fa4d56 38
6a488035 39 if ($duplicateRowCount > 0) {
ca4caf13 40 $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Member_Import_Parser_Membership';
6a488035
TO
41 $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
42 }
6a488035
TO
43 else {
44 $duplicateRowCount = 0;
45 $this->set('duplicateRowCount', $duplicateRowCount);
46 }
47
48 $this->assign('dupeError', FALSE);
49
a05662ef 50 if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) {
6a488035
TO
51 $dupeActionString = ts('These records have been updated with the imported data.');
52 }
a05662ef 53 elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) {
6a488035
TO
54 $dupeActionString = ts('These records have been filled in with the imported data.');
55 }
56 else {
57 /* Skip by default */
58
59 $dupeActionString = ts('These records have not been imported.');
60
61 $this->assign('dupeError', TRUE);
62
ceb10dc7 63 /* only subtract dupes from successful import if we're skipping */
6a488035
TO
64
65 $this->set('validRowCount', $totalRowCount - $invalidRowCount -
67fa4d56 66 $duplicateRowCount
6a488035
TO
67 );
68 }
69 $this->assign('dupeActionString', $dupeActionString);
70
be2fb01f 71 $properties = [
353ffa53
TO
72 'totalRowCount',
73 'validRowCount',
74 'invalidRowCount',
353ffa53
TO
75 'downloadErrorRecordsUrl',
76 'duplicateRowCount',
77 'downloadDuplicateRecordsUrl',
353ffa53 78 'groupAdditions',
be2fb01f 79 ];
6a488035
TO
80 foreach ($properties as $property) {
81 $this->assign($property, $this->get($property));
82 }
83 }
84
6a488035 85}