LP1904036 Improve patron reg billing/mailing checkboxes
authorBill Erickson <berickxx@gmail.com>
Tue, 9 Nov 2021 15:56:36 +0000 (10:56 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:38 +0000 (20:13 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts

index 0affa88..92b7763 100644 (file)
@@ -1293,12 +1293,20 @@ export class EditComponent implements OnInit, AfterViewInit {
             // select another address to fill that role.  Select the
             // first address in the list (that does not match the
             // modifed address)
+            let found = false;
             this.patron.addresses().some(a => {
                 if (a.id() !== addr.id()) {
                     this.patron[addrType + '_address'](a);
-                    return true;
+                    return found = true;
                 }
             });
+
+            if (!found) {
+                // No alternate address was found.  Clear the value.
+                this.patron[addrType + '_address'](null);
+            }
+
+            this.patron.ischanged(true);
         }
     }