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',
<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>
// 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);
}