From 9382624d3bd12a43285a1e72908b3f99925def36 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Thu, 16 Oct 2014 15:21:29 +0530 Subject: [PATCH] CRM-15447 --- CRM/Custom/Form/Group.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CRM/Custom/Form/Group.php b/CRM/Custom/Form/Group.php index 940268bad2..79f23df779 100644 --- a/CRM/Custom/Form/Group.php +++ b/CRM/Custom/Form/Group.php @@ -546,16 +546,22 @@ class CRM_Custom_Form_Group extends CRM_Core_Form { static function getFormattedList(&$list) { $relName = array(); - foreach ($list as $k => $v) { - $key = substr($k, 0, strpos($k, '_')); + foreach ($list as $listItemKey => $itemValue) { + // Extract the relationship ID. + $key = substr($listItemKey, 0, strpos($listItemKey, '_')); if (isset($list["{$key}_b_a"])) { + $relName["$key"] = $list["{$key}_a_b"]; + // Are the two labels different? if ($list["{$key}_a_b"] != $list["{$key}_b_a"]) { $relName["$key"] = $list["{$key}_a_b"] . ' / ' . $list["{$key}_b_a"]; } unset($list["{$key}_b_a"]); + unset($list["{$key}_a_b"]); } else { + // If no '_b_a' label exists save the '_a_b' one and unset it from the list $relName["{$key}"] = $list["{$key}_a_b"]; + unset($list["{$key}_a_b"]); } } return $relName; -- 2.25.1