Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
232624b1 | 4 | | CiviCRM version 4.4 | |
6a488035 TO |
5 | +--------------------------------------------------------------------+ |
6 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 | |
31 | * @copyright CiviCRM LLC (c) 2004-2013 | |
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 | /** | |
42 | * Function to set variables up before form is built | |
43 | * | |
44 | * @return void | |
45 | * @access public | |
46 | */ | |
47 | public function preProcess() { | |
48 | ||
49 | // set the error message path to display | |
50 | $errorFile = $this->assign('errorFile', $this->get('errorFile')); | |
51 | ||
52 | $totalRowCount = $this->get('totalRowCount'); | |
53 | $relatedCount = $this->get('relatedCount'); | |
54 | $totalRowCount += $relatedCount; | |
55 | $this->set('totalRowCount', $totalRowCount); | |
56 | ||
719a6fec CW |
57 | $invalidRowCount = $this->get('invalidRowCount'); |
58 | $conflictRowCount = $this->get('conflictRowCount'); | |
6a488035 | 59 | $duplicateRowCount = $this->get('duplicateRowCount'); |
719a6fec CW |
60 | $onDuplicate = $this->get('onDuplicate'); |
61 | $mismatchCount = $this->get('unMatchCount'); | |
6a488035 | 62 | if ($duplicateRowCount > 0) { |
a05662ef | 63 | $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Activity_Import_Parser'; |
6a488035 TO |
64 | $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
65 | } | |
66 | elseif ($mismatchCount) { | |
a05662ef | 67 | $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Activity_Import_Parser'; |
6a488035 TO |
68 | $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
69 | } | |
70 | else { | |
71 | $duplicateRowCount = 0; | |
72 | $this->set('duplicateRowCount', $duplicateRowCount); | |
73 | } | |
74 | ||
75 | $this->assign('dupeError', FALSE); | |
76 | ||
a05662ef | 77 | if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { |
6a488035 TO |
78 | $dupeActionString = ts('These records have been updated with the imported data.'); |
79 | } | |
a05662ef | 80 | elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) { |
6a488035 TO |
81 | $dupeActionString = ts('These records have been filled in with the imported data.'); |
82 | } | |
83 | else { | |
84 | /* Skip by default */ | |
85 | ||
86 | $dupeActionString = ts('These records have not been imported.'); | |
87 | ||
88 | $this->assign('dupeError', TRUE); | |
89 | ||
ceb10dc7 | 90 | /* only subtract dupes from successful import if we're skipping */ |
6a488035 TO |
91 | |
92 | $this->set('validRowCount', $totalRowCount - $invalidRowCount - | |
93 | $conflictRowCount - $duplicateRowCount - $mismatchCount | |
94 | ); | |
95 | } | |
96 | $this->assign('dupeActionString', $dupeActionString); | |
97 | ||
98 | $properties = array('totalRowCount', 'validRowCount', 'invalidRowCount', 'conflictRowCount', 'downloadConflictRecordsUrl', 'downloadErrorRecordsUrl', 'duplicateRowCount', 'downloadDuplicateRecordsUrl', 'downloadMismatchRecordsUrl', 'groupAdditions', 'unMatchCount'); | |
99 | foreach ($properties as $property) { | |
100 | $this->assign($property, $this->get($property)); | |
101 | } | |
102 | } | |
103 | ||
6a488035 TO |
104 | } |
105 |