Lines 38-44
use Koha::DateUtils;
Link Here
|
38 |
use Date::Calc qw/Today Date_to_Days/; |
38 |
use Date::Calc qw/Today Date_to_Days/; |
39 |
# use Data::Dumper; |
39 |
# use Data::Dumper; |
40 |
|
40 |
|
41 |
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves"); |
41 |
my $maxreserves = C4::Context->preference("maxreserves"); |
42 |
|
42 |
|
43 |
my $query = new CGI; |
43 |
my $query = new CGI; |
44 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
44 |
my ( $template, $borrowernumber, $cookie ) = get_template_and_user( |
Lines 114-119
if (($#biblionumbers < 0) && (! $query->param('place_reserve'))) {
Link Here
|
114 |
&get_out($query, $cookie, $template->output); |
114 |
&get_out($query, $cookie, $template->output); |
115 |
} |
115 |
} |
116 |
|
116 |
|
|
|
117 |
|
117 |
# pass the pickup branch along.... |
118 |
# pass the pickup branch along.... |
118 |
my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ; |
119 |
my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ; |
119 |
($branches->{$branch}) or $branch = ""; # Confirm branch is real |
120 |
($branches->{$branch}) or $branch = ""; # Confirm branch is real |
Lines 183-189
foreach my $biblioNumber (@biblionumbers) {
Link Here
|
183 |
# |
184 |
# |
184 |
if ( $query->param('place_reserve') ) { |
185 |
if ( $query->param('place_reserve') ) { |
185 |
my $reserve_cnt = 0; |
186 |
my $reserve_cnt = 0; |
186 |
if ($MAXIMUM_NUMBER_OF_RESERVES) { |
187 |
if ($maxreserves) { |
187 |
$reserve_cnt = GetReservesFromBorrowernumber( $borrowernumber ); |
188 |
$reserve_cnt = GetReservesFromBorrowernumber( $borrowernumber ); |
188 |
} |
189 |
} |
189 |
|
190 |
|
Lines 267-274
if ( $query->param('place_reserve') ) {
Link Here
|
267 |
} |
268 |
} |
268 |
my $notes = $query->param('notes_'.$biblioNum)||''; |
269 |
my $notes = $query->param('notes_'.$biblioNum)||''; |
269 |
|
270 |
|
270 |
if ( $MAXIMUM_NUMBER_OF_RESERVES |
271 |
if ( $maxreserves |
271 |
&& $reserve_cnt >= $MAXIMUM_NUMBER_OF_RESERVES ) |
272 |
&& $reserve_cnt >= $maxreserves ) |
272 |
{ |
273 |
{ |
273 |
$canreserve = 0; |
274 |
$canreserve = 0; |
274 |
} |
275 |
} |
Lines 308-339
if ( $borr->{'amountoutstanding'} && ($borr->{'amountoutstanding'} > $maxoutstan
Link Here
|
308 |
if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} == 1) ) { |
309 |
if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} == 1) ) { |
309 |
$noreserves = 1; |
310 |
$noreserves = 1; |
310 |
$template->param( |
311 |
$template->param( |
311 |
message => 1, |
312 |
message => 1, |
312 |
GNA => 1 |
313 |
GNA => 1 |
313 |
); |
314 |
); |
314 |
} |
315 |
} |
315 |
if ( $borr->{lost} && ($borr->{lost} == 1) ) { |
316 |
if ( $borr->{lost} && ($borr->{lost} == 1) ) { |
316 |
$noreserves = 1; |
317 |
$noreserves = 1; |
317 |
$template->param( |
318 |
$template->param( |
318 |
message => 1, |
319 |
message => 1, |
319 |
lost => 1 |
320 |
lost => 1 |
320 |
); |
321 |
); |
321 |
} |
322 |
} |
322 |
if ( $borr->{'debarred'} ) { |
323 |
if ( $borr->{'debarred'} ) { |
323 |
$noreserves = 1; |
324 |
$noreserves = 1; |
324 |
$template->param( |
325 |
$template->param( |
325 |
message => 1, |
326 |
message => 1, |
326 |
debarred => 1 |
327 |
debarred => 1 |
327 |
); |
328 |
); |
328 |
} |
329 |
} |
329 |
|
330 |
|
330 |
my @reserves = GetReservesFromBorrowernumber( $borrowernumber ); |
331 |
my @reserves = GetReservesFromBorrowernumber( $borrowernumber ); |
|
|
332 |
my $reserves_count = scalar(@reserves); |
331 |
$template->param( RESERVES => \@reserves ); |
333 |
$template->param( RESERVES => \@reserves ); |
332 |
if ( $MAXIMUM_NUMBER_OF_RESERVES && (scalar(@reserves) >= $MAXIMUM_NUMBER_OF_RESERVES) ) { |
334 |
if ( $maxreserves && ( $reserves_count >= $maxreserves ) ) { |
333 |
$template->param( message => 1 ); |
335 |
$template->param( message => 1 ); |
334 |
$noreserves = 1; |
336 |
$noreserves = 1; |
335 |
$template->param( too_many_reserves => scalar(@reserves)); |
337 |
$template->param( too_many_reserves => scalar(@reserves)); |
336 |
} |
338 |
} |
|
|
339 |
|
340 |
unless ( $noreserves ) { |
341 |
my $requested_reserves_count = scalar( @biblionumbers ); |
342 |
if ( $maxreserves && ( $reserves_count + $requested_reserves_count > $maxreserves ) ) { |
343 |
$template->param( new_reserves_allowed => $maxreserves - $reserves_count ); |
344 |
} |
345 |
} |
346 |
|
337 |
foreach my $res (@reserves) { |
347 |
foreach my $res (@reserves) { |
338 |
foreach my $biblionumber (@biblionumbers) { |
348 |
foreach my $biblionumber (@biblionumbers) { |
339 |
if ( $res->{'biblionumber'} == $biblionumber && $res->{'borrowernumber'} == $borrowernumber) { |
349 |
if ( $res->{'biblionumber'} == $biblionumber && $res->{'borrowernumber'} == $borrowernumber) { |