koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha koha-tmpl/opac-tmpl/prog/en/opac-addbookby... [rel_3_0]


From: Antoine Farnault
Subject: [Koha-cvs] koha koha-tmpl/opac-tmpl/prog/en/opac-addbookby... [rel_3_0]
Date: Mon, 15 Jan 2007 17:12:18 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Antoine Farnault <toins>        07/01/15 17:12:18

Modified files:
        koha-tmpl/opac-tmpl/prog/en: opac-addbookbybiblionumber.tmpl 
        opac           : opac-addbookbybiblionumber.pl 

Log message:
        enable to add multiple biblios to a shelf from basket.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/prog/en/opac-addbookbybiblionumber.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.2&r2=1.1.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-addbookbybiblionumber.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.5.2.4&r2=1.5.2.5

Patches:
Index: koha-tmpl/opac-tmpl/prog/en/opac-addbookbybiblionumber.tmpl
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/opac-tmpl/prog/en/opac-addbookbybiblionumber.tmpl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -b -r1.1.2.2 -r1.1.2.3
--- koha-tmpl/opac-tmpl/prog/en/opac-addbookbybiblionumber.tmpl 11 Dec 2006 
17:10:06 -0000      1.1.2.2
+++ koha-tmpl/opac-tmpl/prog/en/opac-addbookbybiblionumber.tmpl 15 Jan 2007 
17:12:18 -0000      1.1.2.3
@@ -2,14 +2,24 @@
 <!-- TMPL_VAR NAME="LibraryNameTitle" --> Catalog -- Add to My Book List
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 
+
+<!-- TMPL_IF NAME="multiple"-->
+    <h1>Add these <!-- TMPL_VAR NAME="total"--> biblios to a shelf</h1>
+        <!-- TMPL_LOOP NAME="biblios"-->
+            <b><!-- TMPL_VAR NAME="title"--></b> 
+            <!-- TMPL_IF NAME="author"-->by <!-- TMPL_VAR NAME="author"--><!-- 
/TMPL_IF -->
+            <br /><br />
+        <!-- /TMPL_LOOP -->
+<!-- TMPL_ELSE -->
 <h1>Add 
     <i><!-- TMPL_VAR NAME="title" --></i>
     <!-- TMPL_IF NAME="author" -->
         by <!-- TMPL_VAR NAME="author" -->
     <!-- /TMPL_IF --> to a Virtual Shelf
 </h1>
+<!-- /TMPL_IF -->
 
-<form name="f1" action="/cgi-bin/koha/opac-addbookbybiblionumber.pl" 
method="GET">
+<form name="f1" action="/cgi-bin/koha/opac-addbookbybiblionumber.pl" 
method="POST">
     
     <p><b>Select an Existing Bookshelf</b></p>
     <label>Add to virtual shelf</label> <!-- TMPL_VAR NAME="CGIbookshelves" -->
@@ -19,7 +29,7 @@
     
 </form>
 <p>...or...</p>
-<form name="f2" method="GET" 
action="/cgi-bin/koha/opac-addbookbybiblionumber.pl">
+<form name="f2" method="POST" 
action="/cgi-bin/koha/opac-addbookbybiblionumber.pl">
     <b>Add to a New Bookshelf:</b>
         <p>
             <label for="newbookshelf">

Index: opac/opac-addbookbybiblionumber.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-addbookbybiblionumber.pl,v
retrieving revision 1.5.2.4
retrieving revision 1.5.2.5
diff -u -b -r1.5.2.4 -r1.5.2.5
--- opac/opac-addbookbybiblionumber.pl  11 Dec 2006 17:10:06 -0000      1.5.2.4
+++ opac/opac-addbookbybiblionumber.pl  15 Jan 2007 17:12:18 -0000      1.5.2.5
@@ -1,8 +1,9 @@
 #!/usr/bin/perl
+
 #script to provide bookshelf management
 # WARNING: This file uses 4-character tabs!
 #
-# $Header: /sources/koha/koha/opac/opac-addbookbybiblionumber.pl,v 1.5.2.4 
2006/12/11 17:10:06 toins Exp $
+# $Header: /sources/koha/koha/opac/opac-addbookbybiblionumber.pl,v 1.5.2.5 
2007/01/15 17:12:18 toins Exp $
 #
 # Copyright 2000-2002 Katipo Communications
 #
@@ -36,11 +37,6 @@
 my $newbookshelf = $query->param('newbookshelf');
 my $category     = $query->param('category');
 
