Initial stab at an interface for bulk changes to copies
authordbs <dbs@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Thu, 22 Jul 2010 09:11:51 +0000 (09:11 +0000)
committerdbs <dbs@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Thu, 22 Jul 2010 09:11:51 +0000 (09:11 +0000)
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 [new file with mode: 0644]
web/templates/default/cat/storage/move.tt2 [new file with mode: 0644]

diff --git a/web/js/ui/default/cat/storage/move.js b/web/js/ui/default/cat/storage/move.js
new file mode 100644 (file)
index 0000000..fb0c5ed
--- /dev/null
@@ -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 (file)
index 0000000..e183bb6
--- /dev/null
@@ -0,0 +1,52 @@
+[% 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 %]
+