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

(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 7750-7755 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
7750
    SetVersion($DBversion);
7750
    SetVersion($DBversion);
7751
}
7751
}
7752
7752
7753
$DBversion = "3.15.00.XXX";
7754
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
7755
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('maxreserves',50,'System-wide maximum number of holds a patron can place','','Integer')");
7756
    print "Upgrade to $DBversion done (Re-add system preference maxreserves)\n";
7757
    SetVersion($DBversion);
7758
}
7759
7753
7760
7754
=head1 FUNCTIONS
7761
=head1 FUNCTIONS
7755
7762
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt (+15 lines)
Lines 5-14 Link Here
5
<script type="text/javascript">
5
<script type="text/javascript">
6
// <![CDATA[
6
// <![CDATA[
7
 var MSG_NO_COPY_SELECTED = _("Expecting a specific copy selection.");
7
 var MSG_NO_COPY_SELECTED = _("Expecting a specific copy selection.");
8
8
 var ForceHoldNotesReasons=new Array(
9
 var ForceHoldNotesReasons=new Array(
9
    _("This title consists of multiple volumes/parts. Please indicate which part you need. Clicking on specific copy information may be helpful."),
10
    _("This title consists of multiple volumes/parts. Please indicate which part you need. Clicking on specific copy information may be helpful."),
10
    "*** Add a new reason above this line ***" ); // NOTE: Do not renumber reasons; this will affect use of existing ones.
11
    "*** Add a new reason above this line ***" ); // NOTE: Do not renumber reasons; this will affect use of existing ones.
11
12
13
 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.");
14
12
 function prefixOf (s, tok) {
15
 function prefixOf (s, tok) {
13
     var index = s.indexOf(tok);
16
     var index = s.indexOf(tok);
14
     return s.substring(0, index);
17
     return s.substring(0, index);
Lines 138-143 Link Here
138
            return false;
141
            return false;
139
        }
142
        }
140
143
144
   [% IF ( new_reserves_allowed ) %]
145
        if ($(".confirmjs:checked").size() > [% new_reserves_allowed %]) {
146
            alert(MSG_MAX_HOLDS_EXCEEDED);
147
            return false;
148
        }
149
    [% END %]
150
141
        // Find the items with the 'Hold' box checked
151
        // Find the items with the 'Hold' box checked
142
        var badBib = null;
152
        var badBib = null;
