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

(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 64-70 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
64
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MARCOrgCode','OSt','Define MARC Organization Code - http://www.loc.gov/marc/organizations/orgshome.html','','free');
64
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MARCOrgCode','OSt','Define MARC Organization Code - http://www.loc.gov/marc/organizations/orgshome.html','','free');
65
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MaxFine',9999,'Maximum fine a patron can have for a single late return','','Integer');
65
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MaxFine',9999,'Maximum fine a patron can have for a single late return','','Integer');
66
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxoutstanding',5,'maximum amount withstanding to be able make holds','','Integer');
66
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxoutstanding',5,'maximum amount withstanding to be able make holds','','Integer');
67
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxreserves',50,'Define maximum number of holds a patron can place','','Integer');
67
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxreserves',50,'System-wide maximum number of holds a patron can place','','Integer');
68
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxItemsInSearchResults',20,'Specify the maximum number of items to display for each result on a page of results',NULL,'free');
68
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxItemsInSearchResults',20,'Specify the maximum number of items to display for each result on a page of results',NULL,'free');
69
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('memberofinstitution',0,'If ON, patrons can be linked to institutions',NULL,'YesNo');
69
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('memberofinstitution',0,'If ON, patrons can be linked to institutions',NULL,'YesNo');
70
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('noissuescharge',5,'Define maximum amount withstanding before check outs are blocked','','Integer');
70
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('noissuescharge',5,'Define maximum amount withstanding before check outs are blocked','','Integer');
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 5392-5397 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5392
    SetVersion ($DBversion);
5392
    SetVersion ($DBversion);
5393
}
5393
}
5394
5394
5395
$DBversion = "3.09.00.XXX";
5396
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5397
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('maxreserves',50,'System-wide maximum number of holds a patron can place','','Integer')");
5398
    print "Upgrade to $DBversion done (Re-add system preference maxreserves)\n";
5399
    SetVersion($DBversion);
