From 33b4f17dc63524294e9d7f6532cf03c75ecb5c02 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 11 Jun 2021 11:29:47 -0400 Subject: [PATCH] LP1929741 Bundle of ACQ bug fixes * Distribution formula combobox now displays entries on click * Ditto Charge Type combobox * Items now vanish when deleted * Estimated amount, etc. update when items are added/deleted * Lineitem action links match order of previous interface. * PO dry run checks now fire after a brief record is added * PO activation is blocked if an item has no owning lib. Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton Signed-off-by: Jane Sandberg --- .../staff/acq/lineitem/batch-copies.component.html | 2 +- .../staff/acq/lineitem/batch-copies.component.ts | 4 ++ .../staff/acq/lineitem/brief-record.component.ts | 5 +- .../app/staff/acq/lineitem/copies.component.html | 1 + .../src/app/staff/acq/lineitem/copies.component.ts | 14 ++++-- .../staff/acq/lineitem/copy-attrs.component.html | 7 +-- .../acq/lineitem/lineitem-list.component.html | 55 +++++++++++++--------- .../staff/acq/lineitem/lineitem-list.component.ts | 6 ++- .../src/app/staff/acq/lineitem/lineitem.service.ts | 4 +- .../src/app/staff/acq/po/charges.component.html | 1 + .../src/eg2/src/app/staff/acq/po/po.service.ts | 9 ++-- .../eg2/src/app/staff/acq/po/print.component.ts | 18 +++---- .../src/app/staff/acq/po/summary.component.html | 8 +++- .../eg2/src/app/staff/acq/po/summary.component.ts | 3 +- .../perlmods/lib/OpenILS/Application/Acq/Order.pm | 8 ++++ 15 files changed, 93 insertions(+), 52 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/batch-copies.component.html b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/batch-copies.component.html index 2fdfd2df7c..8a5bb4d132 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/batch-copies.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/batch-copies.component.html @@ -45,7 +45,7 @@
+ *ngFor="let copy of copies(); let idx = index"> !c.isdeleted()); + } } diff --git a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.ts index f1384da7cc..623d305561 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/brief-record.component.ts @@ -4,6 +4,7 @@ import {IdlService, IdlObject} from '@eg/core/idl.service'; import {NetService} from '@eg/core/net.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {AuthService} from '@eg/core/auth.service'; +import {LineitemService} from './lineitem.service'; const MARC_NS = 'http://www.loc.gov/MARC21/slim'; @@ -34,7 +35,8 @@ export class BriefRecordComponent implements OnInit { private idl: IdlService, private auth: AuthService, private net: NetService, - private pcrud: PcrudService + private pcrud: PcrudService, + private liService: LineitemService ) { } ngOnInit() { @@ -103,6 +105,7 @@ export class BriefRecordComponent implements OnInit { this.net.request('open-ils.acq', 'open-ils.acq.lineitem.create', this.auth.token(), li ).toPromise().then(_ => { + this.liService.activateStateChange.emit(); this.router.navigate(['../'], { relativeTo: this.route, queryParamsHandling: 'merge' diff --git a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copies.component.html b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copies.component.html index 0f768d83f3..3335cb4219 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copies.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copies.component.html @@ -15,6 +15,7 @@ diff --git a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copies.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copies.component.ts index e9f060e83d..ac5788ecfb 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copies.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copies.component.ts @@ -8,7 +8,7 @@ import {OrgService} from '@eg/core/org.service'; import {NetService} from '@eg/core/net.service'; import {PcrudService} from '@eg/core/pcrud.service'; import {AuthService} from '@eg/core/auth.service'; -import {LineitemService} from './lineitem.service'; +import {LineitemService, FleshCacheParams} from './lineitem.service'; import {ComboboxEntry} from '@eg/share/combobox/combobox.component'; import {ItemLocationService} from '@eg/share/item-location-select/item-location-select.service'; @@ -74,11 +74,15 @@ export class LineitemCopiesComponent implements OnInit, AfterViewInit { this.liService.getLiAttrDefs(); } - load(): Promise { + load(params?: FleshCacheParams): Promise { this.lineitem = null; this.copyCount = 1; - return this.liService.getFleshedLineitems( - [this.lineitemId], {toCache: true, fromCache: true}) + + if (!params) { + params = {toCache: true, fromCache: true}; + } + + return this.liService.getFleshedLineitems([this.lineitemId], params) .pipe(tap(liStruct => this.lineitem = liStruct.lineitem)).toPromise() .then(_ => { this.liLocked = @@ -241,7 +245,7 @@ export class LineitemCopiesComponent implements OnInit, AfterViewInit { this.progressValue++; }, err => {}, - () => this.load().then(_ => { + () => this.load({toCache: true}).then(_ => { this.liService.activateStateChange.emit(this.lineitem.id()); this.saving = false; }) diff --git a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copy-attrs.component.html b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copy-attrs.component.html index 49d3a1ab8f..f2d8952a99 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copy-attrs.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/copy-attrs.component.html @@ -80,16 +80,11 @@
- - Mark Received diff --git a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.html b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.html index bab495d9b5..b206f7eacc 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.html @@ -211,19 +211,6 @@ flag - | - - create - Worksheet - - | - - list - Invoice(s) - | - - | - - center_focus_weak - {{li.purchase_order().id()}} - - + + + | + + create + Worksheet + | {{li.picklist().name()}} + + | + + center_focus_weak + {{li.purchase_order().id()}} + + + + + + | + + list + Invoice(s) + + + + | {{li.provider().name()}} + + +
diff --git a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.ts index e29938f049..ce90fe93c4 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.ts @@ -15,7 +15,7 @@ import {CancelDialogComponent} from './cancel-dialog.component'; const DELETABLE_STATES = [ 'new', 'selector-ready', 'order-ready', 'approved', 'pending-order' -] +]; @Component({ templateUrl: 'lineitem-list.component.html', @@ -263,6 +263,10 @@ export class LineitemListComponent implements OnInit { } else { this.pageOfLineitems.push(li); } + + // Remove any 'new' lineitem details which may have been added + // and left unsaved on the copies page + li.lineitem_details(li.lineitem_details().filter(d => !d.isnew())); } // First matching attr diff --git a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem.service.ts b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem.service.ts index 379f94d3c6..f669555181 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem.service.ts @@ -31,7 +31,7 @@ export interface BatchLineitemUpdateStruct { [key: string]: any; // Perl Acq::BatchManager } -interface FleshedLineitemParams { +export interface FleshCacheParams { // Flesh data beyond the default. fleshMore?: any; @@ -79,7 +79,7 @@ export class LineitemService { ) {} getFleshedLineitems(ids: number[], - params: FleshedLineitemParams = {}): Observable { + params: FleshCacheParams = {}): Observable { if (params.fromCache) { const fromCache = this.getLineitemsFromCache(ids); diff --git a/Open-ILS/src/eg2/src/app/staff/acq/po/charges.component.html b/Open-ILS/src/eg2/src/app/staff/acq/po/charges.component.html index 753f7309cf..a51e067b90 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/po/charges.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/po/charges.component.html @@ -17,6 +17,7 @@ *ngFor="let charge of po().po_items()">
diff --git a/Open-ILS/src/eg2/src/app/staff/acq/po/po.service.ts b/Open-ILS/src/eg2/src/app/staff/acq/po/po.service.ts index 46781894f7..25d1924c6b 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/po/po.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/po/po.service.ts @@ -6,6 +6,7 @@ import {EventService} from '@eg/core/event.service'; import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; import {PcrudService} from '@eg/core/pcrud.service'; +import {LineitemService, FleshCacheParams} from '@eg/staff/acq/lineitem/lineitem.service'; @Injectable() export class PoService { @@ -20,9 +21,9 @@ export class PoService { private auth: AuthService ) {} - getFleshedPo(id: number, fleshMore?: any, noCache?: boolean): Promise { + getFleshedPo(id: number, params: FleshCacheParams = {}): Promise { - if (!noCache) { + if (params.fromCache) { if (this.currentPo && id === this.currentPo.id()) { // Set poService.currentPo = null to bypass the cache return Promise.resolve(this.currentPo); @@ -35,7 +36,7 @@ export class PoService { flesh_po_items: true, flesh_price_summary: true, flesh_lineitem_count: true - }, fleshMore || {}); + }, params.fleshMore || {}); return this.net.request( 'open-ils.acq', @@ -46,7 +47,7 @@ export class PoService { const evt = this.evt.parse(po); if (evt) { return Promise.reject(evt + ''); } - if (!noCache) { this.currentPo = po; } + if (params.toCache) { this.currentPo = po; } this.poRetrieved.emit(po); return po; diff --git a/Open-ILS/src/eg2/src/app/staff/acq/po/print.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/po/print.component.ts index 2ed659a640..beadb5d99e 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/po/print.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/po/print.component.ts @@ -57,14 +57,16 @@ export class PrintComponent implements OnInit, AfterViewInit { this.po = null; this.poService.getFleshedPo(this.poId, { - flesh_provider_addresses: true, - flesh_lineitems: true, - flesh_lineitem_attrs: true, - flesh_lineitem_notes: true, - flesh_lineitem_details: true, - clear_marc: true, - flesh_notes: true - }, true) + fleshMore: { + flesh_provider_addresses: true, + flesh_lineitems: true, + flesh_lineitem_attrs: true, + flesh_lineitem_notes: true, + flesh_lineitem_details: true, + clear_marc: true, + flesh_notes: true + } + }) .then(po => this.po = po) .then(_ => this.populatePreview()) .then(_ => this.initDone = true); diff --git a/Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.html b/Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.html index 8c05c15fbc..95bd00e294 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.html @@ -60,10 +60,16 @@ + *ngIf="evt.textcode == 'ACQ_LINEITEM_NO_COPIES'; else noOwner"> One or more lineitems have no items attached. + + + One or more items have no owning lib. + + {{evt.textcode}} : {{evt.desc}} diff --git a/Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.ts index 21799f28d8..2cef47f5fe 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/po/summary.component.ts @@ -66,6 +66,7 @@ export class PoSummaryComponent implements OnInit { // Re-check for activation blocks if the LI service tells us // something significant happened. this.liService.activateStateChange + .pipe(tap(_ => this.poService.getFleshedPo(this.poId, {toCache: true}))) .subscribe(_ => this.setCanActivate()); } @@ -76,7 +77,7 @@ export class PoSummaryComponent implements OnInit { load(): Promise { if (!this.poId) { return Promise.resolve(); } - return this.poService.getFleshedPo(this.poId) + return this.poService.getFleshedPo(this.poId, {fromCache: true, toCache: true}) .then(po => { // EDI message count diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm index ad2d46da05..475c61f01a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm @@ -911,6 +911,14 @@ sub create_lineitem_debits { } ]); + if (!$lid->owning_lib) { + # It's OK to create copies with no owning lib, but activating + # an order with such copies creates problems. + $mgr->editor->event(OpenILS::Event->new('ACQ_COPY_NO_OWNING_LIB', payload => $li->id)); + $mgr->editor->rollback; + return 0; + } + create_lineitem_detail_debit($mgr, $li, $lid, $dry_run) or return 0; } -- 2.11.0