From 972986615f646f2d6e8ebb40446afe2a230c2d52 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 3 Nov 2021 20:26:27 -0700 Subject: [PATCH] transitionParticipants() - Improve $contactDetails cache maintenance This revises a very recent commit that touches `static $contactDetails` cache. Imagine you have two calls to `transitionParticipants()` which involve different-but-overlapping sets: * First invocation involves Alice and Bob * Second invocation involves Bob and Carol The first invocation loads Alice and Bob into `$contactDetails`. The second invocation identifies Carol as missing. We need to load Carol. Here's the change: * Before: Carol overwrites Bob in `$contactDetails`. Bob goes missing. * After: Alice, Bob, and Carol all exist in `$contactDetails`. --- CRM/Event/BAO/Participant.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Event/BAO/Participant.php b/CRM/Event/BAO/Participant.php index 618927d8c568..1964f754632d 100644 --- a/CRM/Event/BAO/Participant.php +++ b/CRM/Event/BAO/Participant.php @@ -1236,7 +1236,7 @@ public static function transitionParticipants( //get all required contacts detail. if (!empty($contactIds)) { - $contactDetails = civicrm_api3('Contact', 'get', ['id' => ['IN' => $contactIds, 'return' => 'display_name']])['values']; + $contactDetails += civicrm_api3('Contact', 'get', ['id' => ['IN' => $contactIds, 'return' => 'display_name']])['values']; } //get all required events detail.