5400
}
5401
5395
=head1 FUNCTIONS
5402
=head1 FUNCTIONS
5396
5403
5397
=head2 TableExists($table)
5404
=head2 TableExists($table)
(-)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 (-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 277-308 if ( $borr->{'amountoutstanding'} && ($borr->{'amountoutstanding'} > $maxoutstan Link Here
277
if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} eq 1) ) {
278
if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} eq 1) ) {
278
    $noreserves = 1;
279
    $noreserves = 1;
279
    $template->param(
280
    $template->param(
280
                     message => 1,
281
        message => 1,
281
                     GNA     => 1
282
        GNA     => 1
282
                    );
283
    );
283
}
284
}
284
if ( $borr->{lost} && ($borr->{lost} eq 1) ) {
285
if ( $borr->{lost} && ($borr->{lost} eq 1) ) {
285
    $noreserves = 1;
286
    $noreserves = 1;
286
    $template->param(
287
    $template->param(
287
                     message => 1,
288
        message => 1,
288
                     lost    => 1
289
        lost    => 1
289
                    );
290
    );
290
}
291
}
291
if ( CheckBorrowerDebarred($borrowernumber) ) {
292
if ( CheckBorrowerDebarred($borrowernumber) ) {
292
    $noreserves = 1;
293
    $noreserves = 1;
293
    $template->param(
294
    $template->param(
294
                     message  => 1,
295
        message  => 1,
295
                     debarred => 1
296
        debarred => 1
296
                    );
297
    );
297
}
298
}
298
299
299
my @reserves = GetReservesFromBorrowernumber( $borrowernumber );
300
my @reserves = GetReservesFromBorrowernumber( $borrowernumber );
301
my $reserves_count = scalar(@reserves);
300
$template->param( RESERVES => \@reserves );
302
$template->param( RESERVES => \@reserves );
301
if ( $MAXIMUM_NUMBER_OF_RESERVES && (scalar(@reserves) >= $MAXIMUM_NUMBER_OF_RESERVES) ) {
303
if ( $maxreserves && ( $reserves_count >= $maxreserves ) ) {
302
    $template->param( message => 1 );
304
    $template->param( message => 1 );
303
    $noreserves = 1;
305
    $noreserves = 1;
304
    $template->param( too_many_reserves => scalar(@reserves));
306
    $template->param( too_many_reserves => scalar(@reserves));
305
}
307
}
308
309
unless ( $noreserves ) {
310
    my $requested_reserves_count = scalar( @biblionumbers );
311
    if ( $maxreserves && ( $reserves_count + $requested_reserves_count >= $maxreserves ) ) {
312
        $template->param( new_reserves_allowed => $maxreserves - $reserves_count );
313
    }
314
}
315
306
foreach my $res (@reserves) {
316
foreach my $res (@reserves) {
307
    foreach my $biblionumber (@biblionumbers) {
317
    foreach my $biblionumber (@biblionumbers) {
308
        if ( $res->{'biblionumber'} == $biblionumber && $res->{'borrowernumber'} == $borrowernumber) {
318
        if ( $res->{'biblionumber'} == $biblionumber && $res->{'borrowernumber'} == $borrowernumber) {
(-)a/reserve/request.pl (-11 / +9 lines)
Lines 141-154 if ($borrowernumber_hold && !$action) { Link Here
141
    my $count_reserv = 0;
141
    my $count_reserv = 0;
142
    my $maxreserves;
142
    my $maxreserves;
143
143
144
#   we check the reserves of the borrower, and if he can reserv a document
144
    # we check the reserves of the borrower, and if he can reserv a document
145
# FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
145
    # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
146
146
147
    my $number_reserves =
147
    my $number_reserves =
148
      GetReserveCount( $borrowerinfo->{'borrowernumber'} );
148
      GetReserveCount( $borrowerinfo->{'borrowernumber'} );
149
149
150
    if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) {
150
    if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) {
151
		$warnings = 1;
151
	$warnings = 1;
152
        $maxreserves = 1;
152
        $maxreserves = 1;
153
    }
153
    }
154
154
Lines 156-168 if ($borrowernumber_hold && !$action) { Link Here
156
    my $expiry_date = $borrowerinfo->{dateexpiry};
156
    my $expiry_date = $borrowerinfo->{dateexpiry};
157
    my $expiry = 0; # flag set if patron account has expired
157
    my $expiry = 0; # flag set if patron account has expired
158
    if ($expiry_date and $expiry_date ne '0000-00-00' and
158
    if ($expiry_date and $expiry_date ne '0000-00-00' and
159
            Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
159
        Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
160
		$messages = $expiry = 1;
160
        $messages = $expiry = 1;
161
    }
161
    }
162
162
163
    # check if the borrower make the reserv in a different branch
163
    # check if the borrower make the reserv in a different branch
164
    if ( $borrowerinfo->{'branchcode'} ne C4::Context->userenv->{'branch'} ) {
164
    if ( $borrowerinfo->{'branchcode'} ne C4::Context->userenv->{'branch'} ) {
165
		$messages = 1;
165
        $messages = 1;
166
        $diffbranch = 1;
166
        $diffbranch = 1;
167
    }
167
    }
168
168
Lines 184-191 if ($borrowernumber_hold && !$action) { Link Here
184
                maxreserves         => $maxreserves,
184
                maxreserves         => $maxreserves,
185
                expiry              => $expiry,
185
                expiry              => $expiry,
186
                diffbranch          => $diffbranch,
186
                diffbranch          => $diffbranch,
187
				messages            => $messages,
187
                messages            => $messages,
188
				warnings            => $warnings
188
                warnings            => $warnings
189
    );
189
    );
190
}
190
}
191
191
Lines 466-473 foreach my $biblionumber (@biblionumbers) { Link Here
466
                $num_available++;
466
                $num_available++;
467
            }
467
            }
468
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
468
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
469
469
                # If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules
470
# If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules
471
                $item->{override} = 1;
470
                $item->{override} = 1;
472
                $num_override++;
471
                $num_override++;
473
            }
472
            }
474
- 

Return to bug 4045