LP1904036 Sanity check missing mailing/billing addresses
authorBill Erickson <berickxx@gmail.com>
Mon, 10 May 2021 15:35:11 +0000 (11:35 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:34 +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-toolbar.component.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html
Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts

index f67751f..a72cf7d 100644 (file)
@@ -87,9 +87,12 @@ export class EditToolbarComponent implements OnInit {
 
     checkAddressAlerts(patron: IdlObject, addr: IdlObject) {
         const addrHash = this.idl.toHash(addr);
-        console.log('CHECKING ADDR', addrHash);
-        addrHash.mailing_address = addr.id() === patron.mailing_address().id();
-        addrHash.billing_address = addr.id() === patron.billing_address().id();
+        if (patron.mailing_address()) {
+            addrHash.mailing_address = addr.id() === patron.mailing_address().id();
+        }
+        if (patron.billing_address()) {
+            addrHash.billing_address = addr.id() === patron.billing_address().id();
+        }
         this.net.request(
             'open-ils.actor',
             'open-ils.actor.address_alert.test',
index 2e5f24d..d916f4e 100644 (file)
           <div class="form-check form-check-inline mr-2">
             <input class="form-check-input" type="checkbox" 
               name="addr-{{addr.id()}}-mailing" id="addr-{{addr.id()}}-mailing" 
-              [ngModel]="addr.id() == patron.mailing_address().id()"
+              [ngModel]="patron.mailing_address() && addr.id() == patron.mailing_address().id()"
               (ngModelChange)="setAddrType('mailing', addr, $event)"/>
             <label class="form-check-label" 
               for="addr-{{addr.id()}}-mailing" i18n>Mailing</label>
           <div class="form-check form-check-inline mr-2">
             <input class="form-check-input" type="checkbox" 
               name="addr-{{addr.id()}}-billing" id="addr-{{addr.id()}}-billing" 
-              [ngModel]="addr.id() == patron.billing_address().id()"
+              [ngModel]="patron.billing_address() && addr.id() == patron.billing_address().id()"
               (ngModelChange)="setAddrType('billing', addr, $event)"/>
             <label class="form-check-label" 
               for="addr-{{addr.id()}}-billing" i18n>Physical</label>
index 373a6d8..1ebfd9d 100644 (file)
@@ -1316,11 +1316,13 @@ export class EditComponent implements OnInit, AfterViewInit {
 
             // Roll the mailing/billing designation to another
             // address when needed.
-            if (this.patron.mailing_address().id() === addr.id()) {
+            if (this.patron.mailing_address() &&
+                this.patron.mailing_address().id() === addr.id()) {
                 this.setAddrType('mailing', addr, false);
             }
 
-            if (this.patron.billing_address().id() === addr.id()) {
+            if (this.patron.billing_address() &&
+                this.patron.billing_address().id() === addr.id()) {
                 this.setAddrType('billing', addr, false);
             }