--- /dev/null
+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);
--- /dev/null
+[% ctx.page_title = 'Move item to storage' %]
+[% WRAPPER default/base.tt2 %]
+<script src='[% ctx.media_prefix %]/js/ui/default/cat/storage/storage.js'> </script>
+
+<style>
+
+ /* XXX Move me into the CSS tree XXX */
+
+ #uedit-tbody tr td {
+ padding: 5px;
+ text-align: left;
+ }
+
+
+ #uedit-save-div {
+ position: fixed;
+ top:40px;
+ right:30px;
+ width:300px;
+ border:2px solid #d9e8f9;
+ -moz-border-radius: 10px;
+ font-weight: bold;
+ padding: 12px;
+ text-align:center;
+ vertical-align:middle;
+ }
+
+ .divider td {
+ min-height:10px;
+ background-color: #e0e0e0;
+ }
+
+ .divider span { padding: 0px 5px 0px 5px; }
+
+ .dijitTextBoxFocused, .dijitFocused { border:1px dashed #3e3e3e; color: #303030; font-weight:bold;}
+
+</style>
+
+<form method="get" action="/eg/cat/storage/storage">
+ <table>
+ <tr>
+ <td><label for="barcode">Barcode</label></td>
+ <td><input type="text" id="barcode" name="barcode" dojoType="dijit.form.TextBox"/></td>
+ </tr>
+</form>
+
+<div id='uedit-save-div'>
+ <button dojoType='dijit.form.Button' jsId='saveButton' onClick='moveCopySubmit'>Submit</button>
+</div>
+
+[% END %]
+