LP1904036 Replace card correct deactivates current card
authorBill Erickson <berickxx@gmail.com>
Thu, 16 Sep 2021 15:24:39 +0000 (11:24 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 6 Oct 2022 17:05:39 +0000 (13:05 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts

index 15d29b3..5c02838 100644 (file)
@@ -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');