From 422e22b0836d0faffee0a5c7402525839f9909ff Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 9 Sep 2010 21:09:26 +0000 Subject: [PATCH] added support for viewing and editing existing issuance-level holds to the default opac skin git-svn-id: svn://svn.open-ils.org/ILS/trunk@17554 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/common/js/config.js | 1 + Open-ILS/web/opac/locale/en-US/opac.dtd | 2 + Open-ILS/web/opac/skin/default/js/holds.js | 75 +++++++++++++--------- .../web/opac/skin/default/xml/common/holds.xml | 6 ++ 4 files changed, 54 insertions(+), 30 deletions(-) diff --git a/Open-ILS/web/opac/common/js/config.js b/Open-ILS/web/opac/common/js/config.js index 45fe0c436..098720c23 100644 --- a/Open-ILS/web/opac/common/js/config.js +++ b/Open-ILS/web/opac/common/js/config.js @@ -356,6 +356,7 @@ var UPDATE_HOLD = 'open-ils.circ:open-ils.circ.hold.update'; var FETCH_COPIES_FROM_VOLUME = 'open-ils.search:open-ils.search.asset.copy.retrieve_by_cn_label:1'; var FETCH_VOLUME_BY_INFO = 'open-ils.search:open-ils.search.call_number.retrieve_by_info'; /* XXX staff method? */ var FETCH_VOLUME = 'open-ils.search:open-ils.search.asset.call_number.retrieve'; +var FETCH_ISSUANCE = 'open-ils.serial:open-ils.serial.issuance.pub_fleshed.batch.retrieve'; var FETCH_COPY_LOCATIONS = 'open-ils.circ:open-ils.circ.copy_location.retrieve.all'; var FETCH_COPY_NOTES = 'open-ils.circ:open-ils.circ.copy_note.retrieve.all'; var FETCH_COPY_STAT_CATS = 'open-ils.circ:open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy'; diff --git a/Open-ILS/web/opac/locale/en-US/opac.dtd b/Open-ILS/web/opac/locale/en-US/opac.dtd index d1086ad5b..b215f73c9 100644 --- a/Open-ILS/web/opac/locale/en-US/opac.dtd +++ b/Open-ILS/web/opac/locale/en-US/opac.dtd @@ -592,6 +592,7 @@ We recommend that you remove this title from any bookbags it may have been added + @@ -599,6 +600,7 @@ We recommend that you remove this title from any bookbags it may have been added + diff --git a/Open-ILS/web/opac/skin/default/js/holds.js b/Open-ILS/web/opac/skin/default/js/holds.js index a5a06e98e..9a7d6fece 100644 --- a/Open-ILS/web/opac/skin/default/js/holds.js +++ b/Open-ILS/web/opac/skin/default/js/holds.js @@ -11,6 +11,16 @@ item_form is specified, use item_type(s)--language var noEmailMessage; var noEmailMessageXUL; +var holdTargetTypeMap = { + M : 'metarecord', + T : 'record', + V : 'volume', + I : 'issuance', + C : 'copy' +}; + + + function holdsHandleStaff() { // if we know the recipient's barcode, use it @@ -180,21 +190,7 @@ function holdArgsFromHold(hold, oargs) { var args = (oargs) ? oargs : {}; args.type = hold.hold_type(); var target = hold.target(); - - switch(args.type) { - case 'M': - args.metarecord = target; - break; - case 'T': - args.record = target; - break; - case 'V': - args.volume = target; - break; - case 'C': - args.copy = target; - break; - } + args[holdTargetTypeMap[args.type]] = target; return args; } @@ -229,6 +225,9 @@ function holdFetchObjects(hold, doneCallback) { if( type == 'V' ) { _h_set_vol(args, doneCallback); + } else if( type == 'I' ) { + _h_set_issuance(args, doneCallback); + } else { if( type == 'T' ) { _h_set_rec(args, doneCallback); @@ -263,6 +262,28 @@ function _h_set_vol(args, doneCallback) { } } +function _h_set_issuance(args, doneCallback) { + + if( args.issuanceObject ) { + args.issuance = args.issuanceObject.id(); + args.record = args.issuanceObject.subscription().record_entry(); + _h_set_rec(args, doneCallback); + + } else { + + var vreq = new Request(FETCH_ISSUANCE, [args.issuance]); + vreq.callback( + function(r) { + var issuance = r.getResultObject()[0]; + args.issuanceObject = issuance; + args.record = issuance.subscription().record_entry(); + _h_set_rec(args, doneCallback); + } + ); + vreq.send(); + } +} + function _h_set_rec(args, doneCallback) { if(args.recordObject) @@ -395,7 +416,13 @@ function __holdsDrawWindow() { appendClear($('holds_title'), text(rec.title())); appendClear($('holds_author'), text(rec.author())); - if( holdArgs.type == 'V' || holdArgs.type == 'C' ) { + if( holdArgs.type == 'I' ) { + unHideMe($('holds_type_row')); + unHideMe($('holds_is_issuance')); + unHideMe($('holds_issuance_row')); + appendClear($('holds_issuance_label'), text(holdArgs.issuanceObject.label())); + + } else if( holdArgs.type == 'V' || holdArgs.type == 'C' ) { unHideMe($('holds_type_row')); unHideMe($('holds_cn_row')); @@ -416,6 +443,7 @@ function __holdsDrawWindow() { hideMe($('holds_type_row')); hideMe($('holds_copy_row')); hideMe($('holds_cn_row')); + hideMe($('holds_issuance_row')); } removeChildren($('holds_format')); @@ -783,20 +811,7 @@ function holdsBuildHoldFromWindow() { else hold.email_notify(0); - var target; - - switch(holdArgs.type) { - case 'M': - target = holdArgs.metarecord; break; - case 'T': - target = holdArgs.record; break; - case 'V': - target = holdArgs.volume; break; - case 'C': - target = holdArgs.copy; break; - } - - + var target = holdArgs[holdTargetTypeMap[holdArgs.type]]; hold.pickup_lib(org); //hold.request_lib(org); diff --git a/Open-ILS/web/opac/skin/default/xml/common/holds.xml b/Open-ILS/web/opac/skin/default/xml/common/holds.xml index db42396a2..b71d8128f 100644 --- a/Open-ILS/web/opac/skin/default/xml/common/holds.xml +++ b/Open-ILS/web/opac/skin/default/xml/common/holds.xml @@ -62,10 +62,16 @@ + + &common.issuance_label.label; + + + &common.hold.type.label; &common.hold.volume; &common.hold.copy; + &common.hold.issuance; -- 2.11.0