From 2666861cb9f766ff333afe8ff441b4fe218dc6e7 Mon Sep 17 00:00:00 2001 From: Kevin Levie Date: Wed, 22 Jul 2015 20:24:03 +0200 Subject: [PATCH] Fix CRM-16866 for 4.6 branch --- CRM/Core/Permission.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/CRM/Core/Permission.php b/CRM/Core/Permission.php index 238c8ae5be..9d983b921f 100644 --- a/CRM/Core/Permission.php +++ b/CRM/Core/Permission.php @@ -605,16 +605,19 @@ class CRM_Core_Permission { $perm = $comp->getPermissions(FALSE, $descriptions); if ($perm) { $info = $comp->getInfo(); - if ($descriptions) { - foreach ($perm as $p => $attr) { - $title = $info['translatedName'] . ': ' . array_shift($attr); - array_unshift($attr, $title); + foreach ($perm as $p => $attr) { + + if (!is_array($attr)) { + $attr = array($attr); + } + + $attr[0] = $info['translatedName'] . ': ' . $attr[0]; + + if ($descriptions) { $permissions[$p] = $attr; } - } - else { - foreach ($perm as $p) { - $permissions[$p] = $info['translatedName'] . ': ' . $p; + else { + $permissions[$p] = $attr[0]; } } } -- 2.25.1