-if ( $query->param('place_reserve') ) {
- my @bibitems=$query->param('biblioitem');
- my $notes=$query->param('notes');
- my $checkitem=$query->param('checkitem');
- my $found;
-
- #if we have an item selectionned, and the pickup branch is the same as the holdingbranch of the document, we force the value $rank and $found.
- if ($checkitem ne ''){
- $rank = '0';
- my $item = $checkitem;
- $item = GetItem($item);
- if ( $item->{'holdingbranch'} eq $branch ){
- $found = 'W' unless C4::Context->preference('ReservesNeedReturns');
- }
- }
-
- my $count=@bibitems;
- @bibitems=sort @bibitems;
- my $i2=1;
- my @realbi;
- $realbi[0]=$bibitems[0];
- for (my $i=1;$i<$count;$i++) {
- my $i3=$i2-1;
- if ($realbi[$i3] ne $bibitems[$i]) {
- $realbi[$i2]=$bibitems[$i];
- $i2++;
- }
- }
- # here we actually do the reserveration. Stage 3.
- if ($query->param('request') eq 'any'){
- # place a request on 1st available
- AddReserve($branch,$borrowernumber,$biblionumber,'a',\@realbi,$rank,$notes,$bibdata->{'title'},$checkitem,$found);
- } else {
- AddReserve($branch,$borrowernumber,$biblionumber,'a',\@realbi,$rank,$notes,$bibdata->{'title'},$checkitem, $found);
- }
- print $query->redirect("/cgi-bin/koha/opac-user.pl");
+my @reserves = GetReservesFromBorrowernumber( $borrowernumber );
+$template->param( RESERVES => \@reserves );
+if ( $MAXIMUM_NUMBER_OF_RESERVES && (scalar(@reserves) >= $MAXIMUM_NUMBER_OF_RESERVES) ) {
+ $template->param( message => 1 );
+ $noreserves = 1;
+ $template->param( too_many_reserves => scalar(@reserves));