Merge pull request #11735 from mukeshcompucorp/CRM-21814-add-proper-container-to...
[civicrm-core.git] / CRM / Member / Import / Form / Summary.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
7e9e8871 4 | CiviCRM version 4.7 |
6a488035 5 +--------------------------------------------------------------------+
8c9251b3 6 | Copyright CiviCRM LLC (c) 2004-2018 |
6a488035
TO
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
d25dd0ee 26 */
6a488035
TO
27
28/**
29 *
30 * @package CRM
8c9251b3 31 * @copyright CiviCRM LLC (c) 2004-2018
6a488035
TO
32 * $Id$
33 *
34 */
35
36/**
37 * This class summarizes the import results
38 */
52892e8b 39class CRM_Member_Import_Form_Summary extends CRM_Import_Form_Summary {
6a488035
TO
40
41 /**
fe482240 42 * Set variables up before form is built.
6a488035
TO
43 *
44 * @return void
6a488035
TO
45 */
46 public function preProcess() {
6a488035 47 // set the error message path to display
bb3a214a 48 $this->assign('errorFile', $this->get('errorFile'));
6a488035
TO
49
50 $totalRowCount = $this->get('totalRowCount');
51 $relatedCount = $this->get('relatedCount');
52 $totalRowCount += $relatedCount;
53 $this->set('totalRowCount', $totalRowCount);
54
719a6fec
CW
55 $invalidRowCount = $this->get('invalidRowCount');
56 $conflictRowCount = $this->get('conflictRowCount');
6a488035 57 $duplicateRowCount = $this->get('duplicateRowCount');
719a6fec
CW
58 $onDuplicate = $this->get('onDuplicate');
59 $mismatchCount = $this->get('unMatchCount');
6a488035 60 if ($duplicateRowCount > 0) {
a05662ef 61 $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Member_Import_Parser';
6a488035
TO
62 $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
63 }
64 elseif ($mismatchCount) {
a05662ef 65 $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Member_Import_Parser';
6a488035
TO
66 $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
67 }
68 else {
69 $duplicateRowCount = 0;
70 $this->set('duplicateRowCount', $duplicateRowCount);
71 }
72
73 $this->assign('dupeError', FALSE);
74
a05662ef 75 if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) {
6a488035
TO
76 $dupeActionString = ts('These records have been updated with the imported data.');
77 }
a05662ef 78 elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) {
6a488035
TO
79 $dupeActionString = ts('These records have been filled in with the imported data.');
80 }
81 else {
82 /* Skip by default */
83
84 $dupeActionString = ts('These records have not been imported.');
85
86 $this->assign('dupeError', TRUE);
87
ceb10dc7 88 /* only subtract dupes from successful import if we're skipping */
6a488035
TO
89
90 $this->set('validRowCount', $totalRowCount - $invalidRowCount -
91 $conflictRowCount - $duplicateRowCount - $mismatchCount
92 );
93 }
94 $this->assign('dupeActionString', $dupeActionString);
95
353ffa53
TO
96 $properties = array(
97 'totalRowCount',
98 'validRowCount',
99 'invalidRowCount',
100 'conflictRowCount',
101 'downloadConflictRecordsUrl',
102 'downloadErrorRecordsUrl',
103 'duplicateRowCount',
104 'downloadDuplicateRecordsUrl',
105 'downloadMismatchRecordsUrl',
106 'groupAdditions',
af9b09df 107 'unMatchCount',
353ffa53 108 );
6a488035
TO
109 foreach ($properties as $property) {
110 $this->assign($property, $this->get($property));
111 }
112 }
113
6a488035 114}