From: Bill Erickson <berickxx@gmail.com>
Date: Thu, 16 Sep 2021 15:24:39 +0000 (-0400)
Subject: LP1904036 Replace card correct deactivates current card
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c50802344eb266bfede284892de289c553cc8344;p=evergreen%2Ftadl.git

LP1904036 Replace card correct deactivates current card

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
---

diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts
index 15d29b36ad..5c02838dc6 100644
--- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts
+++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts
@@ -1582,9 +1582,16 @@ export class EditComponent implements OnInit, AfterViewInit {
 
     replaceBarcode() {
         // Disable current card
+
         if (this.patron.card()) {
-            this.patron.card().active('f');
-            this.patron.card().ischanged(true);
+            // patron.card() is not the same in-memory object as its
+            // analog in patron.cards().  Since we're about to replace
+            // patron.card() anyway, just update the patron.cards() version.
+            const card = this.patron.cards()
+                .filter(c => c.id() === this.patron.card().id())[0];
+
+            card.active('f');
+            card.ischanged(true);
         }
 
         const card = this.idl.create('ac');