LP#1394989: Do not include deleted users when retrieving for Collections
authorBill Ott <bott@grpl.org>
Tue, 28 Jul 2015 20:05:31 +0000 (16:05 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 10 Aug 2015 19:34:37 +0000 (15:34 -0400)
As a side effect of discovering that users with no cards were being retrieved
as part of the Collections API calls, those users ended up being mostly
made up of deleted users (merged with an actual lead record, etc.)

This patch contribued by Bill Ott changes the retrieval so that it skips
over those deleted users.

Signed-off-by: Bill Ott <bott@grpl.org>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm

index 6b314bd..6507db9 100644 (file)
@@ -186,6 +186,8 @@ select
           group by 1,2
         ) full_list
         left join money.payment p on (full_list.id = p.xact)
+        left join actor.usr au on (au.id = usr)
+        where au.deleted is false
   group by 1
   having SUM(total_billing) - SUM(COALESCE(p.amount,0)) > ?
 ;