From: Jane Sandberg Date: Wed, 22 Feb 2023 04:48:31 +0000 (-0800) Subject: LP1999401: Don't override magic statuses from holdings editor templates X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d6aae71ea39b66d39d9af601d1117fdf41bb9250;p=evergreen%2Fmasslnc.git LP1999401: Don't override magic statuses from holdings editor templates 1. Create a new template including a status 2. Check out an item 3. Apply your template to the item 4. Note that the item's status is no longer Checked Out 5. Apply this patch 6. Retry steps 1-3. Note that the item's status is still Checked Out Signed-off-by: Jane Sandberg Signed-off-by: Elizabeth Davis Signed-off-by: Michele Morgan --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.spec.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.spec.ts index 1236b2a69a..561792b4e8 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.spec.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.spec.ts @@ -1,14 +1,15 @@ +import { IdlService, IdlObject } from './../../../core/idl.service'; import { QueryList } from "@angular/core"; import { waitForAsync } from "@angular/core/testing"; import { AuthService } from "@eg/core/auth.service"; import { FormatService } from "@eg/core/format.service"; -import { IdlService } from "@eg/core/idl.service"; import { OrgService } from "@eg/core/org.service"; import { StoreService } from "@eg/core/store.service"; import { ComboboxComponent } from "@eg/share/combobox/combobox.component"; import { ToastService } from "@eg/share/toast/toast.service"; import { FileExportService } from "@eg/share/util/file-export.service"; import { CopyAttrsComponent } from "./copy-attrs.component"; +import { VolCopyContext } from "./volcopy"; import { VolCopyService } from "./volcopy.service"; describe('CopyAttrsComponent', () => { @@ -44,5 +45,18 @@ describe('CopyAttrsComponent', () => { expect(component.applyCopyValue).not.toHaveBeenCalled(); })); }); - }) + }); + describe('#applyCopyValue', () => { + it('does not override a magic status', () => { + volCopyServiceMock.copyStatIsMagic.and.returnValue(true); + const item = jasmine.createSpyObj(['ischanged'], {'status': () => {1}}); + const contextMock = jasmine.createSpyObj(['copyList']); + contextMock.copyList.and.returnValue([item]); + component.context = contextMock; + spyOn(component, 'emitSaveChange'); + + component.applyCopyValue('status', 0); + expect(item.ischanged).not.toHaveBeenCalled(); + }); + }); }); diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts index a1eafa9368..0fce55a34a 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts @@ -274,6 +274,8 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { this.context.copyList().forEach(copy => { if (!copy[field] || copy[field]() === value) { return; } + // Don't overwrite magic statuses + if (field === 'status' && this.volcopy.copyStatIsMagic(copy[field]()) ) { return; } // Change selection indicates which items should be modified // based on the display value for the selected field at