143
        $(".confirmjs:checked").each(function() {
153
        $(".confirmjs:checked").each(function() {
Lines 222-227 Link Here
222
    [% INCLUDE 'masthead.inc' %]
232
    [% INCLUDE 'masthead.inc' %]
223
	  <div id="yui-g">
233
	  <div id="yui-g">
224
        <div id="holds" class="container">
234
        <div id="holds" class="container">
235
            [% IF ( new_reserves_allowed ) %]
236
              <div id="new_reserves_allowed" class="dialog alert">
237
                <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>
238
              </div>
239
            [% END %]
225
        [% IF ( message ) %]
240
        [% IF ( message ) %]
226
            [% IF ( GNA ) %]
241
            [% IF ( GNA ) %]
227
              <div id="gna" class="dialog alert">
242
              <div id="gna" class="dialog alert">
(-)a/opac/opac-reserve.pl (-11 / +21 lines)
Lines 37-43 use C4::Debug; Link Here
37
use Koha::DateUtils;
37
use Koha::DateUtils;
38
# use Data::Dumper;
38
# use Data::Dumper;
39
39
40
my $MAXIMUM_NUMBER_OF_RESERVES = C4::Context->preference("maxreserves");
40
my $maxreserves = C4::Context->preference("maxreserves");
41
41
42
my $query = new CGI;
42
my $query = new CGI;
43
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
43
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
Lines 102-107 if (($#biblionumbers < 0) && (! $query->param('place_reserve'))) { Link Here
102
    &get_out($query, $cookie, $template->output);
102
    &get_out($query, $cookie, $template->output);
103
}
103
}
104
104
105
105
# pass the pickup branch along....
106
# pass the pickup branch along....
106
my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ;
107
my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ;
107
($branches->{$branch}) or $branch = "";     # Confirm branch is real
108
($branches->{$branch}) or $branch = "";     # Confirm branch is real
Lines 296-327 if ( $borr->{'amountoutstanding'} && ($borr->{'amountoutstanding'} > $maxoutstan Link Here
296
if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} == 1) ) {
297
if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} == 1) ) {
297
    $noreserves = 1;
298
    $noreserves = 1;
298
    $template->param(
299
    $template->param(
299
                     message => 1,
300
        message => 1,
300
                     GNA     => 1
301
        GNA     => 1
301
                    );
302
    );
302
}
303
}
303
if ( $borr->{lost} && ($borr->{lost} == 1) ) {
304
if ( $borr->{lost} && ($borr->{lost} == 1) ) {
304
    $noreserves = 1;
305
    $noreserves = 1;
305
    $template->param(
306
    $template->param(
306
                     message => 1,
307
        message => 1,
307
                     lost    => 1
308
        lost    => 1
308
                    );
309
    );
309
}
310
}
310
if ( $borr->{'debarred'} ) {
311
if ( $borr->{'debarred'} ) {
311
    $noreserves = 1;
312
    $noreserves = 1;
312
    $template->param(
313
    $template->param(
313
                     message  => 1,
314
        message  => 1,
314
                     debarred => 1
315
        debarred => 1
315
                    );
316
    );
316
}
317
}
317
318
318
my @reserves = GetReservesFromBorrowernumber( $borrowernumber );
319
my @reserves = GetReservesFromBorrowernumber( $borrowernumber );
320
my $reserves_count = scalar(@reserves);
319
$template->param( RESERVES => \@reserves );
321
$template->param( RESERVES => \@reserves );
320
if ( $MAXIMUM_NUMBER_OF_RESERVES && (scalar(@reserves) >= $MAXIMUM_NUMBER_OF_RESERVES) ) {
322
if ( $maxreserves && ( $reserves_count >= $maxreserves ) ) {
321
    $template->param( message => 1 );
323
    $template->param( message => 1 );
322
    $noreserves = 1;
324
    $noreserves = 1;
323
    $template->param( too_many_reserves => scalar(@reserves));
325
    $template->param( too_many_reserves => scalar(@reserves));
324
}
326
}
327
328
unless ( $noreserves ) {
329
    my $requested_reserves_count = scalar( @biblionumbers );
330
    if ( $maxreserves && ( $reserves_count + $requested_reserves_count >= $maxreserves ) ) {
331
        $template->param( new_reserves_allowed => $maxreserves - $reserves_count );
332
    }
333
}
334
325
foreach my $res (@reserves) {
335
foreach my $res (@reserves) {
326
    foreach my $biblionumber (@biblionumbers) {
336
    foreach my $biblionumber (@biblionumbers) {
327
        if ( $res->{'biblionumber'} == $biblionumber && $res->{'borrowernumber'} == $borrowernumber) {
337
        if ( $res->{'biblionumber'} == $biblionumber && $res->{'borrowernumber'} == $borrowernumber) {
(-)a/reserve/request.pl (-6 / +7 lines)
Lines 122-134 if ($borrowernumber_hold && !$action) { Link Here
122
    my @getreservloop;
122
    my @getreservloop;
123
    my $count_reserv = 0;
123
    my $count_reserv = 0;
124
124
125
#   we check the reserves of the borrower, and if he can reserv a document
125
    # we check the reserves of the borrower, and if he can reserv a document
126
# FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
126
    # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
127
127
128
    my $number_reserves =
128
    my $number_reserves =
129
      GetReserveCount( $borrowerinfo->{'borrowernumber'} );
129
      GetReserveCount( $borrowerinfo->{'borrowernumber'} );
130
130
131
    if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) {
131
    if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) {
132
        $warnings = 1;
132
        $maxreserves = 1;
133
        $maxreserves = 1;
133
    }
134
    }
134
135
Lines 136-142 if ($borrowernumber_hold && !$action) { Link Here
136
    my $expiry_date = $borrowerinfo->{dateexpiry};
137
    my $expiry_date = $borrowerinfo->{dateexpiry};
137
    my $expiry = 0; # flag set if patron account has expired
138
    my $expiry = 0; # flag set if patron account has expired
138
    if ($expiry_date and $expiry_date ne '0000-00-00' and
139
    if ($expiry_date and $expiry_date ne '0000-00-00' and
139
            Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
140
        Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
140
        $expiry = 1;
141
        $expiry = 1;
141
    }
142
    }
142
143
Lines 162-167 if ($borrowernumber_hold && !$action) { Link Here
162
                cardnumber          => $borrowerinfo->{'cardnumber'},
163
                cardnumber          => $borrowerinfo->{'cardnumber'},
163
                expiry              => $expiry,
164
                expiry              => $expiry,
164
                diffbranch          => $diffbranch,
165
                diffbranch          => $diffbranch,
166
                messages            => $messages,
167
                warnings            => $warnings
165
    );
168
    );
166
}
169
}
167
170
Lines 416-423 foreach my $biblionumber (@biblionumbers) { Link Here
416
                $num_available++;
419
                $num_available++;
417
            }
420
            }
418
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
421
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
419
422
                # If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules
420
# If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules
421
                $item->{override} = 1;
423
                $item->{override} = 1;
422
                $num_override++;
424
                $num_override++;
423
            }
425
            }
424
- 

Return to bug 4045