From 7137241adf88aadcf12eab34b6405f293fc684be Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 21 Aug 2018 08:43:00 -0400 Subject: [PATCH 1/2] Fix recent item deduping --- CRM/Utils/Recent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Utils/Recent.php b/CRM/Utils/Recent.php index f3baf0927192..cdacc30bf5b3 100644 --- a/CRM/Utils/Recent.php +++ b/CRM/Utils/Recent.php @@ -116,7 +116,7 @@ public static function add( // make sure item is not already present in list for ($i = 0; $i < count(self::$_recent); $i++) { - if (self::$_recent[$i]['type'] === $type && self::$_recent[$i]['id'] === $id) { + if (self::$_recent[$i]['type'] === $type && self::$_recent[$i]['id'] == $id) { // delete item from array array_splice(self::$_recent, $i, 1); break; From ab217754a0714992ba08596281842041ddb5a7f7 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 21 Aug 2018 09:39:03 -0400 Subject: [PATCH 2/2] Call hooks when deleting recent items --- CRM/Utils/Recent.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/Recent.php b/CRM/Utils/Recent.php index cdacc30bf5b3..0fadf5de6fe8 100644 --- a/CRM/Utils/Recent.php +++ b/CRM/Utils/Recent.php @@ -174,6 +174,7 @@ public static function del($recentItem) { } } + CRM_Utils_Hook::recent(self::$_recent); $session = CRM_Core_Session::singleton(); $session->set(self::STORE_NAME, self::$_recent); } @@ -200,15 +201,17 @@ public static function delContact($id) { self::$_recent[] = $tempRecent[$i]; } + CRM_Utils_Hook::recent(self::$_recent); $session = CRM_Core_Session::singleton(); $session->set(self::STORE_NAME, self::$_recent); } /** * Check if a provider is allowed to add stuff. - * If correspondig setting is empty, all are allowed + * If corresponding setting is empty, all are allowed * * @param string $providerName + * @return bool */ public static function isProviderEnabled($providerName) { @@ -230,6 +233,8 @@ public static function isProviderEnabled($providerName) { /** * Gets the list of available providers to civi's recent items stack + * + * @return array */ public static function getProviders() { $providers = array(