-warn "biblionumber=".$biblionumber;
-warn "shelfnumber=".$shelfnumber;
-warn "newbookshelf=".$newbookshelf;
-warn "category=".$category;
-
 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {
         template_name   => "opac-addbookbybiblionumber.tmpl",
@@ -52,17 +48,26 @@
 
 $shelfnumber = AddShelf( '', $newbookshelf, $loggedinuser, $category ) if 
$newbookshelf;
 
+# to know if we had to add more than one biblio.
+my $multiple = 0;
+$multiple = 1 if $biblionumber =~ /^(\d*\/)*$/;
+
+
 if ($shelfnumber) {
-    warn "add shelf from biblio.";
-    &AddToShelfFromBiblio( $biblionumber, $shelfnumber );
     
+    if ($multiple){
+        foreach (split /\//,$biblionumber){
+            &AddToShelfFromBiblio($_,$shelfnumber);
+        }
+    }
+    else {
+        &AddToShelfFromBiblio( $biblionumber, $shelfnumber );
+    }
     print $query->header;
     print "<html><body onload=\"window.close();\"></body></html>";
     exit;
 }
 else {
-    my ( $bibliocount, @biblios ) = GetBiblio($biblionumber);
-
     my ($shelflist) = GetShelves( $loggedinuser, 3 );
     my @shelvesloop;
     my %shelvesloop;
@@ -73,7 +78,7 @@
 
     my $CGIbookshelves;
     if ( @shelvesloop > 0 ) {
-        $CGIbookshelves = CGI::scrolling_list(
+        $CGIbookshelves = CGI::scrolling_list (
             -name     => 'shelfnumber',
             -values   => address@hidden,
             -labels   => \%shelvesloop,
@@ -83,48 +88,31 @@
         );
     }
 
-    $template->param(
+    if ( $multiple ) {
+        my @biblios;
+        foreach (split /\//,$biblionumber){
+            my $data = GetBiblioData($_);
+            push @biblios,$data;
+        }
+        $template->param (
+            multiple => 1,
         biblionumber         => $biblionumber,
-        title                => $biblios[0]->{'title'},
-        author               => $biblios[0]->{'author'},
+            total    => scalar @biblios,
+            biblios  => address@hidden,
+        );
+    }
+    else { # just one to add.
+        my $data = GetBiblioData( $biblionumber );
+        $template->param (
+            biblionumber => $biblionumber,
+            title        => $data->{'title'},
+            author       => $data->{'author'},
+        );
+    }
+
+    $template->param (
         CGIbookshelves       => $CGIbookshelves,
-        LibraryName          => C4::Context->preference("LibraryName"),
-        suggestion           => C4::Context->preference("suggestion"),
-        virtualshelves       => C4::Context->preference("virtualshelves"),
-        OpacNav              => C4::Context->preference("OpacNav"),
-        opaccredits          => C4::Context->preference("opaccredits"),
-        opacsmallimage       => C4::Context->preference("opacsmallimage"),
-        opaclayoutstylesheet => 
C4::Context->preference("opaclayoutstylesheet"),
-        opaccolorstylesheet  => C4::Context->preference("opaccolorstylesheet"),
     );
 
     output_html_with_http_headers $query, $cookie, $template->output;
 }
-
-# $Log: opac-addbookbybiblionumber.pl,v $
-# Revision 1.5.2.4  2006/12/11 17:10:06  toins
-# fixing some bugs on bookshelves.
-#
-# Revision 1.5.2.3  2006/12/07 15:42:15  toins
-# synching opac & intranet.
-# fix some broken link & bugs.
-# removing warn compilation.
-#
-# Revision 1.5.2.2  2006/12/05 11:35:31  toins
-# Biblio.pm cleaned.
-# additionalauthors, bibliosubject, bibliosubtitle tables are now unused.
-# Some functions renamed according to the coding guidelines.
-#
-# Revision 1.5.2.1  2006/11/30 18:23:51  toins
-# theses scripts don't need to use C4::Search.
-#
-# Revision 1.5  2006/07/04 14:36:52  toins
-# Head & rel_2_2 merged
-#
-# Revision 1.4  2006/05/21 02:10:32  kados
-# syncing dev-week and HEAD
-#
-# Revision 1.1.2.6  2006/04/27 16:23:34  oleonard
-# Hiding option to add to existing virtual shelves if there are no existing 
virtual shelves (thanks Chris!)
-#
-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]