Bug 5510: prepend output with system name
[koha.git] / serials / serials-collection.pl
index c82a2fa..10e18e0 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 
 # Copyright 2000-2002 Katipo Communications
+# Parts Copyright 2010 Biblibre
 #
 # This file is part of Koha.
 #
@@ -13,9 +14,9 @@
 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 
 use strict;
@@ -28,6 +29,7 @@ use C4::Serials;
 use C4::Letters;
 use C4::Output;
 use C4::Context;
+use List::MoreUtils qw/uniq/;
 
 
 my $query = new CGI;
@@ -40,13 +42,14 @@ my ($template, $loggedinuser, $cookie);
                             query => $query,
                             type => "intranet",
                             authnotrequired => 0,
-                            flagsrequired => {serials => 1},
+                            flagsrequired => {serials => 'receive_serials'},
                             debug => 1,
                             });
 my $biblionumber = $query->param('biblionumber');
 my @subscriptionid = $query->param('subscriptionid');
 
-my $subscriptiondescs ;
+@subscriptionid= uniq @subscriptionid;
+my $subscriptiondescs;
 my $subscriptions;
 
 if($op eq 'gennext' && @subscriptionid){
@@ -89,6 +92,7 @@ if($op eq 'gennext' && @subscriptionid){
     print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid);
 }
 
+my ($location, $callnumber);
 if (@subscriptionid){
    my @subscriptioninformation=();
    foreach my $subscriptionid (@subscriptionid){
@@ -111,6 +115,8 @@ if (@subscriptionid){
     $subs->{'abouttoexpire'}=abouttoexpire($subs->{'subscriptionid'});
     $subs->{'subscriptionexpired'}=HasSubscriptionExpired($subs->{'subscriptionid'});
     $subs->{'subscriptionid'} = $subscriptionid;  # FIXME - why was this lost ?
+       $location = GetAuthorisedValues('LOC', $subs->{'location'});
+       $callnumber = $subs->{callnumber};
     push @$subscriptiondescs,$subs;
     my $tmpsubscription= GetFullSubscription($subscriptionid);
     @subscriptioninformation=(@$tmpsubscription,@subscriptioninformation);
@@ -133,6 +139,11 @@ foreach my $subscription (@$subscriptiondescs){
 
 # warn "title : $title yearmax : $yearmax nombre d'elements dans le tableau :".scalar(@$subscriptions);
 #  use Data::Dumper; warn Dumper($subscriptions);
+my $locationlib;
+foreach (@$location) {
+    $locationlib = $_->{'lib'} if $_->{'selected'};
+}
+
 chop $subscriptionidlist;
 $template->param(
           onesubscription => (scalar(@$subscriptiondescs)==1),
@@ -146,6 +157,8 @@ $template->param(
           suggestion => C4::Context->preference("suggestion"),
           virtualshelves => C4::Context->preference("virtualshelves"),
           subscr=>$query->param('subscriptionid'),
+    location          => $locationlib,
+    callnumber        => $callnumber,
           );
 
 output_html_with_http_headers $query, $cookie, $template->output;