TPac: avoid showing replaced addresses
authorBill Erickson <berick@esilibrary.com>
Tue, 21 Feb 2012 16:47:34 +0000 (11:47 -0500)
committerMike Rylander <mrylander@gmail.com>
Tue, 20 Mar 2012 16:40:59 +0000 (12:40 -0400)
Replaced (negative-id) addresses should never be visible to the patron.
Remove them from the collected list of addrs.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm

index 489594c..fddb0ed 100644 (file)
@@ -34,6 +34,10 @@ sub prepare_extended_user_info {
 
     $e->rollback if $local_xact;
 
+    # discard replaced (negative-id) addresses.
+    $self->ctx->{user}->addresses([
+        grep {$_->id > 0} @{$self->ctx->{user}->addresses} ]);
+
     return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR 
         unless $self->ctx->{user};