From: Bill Erickson Date: Tue, 12 Feb 2013 20:42:44 +0000 (-0500) Subject: acq li ident : set perm UI X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6d1619010dc22a62bb3abbb39099d036bed9a531;p=evergreen%2Fequinox.git acq li ident : set perm UI Signed-off-by: Bill Erickson --- 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 3fa3e6f530..8b240653da 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 @@ -748,7 +748,6 @@ function AcqLiTable() { cbox.startup(); - // set the value for the cbox if (values[name].length) { var orderIdent = self.getLiOrderIdent(li); @@ -760,16 +759,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 490de978cf..2b9cc4b7d2 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 @@ -412,11 +412,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(