Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recent item deduping & call hooks #12704

Merged
merged 2 commits into from
Aug 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CRM/Utils/Recent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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) {

Expand All @@ -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(
Expand Down