dojo.require('openils.XUL');
var pcrud;
+var pcrudRead;
var staff;
var copy;
var volume;
function load() {
staff = new openils.User().user;
pcrud = new openils.PermaCrud();
+ pcrudRead = new openils.PermaCrud();
cgi = new openils.CGI();
var barcode = cgi.param('barcode');
return;
}
- copy = fieldmapper.standardRequest(
- ['open-ils.search', 'open-ils.search.asset.copy.find_by_barcode'],
- {params: [barcode]}
- );
+ copy = pcrud.search('acp', {"barcode":barcode});
+ // There can be only one copy
+ copy = copy[0];
if (!copy.location) {
dojo.place('<div class="alert">Barcode [' + barcode + '] was not found!</div>', 'resultsDiv', 'only');
return;
}
+
copy.location(152);
copy.ischanged(1);
pcrud.update(copy);
- volume = pcrud.retrieve("acn", copy.call_number());
- record = pcrud.retrieve("bre", volume.record());
+ volume = pcrudRead.retrieve("acn", copy.call_number());
+ record = pcrudRead.retrieve("bre", volume.record());
+
dojo.place("<div class='barcode'>" + copy.barcode() + "</div>", 'resultsDiv', 'only');
dojo.place("<div class='call_number'>" + volume.label() + "</div>", 'resultsDiv', 'last');
dojo.place("<div style='display:none'>" + record.marc() + "</div>", dojo.body(), 'last');