Skip to content

Commit

Permalink
Merge pull request #13583 from eileenmcnaughton/user_dash
Browse files Browse the repository at this point in the history
[REF] switch from (undeclared) class property to local variable.
  • Loading branch information
eileenmcnaughton authored Feb 13, 2019
2 parents b2532c3 + 83564f9 commit 9aa4d23
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions CRM/Contact/Page/View/UserDashBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,12 @@ class CRM_Contact_Page_View_UserDashBoard extends CRM_Core_Page {
public function __construct() {
parent::__construct();

$check = CRM_Core_Permission::check('access Contact Dashboard');

if (!$check) {
if (!CRM_Core_Permission::check('access Contact Dashboard')) {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/dashboard', 'reset=1'));
}

$this->_contactId = CRM_Utils_Request::retrieve('id', 'Positive', $this);

$session = CRM_Core_Session::singleton();
$userID = $session->get('userID');
$userID = CRM_Core_Session::singleton()->getLoggedInContactID();

$userChecksum = $this->getUserChecksum();
$validUser = FALSE;
Expand Down Expand Up @@ -115,10 +111,9 @@ public function preProcess() {
*/
public function buildUserDashBoard() {
//build component selectors
$dashboardElements = array();
$config = CRM_Core_Config::singleton();
$dashboardElements = [];

$this->_userOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
$dashboardOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'user_dashboard_options'
);

Expand All @@ -130,7 +125,7 @@ public function buildUserDashBoard() {
continue;
}

if (!empty($this->_userOptions[$name]) &&
if (!empty($dashboardOptions[$name]) &&
(CRM_Core_Permission::access($component->name) ||
CRM_Core_Permission::check($elem['perm'][0])
)
Expand All @@ -148,7 +143,7 @@ public function buildUserDashBoard() {
}

// CRM-16512 - Hide related contact table if user lacks permission to view self
if (!empty($this->_userOptions['Permissioned Orgs']) && CRM_Core_Permission::check('view my contact')) {
if (!empty($dashboardOptions['Permissioned Orgs']) && CRM_Core_Permission::check('view my contact')) {
$dashboardElements[] = array(
'class' => 'crm-dashboard-permissionedOrgs',
'templatePath' => 'CRM/Contact/Page/View/RelationshipSelector.tpl',
Expand All @@ -158,7 +153,7 @@ public function buildUserDashBoard() {

}

if (!empty($this->_userOptions['PCP'])) {
if (!empty($dashboardOptions['PCP'])) {
$dashboardElements[] = array(
'class' => 'crm-dashboard-pcp',
'templatePath' => 'CRM/Contribute/Page/PcpUserDashboard.tpl',
Expand All @@ -170,7 +165,7 @@ public function buildUserDashBoard() {
$this->assign('pcpInfo', $pcpInfo);
}

if (!empty($this->_userOptions['Assigned Activities']) && empty($this->_isChecksumUser)) {
if (!empty($dashboardOptions['Assigned Activities']) && empty($this->_isChecksumUser)) {
// Assigned Activities section
$dashboardElements[] = array(
'class' => 'crm-dashboard-assignedActivities',
Expand All @@ -186,9 +181,9 @@ public function buildUserDashBoard() {
$this->assign('dashboardElements', $dashboardElements);

// return true when 'Invoices / Credit Notes' checkbox is checked
$this->assign('invoices', $this->_userOptions['Invoices / Credit Notes']);
$this->assign('invoices', $dashboardOptions['Invoices / Credit Notes']);

if (!empty($this->_userOptions['Groups'])) {
if (!empty($dashboardOptions['Groups'])) {
$this->assign('showGroup', TRUE);
//build group selector
$gContact = new CRM_Contact_Page_View_UserDashBoard_GroupContact();
Expand Down

0 comments on commit 9aa4d23

Please sign in to comment.