From: Bill Erickson Date: Fri, 10 Feb 2012 15:42:24 +0000 (-0500) Subject: Acq+Vandelay form re-use new queue X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=349e7ed4608dd9cbf3b836867b743139e9e9dd1c;p=evergreen%2Fmasslnc.git Acq+Vandelay form re-use new queue In the Vandelay agent form, if a user creates a new destination queue for the uploaded records, allow the user to re-use the new queue without having to refresh the interface. This is primarily useful in the ACQ upload UI, where re-using the pre-filled form is possible. Signed-off-by: Bill Erickson Signed-off-by: Ben Shum --- diff --git a/Open-ILS/web/js/ui/default/acq/common/vlagent.js b/Open-ILS/web/js/ui/default/acq/common/vlagent.js index 7e307c6f42..dbfc70f38c 100644 --- a/Open-ILS/web/js/ui/default/acq/common/vlagent.js +++ b/Open-ILS/web/js/ui/default/acq/common/vlagent.js @@ -1,4 +1,5 @@ dojo.require('openils.widget.AutoFieldWidget'); +dojo.require('openils.PermaCrud'); function VLAgent(args) { args = args || {}; @@ -34,7 +35,8 @@ function VLAgent(args) { selfReference : true, orgLimitPerms : [self.limitPerm || 'CREATE_PURCHASE_ORDER'], parentNode : dojo.byId('acq_vl:' + widg.key), - searchFilter : (widg.cls == 'vbq') ? {queue_type : 'acq'} : null + searchFilter : (widg.cls == 'vbq') ? {queue_type : 'acq'} : null, + useWriteStore : (widg.cls == 'vbq') }).build(function(dijit) { widg.dijit = dijit; self.attachOnChange(widg); @@ -161,7 +163,20 @@ function VLAgent(args) { } if (resp.queue) { - res.queue_url = oilsBasePath + '/vandelay/vandelay?qtype=bib&qid=' + resp.queue.id(); + var newQid = resp.queue.id(); + res.queue_url = oilsBasePath + '/vandelay/vandelay?qtype=bib&qid=' + newQid; + + var qInput = this.getDijit('queue_name'); + + if (newQName = qInput.attr('value')) { + // user created a new queue. Fetch the new queue object, + // replace the ReadStore with a WriteStore and insert. + qInput.attr('value', ''); + var qSelector = this.getDijit('existing_queue'); + var newQ = new openils.PermaCrud().retrieve('vbq', newQid); + qSelector.store.newItem(newQ.toStoreItem()); + qSelector.attr('value', newQid); + } } if (oncomplete)