Commit | Line | Data |
---|---|---|
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 | ||
3592a5e4 EM |
18 | use Civi\Api4\UserJob; |
19 | ||
6a488035 | 20 | /** |
f12c6f7d | 21 | * This class summarizes the import results. |
6a488035 | 22 | */ |
52892e8b | 23 | class CRM_Contact_Import_Form_Summary extends CRM_Import_Form_Summary { |
6a488035 TO |
24 | |
25 | /** | |
fe482240 | 26 | * Set variables up before form is built. |
c4f66023 EM |
27 | * |
28 | * @throws \API_Exception | |
29 | * @throws \CRM_Core_Exception | |
6a488035 TO |
30 | */ |
31 | public function preProcess() { | |
3592a5e4 | 32 | $userJobID = CRM_Utils_Request::retrieve('user_job_id', 'String', $this, TRUE); |
c78fdefd TO |
33 | $userJob = UserJob::get(TRUE)->addWhere('id', '=', $userJobID)->addSelect('metadata', 'job_type:label')->execute()->first(); |
34 | $this->setTitle($userJob['job_type:label']); | |
3592a5e4 | 35 | $onDuplicate = $userJob['metadata']['submitted_values']['onDuplicate']; |
6a488035 TO |
36 | $this->assign('dupeError', FALSE); |
37 | ||
3592a5e4 | 38 | if ($onDuplicate === CRM_Import_Parser::DUPLICATE_UPDATE) { |
c4f66023 | 39 | $this->assign('dupeActionString', ts('These records have been updated with the imported data.')); |
6a488035 | 40 | } |
3592a5e4 | 41 | elseif ($onDuplicate === CRM_Import_Parser::DUPLICATE_FILL) { |
c4f66023 | 42 | $this->assign('dupeActionString', ts('These records have been filled in with the imported data.')); |
6a488035 TO |
43 | } |
44 | else { | |
45 | /* Skip by default */ | |
c4f66023 | 46 | $this->assign('dupeActionString', ts('These records have not been imported.')); |
6a488035 TO |
47 | $this->assign('dupeError', TRUE); |
48 | } | |
6a488035 | 49 | |
4ff86743 EM |
50 | $this->assign('groupAdditions', $this->getUserJob()['metadata']['summary_info']['groups'] ?? []); |
51 | $this->assign('tagAdditions', $this->getUserJob()['metadata']['summary_info']['tags'] ?? []); | |
22f90136 | 52 | $this->assignOutputURLs(); |
6a488035 TO |
53 | $session = CRM_Core_Session::singleton(); |
54 | $session->pushUserContext(CRM_Utils_System::url('civicrm/import/contact', 'reset=1')); | |
55 | } | |
56 | ||
6a488035 | 57 | } |