LP1929741 Sort funds by year desc, then code
authorBill Erickson <berickxx@gmail.com>
Tue, 22 Jun 2021 16:19:44 +0000 (12:19 -0400)
committerJane Sandberg <js7389@princeton.edu>
Sun, 2 Oct 2022 15:02:49 +0000 (08:02 -0700)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Open-ILS/src/eg2/src/app/share/combobox/combobox.component.ts
Open-ILS/src/eg2/src/app/staff/acq/lineitem/copy-attrs.component.html

index 243458c..b34cf1b 100644 (file)
@@ -115,6 +115,8 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie
     // when fetching objects by idlClass.
     @Input() idlQueryAnd: {[field: string]: any};
 
+    @Input() idlQuerySort: {[cls: string]: string};
+
     // Display the selected value as text instead of within
     // the typeahead
     @Input() readOnly = false;
@@ -281,7 +283,11 @@ export class ComboboxComponent implements ControlValueAccessor, OnInit, AfterVie
                 if (this.idlQueryAnd) {
                     Object.assign(args, this.idlQueryAnd);
                 }
-                extra_args['order_by'][this.idlClass] = field;
+                if (this.idlQuerySort) {
+                    extra_args['order_by'] = this.idlQuerySort;
+                } else {
+                    extra_args['order_by'][this.idlClass] = field;
+                }
                 extra_args['limit'] = 100;
                 if (this.idlIncludeLibraryInLabel) {
                     extra_args['flesh'] = 1;
index f2d8952..623584b 100644 (file)
@@ -37,6 +37,7 @@
       [readOnly]="fieldIsDisabled('fund')"
       #fundSelector [entries]="fundEntries"
       [selectedId]="copy.fund()" (onChange)="valueChange('fund', $event)"
+      [idlQuerySort]="{acqf: 'year DESC, code'}"
       [idlQueryAnd]="{active: 't'}">
     </eg-combobox>
   </div>