From 9b683dd3d328ccc581cf558c3599b302a21738bb Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 19 Oct 2020 11:03:43 -0400 Subject: [PATCH] LP1889128 Support user settings for SMS prefs Honor the user setting values 'opac.default_sms_carrier' and 'opac.default_sms_notify' in the Angular staff catalog place holds form. Signed-off-by: Bill Erickson Signed-off-by: Michele Morgan Signed-off-by: Jane Sandberg --- .../staff/catalog/hold/hold.component.html | 2 +- .../app/staff/catalog/hold/hold.component.ts | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html index 3c47fbb9a1..6a1147dc0a 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html @@ -174,7 +174,7 @@
- diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts index 2350890de1..59f6a54543 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts @@ -14,7 +14,7 @@ import {CatalogService} from '@eg/share/catalog/catalog.service'; import {StaffCatalogService} from '../catalog.service'; import {HoldsService, HoldRequest, HoldRequestTarget} from '@eg/staff/share/holds/holds.service'; -import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; +import {ComboboxEntry, ComboboxComponent} from '@eg/share/combobox/combobox.component'; import {PatronService} from '@eg/staff/share/patron/patron.service'; import {PatronSearchDialogComponent } from '@eg/staff/share/patron/search-dialog.component'; @@ -62,7 +62,6 @@ export class HoldComponent implements OnInit { phoneValue: string; notifySms: boolean; smsValue: string; - smsCarrier: string; suspend: boolean; activeDate: string; @@ -89,6 +88,8 @@ export class HoldComponent implements OnInit { @ViewChild('patronSearch', {static: false}) patronSearch: PatronSearchDialogComponent; + @ViewChild('smsCbox', {static: false}) smsCbox: ComboboxComponent; + constructor( private router: Router, private route: ActivatedRoute, @@ -358,10 +359,13 @@ export class HoldComponent implements OnInit { this.user = null; this.notifyEmail = true; this.notifyPhone = true; + this.notifySms = false; this.phoneValue = ''; this.pickupLib = this.requestor.ws_ou(); this.currentUserBarcode = null; this.multiHoldCount = 1; + this.smsValue = ''; + if (this.smsCbox) { this.smsCbox.selectedId = null; } // Avoid clearing the barcode in cases where the form is // reset as the result of a barcode change. @@ -419,6 +423,22 @@ export class HoldComponent implements OnInit { case 'opac.default_phone': this.phoneValue = value; break; + + case 'opac.default_sms_carrier': + setTimeout(() => { + // timeout creates an extra window where the cbox + // can be rendered in cases where the hold receipient + // is known at page load time. This out of an + // abundance of caution. + if (this.smsCbox) { + this.smsCbox.selectedId = Number(value); + } + }); + break; + + case 'opac.default_sms_notify': + this.smsValue = value; + break; } }); @@ -512,7 +532,7 @@ export class HoldComponent implements OnInit { notifyEmail: this.notifyEmail, // bool notifyPhone: this.notifyPhone ? this.phoneValue : null, notifySms: this.notifySms ? this.smsValue : null, - smsCarrier: this.notifySms ? this.smsCarrier : null, + smsCarrier: this.smsCbox ? this.smsCbox.selectedId : null, thawDate: this.suspend ? this.activeDate : null, frozen: this.suspend, holdableFormats: selectedFormats -- 2.43.2