From: phasefx Date: Thu, 3 Aug 2006 21:14:39 +0000 (+0000) Subject: optionally showing noncats in items out X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=acd247d812cbc5c1de852ae34b472404e48d6c84;p=evergreen%2Fpines.git optionally showing noncats in items out git-svn-id: svn://svn.open-ils.org/ILS/trunk@5264 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index cbe078698a..1301dc51b7 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -46,6 +46,8 @@ const api = { 'FM_AHR_UPDATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.update' }, 'FM_AHR_RESET' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.hold.reset' }, 'FM_AIHU_CREATE' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.in_house_use.create' }, + 'FM_ANCC_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.non_cataloged_circulation.retrieve' }, + 'FM_ANCC_RETRIEVE_VIA_USER' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.open_non_cataloged_circulation.user' }, 'FM_AOA_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit.address.retrieve' }, 'FM_AOU_RETRIEVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_tree.retrieve' }, 'FM_AOU_RETRIEVE_RELATED_VIA_SESSION' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.org_unit.full_path.retrieve' }, diff --git a/Open-ILS/xul/staff_client/server/patron/items.js b/Open-ILS/xul/staff_client/server/patron/items.js index b62fcb4472..a3995a365c 100644 --- a/Open-ILS/xul/staff_client/server/patron/items.js +++ b/Open-ILS/xul/staff_client/server/patron/items.js @@ -40,6 +40,7 @@ patron.items.prototype = { 'cmd_show_catalog2' : [ ['command'], function() { obj.show_catalog(2); } ], 'cmd_add_billing' : [ ['command'], function() { obj.add_billing(1); } ], 'cmd_add_billing2' : [ ['command'], function() { obj.add_billing(2); } ], + 'cmd_show_noncats' : [ ['command'], function() { obj.show_noncats(); } ], } } ); @@ -60,6 +61,52 @@ patron.items.prototype = { obj.controller.view.cmd_show_catalog2.setAttribute('disabled','true'); }, + 'show_noncats' : function() { + var obj = this; var checkout = {}; + try { + var robj = obj.network.simple_request('FM_ANCC_RETRIEVE_VIA_USER',[ ses(), obj.patron_id ]); + if (typeof robj.ilsevent != 'undefined') throw(robj); + + for (var ii = 0; ii < robj.length; ii++) { + try { + var nc_circ = obj.network.simple_request('FM_ANCC_RETRIEVE_VIA_ID',[ ses(), robj[ii] ]); + if (typeof nc_circ.ilsevent != 'undefined') throw(nc_circ); + var fake_circ = new aoc(); + fake_circ.circ_lib( nc_circ.circ_lib() ); + fake_circ.circ_staff( nc_circ.staff() ); + fake_circ.usr( nc_circ.patron() ); + fake_circ.circ_staff( nc_circ.staff() ); + fake_circ.circ_lib( nc_circ.circ_lib() ); + fake_circ.xact_start( nc_circ.circ_time() ); + fake_circ.renewal_remaining(0); + fake_circ.stop_fines('Non-Cataloged'); + + JSAN.use('util.date'); + var c = nc_circ.circ_time(); + var d = c == "now" ? new Date() : util.date.db_date2Date( c ); + var t = obj.data.hash.cnct[ nc_circ.item_type() ]; + var cd = t.circ_duration() || "14 days"; + var i = util.date.interval_to_seconds( cd ) * 1000; + d.setTime( Date.parse(d) + i ); + fake_circ.due_date( util.date.formatted_date(d,'%F') ); + + var fake_record = new mvr(); + fake_record.title( obj.data.hash.cnct[ nc_circ.item_type() ].name()); + + var fake_copy = new acp(); + fake_copy.barcode( '' ); + + obj.list.append( { 'row' : { 'my' : { 'circ' : fake_circ, 'mvr' : fake_record, 'acp' : fake_copy } }, } ); + + } catch(F) { + obj.error.standard_unexpected_error_alert('Error showing NonCat #' + robj[ii],F); + } + } + + } catch(E) { + obj.error.standard_unexpected_error_alert('Error showing NonCat circulations',E); + } + }, 'items_print' : function(which) { var obj = this; @@ -388,8 +435,12 @@ patron.items.prototype = { function retrieve_row(params) { var row = params.row; - var funcs = []; + if (!row.my.circ_id) { + if (typeof params.on_retrieve == 'function') { params.on_retrieve(row); } + return row; + } + var funcs = []; funcs.push( function() { diff --git a/Open-ILS/xul/staff_client/server/patron/items.xul b/Open-ILS/xul/staff_client/server/patron/items.xul index f1f99e3787..1853d064d2 100644 --- a/Open-ILS/xul/staff_client/server/patron/items.xul +++ b/Open-ILS/xul/staff_client/server/patron/items.xul @@ -74,6 +74,8 @@ + + diff --git a/Open-ILS/xul/staff_client/server/patron/items_overlay.xul b/Open-ILS/xul/staff_client/server/patron/items_overlay.xul index c03fe05b9e..3674c3057b 100644 --- a/Open-ILS/xul/staff_client/server/patron/items_overlay.xul +++ b/Open-ILS/xul/staff_client/server/patron/items_overlay.xul @@ -98,6 +98,7 @@ +