From f9006b342b4549be3b9cc3c2e6857603d16aedb4 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 12 Feb 2013 15:42:44 -0500 Subject: [PATCH] acq li ident : set perm UI Signed-off-by: Bill Erickson --- Open-ILS/web/js/ui/default/acq/common/li_table.js | 24 +++++++++++++++++++++-- Open-ILS/web/js/ui/default/acq/picklist/view.js | 7 +++++-- Open-ILS/web/js/ui/default/acq/po/view_po.js | 6 ++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 1f448d5b00..02f095678f 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -765,7 +765,6 @@ function AcqLiTable() { cbox.startup(); - // set the value for the cbox if (values[name].length) { var orderIdent = self.getLiOrderIdent(li); @@ -777,16 +776,37 @@ function AcqLiTable() { } } + if (!self.orderIdentAllowed) + cbox.attr('disabled', true); + sel._cbox = cbox; cbox._lineitem = li; dojo.connect(cbox, 'onChange', updateOrderIdent); } - changeComboBox(typeSel); // force the initial draw typeSel.onchange = function() {changeComboBox(typeSel)}; }; + this.testOrderIdentPerms = function(org, callback) { + var self = this; + new openils.User().getPermOrgList( + 'ACQ_SET_LINEITEM_IDENTIFIER', + function(orgs) { + console.log('found orgs = ' + orgs); + for (var i = 0; i < orgs.length; i++) { + if (Number(orgs[i]) == Number(org)) { + self.orderIdentAllowed = true; + if (callback) callback(); + return; + } + } + if (callback) callback(); + }, + true, true + ); + }; + this.checkClaimEligibility = function(li, callback, row) { /* Assume always eligible, i.e. from this interface we don't care about * claim eligibility any more. this is where the user would force a diff --git a/Open-ILS/web/js/ui/default/acq/picklist/view.js b/Open-ILS/web/js/ui/default/acq/picklist/view.js index f44f743c58..6fa02df2e4 100644 --- a/Open-ILS/web/js/ui/default/acq/picklist/view.js +++ b/Open-ILS/web/js/ui/default/acq/picklist/view.js @@ -21,7 +21,10 @@ function load() { {flesh_lineitem_count:true, flesh_owner:true}], oncomplete: function(r) { plist = openils.Util.readResponse(r); - drawPl(plist); + liTable.testOrderIdentPerms( + plist.org_unit(), + function() { drawPl(plist) } + ); } } ); @@ -49,7 +52,7 @@ function load() { } function drawPl() { - + dojo.byId("oils-acq-picklist-name").innerHTML = plist.name(); dojo.byId("oils-acq-picklist-attr-owner").innerHTML = plist.owner().usrname(); dojo.byId("oils-acq-picklist-attr-count").innerHTML = plist.entry_count(); diff --git a/Open-ILS/web/js/ui/default/acq/po/view_po.js b/Open-ILS/web/js/ui/default/acq/po/view_po.js index e20794937f..3eee936b70 100644 --- a/Open-ILS/web/js/ui/default/acq/po/view_po.js +++ b/Open-ILS/web/js/ui/default/acq/po/view_po.js @@ -426,11 +426,17 @@ function init() { /* po item table */ poItemTable = new PoItemTable(PO, pcrud); + liTable.testOrderIdentPerms( PO.ordering_agency(), init2); + renderPo(); } } ); +} + +function init2() { + var totalEstimated = 0; var zeroLi = true; fieldmapper.standardRequest( -- 2.11.0