Enable bookbags to have a target searchOrg that sets the appropriate search scope...
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 16 Sep 2010 20:31:26 +0000 (20:31 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 16 Sep 2010 20:31:26 +0000 (20:31 +0000)
For example, http://example.com/opac/extras/feed/bookbag/opac/2378?skin=sparkly&searchOrg=BR1
would resolve to a scope of BR1 in the dynamic OPAC.

There is a more sophisticated version of this in 2.0/trunk; this is just a
stop-gap measure until then.

git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6@17747 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm

index a8f13af..89d1ad7 100644 (file)
@@ -781,6 +781,7 @@ sub bookbag_feed {
 
        my $skin = $cgi->param('skin') || 'default';
        my $locale = $cgi->param('locale') || 'en-US';
+       my $org_sn = $cgi->param('searchOrg') || '-';
 
        $root =~ s{(?<!http:)//}{/}go;
        $base =~ s{(?<!http:)//}{/}go;
@@ -797,7 +798,14 @@ sub bookbag_feed {
 
        my $bucket_tag = "tag:$host,$year:record_bucket/$id";
        if ($type eq 'opac') {
-               print "Location: $root/../../$locale/skin/$skin/xml/rresult.xml?rt=list&" .
+               my $scope = '';
+               if ($org_sn) {
+                       my $ou = $actor->request("open-ils.actor.org_unit_list.search", "shortname", $org_sn)->gather(1);
+                       if ($ou) {
+                               $scope = '&l=' . $ou->[0]->id;
+                       }
+               }
+               print "Location: $root/../../$locale/skin/$skin/xml/rresult.xml?rt=list$scope&" .
                        join('&', map { "rl=" . $_->target_biblio_record_entry } @{ $bucket->items }) .
                        "\n\n";
                return 302;