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

(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt (+13 lines)
Lines 4-9 Link Here
4
<script type="text/javascript">
4
<script type="text/javascript">
5
// <![CDATA[
5
// <![CDATA[
6
 var MSG_NO_COPY_SELECTED = _("Expecting a specific copy selection.");
6
 var MSG_NO_COPY_SELECTED = _("Expecting a specific copy selection.");
7
 var MSG_MAX_HOLDS_EXCEEDED = _("You cannot place this many more holds, please reduce the amount of holds requested to [% new_reserves_allowed %] or less.");
7
8
8
 function prefixOf (s, tok) {
9
 function prefixOf (s, tok) {
9
     var index = s.indexOf(tok);
10
     var index = s.indexOf(tok);
Lines 111-116 Link Here
111
            return false;
112
            return false;
112
        }
113
        }
113
114
115
	[% IF ( new_reserves_allowed ) %]
116
        if ($(".confirmjs:checked").size() > [% new_reserves_allowed %]) {
117
            alert(MSG_MAX_HOLDS_EXCEEDED);
118
            return false;
119
        }
120
	[% END %]
121
114
        // Find the items with the 'Hold' box checked
122
        // Find the items with the 'Hold' box checked
115
        var badBib = null;
123
        var badBib = null;
116
        $(".confirmjs:checked").each(function() {
124
        $(".confirmjs:checked").each(function() {
Lines 163-168 Link Here
163
    <div id="bd">
171
    <div id="bd">
164
	  <div id="yui-g">
172
	  <div id="yui-g">
165
        <div id="holds" class="container">
173
        <div id="holds" class="container">
174
            [% IF ( new_reserves_allowed ) %]
175
              <div id="new_reserves_allowed" class="dialog alert">
176
                <p><strong>Sorry</strong>, you cannot place holds on all these items. You can only place [% new_reserves_allowed %] more hold(s). Please choose the items you wish to be held.</p>
177
              </div>
178
            [% END %]
166
        [% IF ( message ) %]
179
        [% IF ( message ) %]
167
            [% IF ( GNA ) %]
180
            [% IF ( GNA ) %]
168
              <div id="gna" class="dialog alert">
181
              <div id="gna" class="dialog alert">
(-)a/opac/opac-reserve.pl (-12 / +21 lines)
Lines 33-39 use C4::Overdues; Link Here
33
use C4::Debug;
33
use C4::Debug;
34
# use Data::Dumper;
34
# use Data::Dumper;
35
35
36
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves");
36
my $maxreserves = C4::Context->preference("maxreserves");
37
37
38
my $query = new CGI;
38
my $query = new CGI;
39
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
39
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Lines 92-97 if (($#biblionumbers < 0) && (! $query->param('place_reserve'))) { Link Here
92
    &get_out($query, $cookie, $template->output);
92
    &get_out($query, $cookie, $template->output);
93
}
93
}
94
94
95
95
# pass the pickup branch along....
96
# pass the pickup branch along....
96
my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ;
97
my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ;
97
($branches->{$branch}) or $branch = "";     # Confirm branch is real
98
($branches->{$branch}) or $branch = "";     # Confirm branch is real
Lines 268-299 if ( $borr->{'amountoutstanding'} && ($borr->{'amountoutstanding'} > $maxoutstan Link Here
268
if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} eq 1) ) {
269
if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} eq 1) ) {
269
    $noreserves = 1;
270
    $noreserves = 1;
270
    $template->param(
271
    $template->param(
271
                     message => 1,
272
        message => 1,
272
                     GNA     => 1
273
        GNA     => 1
273
                    );
274
    );
274
}
275
}
275
if ( $borr->{lost} && ($borr->{lost} eq 1) ) {
276
if ( $borr->{lost} && ($borr->{lost} eq 1) ) {
276
    $noreserves = 1;
277
    $noreserves = 1;
277
    $template->param(
278
    $template->param(
278
                     message => 1,
279
        message => 1,
279
                     lost    => 1
280
        lost    => 1
280
                    );
281
    );
281
}
282
}
282
if ( CheckBorrowerDebarred($borrowernumber) ) {
283
if ( CheckBorrowerDebarred($borrowernumber) ) {
283
    $noreserves = 1;
284
    $noreserves = 1;
284
    $template->param(
285
    $template->param(
285
                     message  => 1,
286
        message  => 1,
286
                     debarred => 1
287
        debarred => 1
287
                    );
288
    );
288
}
289
}
289
290
290
my @reserves = GetReservesFromBorrowernumber( $borrowernumber );
291
my @reserves = GetReservesFromBorrowernumber( $borrowernumber );
292
my $reserves_count = scalar(@reserves);
291
$template->param( RESERVES => \@reserves );
293
$template->param( RESERVES => \@reserves );
292
if ( $MAXIMUM_NUMBER_OF_RESERVES && (scalar(@reserves) >= $MAXIMUM_NUMBER_OF_RESERVES) ) {
294
if ( $maxreserves && ( $reserves_count >= $maxreserves ) ) {
293
    $template->param( message => 1 );
295
    $template->param( message => 1 );
294
    $noreserves = 1;
296
    $noreserves = 1;
295
    $template->param( too_many_reserves => scalar(@reserves));
297
    $template->param( too_many_reserves => scalar(@reserves));
296
}
298
}
299
300
unless ( $noreserves ) {
301
    my $requested_reserves_count = scalar( @biblionumbers );
302
    if ( $maxreserves && ( $reserves_count + $requested_reserves_count >= $maxreserves ) ) {
303
        $template->param( new_reserves_allowed => $maxreserves - $reserves_count );
304
    }
305
}
306
297
foreach my $res (@reserves) {
307
foreach my $res (@reserves) {
298
    foreach my $biblionumber (@biblionumbers) {
308
    foreach my $biblionumber (@biblionumbers) {
299
        if ( $res->{'biblionumber'} == $biblionumber && $res->{'borrowernumber'} == $borrowernumber) {
309
        if ( $res->{'biblionumber'} == $biblionumber && $res->{'borrowernumber'} == $borrowernumber) {
300
- 

Return to bug 6976