From fec28a75a3d79519a648d7d3bcaf4bf2bb2b9420 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 5 May 2006 13:53:22 +0000 Subject: [PATCH] hold possibility is now checked after filling out the hold form to facilitate pickup_lib checking git-svn-id: svn://svn.open-ils.org/ILS/trunk@4106 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/skin/default/js/holds.js | 35 +++++++++++-------- .../opac/skin/default/xml/common/holds.xml | 8 ++++- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Open-ILS/web/opac/skin/default/js/holds.js b/Open-ILS/web/opac/skin/default/js/holds.js index 47f9f460f2..e5fe5229b9 100644 --- a/Open-ILS/web/opac/skin/default/js/holds.js +++ b/Open-ILS/web/opac/skin/default/js/holds.js @@ -1,5 +1,6 @@ var currentHoldRecord; +var currentHoldType; var currentHoldRecordObj; var holdsOrgSelectorBuilt = false; var holdRecipient; @@ -43,7 +44,9 @@ function holdsDrawWindow(recid, type, edithold, done_callback) { recid = currentHoldRecord; if(recid == null) return; } + currentHoldRecord = recid; + currentHoldType = type; holdEditHold = edithold; holdEditCallback = done_callback; @@ -63,18 +66,12 @@ function holdsDrawWindow(recid, type, edithold, done_callback) { return; } - - swapCanvas($('check_holds_box')); - + _holdsDrawWindow(recid, type); if(edithold) { hideMe($('holds_submit')); unHideMe($('holds_update')); - _holdsDrawWindow(recid, type); _holdsUpdateEditHold(edithold); - - } else { - setTimeout( function() { holdsCheckPossibility(recid, type); }, 10 ); - } + } } function _holdsUpdateEditHold(hold) { @@ -181,14 +178,11 @@ function _holdsDrawWindow(recid, type) { } -function holdsCheckPossibility(recid, type) { +function holdsCheckPossibility(recid, type, pickuplib) { var req = new Request(CHECK_HOLD_POSSIBLE, G.user.session, - { titleid : recid, patronid : G.user.id(), depth : 0 } ); + { titleid : recid, patronid : G.user.id(), depth : 0, pickup_lib : pickuplib } ); req.send(true); - var res = req.result(); - - if(res) _holdsDrawWindow(recid, type); - else drawCanvas(); + return req.result(); } @@ -258,6 +252,15 @@ function holdsBuildHoldFromWindow() { function holdsPlaceHold(hold) { + swapCanvas($('check_holds_box')); + alert(currentHoldRecord + ' : ' + hold.pickup_lib() ); + + if( ! holdsCheckPossibility(currentHoldRecord, currentHoldType, hold.pickup_lib() ) ) { + alert($('hold_not_allowed').innerHTML); + drawCanvas(); + return; + } + var req = new Request( CREATE_HOLD, holdRequestor.session, hold ); req.send(true); var res = req.result(); @@ -266,8 +269,12 @@ function holdsPlaceHold(hold) { else alert($('holds_failure').innerHTML); showCanvas(); + holdRecipient = null; holdRequestor = null; + currentHoldRecord = null; + currentHoldType = null; + runEvt('common', 'holdUpdated'); } 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 1cfd250df5..ce9689abeb 100644 --- a/Open-ILS/web/opac/skin/default/xml/common/holds.xml +++ b/Open-ILS/web/opac/skin/default/xml/common/holds.xml @@ -31,7 +31,7 @@ Place or Edit a Hold + align='center' colspan='2'>Create / Edit a Hold &opac.holds.recipient;: @@ -112,6 +112,12 @@ The phone number does not have the correct format. The expected format is XXX-YYY-ZZZZ + + + No items were found that could fulfill the requested holds. + It's possible that changing the pickup library or choosing a + different format will result in a successful hold. + -- 2.43.2