add root ou to the search
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 16 Dec 2007 19:36:40 +0000 (19:36 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 16 Dec 2007 19:36:40 +0000 (19:36 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@8224 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm

index ec6afc3..8942a6d 100644 (file)
@@ -537,8 +537,15 @@ sub cat_search_z_style_wrapper {
        my $authtoken = shift;
        my $args = shift;
 
+       my $cstore = OpenSRF::AppSession->connect('open-ils.cstore');
+
+       my $ou = $cstore->request(
+               'open-ils.cstore.direct.actor.org_unit.search',
+               { parent_ou => undef }
+       )->gather(1);
+
        my $result = { service => 'native-evergreen-catalog', records => [] };
-       my $searchhash = { limit => $$args{limit}, offset => $$args{offset}};
+       my $searchhash = { limit => $$args{limit}, offset => $$args{offset}, org_unit => $ou->id };
 
        $$searchhash{searches}{title} = $$args{search}{title};
        $$searchhash{searches}{author} = $$args{search}{author};
@@ -555,7 +562,6 @@ sub cat_search_z_style_wrapper {
        if ($list->{count} > 0) {
                $result->{count} = $list->{count};
 
-               my $cstore = OpenSRF::AppSession->connect('open-ils.cstore');
                my $records = $cstore->request(
                        'open-ils.cstore.direct.biblio.record_entry.search.atomic',
                        { id => [ map { ( $_->[0] ) } @{$list->{ids}} ] }