From 55258cb47a8fcd52bea496918bbfe7a2214a3bb6 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Tue, 4 Oct 2011 16:54:32 -0400 Subject: [PATCH] Add can have copies check to the Add MFHD Record link in rdetail. This prevents the button from the JSPAC from being able to add MFHD records to the affected bib record. Signed-off-by: Jason Stephenson Signed-off-by: Dan Scott --- Open-ILS/web/js/dojo/openils/opac/nls/opac.js | 3 ++- Open-ILS/web/opac/common/js/config.js | 1 + Open-ILS/web/opac/skin/default/js/rdetail.js | 16 +++++++++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/opac/nls/opac.js b/Open-ILS/web/js/dojo/openils/opac/nls/opac.js index 9db079d7a0..59ae500f0e 100644 --- a/Open-ILS/web/js/dojo/openils/opac/nls/opac.js +++ b/Open-ILS/web/js/dojo/openils/opac/nls/opac.js @@ -37,5 +37,6 @@ "HOLD_STATUS_PLURAL": "hold # ${0} of ${1} total holds and ${2} potential items", "HOLD_STATUS_SINGULAR": "hold # ${0} of ${1} total holds and ${2} potential item", "MORE": "More", - "MORE_COPIES_FULL_RECORD": "... more copies listed in full record" + "MORE_COPIES_FULL_RECORD": "... more copies listed in full record", + "SOURCE_CANNOT_HAVE_COPIES": "Records from ${0} cannot have copies." } diff --git a/Open-ILS/web/opac/common/js/config.js b/Open-ILS/web/opac/common/js/config.js index 1cdc09dd27..6c87b73467 100644 --- a/Open-ILS/web/opac/common/js/config.js +++ b/Open-ILS/web/opac/common/js/config.js @@ -365,6 +365,7 @@ var FETCH_ISSUANCE = 'open-ils.serial:open-ils.serial.issuance.pub_fleshed.b 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'; +var FETCH_BIB_SOURCE = 'open-ils.pcrud:open-ils.pcrud.retrieve.cbs'; /* XXX deprecated. Use ccvm's instead */ var FETCH_LIT_FORMS = 'open-ils.search:open-ils.search.biblio.lit_form_map.retrieve.all'; diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index 13c5eab95f..da5f86c9ba 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -191,9 +191,19 @@ function rdetailDraw() { dojo.place("
", "rdetail_details_table", "after"); var mfhd_add = new dijit.Menu({style:"float: right;"}); new dijit.MenuItem({onClick:function(){ - var req = new Request(CREATE_MFHD_RECORD, G.user.session, 1, here.id(), getRid()); - var res = req.send(); - alert(dojo.string.substitute(opac_strings.CREATED_MFHD_RECORD, [here.name()])); + var bibReq = new Request(FETCH_BRE, [getRid()]); + bibReq.send(true); + var bib = bibReq.result()[0]; + var sourceReq = new Request(FETCH_BIB_SOURCE, G.user.session, bib.source()); + sourceReq.send(true); + var source = sourceReq.result(); + if (source.can_have_copies() == 'f') { + alert(dojo.string.substitute(opac_strings.SOURCE_CANNOT_HAVE_COPIES, [source.source()])); + } else { + var req = new Request(CREATE_MFHD_RECORD, G.user.session, 1, here.id(), getRid()); + var res = req.send(); + alert(dojo.string.substitute(opac_strings.CREATED_MFHD_RECORD, [here.name()])); + } }, label:opac_strings.CREATE_MFHD}).placeAt(mfhd_add); mfhd_add.placeAt(mfhd_ad_menu); } -- 2.11.0