MT 1976 : Multiple add of records to a new list, intranet
authorMatthias Meusburger <matthias.meusburger@biblibre.com>
Wed, 30 Sep 2009 08:37:11 +0000 (10:37 +0200)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 30 Sep 2009 09:40:37 +0000 (11:40 +0200)
(cherry picked from commit f9867cdd975726197720613af04bddd0197f3fac)

koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/addbybiblionumber.tmpl
virtualshelves/addbybiblionumber.pl

index 8de3c38..dd3c5db 100644 (file)
@@ -21,11 +21,6 @@ function verify_images() {
         }
     });
 }
-$(window).load(function() {
-    verify_images();
-});
-<!-- /TMPL_IF -->
-
 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;   
                 }
index 5cd8ef4..70d33de 100644 (file)
   </h4>
 <!-- /TMPL_UNLESS -->
 
-<!-- TMPL_IF NAME="CGIvirtualshelves" --><form name="f1" method="post" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl">
+<!-- TMPL_IF NAME="CGIvirtualshelves" --><!-- TMPL_UNLESS NAME="newshelf" --><form name="f1" method="post" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl">
     <!-- TMPL_UNLESS NAME="biblionumbers" -->
       <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
     <!-- TMPL_ELSE -->
       <input type="hidden" name="biblionumbers" value="<!-- TMPL_VAR NAME="biblionumbers" -->" />
     <!-- /TMPL_UNLESS -->
+    <input type="hidden" name="confirmed" value="1" /></fieldset>
     <fieldset class="rows">
     <legend>Select an existing list</legend>
     <ol>
         <li><label>Choose list</label><!-- TMPL_VAR NAME="CGIvirtualshelves" --></li>
     </ol>
+    <!-- TMPL_LOOP NAME="biblios" --><input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->"><!-- /TMPL_LOOP -->
     <!-- TMPL_UNLESS NAME="biblionumbers" -->
       <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
     <!-- TMPL_ELSE -->
     <fieldset class="action"><input type="submit" value="Save" class="submit" /></fieldset>
        </fieldset>
 </form>
-<h4>...or...</h4><!-- /TMPL_IF -->
-
+<h4>...or...</h4><!-- /TMPL_UNLESS --><!-- /TMPL_IF -->
+<!-- TMPL_UNLESS NAME="shelfnumber" -->
 <form name="f2" method="post" action="/cgi-bin/koha/virtualshelves/addbybiblionumber.pl">
     <fieldset class="rows"><legend>Add to a new list:</legend>
         <ol><li>
             <label for="newvirtualshelf">
                 List name:
             </label>
+            <!-- TMPL_LOOP NAME="biblios" --><input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->"><!-- /TMPL_LOOP -->
             <!-- TMPL_UNLESS NAME="biblionumbers" -->
                          <input type="hidden" name="biblionumber" id="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
             <!-- TMPL_ELSE -->
                          <input type="hidden" name="biblionumbers" id="biblionumbers" value="<!-- TMPL_VAR NAME="biblionumbers" -->" />
             <!-- /TMPL_UNLESS -->
             <input type="text" name="newvirtualshelf" id="newvirtualshelf" size="40" />
+           <input type="hidden" name="confirmed" value="1" />
         </li>
         <li>
             <label for="category">Category:</label>
             <select name="category" id="category">
                 <option value="1">Private</option>
                 <option value="2">Public</option>
-                               <option value="3">Free</option>
+               <option value="3">Free</option>
             </select>
         </li></ol>
     <fieldset class="action"><input type="submit" value="Save" class="submit" /></fieldset> </fieldset>
 </form>
+<!-- /TMPL_UNLESS -->
 <!-- /TMPL_IF -->
 </div>
 
index 69a2c06..f81c2fe 100755 (executable)
 
     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