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 4712-4717 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4712
    SetVersion($DBversion);
4712
    SetVersion($DBversion);
4713
}
4713
}
4714
4714
4715
$DBversion = "3.07.00.XXX";
4716
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4717
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('maxreserves',50,'System-wide maximum number of holds a patron can place','','Integer')");
4718
    print "Upgrade to $DBversion done (Re-add system preference maxreserves)\n";
4719
    SetVersion($DBversion);
4720
}
4721
4715
=head1 FUNCTIONS
4722
=head1 FUNCTIONS
4716
4723
4717
=head2 DropAllForeignKeys($table)
4724
=head2 DropAllForeignKeys($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 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) {
(-)a/reserve/request.pl (-11 / +9 lines)
Lines 135-148 if ($borrowernumber_hold && !$action) { Link Here
135
    my $count_reserv = 0;
135
    my $count_reserv = 0;
136
    my $maxreserves;
136
    my $maxreserves;
137
137
138
#   we check the reserves of the borrower, and if he can reserv a document
138
    # we check the reserves of the borrower, and if he can reserv a document
139
# FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
139
    # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
140
140
141
    my $number_reserves =
141
    my $number_reserves =
142
      GetReserveCount( $borrowerinfo->{'borrowernumber'} );
142
      GetReserveCount( $borrowerinfo->{'borrowernumber'} );
143
143
144
    if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) {
144
    if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) {
145
		$warnings = 1;
145
	$warnings = 1;
146
        $maxreserves = 1;
146
        $maxreserves = 1;
147
    }
147
    }
148
148
Lines 150-162 if ($borrowernumber_hold && !$action) { Link Here
150
    my $expiry_date = $borrowerinfo->{dateexpiry};
150
    my $expiry_date = $borrowerinfo->{dateexpiry};
151
    my $expiry = 0; # flag set if patron account has expired
151
    my $expiry = 0; # flag set if patron account has expired
152
    if ($expiry_date and $expiry_date ne '0000-00-00' and
152
    if ($expiry_date and $expiry_date ne '0000-00-00' and
153
            Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
153
        Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
154
		$messages = $expiry = 1;
154
        $messages = $expiry = 1;
155
    }
155
    }
156
156
157
    # check if the borrower make the reserv in a different branch
157
    # check if the borrower make the reserv in a different branch
158
    if ( $borrowerinfo->{'branchcode'} ne C4::Context->userenv->{'branch'} ) {
158
    if ( $borrowerinfo->{'branchcode'} ne C4::Context->userenv->{'branch'} ) {
159
		$messages = 1;
159
        $messages = 1;
160
        $diffbranch = 1;
160
        $diffbranch = 1;
161
    }
161
    }
162
162
Lines 178-185 if ($borrowernumber_hold && !$action) { Link Here
178
                maxreserves         => $maxreserves,
178
                maxreserves         => $maxreserves,
179
                expiry              => $expiry,
179
                expiry              => $expiry,
180
                diffbranch          => $diffbranch,
180
                diffbranch          => $diffbranch,
181
				messages            => $messages,
181
                messages            => $messages,
182
				warnings            => $warnings
182
                warnings            => $warnings
183
    );
183
    );
184
}
184
}
185
185
Lines 460-467 foreach my $biblionumber (@biblionumbers) { Link Here
460
                $num_available++;
460
                $num_available++;
461
            }
461
            }
462
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
462
            elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
463
463
                # If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules
464
# If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules
465
                $item->{override} = 1;
464
                $item->{override} = 1;
466
                $num_override++;
465
                $num_override++;
467
            }
466
            }
468
- 

Return to bug 4045