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
;
29 # use C4::Circulation; # not really used
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 # multiple bibs might come in as '/' delimited string (from where, i don't see), or as array.
56 if (scalar(@biblionumber) == 1) {
57 @biblionumber = (split /\//,$biblionumber[0]);
59 if ($shelfnumber && ($shelfnumber != -1)) {
60 for my $bib (@biblionumber){
61 &AddToShelfFromBiblio
($bib,$shelfnumber);
64 print "<html><body onload=\"window.close();\"><div>Please close this window to continue.</div></body></html>";
69 # adding to specific shelf
70 my ( $singleshelf, $singleshelfname, $singlecategory ) = GetShelf
( $query->param('selectedshelf') );
73 shelfnumber
=> $singleshelf,
74 shelfname
=> $singleshelfname,
75 "category$singlecategory" => 1
78 # offer choice of shelves
79 my ($shelflist) = GetShelves
( $loggedinuser, 3 );
82 foreach my $element ( sort keys %$shelflist ) {
83 push( @shelvesloop, $element );
84 $shelvesloop{$element} = $shelflist->{$element}->{'shelfname'};
86 my $CGIvirtualshelves;
87 if ( @shelvesloop > 0 ) {
88 $CGIvirtualshelves = CGI
::scrolling_list
(
89 -name
=> 'shelfnumber',
91 -values => \
@shelvesloop,
92 -labels
=> \
%shelvesloop,
99 CGIvirtualshelves
=> $CGIvirtualshelves,
106 for my $bib (@biblionumber) {
107 my $data = GetBiblioData
( $bib );
109 { biblionumber
=> $bib,
110 title
=> $data->{'title'},
111 author
=> $data->{'author'},
115 newshelf
=> $newshelf,
116 multiple
=> (scalar(@biblios) > 1),
117 total
=> scalar @biblios,
118 biblios
=> \
@biblios,
121 output_html_with_http_headers
$query, $cookie, $template->output;