From: Bill Erickson Date: Tue, 20 Apr 2021 15:15:36 +0000 (-0400) Subject: LP1929741 View/Place orders sorts newest to oldest X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2bf1427b2d7454a095cf3cdd181990494cafa586;p=evergreen%2Fpines.git LP1929741 View/Place orders sorts newest to oldest Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton Signed-off-by: Jane Sandberg --- 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; });