3 #script to provide virtualshelf management
4 # WARNING: This file uses 4-character tabs!
8 # Copyright 2000-2002 Katipo Communications
10 # This file is part of Koha.
12 # Koha is free software; you can redistribute it and/or modify it under the
13 # terms of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
17 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
18 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License along with
22 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
23 # Suite 330, Boston, MA 02111-1307 USA
28 use C4::VirtualShelves;
31 use C4::Auth qw/get_session/;
34 my @biblionumber = $query->param('biblionumber');
35 my $selectedshelf = $query->param('selectedshelf');
36 my $newshelf = $query->param('newshelf');
37 my $shelfnumber = $query->param('shelfnumber');
38 my $newvirtualshelf = $query->param('newvirtualshelf');
39 my $category = $query->param('category');
41 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
43 template_name => "opac-addbybiblionumber.tmpl",
50 $shelfnumber = AddShelf( $newvirtualshelf, $loggedinuser, $category ) if $newvirtualshelf;
52 # verify user is authorized to perform the action on the shelf...
55 $authorized = 0 unless ShelfPossibleAction( $loggedinuser, $selectedshelf );
58 # multiple bibs might come in as '/' delimited string (from where, i don't see), or as array.
62 if (scalar(@biblionumber) == 1) {
63 @biblionumber = (split /\//,$biblionumber[0]);
65 if ($shelfnumber && ($shelfnumber != -1)) {
66 for my $bib (@biblionumber){
67 &AddToShelfFromBiblio($bib,$shelfnumber);
70 print "<html><body onload=\"window.close();\"><div>Please close this window to continue.</div></body></html>";
75 # adding to specific shelf
76 my ( $singleshelf, $singleshelfname, $singlecategory ) = GetShelf( $query->param('selectedshelf') );
79 shelfnumber => $singleshelf,
80 shelfname => $singleshelfname,
81 "category$singlecategory" => 1
84 # offer choice of shelves
85 my ($shelflist) = GetShelves( $loggedinuser, 3 );
88 foreach my $element ( sort keys %$shelflist ) {
89 push( @shelvesloop, $element );
90 $shelvesloop{$element} = $shelflist->{$element}->{'shelfname'};
92 my $CGIvirtualshelves;
93 if ( @shelvesloop > 0 ) {
94 $CGIvirtualshelves = CGI::scrolling_list (
95 -name => 'shelfnumber',
97 -values => \@shelvesloop,
98 -labels => \%shelvesloop,
105 CGIvirtualshelves => $CGIvirtualshelves,
112 for my $bib (@biblionumber) {
113 my $data = GetBiblioData( $bib );
115 { biblionumber => $bib,
116 title => $data->{'title'},
117 author => $data->{'author'},
121 newshelf => $newshelf,
122 multiple => (scalar(@biblios) > 1),
123 total => scalar @biblios,
124 biblios => \@biblios,
125 authorized => $authorized,
128 output_html_with_http_headers $query, $cookie, $template->output;