use C4::VirtualShelves qw/:DEFAULT GetRecentShelves/;
use C4::Circulation;
use C4::Auth;
+#splits incoming biblionumber(s) to array and adds each to shelf.
+sub AddBibliosToShelf {
+ my ($shelfnumber,@biblionumber)=@_;
+
+ # multiple bibs might come in as '/' delimited string (from where, i don't see), or as array.
+ if (scalar(@biblionumber) == 1) {
+ @biblionumber = (split /\//,$biblionumber[0]);
+ }
+ for my $bib (@biblionumber){
+ AddToShelfFromBiblio($bib, $shelfnumber);
+ }
+}
+
+
#use it only to debug !
use warnings;
my $biblionumber = $query->param('biblionumber');
# If set, then multiple item case.
-
+my @biblionumber = $query->param('biblionumber');
my $biblionumbers = $query->param('biblionumbers');
+
my $shelfnumber = $query->param('shelfnumber');
my $newvirtualshelf = $query->param('newvirtualshelf');
my $category = $query->param('category');
-my $confirmed = $query->param('confirmed');
-my $sortfield = $query->param('sortfield');
+my $sortfield = $query->param('sortfield');
+my $confirmed = $query->param('confirmed') || 0;
+
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
$shelfnumber = AddShelf( $newvirtualshelf, $loggedinuser, $category, $sortfield )
if $newvirtualshelf;
if ( $shelfnumber || ( $shelfnumber == -1 ) ) { # the shelf already exist.
+
if ($confirmed == 1) {
- AddBibliosToShelf($shelfnumber,@biblionumbers);
+ AddBibliosToShelf($shelfnumber,@biblionumber);
print
"Content-Type: text/html\n\n<html><body onload=\"window.opener.location.reload(true);window.close()\"></body></html>";
exit;