Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
39de6fd5 | 4 | | CiviCRM version 4.6 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06b69b18 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
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 | +--------------------------------------------------------------------+ | |
26 | */ | |
27 | ||
28 | /** | |
29 | * | |
30 | * @package CRM | |
06b69b18 | 31 | * @copyright CiviCRM LLC (c) 2004-2014 |
6a488035 TO |
32 | * $Id$ |
33 | * | |
34 | */ | |
35 | ||
36 | /** | |
37 | * This class summarizes the import results | |
38 | */ | |
52892e8b | 39 | class CRM_Activity_Import_Form_Summary extends CRM_Import_Form_Summary { |
6a488035 TO |
40 | |
41 | /** | |
100fef9d | 42 | * Set variables up before form is built |
6a488035 TO |
43 | * |
44 | * @return void | |
6a488035 TO |
45 | */ |
46 | public function preProcess() { | |
47 | ||
48 | // set the error message path to display | |
49 | $errorFile = $this->assign('errorFile', $this->get('errorFile')); | |
50 | ||
51 | $totalRowCount = $this->get('totalRowCount'); | |
52 | $relatedCount = $this->get('relatedCount'); | |
53 | $totalRowCount += $relatedCount; | |
54 | $this->set('totalRowCount', $totalRowCount); | |
55 | ||
719a6fec CW |
56 | $invalidRowCount = $this->get('invalidRowCount'); |
57 | $conflictRowCount = $this->get('conflictRowCount'); | |
6a488035 | 58 | $duplicateRowCount = $this->get('duplicateRowCount'); |
719a6fec CW |
59 | $onDuplicate = $this->get('onDuplicate'); |
60 | $mismatchCount = $this->get('unMatchCount'); | |
6a488035 | 61 | if ($duplicateRowCount > 0) { |
a05662ef | 62 | $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Activity_Import_Parser'; |
6a488035 TO |
63 | $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
64 | } | |
65 | elseif ($mismatchCount) { | |
a05662ef | 66 | $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Activity_Import_Parser'; |
6a488035 TO |
67 | $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
68 | } | |
69 | else { | |
70 | $duplicateRowCount = 0; | |
71 | $this->set('duplicateRowCount', $duplicateRowCount); | |
72 | } | |
73 | ||
74 | $this->assign('dupeError', FALSE); | |
75 | ||
a05662ef | 76 | if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { |
6a488035 TO |
77 | $dupeActionString = ts('These records have been updated with the imported data.'); |
78 | } | |
a05662ef | 79 | elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) { |
6a488035 TO |
80 | $dupeActionString = ts('These records have been filled in with the imported data.'); |
81 | } | |
82 | else { | |
83 | /* Skip by default */ | |
84 | ||
85 | $dupeActionString = ts('These records have not been imported.'); | |
86 | ||
87 | $this->assign('dupeError', TRUE); | |
88 | ||
ceb10dc7 | 89 | /* only subtract dupes from successful import if we're skipping */ |
6a488035 TO |
90 | |
91 | $this->set('validRowCount', $totalRowCount - $invalidRowCount - | |
92 | $conflictRowCount - $duplicateRowCount - $mismatchCount | |
93 | ); | |
94 | } | |
95 | $this->assign('dupeActionString', $dupeActionString); | |
96 | ||
353ffa53 TO |
97 | $properties = array( |
98 | 'totalRowCount', | |
99 | 'validRowCount', | |
100 | 'invalidRowCount', | |
101 | 'conflictRowCount', | |
102 | 'downloadConflictRecordsUrl', | |
103 | 'downloadErrorRecordsUrl', | |
104 | 'duplicateRowCount', | |
105 | 'downloadDuplicateRecordsUrl', | |
106 | 'downloadMismatchRecordsUrl', | |
107 | 'groupAdditions', | |
3bdca100 | 108 | 'unMatchCount', |
353ffa53 | 109 | ); |
6a488035 TO |
110 | foreach ($properties as $property) { |
111 | $this->assign($property, $this->get($property)); | |
112 | } | |
113 | } | |
114 | ||
6a488035 | 115 | } |