MT2582: Fix user deletion without permission
[koha.git] / opac / opac-user.pl
index 19a63be..0c43f52 100755 (executable)
@@ -52,6 +52,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
     }
 );
 
+my $OPACDisplayRequestPriority = (C4::Context->preference("OPACDisplayRequestPriority")) ? 1 : 0;
 my $patronupdate = $query->param('patronupdate');
 
 # get borrower information ....
@@ -89,7 +90,7 @@ $template->param(   BORROWER_INFO  => \@bordat,
                 );
 
 #get issued items ....
-my ($countissues,$issues) = GetPendingIssues($borrowernumber);
+my ($issues) = GetPendingIssues($borrowernumber);
 my @issue_list = sort { $b->{'date_due'} cmp $a->{'date_due'} } @$issues;
 
 my $count          = 0;
@@ -184,7 +185,7 @@ for my $branch_hash (sort keys %$branches ) {
         selected => $selected
       };
 }
-$template->param( branchloop => \@branch_loop, "mylibraryfirst"=>C4::Context->preference("SearchMyLibraryFirst"));
+$template->param( branchloop => \@branch_loop );
 
 # now the reserved items....
 my @reserves  = GetReservesFromBorrowernumber( $borrowernumber );
@@ -196,6 +197,9 @@ foreach my $res (@reserves) {
     $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
     my $biblioData = GetBiblioData($res->{'biblionumber'});
     $res->{'reserves_title'} = $biblioData->{'title'};
+       if ($OPACDisplayRequestPriority) {
+               $res->{'priority'} = '' if $res->{'priority'} eq '0';
+       }
 }
 
 # use Data::Dumper;
@@ -203,6 +207,7 @@ foreach my $res (@reserves) {
 
 $template->param( RESERVES       => \@reserves );
 $template->param( reserves_count => $#reserves+1 );
+$template->param( showpriority=>1 ) if $OPACDisplayRequestPriority;
 
 my @waiting;
 my $wcount = 0;
@@ -241,6 +246,10 @@ foreach my $res (@reserves) {
         push @waiting, $res;
         $wcount++;
     }
+    # can be cancelled
+    #$res->{'cancelable'} = 1 if ($res->{'wait'} && $res->{'atdestination'} && $res->{'found'} ne "1");
+    $res->{'cancelable'} = 1 if    ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit});
+    
 }
 
 $template->param( WAITING => \@waiting );