[open-ils-commits] r19805 - in trunk/Open-ILS: src/perlmods/lib/OpenILS/Application/Search web/opac/skin/default/js (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Mar 18 11:53:07 EDT 2011
Author: miker
Date: 2011-03-18 11:53:04 -0400 (Fri, 18 Mar 2011)
New Revision: 19805
Modified:
trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
trunk/Open-ILS/web/opac/skin/default/js/holds.js
Log:
Intelligent Metarecord Format Selection for Holds
Previous to this commit, Evergreen would show all possible record formats
when promoting a T-type hold to an M-type. This change causes the middle
layer method to respect the Hard Boundary of the pickup library when
considering what constituent records within a metarecord will contribute
formats.
Signed-off-by: Mike Rylander <mrylander at gmail.com>
Modified: trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm 2011-03-18 14:45:09 UTC (rev 19804)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm 2011-03-18 15:53:04 UTC (rev 19805)
@@ -2364,7 +2364,10 @@
my $item_forms = $$args{item_forms};
my $item_types = $$args{item_types};
my $item_lang = $$args{item_lang};
+ my $pickup_lib = $$args{pickup_lib};
+ my $hard_boundary = $U->ou_ancestor_setting_value($pickup_lib, OILS_SETTING_HOLD_HARD_BOUNDARY) if (defined $pickup_lib);
+
my $e = new_editor();
my $recs;
@@ -2385,6 +2388,35 @@
my $desc = $e->search_metabib_record_descriptor($search);
+ if ($hard_boundary) { # 0 (or "top") is the same as no setting
+ my $orgs = $e->json_query(
+ { from => [ 'actor.org_unit_descendants' => $pickup_lib, $hard_boundary ] }
+ );
+
+ my $good_records = $e->json_query(
+ { distinct => 1,
+ select => { 'bre' => ['id'] },
+ from => { 'bre' => { 'acn' => { 'join' => { 'acp' } } } },
+ where => {
+ '+bre' => { id => \@recs },
+ '+acp' => {
+ circ_lib => [ map { $_->{id} } @$orgs ],
+ deleted => 'f'
+ }
+ }
+ }
+ );
+
+ my @keep;
+ for my $d (@$desc) {
+ if ( grep { $d->record == $_->{id} } @$good_records ) {
+ push @keep, $d;
+ }
+ }
+
+ $desc = \@keep;
+ }
+
return { metarecord => $mrec, descriptors => $desc };
}
Modified: trunk/Open-ILS/web/opac/skin/default/js/holds.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/holds.js 2011-03-18 14:45:09 UTC (rev 19804)
+++ trunk/Open-ILS/web/opac/skin/default/js/holds.js 2011-03-18 15:53:04 UTC (rev 19805)
@@ -300,26 +300,32 @@
function _h_set_rec_descriptors(args, doneCallback) {
+ if( ! args.pickup_lib )
+ args.pickup_lib = getSelectorVal($('holds_org_selector'));
+
+ if(args.pickup_lib === null)
+ args.pickup_lib = holdArgs.recipient.home_ou();
+
// grab the list of record desciptors attached to this records metarecord
if( ! args.recordDescriptors ) {
- var params = {};
+ var params = { pickup_lib: args.pickup_lib };
if (args.type == 'M') {
if( !args.metarecord && args.record) {
params.metarecord = args.metarecord = args.record;
delete(args.record);
} else {
- params = { metarecord : args.metarecordObject.doc_id() };
+ params.metarecord = args.metarecordObject.doc_id();
}
} else {
- params = { record: args.record };
+ params.record = args.record;
}
if( ! args.record ) {
if( args.metarecord )
- params = { metarecord : args.metarecord };
+ params.metarecord = args.metarecord;
else
- params = { metarecord : args.metarecordObject.doc_id() };
+ params.metarecord = args.metarecordObject.doc_id();
}
var req = new Request(FETCH_MR_DESCRIPTORS, params );
@@ -350,6 +356,7 @@
$('holds_cancel').onclick = function(){ runEvt('common', 'holdUpdateCanceled'), showCanvas() };
$('holds_submit').onclick = function(){holdsPlaceHold(holdsBuildHoldFromWindow())};
$('holds_update').onclick = function(){holdsPlaceHold(holdsBuildHoldFromWindow())};
+ $('holds_org_selector').onchange = function(){holdsDrawWindow()};
holdFetchObjects(null,
function(){
__holdsDrawWindow();
More information about the open-ils-commits
mailing list