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_Contribute_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 | // set the error message path to display | |
48 | $errorFile = $this->assign('errorFile', $this->get('errorFile')); | |
49 | ||
50 | $totalRowCount = $this->get('totalRowCount'); | |
51 | $relatedCount = $this->get('relatedCount'); | |
52 | $totalRowCount += $relatedCount; | |
53 | $this->set('totalRowCount', $totalRowCount); | |
54 | ||
55 | $invalidRowCount = $this->get('invalidRowCount'); | |
56 | $invalidSoftCreditRowCount = $this->get('invalidSoftCreditRowCount'); | |
57 | if ($invalidSoftCreditRowCount) { | |
58 | $urlParams = 'type=' . CRM_Contribute_Import_Parser::SOFT_CREDIT_ERROR . '&parser=CRM_Contribute_Import_Parser'; | |
59 | $this->set('downloadSoftCreditErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); | |
60 | } | |
61 | $validSoftCreditRowCount = $this->get('validSoftCreditRowCount'); | |
62 | $invalidPledgePaymentRowCount = $this->get('invalidPledgePaymentRowCount'); | |
63 | if ($invalidPledgePaymentRowCount) { | |
64 | $urlParams = 'type=' . CRM_Contribute_Import_Parser::PLEDGE_PAYMENT_ERROR . '&parser=CRM_Contribute_Import_Parser'; | |
65 | $this->set('downloadPledgePaymentErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); | |
66 | } | |
67 | $validPledgePaymentRowCount = $this->get('validPledgePaymentRowCount'); | |
68 | $conflictRowCount = $this->get('conflictRowCount'); | |
69 | $duplicateRowCount = $this->get('duplicateRowCount'); | |
70 | $onDuplicate = $this->get('onDuplicate'); | |
71 | $mismatchCount = $this->get('unMatchCount'); | |
72 | if ($duplicateRowCount > 0) { | |
a05662ef | 73 | $urlParams = 'type=' . CRM_Import_Parser::DUPLICATE . '&parser=CRM_Contribute_Import_Parser'; |
6a488035 TO |
74 | $this->set('downloadDuplicateRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
75 | } | |
76 | elseif ($mismatchCount) { | |
a05662ef | 77 | $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Contribute_Import_Parser'; |
6a488035 TO |
78 | $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams)); |
79 | } | |
80 | else { | |
81 | $duplicateRowCount = 0; | |
82 | $this->set('duplicateRowCount', $duplicateRowCount); | |
83 | } | |
84 | ||
85 | $this->assign('dupeError', FALSE); | |
86 | ||
a05662ef | 87 | if ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) { |
6a488035 TO |
88 | $dupeActionString = ts('These records have been updated with the imported data.'); |
89 | } | |
a05662ef | 90 | elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) { |
6a488035 TO |
91 | $dupeActionString = ts('These records have been filled in with the imported data.'); |
92 | } | |
93 | else { | |
94 | /* Skip by default */ | |
95 | ||
96 | $dupeActionString = ts('These records have not been imported.'); | |
97 | ||
98 | $this->assign('dupeError', TRUE); | |
99 | ||
719a6fec | 100 | /* only subtract dupes from successful import if we're skipping */ |
6a488035 TO |
101 | |
102 | $this->set('validRowCount', $totalRowCount - $invalidRowCount - | |
103 | $conflictRowCount - $duplicateRowCount - $mismatchCount - $invalidSoftCreditRowCount - $invalidPledgePaymentRowCount | |
104 | ); | |
105 | } | |
106 | $this->assign('dupeActionString', $dupeActionString); | |
107 | ||
108 | $properties = array('totalRowCount', 'validRowCount', 'invalidRowCount', 'validSoftCreditRowCount', 'invalidSoftCreditRowCount', 'conflictRowCount', 'downloadConflictRecordsUrl', 'downloadErrorRecordsUrl', 'duplicateRowCount', 'downloadDuplicateRecordsUrl', 'downloadMismatchRecordsUrl', 'groupAdditions', 'unMatchCount', 'validPledgePaymentRowCount', 'invalidPledgePaymentRowCount', 'downloadPledgePaymentErrorRecordsUrl', 'downloadSoftCreditErrorRecordsUrl'); | |
109 | foreach ($properties as $property) { | |
110 | $this->assign($property, $this->get($property)); | |
111 | } | |
112 | } | |
113 | ||
6a488035 | 114 | } |