From ed8cb3204bbb4f2d8bf671c9da3fa0d5f1c98f0c Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 23 May 2013 09:11:25 -0400 Subject: [PATCH] LP1183340 selectivly apply editable funds sorting Avoid sorting editable funds to the front of the fund list when there are no org units at which the user has the ADMIN_ACQ_FUND permission. Otherwise, we are sorting on an empty 'IN' list in pcrud, which results in an error. Signed-off-by: Bill Erickson Signed-off-by: Dan Wells --- .../web/js/ui/default/acq/financial/list_funds.js | 27 +++++++++++----------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js index abad41d987..334de95c3a 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js +++ b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js @@ -116,22 +116,23 @@ function loadFundGrid(year) { year = year || fundFilterYearSelect.attr('value'); cachedFunds = []; + var order_by = [{'class' : 'acqf', field : 'name'}]; + + if (adminPermOrgs.length) { + // sort funds I can edit to the front + order_by.unshift({ + 'class' : 'acqf', + field : 'org', + compare : {'in' : adminPermOrgs}, + direction : 'desc' + }); + } + lfGrid.loadAll( - { + { flesh : 1, flesh_fields : {acqf : fundFleshFields}, - - // by default, sort funds I can edit to the front - order_by : [ - { 'class' : 'acqf', - field : 'org', - compare : {'in' : adminPermOrgs}, - direction : 'desc' - }, - { 'class' : 'acqf', - field : 'name' - } - ] + order_by : order_by, }, { year : year, org : fieldmapper.aou.descendantNodeList(contextOrg, true) -- 2.11.0