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

(-)a/C4/Circulation.pm (-1 / +11 lines)
Lines 2715-2721 sub CanBookBeRenewed { Link Here
2715
            $resfound = 0;
2715
            $resfound = 0;
2716
        }
2716
        }
2717
    }
2717
    }
2718
2719
    return ( 0, "on_reserve" ) if $resfound;    # '' when no hold was found
2718
    return ( 0, "on_reserve" ) if $resfound;    # '' when no hold was found
2720
2719
2721
    return ( 1, undef ) if $override_limit;
2720
    return ( 1, undef ) if $override_limit;
Lines 2727-2732 sub CanBookBeRenewed { Link Here
2727
    return ( 0, "too_many" )
2726
    return ( 0, "too_many" )
2728
      if $issuingrule->{renewalsallowed} <= $itemissue->{renewals};
2727
      if $issuingrule->{renewalsallowed} <= $itemissue->{renewals};
2729
2728
2729
    my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing');
2730
    my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing');
2731
    my $restricted = Koha::Borrower::Debarments::IsDebarred($borrowernumber);
2732
    my $hasoverdues = C4::Members::HasOverdues($borrowernumber);
2733
2734
    if ( $restricted and $restrictionblockrenewing ) {
2735
        return ( 0, 'restriction');
2736
    } elsif ( ($hasoverdues and $overduesblockrenewing eq 'block') || ($itemissue->{overdue} and $overduesblockrenewing eq 'blockitem') ) {
2737
        return ( 0, 'overdue');
2738
    }
2739
2730
    if ( $issuingrule->{norenewalbefore} ) {
2740
    if ( $issuingrule->{norenewalbefore} ) {
2731
2741
2732
        # Get current time and add norenewalbefore.
2742
        # Get current time and add norenewalbefore.
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 326-331 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
326
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
326
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
327
('OverdueNoticeCalendar',0,NULL,'Take the calendar into consideration when generating overdue notices','YesNo'),
327
('OverdueNoticeCalendar',0,NULL,'Take the calendar into consideration when generating overdue notices','YesNo'),
328
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
328
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
329
('OverduesBlockRenewing','allow','allow|blockitem|block','If any of patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','Choice'),
329
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
330
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
330
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
331
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
331
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
332
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
Lines 357-362 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
357
('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'),
358
('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'),
358
('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'),
359
('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'),
359
('ReservesNeedReturns','1','','If ON, a hold placed on an item available in this library must be checked-in, otherwise, a hold on a specific item, that is in the library & available is considered available','YesNo'),
360
('ReservesNeedReturns','1','','If ON, a hold placed on an item available in this library must be checked-in, otherwise, a hold on a specific item, that is in the library & available is considered available','YesNo'),
361
('RestrictionBlockRenewing','0',NULL,'If patron is restricted, should renewal be allowed or blocked','YesNo'),
360
('ReturnBeforeExpiry','0',NULL,'If ON, checkout will be prevented if returndate is after patron card expiry','YesNo'),
362
('ReturnBeforeExpiry','0',NULL,'If ON, checkout will be prevented if returndate is after patron card expiry','YesNo'),
361
('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'),
363
('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'),
362
('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'),
364
('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'),
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +14 lines)
Lines 9793-9799 if(CheckVersion($DBversion)) { Link Here
9793
    SetVersion($DBversion);
9793
    SetVersion($DBversion);
9794
}
9794
}
9795
9795
9796
9797
$DBversion = "3.19.00.013";
9796
$DBversion = "3.19.00.013";
9798
if ( CheckVersion($DBversion) ) {
9797
if ( CheckVersion($DBversion) ) {
9799
    $dbh->do(q|
9798
    $dbh->do(q|
Lines 9804-9809 if ( CheckVersion($DBversion) ) { Link Here
9804
    SetVersion($DBversion);
9803
    SetVersion($DBversion);
9805
}
9804
}
9806
9805
9806
$DBversion = "3.19.00.XXX";
9807
if ( CheckVersion($DBversion) ) {
9808
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverduesBlockRenewing','allow','If any of a patron checked out documents is late, should renewal be allowed, blocked only on overdue items or blocked on whatever checked out document','allow|blockitem|block','Choice')");
9809
    print "Upgrade to $DBversion done (Bug 8236: Add system preference OverduesBlockRenewing)\n";
9810
    SetVersion($DBversion);
9811
}
9812
9813
$DBversion = "3.19.00.XXX";
9814
if ( CheckVersion($DBversion) ) {
9815
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('RestrictionBlockRenewing','0','If patron is restricted, should renewal be allowed or blocked',NULL,'YesNo')");
9816
    print "Upgrade to $DBversion done (Bug 8236: Add system preference RestrictionBlockRenewing)\n";
9817
    SetVersion($DBversion);
9818
}
9819
9807
=head1 FUNCTIONS
9820
=head1 FUNCTIONS
9808
9821
9809
=head2 TableExists($table)
9822
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc (+2 lines)
Lines 2-7 Link Here
2
//<![CDATA[
2
//<![CDATA[
3
    var CIRCULATION_RETURNED = _("Checked in");
3
    var CIRCULATION_RETURNED = _("Checked in");
4
    var CIRCULATION_NOT_RETURNED = _("Unable to check in");
4
    var CIRCULATION_NOT_RETURNED = _("Unable to check in");
5
    var NOT_RENEWABLE_OVERDUE = _("Not allowed: overdue");
6
    var NOT_RENEWABLE_RESTRICTION = _("Not allowed: patron restricted");
5
    var CIRCULATION_RENEWED_DUE = _("Renewed, due:");
7
    var CIRCULATION_RENEWED_DUE = _("Renewed, due:");
6
    var CIRCULATION_RENEW_FAILED = _("Renew failed:");
8
    var CIRCULATION_RENEW_FAILED = _("Renew failed:");
7
    var NOT_CHECKED_OUT = _("not checked out");
9
    var NOT_CHECKED_OUT = _("not checked out");
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js (+18 lines)
Lines 106-111 $(document).ready(function() { Link Here
106
                        content += TOO_MANY_RENEWALS;
106
                        content += TOO_MANY_RENEWALS;
107
                    } else if ( data.error == "on_reserve" ) {
107
                    } else if ( data.error == "on_reserve" ) {
108
                        content += ON_RESERVE;
108
                        content += ON_RESERVE;
109
                    } else if ( data.error == "restriction" ) {
110
                        content += NOT_RENEWABLE_RESTRICTION;
111
                    } else if ( data.error == "overdue" ) {
112
                        content += NOT_RENEWABLE_OVERDUE;
109
                    } else if ( data.error ) {
113
                    } else if ( data.error ) {
110
                        content += data.error;
114
                        content += data.error;
111
                    } else {
115
                    } else {
Lines 303-308 $(document).ready(function() { Link Here
303
307
304
                            span_style = "display: none";
308
                            span_style = "display: none";
305
                            span_class = "renewals-allowed";
309
                            span_class = "renewals-allowed";
310
                        } else if ( oObj.can_renew_error == "restriction" ) {
311
                            content += "<span class='renewals-disabled'>"
312
                                    + NOT_RENEWABLE_RESTRICTION
313
                                    + "</span>";
314
315
                            span_style = "display: none";
316
                            span_class = "renewals-allowed";
317
                        } else if ( oObj.can_renew_error == "overdue" ) {
318
                            content += "<span class='renewals-disabled'>"
319
                                    + NOT_RENEWABLE_OVERDUE
320
                                    + "</span>";
321
322
                            span_style = "display: none";
323
                            span_class = "renewals-allowed";
306
                        } else if ( oObj.can_renew_error == "too_soon" ) {
324
                        } else if ( oObj.can_renew_error == "too_soon" ) {
307
                            content += "<span class='renewals-disabled'>"
325
                            content += "<span class='renewals-disabled'>"
308
                                    + NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date )
326
                                    + NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date )
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+15 lines)
Lines 398-403 Circulation: Link Here
398
                  yes: Enable
398
                  yes: Enable
399
                  no: Disable
399
                  no: Disable
400
            - the on-site for all cases (Even if a user is debarred, etc.).
400
            - the on-site for all cases (Even if a user is debarred, etc.).
401
        -
402
            - When a patron's checked out item is late,
403
            - pref: OverduesBlockRenewing
404
              type: choice
405
              choices:
406
                  allow: allow renewing.
407
                  blockitem: block renewing only for this item.
408
                  block: block renewing for all his items.
409
        -
410
            - If patron is restricted,
411
            - pref: RestrictionBlockRenewing
412
              choices:
413
                  yes: Block
414
                  no: Allow
415
            - renewing of items.
401
    Checkin Policy:
416
    Checkin Policy:
402
        -
417
        -
403
            - pref: BlockReturnOfWithdrawnItems
418
            - pref: BlockReturnOfWithdrawnItems
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (+4 lines)
Lines 230-235 Link Here
230
                                                        <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
230
                                                        <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
231
                                                    [% ELSIF ( ISSUE.too_many ) %]
231
                                                    [% ELSIF ( ISSUE.too_many ) %]
232
                                                        Not renewable
232
                                                        Not renewable
233
                                                    [% ELSIF ( ISSUE.norenew_overdue ) %]
234
                                                        Not allowed <span class="renewals">(overdue on a document)</span>
233
                                                    [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
235
                                                    [% ELSIF ( ISSUE.auto_renew || ISSUE.auto_too_soon ) %]
234
                                                        Automatic renewal
236
                                                        Automatic renewal
235
                                                        <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
237
                                                        <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
Lines 463-468 Link Here
463
                                                                <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber %]&amp;bornum=[% OVERDUE.borrowernumber %]">Renew</a>
465
                                                                <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber %]&amp;bornum=[% OVERDUE.borrowernumber %]">Renew</a>
464
                                                            [% END %]
466
                                                            [% END %]
465
                                                                <span class="renewals">([% OVERDUE.renewsleft %] of [% OVERDUE.renewsallowed %] renewals remaining)</span>
467
                                                                <span class="renewals">([% OVERDUE.renewsleft %] of [% OVERDUE.renewsallowed %] renewals remaining)</span>
468
                                                        [% ELSIF ( OVERDUE.norenew_overdue ) %]
469
                                                            Not allowed<span class="renewals">(overdue on a document)</span>
466
                                                        [% ELSIF ( OVERDUE.onreserve ) %]
470
                                                        [% ELSIF ( OVERDUE.onreserve ) %]
467
                                                            On hold
471
                                                            On hold
468
                                                        [% ELSE %]
472
                                                        [% ELSE %]
(-)a/opac/opac-user.pl (-1 / +3 lines)
Lines 199-204 if ($issues){ Link Here
199
        if ($renewerror) {
199
        if ($renewerror) {
200
            $issue->{'too_many'}       = 1 if $renewerror eq 'too_many';
200
            $issue->{'too_many'}       = 1 if $renewerror eq 'too_many';
201
            $issue->{'on_reserve'}     = 1 if $renewerror eq 'on_reserve';
201
            $issue->{'on_reserve'}     = 1 if $renewerror eq 'on_reserve';
202
            $issue->{'norenew_overdue'} = 1 if $renewerror eq 'overdue';
202
            $issue->{'auto_renew'}     = 1 if $renewerror eq 'auto_renew';
203
            $issue->{'auto_renew'}     = 1 if $renewerror eq 'auto_renew';
203
            $issue->{'auto_too_soon'}  = 1 if $renewerror eq 'auto_too_soon';
204
            $issue->{'auto_too_soon'}  = 1 if $renewerror eq 'auto_too_soon';
204
205
Lines 245-250 if ($issues){ Link Here
245
                }
246
                }
246
    }
247
    }
247
}
248
}
249
my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing');
250
$canrenew = 0 if ($overduesblockrenewing ne 'allow' and $overdues_count == $count);
248
$template->param( ISSUES       => \@issuedat );
251
$template->param( ISSUES       => \@issuedat );
249
$template->param( issues_count => $count );
252
$template->param( issues_count => $count );
250
$template->param( canrenew     => $canrenew );
253
$template->param( canrenew     => $canrenew );
251
- 

Return to bug 8236