3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 |
9 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
18 use Civi\Api4\UserJob
;
21 * This class summarizes the import results.
23 * TODO: CRM-11254 - if preProcess and postProcess functions can be reconciled between the 5 child classes,
24 * those classes can be removed entirely and this class will not need to be abstract
26 abstract class CRM_Import_Form_Summary
extends CRM_Import_Forms
{
29 * Set variables up before form is built.
33 public function preProcess() {
34 $this->assignOutputURLs();
38 * Build the form object.
40 public function buildQuickForm() {
41 $this->addButtons(array(
51 * Return a descriptive name for the page, used in wizard header.
55 public function getTitle() {
59 protected function assignOutputURLs(): void
{
60 $this->assign('totalRowCount', $this->getRowCount());
61 $this->assign('validRowCount', $this->getRowCount(CRM_Import_Parser
::VALID
) +
$this->getRowCount(CRM_Import_Parser
::UNPARSED_ADDRESS_WARNING
));
62 $this->assign('invalidRowCount', $this->getRowCount(CRM_Import_Parser
::ERROR
));
63 $this->assign('duplicateRowCount', $this->getRowCount(CRM_Import_Parser
::DUPLICATE
));
64 $this->assign('unMatchCount', $this->getRowCount(CRM_Import_Parser
::NO_MATCH
));
65 $this->assign('unparsedAddressCount', $this->getRowCount(CRM_Import_Parser
::UNPARSED_ADDRESS_WARNING
));
66 $this->assign('downloadDuplicateRecordsUrl', $this->getDownloadURL(CRM_Import_Parser
::DUPLICATE
));
67 $this->assign('downloadErrorRecordsUrl', $this->getDownloadURL(CRM_Import_Parser
::ERROR
));
68 $this->assign('downloadMismatchRecordsUrl', $this->getDownloadURL(CRM_Import_Parser
::NO_MATCH
));
69 $this->assign('downloadAddressRecordsUrl', $this->getDownloadURL(CRM_Import_Parser
::UNPARSED_ADDRESS_WARNING
));
70 $userJobID = CRM_Utils_Request
::retrieve('user_job_id', 'String', $this, TRUE);
71 $userJob = UserJob
::get(TRUE)->addWhere('id', '=', $userJobID)->execute()->first();
72 $onDuplicate = (int) $userJob['metadata']['submitted_values']['onDuplicate'];
73 $this->assign('dupeError', FALSE);
74 if ($onDuplicate === CRM_Import_Parser
::DUPLICATE_UPDATE
) {
75 $dupeActionString = ts('These records have been updated with the imported data.');
77 elseif ($onDuplicate === CRM_Import_Parser
::DUPLICATE_FILL
) {
78 $dupeActionString = ts('These records have been filled in with the imported data.');
82 $dupeActionString = ts('These records have not been imported.');
83 $this->assign('dupeError', TRUE);
85 $this->assign('dupeActionString', $dupeActionString);