use C4::Search; replace use C4::SearchMarc;
[koha_gimpoz] / opac / opac-user.pl
index 6b33fbe..188a3bf 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) 
@@ -31,6 +31,10 @@ $borr->{'expiry'}       = format_date($borr->{'expiry'});
 $borr->{'dateofbirth'}  = format_date($borr->{'dateofbirth'});
 $borr->{'ethnicity'}    = fixEthnicity($borr->{'ethnicity'});
 
+if($borr->{'debarred'} || $borr->{'gonenoaddress'} || $borr->{'lost'}){
+       $borr->{'flagged'} =1;
+}
+
 if ($borr->{'amountoutstanding'} > 5) {
     $borr->{'amountoverfive'} = 1;
 }
@@ -105,7 +109,7 @@ $template->param(issues_count => $count);
 $template->param(OVERDUES => \@overdues);
 $template->param(overdues_count => $overdues_count);
 
-my $branches = getbranches();
+my $branches = GetBranches();
 
 # now the reserved items....
 my ($rcount, $reserves) = FindReserves(undef, $borrowernumber);
@@ -124,14 +128,30 @@ 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 => \@waiting);
-$template->param(waiting_count => $wcount);
+$template->param(waiting_count => $wcount,
+                               textmessaging => $borr->{textmessaging},
+                               OpacPasswordChange => C4::Context->preference("OpacPasswordChange"),
+);
 
 output_html_with_http_headers $query, $cookie, $template->output;