Skip to content

Commit

Permalink
[REF] switch from (undeclared) class property to local variable.
Browse files Browse the repository at this point in the history
We either needed to declare the variable on the class & make it a local variable. Switching
to a local var reflects the fact it is never accessed from outside thie function & improves readability.

grepping for _userOptions returns nothing after this.

I also removed an extraneous config singleton call. I can't see a strong case that either of
these changes will affect the intermittent fails but ... maybe?
  • Loading branch information
eileenmcnaughton committed Feb 13, 2019
1 parent df09643 commit a50321d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions CRM/Contact/Page/View/UserDashBoard.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,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 +129,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 +147,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 +157,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 +169,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 +185,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 a50321d

Please sign in to comment.