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

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

Return to bug 30847