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 312-377 foreach my $biblioNumber (@biblionumbers) { Link Here
312
    $biblioData->{rank} = $reservecount + 1;
363
    $biblioData->{rank} = $reservecount + 1;
313
}
364
}
314
365
315
#
316
#
317
# Here we check that the borrower can actually make reserves Stage 1.
318
#
319
#
320
my $noreserves     = 0;
321
my $maxoutstanding = C4::Context->preference("maxoutstanding");
322
my $amountoutstanding = $patron->account->balance;
323
if ( $amountoutstanding && ($amountoutstanding > $maxoutstanding) ) {
324
    my $amount = sprintf "%.02f", $amountoutstanding;
325
    $template->param( message => 1 );
326
    $noreserves = 1;
327
    $template->param( too_much_oweing => $amount );
328
}
329
366
330
if ( $patron->gonenoaddress && ($patron->gonenoaddress == 1) ) {
367
my $requested_reserves_count = scalar( @biblionumbers );
331
    $noreserves = 1;
368
if ( $maxreserves && ( $reserves_count + $requested_reserves_count > $maxreserves ) ) {
332
    $template->param(
369
    $template->param( new_reserves_allowed => $maxreserves - $reserves_count );
333
        message => 1,
334
        GNA     => 1
335
    );
336
}
370
}
337
371
338
if ( $patron->lost && ($patron->lost == 1) ) {
372
$template->param( select_item_types => 1 );
339
    $noreserves = 1;
340
    $template->param(
341
        message => 1,
342
        lost    => 1
343
    );
344
}
345
346
if ( $patron->is_debarred ) {
347
    $noreserves = 1;
348
    $template->param(
349
        message          => 1,
350
        debarred         => 1,
351
        debarred_comment => $patron->debarredcomment,
352
        debarred_date    => $patron->debarred,
353
    );
354
}
355
356
my $holds = $patron->holds;
357
my $reserves_count = $holds->count;
358
$template->param( RESERVES => $holds->unblessed );
359
if ( $maxreserves && ( $reserves_count >= $maxreserves ) ) {
360
    $template->param( message => 1 );
361
    $noreserves = 1;
362
    $template->param( too_many_reserves => $holds->count );
363
}
364
365
unless ( $noreserves ) {
366
    my $requested_reserves_count = scalar( @biblionumbers );
367
    if ( $maxreserves && ( $reserves_count + $requested_reserves_count > $maxreserves ) ) {
368
        $template->param( new_reserves_allowed => $maxreserves - $reserves_count );
369
    }
370
}
371
372
unless ($noreserves) {
373
    $template->param( select_item_types => 1 );
374
}
375
373
376
374
377
#
375
#
378
- 

Return to bug 30847