'FM_ACP_RETRIEVE_VIA_BARCODE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed2.find_by_barcode.authoritative', 'secure' : false },
'FM_ACP_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed.batch.retrieve', 'secure' : false },
'FM_ACP_UNFLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.batch.retrieve', 'secure' : false },
+ 'FM_ACP_UNFLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.batch.retrieve.authoritative', 'secure' : false },
'FM_ACP_FLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.asset.copy.fleshed.batch.retrieve.authoritative', 'secure' : false },
'FM_ACP_FLESHED_BATCH_UPDATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.copy.fleshed.batch.update' },
'FM_ACP_TRANSFER_COPIES_BATCH' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.transfer_copies_to_volume' },
//Either update the volume or find/create a new one, depending on
//volumes in if we're working with every copy in a volume or just a few
- if(copiesInVolume > currentOrderBarcodes.length) {
+ if (currentOrderBarcodes.length < copiesInVolume) {
var new_volume = g.find_or_create_volume(callnumber, g.map_acn[acn_id].record(), ou_id);
g.set_acn_id_for_current_po(barcodes, acn_id, new_volume.id());
new_volume.label(callnumber);
copies[i].isdeleted(get_db_true());
}
}
+ g.update_copies(copies);
// Get the default copy status; default to "In Process" if unset, per 1.6
var normal_ccs = g.data.hash.aous['cat.default_copy_status_normal'] || 5;
}
}
+g.update_copies = function(copies) {
+ // Update copies
+ var r = g.network.simple_request(
+ 'FM_ACP_FLESHED_BATCH_UPDATE',
+ [ ses(),copies, true ]
+ );
+
+ if (r.textcode === 'ITEM_BARCODE_EXISTS') {
+
+ alert('error with item update: ' + r.desc+": 1184");
+ dont_close = true;
+ }
+
+ else if (typeof r.ilsevent != 'undefined') {
+
+ alert('error with copy update:' + js2JSON(r)+": 1188");
+ }
+
+}
g.stash_and_close = function(param, keepOpen) {
oils_unlock_page();
}
var copies_to_check = g.network.simple_request(
- 'FM_ACP_UNFLESHED_BATCH_RETRIEVE',
+ 'FM_ACP_UNFLESHED_BATCH_RETRIEVE.authoritative',
[ copy_ids ]
);
if (typeof copies_to_check.ilsevent != 'undefined') {
var altered_copies = [];
var remaining_copies = [];
- for(var c = 0; c < copies.length; c++) {
- for (var i = 0; i < copies_to_check; i++) {
+ for (var c = 0; c < copies.length; c++) {
+ for (var i = 0; i < copies_to_check.length; i++) {
+ //Ensure we have the right call number
if (copies_to_check[i].id() == copies[c].id()) {
copies[c].call_number(copies_to_check[i].call_number());
break;
// User clicked 'Save'
else {
- // Update copies
- var r = g.network.simple_request(
- 'FM_ACP_FLESHED_BATCH_UPDATE',
- [ ses(),altered_copies, true ]
- );
-
- if (r.textcode === 'ITEM_BARCODE_EXISTS') {
-
- alert('error with item update: ' + r.desc+": 1184");
- dont_close = true;
- }
-
- else if (typeof r.ilsevent != 'undefined') {
-
- alert('error with copy update:' + js2JSON(r)+": 1188");
- }
+ g.update_copies(altered_copies);
}
try {