Merge pull request #15135 from mattwire/case_links_refactor_report
[civicrm-core.git] / CRM / Admin / Form / CMSUser.php
CommitLineData
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
18/**
19 * This class generates form components for Synchronizing CMS Users
6a488035
TO
20 */
21class CRM_Admin_Form_CMSUser extends CRM_Core_Form {
22
23 /**
eceb18cc 24 * Build the form object.
6a488035
TO
25 */
26 public function buildQuickForm() {
27
be2fb01f 28 $this->addButtons([
0d48f1cc
TO
29 [
30 'type' => 'next',
31 'name' => ts('OK'),
32 'isDefault' => TRUE,
33 ],
34 [
35 'type' => 'cancel',
36 'name' => ts('Cancel'),
37 ],
38 ]);
6a488035
TO
39 }
40
41 /**
eceb18cc 42 * Process the form submission.
6a488035
TO
43 */
44 public function postProcess() {
091db908 45 $result = CRM_Utils_System::synchronizeUsers();
7a0f31f9
CW
46
47 $status = ts('Checked one user record.',
be2fb01f 48 [
7a0f31f9
CW
49 'count' => $result['contactCount'],
50 'plural' => 'Checked %count user records.',
be2fb01f 51 ]
7a0f31f9
CW
52 );
53 if ($result['contactMatching']) {
54 $status .= '<br />' . ts('Found one matching contact record.',
be2fb01f 55 [
7a0f31f9
CW
56 'count' => $result['contactMatching'],
57 'plural' => 'Found %count matching contact records.',
be2fb01f 58 ]
7a0f31f9
CW
59 );
60 }
61
62 $status .= '<br />' . ts('Created one new contact record.',
be2fb01f 63 [
7a0f31f9
CW
64 'count' => $result['contactCreated'],
65 'plural' => 'Created %count new contact records.',
be2fb01f 66 ]
7a0f31f9
CW
67 );
68 CRM_Core_Session::setStatus($status, ts('Synchronize Complete'), 'success');
69 CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
6a488035 70 }
96025800 71
6a488035 72}