From 90334a5cafbba9bbeb3474df727340ac2287774b Mon Sep 17 00:00:00 2001 From: dbs Date: Thu, 22 Jul 2010 09:11:51 +0000 Subject: [PATCH] Initial stab at an interface for bulk changes to copies In this case, we're moving copies from their current location into storage. Plan is for staff to go through the stacks, scan the identified "to be moved" item, and have it display a confirmation message that the location was successfully updated or alert them that the barcode was not found. This interface is still horribly raw, but it works. Huzzah for proofs of concept. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/branches/rel_1_6_0@931 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- web/js/ui/default/cat/storage/move.js | 84 ++++++++++++++++++++++++++++++ web/templates/default/cat/storage/move.tt2 | 52 ++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 web/js/ui/default/cat/storage/move.js create mode 100644 web/templates/default/cat/storage/move.tt2 diff --git a/web/js/ui/default/cat/storage/move.js b/web/js/ui/default/cat/storage/move.js new file mode 100644 index 0000000000..fb0c5edb5b --- /dev/null +++ b/web/js/ui/default/cat/storage/move.js @@ -0,0 +1,84 @@ +dojo.require('dojo.data.ItemFileReadStore'); +dojo.require('dijit.form.Textarea'); +dojo.require('dijit.form.FilteringSelect'); +dojo.require('dijit.form.ComboBox'); +dojo.require('fieldmapper.IDL'); +dojo.require('openils.PermaCrud'); +dojo.require('openils.widget.AutoGrid'); +dojo.require('openils.widget.AutoFieldWidget'); +dojo.require('dijit.form.CheckBox'); +dojo.require('dijit.form.Button'); +dojo.require('dojo.date'); +dojo.require('openils.CGI'); +dojo.require('openils.XUL'); + +var pcrud; +var staff; +var copy; +var volume; +var record; +var rmsr; +var tbody; +var cgi; + +if(!window.xulG) var xulG = null; + +function load() { + staff = new openils.User().user; + pcrud = new openils.PermaCrud(); + cgi = new openils.CGI(); + var barcode = cgi.param('barcode'); + + if(xulG) { + if(xulG.ses) openils.User.authtoken = xulG.ses; + if(xulG.usr !== null) userId = xulG.usr + if(xulG.params) { + var parms = xulG.params; + if(parms.ses) + openils.User.authtoken = parms.ses; + if(parms.usr !== null) + userId = parms.usr + } + } + + dojo.byId("barcode").focus(); + moveCopy(barcode); +} + +function moveCopy(barcode) { + if (!barcode) { + // Just display the barcode entry form + return; + } + + copy = pcrud.search("acp", {"barcode": barcode}); + if (!copy) { + alert('Barcode [' + barcode + '] was not found!'); + return; + } + copy = fieldmapper.standardRequest( + ['open-ils.search', 'open-ils.search.asset.copy.find_by_barcode'], + {params: [barcode]} + ); + copy.location(1); + copy.ischanged(1); + pcrud.update(copy); + + volume = pcrud.retrieve("acn", copy.call_number()); + record = pcrud.retrieve("bre", volume.record()); + alert(copy.barcode() + " " + volume.label() + " " + record.marc()); +} + +function moveCopyRefresh() { + var usr = cgi.param('barcode'); + var href = location.href.replace(/\?.*/, ''); + href += ((usr) ? '?barcode=' + barcode : ''); + location.href = href; +} + +function moveCopyRefreshXUL(newuser) { + if (window.xulG && typeof window.xulG.on_save == 'function') + window.xulG.on_save(newuser); +} + +openils.Util.addOnLoad(load); diff --git a/web/templates/default/cat/storage/move.tt2 b/web/templates/default/cat/storage/move.tt2 new file mode 100644 index 0000000000..e183bb62e9 --- /dev/null +++ b/web/templates/default/cat/storage/move.tt2 @@ -0,0 +1,52 @@ +[% ctx.page_title = 'Move item to storage' %] +[% WRAPPER default/base.tt2 %] + + + + +
+ + + + + + + +
+ +
+ +[% END %] + -- 2.11.0