little bugfixes for opac templated.
[koha_fer] / moredetail.pl
index 07bc6d8..8a7e0e2 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/perl
 
+# $Id$
+
 # Copyright 2000-2002 Katipo Communications
 #
 # This file is part of Koha.
@@ -23,8 +25,9 @@ require Exporter;
 use C4::Koha;
 use CGI;
 use C4::Search;
-use C4::Acquisitions;
-use C4::Output; # contains picktemplate
+use C4::Catalogue;
+use C4::Output; # contains gettemplate
+use C4::Auth;
   
 my $query=new CGI;
 
@@ -32,8 +35,17 @@ my $includes = C4::Context->config('includes') ||
        "/usr/local/www/hdl/htdocs/includes";
 my $startfrom=$query->param('startfrom') || 0;
 
-
-my $template = gettemplate("catalogue/moredetail.tmpl");
+my $subject=$query->param('subject');
+# if its a subject we need to use the subject.tmpl
+my $template;
+if ($subject){
+       $template = gettemplate("catalogue/subject.tmpl");
+} else {
+       $template = gettemplate("catalogue/moredetail.tmpl");
+}
+my $flagsrequired;
+$flagsrequired->{catalogue}=1;
+my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 0, $flagsrequired);
 
 # get variables 
 
@@ -60,7 +72,6 @@ my $count=@items;
 $data->{'count'}=$count;
 my ($order,$ordernum)=getorder($bi,$biblionumber);
 
-
 my $env;
 $env->{itemcount}=1;
 
@@ -81,17 +92,16 @@ foreach my $item (@items){
     $item->{'ordernumber'} = $ordernum;
     $item->{'booksellerinvoicenumber'} = $order->{'booksellerinvoicenumber'};
 
-    # FIXME - This should be "==", not "=", right?
-    if ($item->{'date_due'} = 'Available'){
+    if ($item->{'date_due'} eq 'Available'){
        $item->{'issue'}="<b>Available</b><br>";
     } else {
        $item->{'issue'}="<b>Currently on issue to:</b> <a href=/cgi-bin/koha/moremember.pl?bornum=$item->{'borrower0'}>$item->{'card'}</a><br>";
     }
-         
 }
 
 $template->param(includesdir => $includes);
 $template->param(BIBITEM_DATA => \@results);
 $template->param(ITEM_DATA => \@items);
+$template->param(loggedinuser => $loggedinuser);
 print "Content-Type: text/html\n\n", $template->output;