From: Bill Erickson Date: Tue, 17 Nov 2020 21:27:44 +0000 (-0500) Subject: LP1901930 SIP mediator continued X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=00d63bab2eed1cb1a6a0b0f219af0f4debe454f3;p=working%2FEvergreen.git LP1901930 SIP mediator continued Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.html b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.html index 842d97e639..27aea9c9f3 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.html +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.html @@ -7,6 +7,13 @@ + + + @@ -17,7 +24,7 @@
-
+
- + +
@@ -47,9 +58,9 @@ (recordSaved)="accountSaved()" [recordId]="accountId">
-
+
    -
  • Apply changes to the account before modifying settings
  • +
  • Save account changes before modifying settings.
  • Setting values must be entered as valid JSON.
diff --git a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.ts b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.ts index f4375f7447..52f102d4ad 100644 --- a/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/admin/server/sip/account.component.ts @@ -28,10 +28,12 @@ export class SipAccountComponent implements OnInit { settingGroups: ComboboxEntry[]; usrId: number; settingsSource: GridDataSource = new GridDataSource(); + deleteGroupAccounts: IdlObject[] = []; @ViewChild('cloneDialog') cloneDialog: FmRecordEditorComponent; @ViewChild('settingDialog') settingDialog: FmRecordEditorComponent; @ViewChild('settingGrid') settingGrid: GridComponent; + @ViewChild('confirmDelete') confirmDelete: ConfirmDialogComponent; constructor( private route: ActivatedRoute, @@ -107,7 +109,11 @@ export class SipAccountComponent implements OnInit { } grpChanged(entry: ComboboxEntry) { - if (!entry) { return; } + + if (!entry) { + this.account.setting_group(null); + return; + } this.pcrud.retrieve('sipsetg', entry.id, {flesh: 1, flesh_fields: {sipsetg: ['settings']}}) @@ -147,6 +153,40 @@ export class SipAccountComponent implements OnInit { }); } + openDeleteDialog() { + const grp = this.account.setting_group(); + + // Find accounts that use this group + this.pcrud.search('sipacc', {setting_group: grp.id()}, {atomic: true}) + + // Confirm deletion + .pipe(switchMap(accounts => { + this.deleteGroupAccounts = accounts; + return this.confirmDelete.open(); + }) + + // Modify accounts that use this group so the delete can continue + .pipe(switchMap(approved => { + if (!approved) { return of(); } + + // Clone the accounts so we can avoid modifying the currently + // edited account, which can lead to fleshing-related JS errors + const clones = accounts.map(acc => { + const one = this.idl.clone(acc); + one.setting_group(1); // defaults + return one; + }); + + return this.pcrud.update(clones); + }) + .pipe(switchMap(result => { + if (!result) { return of(); } + return this.pcrud.remove(grp); + }) + .pipe(tap(result => { + if (result) + } + accountSaved() { this.loadAccount(); } diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql index 57f2c43be8..29ede40ce1 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.sip-config.sql @@ -54,64 +54,74 @@ CREATE TABLE sip.session ( INSERT INTO actor.passwd_type (code, name, login, crypt_algo, iter_count) VALUES ('sip2', 'SIP2 Client Password', FALSE, 'bf', 5); -INSERT INTO sip.setting_group (label, institution) - VALUES ('Example Setting Group', 'example'); +-- ID 1 is magic. +INSERT INTO sip.setting_group (id, label, institution) + VALUES (1, 'Default Settings', 'example'); + +-- carve space for other canned setting groups +SELECT SETVAL('sip.setting_group_id_seq'::TEXT, 1000); INSERT INTO sip.setting (setting_group, description, name, value) VALUES ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, + oils_i18n_gettext( + 'eg.staffcat.exclude_electronic', + 'Staff Catalog "Exclude Electronic Resources" Option', + 'cwst', 'label' + ) + 'Monetary amounts are reported in this currency', 'currency', '"USD"' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'AV Format. Options: eg_legacy, 3m, swyer_a, swyer_b', 'av_format', '"eg_legacy"' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Allow clients to request the SIP server status before login (message 99)', 'allow_sc_status_before_login', 'true' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Due date uses 18-char date format (YYYYMMDDZZZZHHMMSS). Otherwise "YYYY-MM-DD HH:MM:SS', 'due_date_use_sip_date_format', 'false' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Checkout and renewal are allowed even when penalties blocking these actions exist', 'patron_status_permit_loans', 'false' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Holds, checkouts, and renewals allowed regardless of blocking penalties', 'patron_status_permit_all', 'false' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Patron holds data may be returned as either "title" or "barcode"', 'default_activity_who', 'null' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Patron circulation data may be returned as either "title" or "barcode"', 'msg64_summary_datatype', '"title"' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Patron holds data may be returned as either "title" or "barcode"', 'msg64_hold_items_available', '"title"' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Checkout override copy alert message', 'checkout.override.COPY_ALERT_MESSAGE', 'true' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Checkin override copy alert message', 'checkin.override.COPY_ALERT_MESSAGE', 'true' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Checkin override bad copy status', 'checkin.override.COPY_BAD_STATUS', 'true' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Checkin override copy status missing', 'checkin.override.COPY_STATUS_MISSING', 'true' ), ( - (SELECT id FROM config.sip_setting_group WHERE institution = 'example'), + 1, 'Checkin local holds as transits', 'checkin_hold_as_transit', 'false' );