View | Details | Raw Unified | Return to bug 30847
Collapse All | Expand All

(-)a/opac/opac-reserve.pl (-70 / +67 lines)
Lines 72-89 unless ( $can_place_hold_if_available_at_pickup ) { Link Here
72
    }
72
    }
73
}
73
}
74
74
75
# check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block
76
if ( $category->effective_BlockExpiredPatronOpacActions ) {
77
78
    if ( $patron->is_expired ) {
79
80
        # cannot reserve, their card has expired and the rules set mean this is not allowed
81
        $template->param( message => 1, expired_patron => 1 );
82
        output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
83
        exit;
84
    }
85
}
86
87
# Pass through any reserve charge
75
# Pass through any reserve charge
88
my $reservefee = $category->reservefee;
76
my $reservefee = $category->reservefee;
89
if ( $reservefee > 0){
77
if ( $reservefee > 0){
Lines 123-128 if (($#biblionumbers < 0) && (! $query->param('place_reserve'))) { Link Here
123
    exit;
111
    exit;
124
}
112
}
125
113
114
#
115
#
116
# Here we check that the borrower can actually make reserves Stage 1.
117
#
118
#
119
my $noreserves     = 0;
120
if ( $category->effective_BlockExpiredPatronOpacActions ) {
121
    if ( $patron->is_expired ) {
122
        # cannot reserve, their card has expired and the rules set mean this is not allowed
123
        $noreserves = 1;
124
        $template->param( message => 1, expired_patron => 1 );
125
    }
126
}
127
128
my $maxoutstanding = C4::Context->preference("maxoutstanding");
129
my $amountoutstanding = $patron->account->balance;
130
if ( $amountoutstanding && ($amountoutstanding > $maxoutstanding) ) {
131
    my $amount = sprintf "%.02f", $amountoutstanding;
132
    $template->param( message => 1 );
133
    $noreserves = 1;
134
    $template->param( too_much_oweing => $amount );
135
}
136
137
if ( $patron->gonenoaddress && ($patron->gonenoaddress == 1) ) {
138
    $noreserves = 1;
139
    $template->param(
140
        message => 1,
141
        GNA     => 1
142
    );
143
}
144
145
if ( $patron->lost && ($patron->lost == 1) ) {
146
    $noreserves = 1;
147
    $template->param(
148
        message => 1,
149
        lost    => 1
150
    );
151
}
152
153
if ( $patron->is_debarred ) {
154
    $noreserves = 1;
155
    $template->param(
156
        message          => 1,
157
        debarred         => 1,
158
        debarred_comment => $patron->debarredcomment,
159
        debarred_date    => $patron->debarred,
160
    );
161
}
162
163
my $holds = $patron->holds;
164
my $reserves_count = $holds->count;
165
$template->param( RESERVES => $holds->unblessed );
166
if ( $maxreserves && ( $reserves_count >= $maxreserves ) ) {
167
    $template->param( message => 1 );
168
    $noreserves = 1;
169
    $template->param( too_many_reserves => $holds->count );
170
}
171
172
if( $noreserves ){
173
    output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
174
    exit;
175
}
176
126
177
127
# pass the pickup branch along....
178
# pass the pickup branch along....
128
my $branch = $query->param('branch') || $patron->branchcode || C4::Context->userenv->{branch} || '' ;
179
my $branch = $query->param('branch') || $patron->branchcode || C4::Context->userenv->{branch} || '' ;
Lines 309-374 foreach my $biblioNumber (@biblionumbers) { Link Here
309
    $biblioData->{rank} = $reservecount + 1;
360
    $biblioData->{rank} = $reservecount + 1;
310
}
361
}
311
362
312
#
313
#
314
# Here we check that the borrower can actually make reserves Stage 1.
315
#
316
#
317
my $noreserves     = 0;
318
my $maxoutstanding = C4::Context->preference("maxoutstanding");
319
my $amountoutstanding = $patron->account->balance;
320
if ( $amountoutstanding && ($amountoutstanding > $maxoutstanding) ) {
321
    my $amount = sprintf "%.02f", $amountoutstanding;
322
    $template->param( message => 1 );
323
    $noreserves = 1;
324
    $template->param( too_much_oweing => $amount );
325
}
326
363
327
if ( $patron->gonenoaddress && ($patron->gonenoaddress == 1) ) {
364
my $requested_reserves_count = scalar( @biblionumbers );
328
    $noreserves = 1;
365
if ( $maxreserves && ( $reserves_count + $requested_reserves_count > $maxreserves ) ) {
329
    $template->param(
366
    $template->param( new_reserves_allowed => $maxreserves - $reserves_count );
330
        message => 1,
331
        GNA     => 1
332
    );
333
}
367
}
334
368
335
if ( $patron->lost && ($patron->lost == 1) ) {
369
$template->param( select_item_types => 1 );
336
    $noreserves = 1;
337
    $template->param(
338
        message => 1,
339
        lost    => 1
340
    );
341
}
342
343
if ( $patron->is_debarred ) {
344
    $noreserves = 1;
345
    $template->param(
346
        message          => 1,
347
        debarred         => 1,
348
        debarred_comment => $patron->debarredcomment,
349
        debarred_date    => $patron->debarred,
350
    );
351
}
352
353
my $holds = $patron->holds;
354
my $reserves_count = $holds->count;
355
$template->param( RESERVES => $holds->unblessed );
356
if ( $maxreserves && ( $reserves_count >= $maxreserves ) ) {
357
    $template->param( message => 1 );
358
    $noreserves = 1;
359
    $template->param( too_many_reserves => $holds->count );
360
}
361
362
unless ( $noreserves ) {
363
    my $requested_reserves_count = scalar( @biblionumbers );
364
    if ( $maxreserves && ( $reserves_count + $requested_reserves_count > $maxreserves ) ) {
365
        $template->param( new_reserves_allowed => $maxreserves - $reserves_count );
366
    }
367
}
368
369
unless ($noreserves) {
370
    $template->param( select_item_types => 1 );
371
}
372
370
373
371
374
#
372
#
375
- 

Return to bug 30847