From 2bf1427b2d7454a095cf3cdd181990494cafa586 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 20 Apr 2021 11:15:36 -0400 Subject: [PATCH] LP1929741 View/Place orders sorts newest to oldest Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton Signed-off-by: Jane Sandberg --- .../src/app/staff/acq/lineitem/lineitem-list.component.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 883d0b9d25..0bb5b60968 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 @@ -136,6 +136,7 @@ export class LineitemListComponent implements OnInit { let options: any = {flesh_lineitem_ids: true, li_limit: 10000}; let method = 'open-ils.acq.purchase_order.retrieve'; let handler = (po) => po.lineitems(); + let sort = true; if (this.picklistId) { @@ -150,6 +151,9 @@ export class LineitemListComponent implements OnInit { method = 'open-ils.acq.lineitems_for_bib.by_bib_id.atomic'; options = {idlist: true, limit: 1000}; handler = (ids) => ids; + // The API sorts the newest to oldest, which is what + // we want here. + sort = false; } return this.net.request( @@ -157,9 +161,13 @@ export class LineitemListComponent implements OnInit { ).toPromise().then(resp => { const ids = handler(resp); - this.lineitemIds = ids - .map(i => Number(i)) - .sort((id1, id2) => id1 < id2 ? -1 : 1); + if (sort) { + this.lineitemIds = ids + .map(i => Number(i)) + .sort((id1, id2) => id1 < id2 ? -1 : 1); + } else { + this.lineitemIds = ids.map(i => Number(i)); + } this.pager.resultCount = ids.length; }); -- 2.11.0