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

(-)a/C4/Circulation.pm (-1 / +11 lines)
Lines 2716-2722 sub CanBookBeRenewed { Link Here
2716
            $resfound = 0;
2716
            $resfound = 0;
2717
        }
2717
        }
2718
    }
2718
    }
2719
2720
    return ( 0, "on_reserve" ) if $resfound;    # '' when no hold was found
2719
    return ( 0, "on_reserve" ) if $resfound;    # '' when no hold was found
2721
2720
2722
    return ( 1, undef ) if $override_limit;
2721
    return ( 1, undef ) if $override_limit;
Lines 2728-2733 sub CanBookBeRenewed { Link Here
2728
    return ( 0, "too_many" )
2727
    return ( 0, "too_many" )
2729
      if $issuingrule->{renewalsallowed} <= $itemissue->{renewals};
2728
      if $issuingrule->{renewalsallowed} <= $itemissue->{renewals};
2730
2729
2730
    my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing');
2731
    my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing');
2732
    my $restricted = Koha::Borrower::Debarments::IsDebarred($borrowernumber);
2733
    my $hasoverdues = C4::Members::HasOverdues($borrowernumber);
2734
2735
    if ( $restricted and $restrictionblockrenewing ) {
2736
        return ( 0, 'restriction');
2737
    } elsif ( ($hasoverdues and $overduesblockrenewing eq 'block') || ($itemissue->{overdue} and $overduesblockrenewing eq 'blockitem') ) {
2738
        return ( 0, 'overdue');
2739
    }
2740
2731
    if ( $issuingrule->{norenewalbefore} ) {
2741
    if ( $issuingrule->{norenewalbefore} ) {
2732
2742
2733
        # Get current time and add norenewalbefore.
2743
        # Get current time and add norenewalbefore.
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 324-329 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
324
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
324
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
325
('OverdueNoticeCalendar',0,NULL,'Take the calendar into consideration when generating overdue notices','YesNo'),
325
('OverdueNoticeCalendar',0,NULL,'Take the calendar into consideration when generating overdue notices','YesNo'),
326
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
326
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
327
('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'),
327
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
328
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
328
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
329
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
329
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
330
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
Lines 355-360 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
355
('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'),
356
('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'),
356
('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'),
357
('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'),
357
('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'),
358
('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'),
359
('RestrictionBlockRenewing','0',NULL,'If patron is restricted, should renewal be allowed or blocked','YesNo'),
358
('ReturnBeforeExpiry','0',NULL,'If ON, checkout will be prevented if returndate is after patron card expiry','YesNo'),
360
('ReturnBeforeExpiry','0',NULL,'If ON, checkout will be prevented if returndate is after patron card expiry','YesNo'),
359
('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'),
361
('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'),
360
('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'),
362
('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 (+14 lines)
Lines 9902-9907 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
9902
    SetVersion ($DBversion);
9902
    SetVersion ($DBversion);
9903
}
9903
}
9904
9904
9905
$DBversion = "3.19.00.XXX";
9906
if ( CheckVersion($DBversion) ) {
9907
    $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')");
9908
    print "Upgrade to $DBversion done (Bug 8236: Add system preference OverduesBlockRenewing)\n";
9909
    SetVersion($DBversion);
9910
}
9911
9912
$DBversion = "3.19.00.XXX";
9913
if ( CheckVersion($DBversion) ) {
9914
    $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')");
9915
    print "Upgrade to $DBversion done (Bug 8236: Add system preference RestrictionBlockRenewing)\n";
9916
    SetVersion($DBversion);
9917
}
9918
9905
=head1 FUNCTIONS
9919
=head1 FUNCTIONS
9906
9920
9907
=head2 TableExists($table)
9921
=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