From b18661529f4866fbdf2459d52282cbca3422b245 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Wed, 30 Sep 2009 10:37:11 +0200 Subject: [PATCH] MT 1976 : Multiple add of records to a new list, intranet (cherry picked from commit f9867cdd975726197720613af04bddd0197f3fac) --- .../prog/en/modules/catalogue/results.tmpl | 7 +---- .../virtualshelves/addbybiblionumber.tmpl | 13 ++++++--- virtualshelves/addbybiblionumber.pl | 28 ++++++++++++++++--- 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl index 8de3c38fa7..dd3c5dbae1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl @@ -21,11 +21,6 @@ function verify_images() { } }); } -$(window).load(function() { - verify_images(); -}); - - var q_array = new Array(); // will hold search terms, if present $(window).load(function() { @@ -80,7 +75,7 @@ $(".addtocart").show(); return false; } else if($("#addto").find("option:selected").attr("value") == "newlist"){ if (vShelfAdd()) { - Dopop('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&confirm=1&' + vShelfAdd()); + Dopop('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vShelfAdd()); } return false; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/addbybiblionumber.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/addbybiblionumber.tmpl index 5cd8ef4a42..70d33deb3c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/addbybiblionumber.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/addbybiblionumber.tmpl @@ -68,17 +68,19 @@ -
+ " /> " /> +
Select an existing list
+ "> " /> @@ -87,31 +89,34 @@
-

...or...

- +

...or...

+
Add to a new list:
  1. + "> " /> " /> +
+ diff --git a/virtualshelves/addbybiblionumber.pl b/virtualshelves/addbybiblionumber.pl index 69a2c06ce8..f81c2fec5b 100755 --- a/virtualshelves/addbybiblionumber.pl +++ b/virtualshelves/addbybiblionumber.pl @@ -50,6 +50,10 @@ if this script has to add a shelf, it add one with this category. +=item newshelf + + if this parameter exists, then we create a new shelf + =back =cut @@ -102,6 +106,7 @@ my $biblionumbers = $query->param('biblionumbers'); my $shelfnumber = $query->param('shelfnumber'); my $newvirtualshelf = $query->param('newvirtualshelf'); +my $newshelf = $query->param('newshelf'); my $category = $query->param('category'); my $sortfield = $query->param('sortfield'); my $confirmed = $query->param('confirmed') || 0; @@ -124,8 +129,7 @@ if ($biblionumbers) { @biblionumbers = (@biblionumber); } -$shelfnumber = AddShelf( $newvirtualshelf, $loggedinuser, $category, $sortfield ) - if $newvirtualshelf; +$shelfnumber = AddShelf( $newvirtualshelf, $loggedinuser, $category, $sortfield ) if $newvirtualshelf; if ( $shelfnumber || ( $shelfnumber == -1 ) ) { # the shelf already exist. if ($confirmed == 1) { @@ -173,6 +177,7 @@ else { # this shelf doesn't already exist. push( @shelvesloop, $shelf->{shelfnumber} ); $shelvesloop{$shelf->{shelfnumber}} = $shelf->{shelfname}; } + if(@shelvesloop gt 0){ my $CGIvirtualshelves = CGI::scrolling_list ( @@ -188,8 +193,23 @@ else { # this shelf doesn't already exist. CGIvirtualshelves => $CGIvirtualshelves, ); } - - unless ($biblionumbers) { + my @biblios; + for my $bib (@biblionumber) { + my $data = GetBiblioData( $bib ); + push(@biblios, + { biblionumber => $bib, + title => $data->{'title'}, + author => $data->{'author'}, + } ); + } + $template->param( + newshelf => $newshelf, + biblios=>\@biblios, + multiple => (scalar(@biblionumber) > 1), + total => scalar(@biblionumber), + ); + + unless (@biblionumbers) { my ( $bibliocount, @biblios ) = GetBiblio($biblionumber); $template->param -- 2.39.5