From 37ce05fd3e7cd9a93630e5c5b5ba0353e66f39c2 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Wed, 15 Apr 2015 12:09:58 -0400 Subject: [PATCH] moveto for Living with Lakes / Faculty Authors live_lakes / faculty_authors Signed-off-by: Dan Scott --- .../src/templates/cat/moveto/faculty_authors.tt2 | 30 ++++++++ Open-ILS/src/templates/cat/moveto/live_lakes.tt2 | 30 ++++++++ .../js/ui/default/cat/moveto/faculty_authors.js | 88 ++++++++++++++++++++++ .../web/js/ui/default/cat/moveto/live_lakes.js | 88 ++++++++++++++++++++++ 4 files changed, 236 insertions(+) create mode 100644 Open-ILS/src/templates/cat/moveto/faculty_authors.tt2 create mode 100644 Open-ILS/src/templates/cat/moveto/live_lakes.tt2 create mode 100644 Open-ILS/web/js/ui/default/cat/moveto/faculty_authors.js create mode 100644 Open-ILS/web/js/ui/default/cat/moveto/live_lakes.js diff --git a/Open-ILS/src/templates/cat/moveto/faculty_authors.tt2 b/Open-ILS/src/templates/cat/moveto/faculty_authors.tt2 new file mode 100644 index 0000000000..bb104233fa --- /dev/null +++ b/Open-ILS/src/templates/cat/moveto/faculty_authors.tt2 @@ -0,0 +1,30 @@ +[% ctx.page_title = 'Move item to Faculty Authors collection' %] +[% WRAPPER base.tt2 %] + + + + +

[% ctx.page_title %]

+ +
+ + + + + +
+
+ +
+ +[% END %] + + diff --git a/Open-ILS/src/templates/cat/moveto/live_lakes.tt2 b/Open-ILS/src/templates/cat/moveto/live_lakes.tt2 new file mode 100644 index 0000000000..1463d6f146 --- /dev/null +++ b/Open-ILS/src/templates/cat/moveto/live_lakes.tt2 @@ -0,0 +1,30 @@ +[% ctx.page_title = 'Move item to Living with Lakes Centre' %] +[% WRAPPER base.tt2 %] + + + + +

Move item to Living with Lakes Centre

+ +
+ + + + + +
+
+ +
+ +[% END %] + + diff --git a/Open-ILS/web/js/ui/default/cat/moveto/faculty_authors.js b/Open-ILS/web/js/ui/default/cat/moveto/faculty_authors.js new file mode 100644 index 0000000000..e30442448d --- /dev/null +++ b/Open-ILS/web/js/ui/default/cat/moveto/faculty_authors.js @@ -0,0 +1,88 @@ +dojo.require('fieldmapper.IDL'); +dojo.require('openils.PermaCrud'); +dojo.require('dojo.date'); +dojo.require('openils.CGI'); +dojo.require('openils.XUL'); + +var pcrud; +var pcrudReader; +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(); + pcrudReader = 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 = fieldmapper.standardRequest( + ['open-ils.search', 'open-ils.search.asset.copy.find_by_barcode'], + {params: [barcode]} + ); +*/ + /* Get rid of non-numeric barcode characters - probably need to configure the cheapo scanner */ + barcode = barcode.replace(/[^0-9]/g, ''); + copy = pcrud.search('acp', {"barcode":barcode}); + // There can be only one copy + copy = copy[0]; + if (!copy.location) { + dojo.place('
Barcode [' + barcode + '] was not found!
', 'resultsDiv', 'only'); + return; + } + copy.location(158); + copy.ischanged(true); + pcrud.update(copy); + + record = pcrudReader.retrieve("bre", volume.record()); + dojo.place("
" + copy.barcode() + "
", 'resultsDiv', 'only'); + dojo.place("
" + volume.label() + "
", 'resultsDiv', 'last'); + dojo.place("
" + record.marc() + "
", dojo.body(), 'last'); + dojo.place("
", 'resultsDiv', 'last'); + dojo.query("datafield[tag='245'] subfield").forEach(function(node, index, arr) { + dojo.place("" + node.innerHTML + " ", 'titleDiv', 'last'); + }); +} + +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/Open-ILS/web/js/ui/default/cat/moveto/live_lakes.js b/Open-ILS/web/js/ui/default/cat/moveto/live_lakes.js new file mode 100644 index 0000000000..c641ac00a1 --- /dev/null +++ b/Open-ILS/web/js/ui/default/cat/moveto/live_lakes.js @@ -0,0 +1,88 @@ +dojo.require('fieldmapper.IDL'); +dojo.require('openils.PermaCrud'); +dojo.require('dojo.date'); +dojo.require('openils.CGI'); +dojo.require('openils.XUL'); + +var pcrud; +var pcrudReader; +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(); + pcrudReader = 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 = fieldmapper.standardRequest( + ['open-ils.search', 'open-ils.search.asset.copy.find_by_barcode'], + {params: [barcode]} + ); +*/ + /* Get rid of non-numeric barcode characters - probably need to configure the cheapo scanner */ + barcode = barcode.replace(/[^0-9]/g, ''); + copy = pcrud.search('acp', {"barcode":barcode}); + // There can be only one copy + copy = copy[0]; + if (!copy.location) { + dojo.place('
Barcode [' + barcode + '] was not found!
', 'resultsDiv', 'only'); + return; + } + copy.location(1230); + copy.ischanged(true); + pcrud.update(copy); + + record = pcrudReader.retrieve("bre", volume.record()); + dojo.place("
" + copy.barcode() + "
", 'resultsDiv', 'only'); + dojo.place("
" + volume.label() + "
", 'resultsDiv', 'last'); + dojo.place("
" + record.marc() + "
", dojo.body(), 'last'); + dojo.place("
", 'resultsDiv', 'last'); + dojo.query("datafield[tag='245'] subfield").forEach(function(node, index, arr) { + dojo.place("" + node.innerHTML + " ", 'titleDiv', 'last'); + }); +} + +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); -- 2.11.0