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

(-)a/C4/Circulation.pm (-1 / +11 lines)
Lines 2713-2719 sub CanBookBeRenewed { Link Here
2713
            $resfound = 0;
2713
            $resfound = 0;
2714
        }
2714
        }
2715
    }
2715
    }
2716
2717
    return ( 0, "on_reserve" ) if $resfound;    # '' when no hold was found
2716
    return ( 0, "on_reserve" ) if $resfound;    # '' when no hold was found
2718
2717
2719
    return ( 1, undef ) if $override_limit;
2718
    return ( 1, undef ) if $override_limit;
Lines 2725-2730 sub CanBookBeRenewed { Link Here
2725
    return ( 0, "too_many" )
2724
    return ( 0, "too_many" )
2726
      if $issuingrule->{renewalsallowed} <= $itemissue->{renewals};
2725
      if $issuingrule->{renewalsallowed} <= $itemissue->{renewals};
2727
2726
2727
    my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing');
2728
    my $restrictionblockrenewing = C4::Context->preference('RestrictionBlockRenewing');
2729
    my $restricted = Koha::Borrower::Debarments::IsDebarred($borrowernumber);
2730
    my $hasoverdues = HasOverdues($borrowernumber);
2731
2732
    if ( $restricted and $restrictionblockrenewing ) {
2733
        return ( 0, 'restriction');
2734
    } elsif ( ($hasoverdues and $overduesblockrenewing eq 'block') || ($itemissue->{overdue} and $overduesblockrenewing eq 'blockitem') ) {
2735
        return ( 0, 'overdue');
2736
    }
2737
2728
    if ( $issuingrule->{norenewalbefore} ) {
2738
    if ( $issuingrule->{norenewalbefore} ) {
2729
2739
2730
        # Get current time and add norenewalbefore.
2740
        # 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 (+14 lines)
Lines 9585-9590 if ( CheckVersion($DBversion) ) { Link Here
9585
    SetVersion ($DBversion);
9585
    SetVersion ($DBversion);
9586
}
9586
}
9587
9587
9588
$DBversion = "3.19.00.XXX";
9589
if ( CheckVersion($DBversion) ) {
9590
    $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')");
9591
    print "Upgrade to $DBversion done (Bug 8236: Add system preference OverduesBlockRenewing)\n";
9592
    SetVersion($DBversion);
9593
}
9594
9595
$DBversion = "3.19.00.XXX";
9596
if ( CheckVersion($DBversion) ) {
9597
    $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')");
9598
    print "Upgrade to $DBversion done (Bug 8236: Add system preference RestrictionBlockRenewing)\n";
9599
    SetVersion($DBversion);
9600
}
9601
9588
=head1 FUNCTIONS
9602
=head1 FUNCTIONS
9589
9603
9590
=head2 TableExists($table)
9604
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc (+3 lines)
Lines 1-5 Link Here
1
<script type="text/javascript">
1
<script type="text/javascript">
2
//<![CDATA[
2
//<![CDATA[
3
    var NOT_RENEWABLE_OVERDUE = _("Not allowed: overdue");
4
    var NOT_RENEWABLE_RESTRICTION = _("Not allowed: patron restricted");
3
    var CIRCULATION_RETURNED = _("Returned");
5
    var CIRCULATION_RETURNED = _("Returned");
4
    var CIRCULATION_NOT_RETURNED = _("Unable to return");
6
    var CIRCULATION_NOT_RETURNED = _("Unable to return");
5
    var CIRCULATION_RENEWED_DUE = _("Renewed, due:");
7
    var CIRCULATION_RENEWED_DUE = _("Renewed, due:");
Lines 27-31 Link Here
27
    var NO = _("No");
29
    var NO = _("No");
28
    var YES = _("Yes");
30
    var YES = _("Yes");
29
    var INHOUSE_USE = _("On-site checkout");
31
    var INHOUSE_USE = _("On-site checkout");
32
    var NO = _("No");
30
//]]>
33
//]]>
31
</script>
34
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js (+18 lines)
Lines 103-108 $(document).ready(function() { Link Here
103
                        content += TOO_MANY_RENEWALS;
103
                        content += TOO_MANY_RENEWALS;
104
                    } else if ( data.error == "on_reserve" ) {
104
                    } else if ( data.error == "on_reserve" ) {
105
                        content += ON_RESERVE;
105
                        content += ON_RESERVE;
106
                    } else if ( data.error == "restriction" ) {
107
                        content += NOT_RENEWABLE_RESTRICTION;
108
                    } else if ( data.error == "overdue" ) {
109
                        content += NOT_RENEWABLE_OVERDUE;
106
                    } else if ( data.error ) {
110
                    } else if ( data.error ) {
107
                        content += data.error;
111
                        content += data.error;
108
                    } else {
112
                    } else {
Lines 294-299 $(document).ready(function() { Link Here
294
298
295
                            span_style = "display: none";
299
                            span_style = "display: none";
296
                            span_class = "renewals-allowed";
300
                            span_class = "renewals-allowed";
301
                        } else if ( oObj.can_renew_error == "restriction" ) {
302
                            content += "<span class='renewals-disabled'>"
303
                                    + NOT_RENEWABLE_RESTRICTION
304
                                    + "</span>";
305
306
                            span_style = "display: none";
307
                            span_class = "renewals-allowed";
308
                        } else if ( oObj.can_renew_error == "overdue" ) {
309
                            content += "<span class='renewals-disabled'>"
310
                                    + NOT_RENEWABLE_OVERDUE
311
                                    + "</span>";
312
313
                            span_style = "display: none";
314
                            span_class = "renewals-allowed";
297
                        } else if ( oObj.can_renew_error == "too_soon" ) {
315
                        } else if ( oObj.can_renew_error == "too_soon" ) {
298
                            content += "<span class='renewals-disabled'>"
316
                            content += "<span class='renewals-disabled'>"
299
                                    + NOT_RENEWABLE_TOO_SOON.format( oObj.can_renew_date )
317
                                    + 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