LP#2009281 Duplicate Entries in Retrieve Recent Patrons Grid user/dbriem/lp2009281_recent_patron_duplicates
authorDan Briem <dbriem@wlsmail.org>
Sun, 5 Mar 2023 01:57:31 +0000 (01:57 +0000)
committerDan Briem <dbriem@wlsmail.org>
Sun, 5 Mar 2023 01:57:31 +0000 (01:57 +0000)
ID is a string when pulled from the route and a number when
pulled from patron search, so the type mismatch causes the
duplicate check to fail. This converts the ID to a number
before appending it to the array of recent patrons.

To test:
1. Set "Number of Retrievable Recent Patrons" setting to 2
2. Load a patron from Patron Search
3. Go to Circulation->Retrieve Last Patron
4. Go to Circulation->Retrieve Recent Patrons
   - note that the patron is not duplicated

Signed-off-by: Dan Briem <dbriem@wlsmail.org>
Open-ILS/web/js/ui/default/staff/services/patron_search.js

index d2ebe6c..831ab52 100644 (file)
@@ -135,6 +135,7 @@ function($q , $timeout , $location , egCore,  egUser , egConfirmDialog , $locale
         if (service.maxRecentPatrons < 1) return;
 
         // no need to re-track same user
+        user_id = Number(user_id);
         if (service.current && service.current.id() == user_id) return;
 
         var patrons =