see mail on koha-devel : code cleaning on Search.pm + normalizing API + use of biblio...
[koha.git] / opac / opac-user.pl
index e3b00da..0d417b6 100755 (executable)
@@ -6,12 +6,12 @@ use CGI;
 use C4::Auth;
 use C4::Koha;
 use C4::Circulation::Circ2;
-use C4::Circulation::Renewals2;
 use C4::Reserves2;
-use C4::Search;
+use C4::Members;
 use C4::Interface::CGI::Output;
 use HTML::Template;
 use C4::Date;
+use C4::Letters;
 
 my $query = new CGI;
 my ($template, $borrowernumber, $cookie) 
@@ -124,15 +124,32 @@ my @waiting;
 my $wcount = 0;
 foreach my $res (@$reserves) {
     if ($res->{'itemnumber'}) {
+       my $item = getiteminformation('',$res->{'itemnumber'},'');
+       $res->{'holdingbranch'} = $branches->{$item->{'holdingbranch'}}->{'branchname'};
        $res->{'branch'} = $branches->{$res->{'branchcode'}}->{'branchname'};
+       if($res->{'holdingbranch'} eq $res->{'branch'}){
+                       $res->{'atdestination'} = 1;
+               }
        push @waiting, $res;
        $wcount++;
     }
 }
-
 $template->param(WAITING => \@waiting);
+
+# current alert subscriptions
+warn " B : $borrowernumber";
+my $alerts = getalert($borrowernumber);
+foreach (@$alerts) {
+       $_->{$_->{type}}=1;
+       $_->{relatedto} = findrelatedto($_->{type},$_->{externalid});
+}
+
 $template->param(waiting_count => $wcount,
-                            LibraryName => C4::Context->preference("LibraryName"),
+                               LibraryName => C4::Context->preference("LibraryName"),
+                               suggestion => C4::Context->preference("suggestion"),
+                               virtualshelves => C4::Context->preference("virtualshelves"),
+                               textmessaging => $borr->{textmessaging},
+                               alertloop => $alerts,
 );
 
 output_html_with_http_headers $query, $cookie, $template->output;