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

(-)a/C4/Circulation.pm (-3 / +43 lines)
Lines 75-80 BEGIN { Link Here
75
	push @EXPORT, qw(
75
	push @EXPORT, qw(
76
		&CanBookBeIssued
76
		&CanBookBeIssued
77
		&CanBookBeRenewed
77
		&CanBookBeRenewed
78
        &HasWhateverRenewalToBeBlocked
78
		&AddIssue
79
		&AddIssue
79
		&AddRenewal
80
		&AddRenewal
80
		&GetRenewCount
81
		&GetRenewCount
Lines 2465-2471 already renewed the loan. $error will contain the reason the renewal can not pro Link Here
2465
sub CanBookBeRenewed {
2466
sub CanBookBeRenewed {
2466
2467
2467
    # check renewal status
2468
    # check renewal status
2468
    my ( $borrowernumber, $itemnumber, $override_limit ) = @_;
2469
    my ( $borrowernumber, $itemnumber, $override_limit, $overduesblockrenew ) = @_;
2469
    my $dbh       = C4::Context->dbh;
2470
    my $dbh       = C4::Context->dbh;
2470
    my $renews    = 1;
2471
    my $renews    = 1;
2471
    my $renewokay = 0;
2472
    my $renewokay = 0;
Lines 2474-2486 sub CanBookBeRenewed { Link Here
2474
    my $borrower    = C4::Members::GetMemberDetails( $borrowernumber, 0 )   or return;
2475
    my $borrower    = C4::Members::GetMemberDetails( $borrowernumber, 0 )   or return;
2475
    my $item        = GetItem($itemnumber)                                  or return;
2476
    my $item        = GetItem($itemnumber)                                  or return;
2476
    my $itemissue   = GetItemIssue($itemnumber)                             or return;
2477
    my $itemissue   = GetItemIssue($itemnumber)                             or return;
2478
    my $overdue = $itemissue->{'overdue'};
2477
2479
2478
    my $branchcode  = _GetCircControlBranch($item, $borrower);
2480
    my $branchcode  = _GetCircControlBranch($item, $borrower);
2479
2481
2480
    my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branchcode);
2482
    my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branchcode);
2481
2483
2482
    if ( ( $issuingrule->{renewalsallowed} > $itemissue->{renewals} ) || $override_limit ) {
2484
    if ( ( $issuingrule->{renewalsallowed} > $itemissue->{renewals} ) || $override_limit ) {
2483
        $renewokay = 1;
2485
            $renewokay =  ( $overduesblockrenew eq 'blockitem' and $overdue and !$override_limit ) ? 0 : 1;
2486
            $error = 'overdue' unless $renewokay;
2484
    } else {
2487
    } else {
2485
        $error = "too_many";
2488
        $error = "too_many";
2486
    }
2489
    }
Lines 2491-2500 sub CanBookBeRenewed { Link Here
2491
        $renewokay = 0;
2494
        $renewokay = 0;
2492
        $error = "on_reserve";
2495
        $error = "on_reserve";
2493
    }
2496
    }
2494
2495
    return ( $renewokay, $error );
2497
    return ( $renewokay, $error );
2496
}
2498
}
2497
2499
2500
=head2 HasWhateverRenewalToBeBlocked
2501
2502
  ($blockallitems, $reasonwhy, $overduesblockrenew) = &HasWhateverRenewalToBeBlocked($borrowernumber, $override_limit);
2503
2504
Check whether whatever renewal must be blocked in the case patron is restricted or any of his documents are late.
2505
2506
C<$blockallitems> if true, causes the renewal to be blocked for every items.
2507
2508
C<$reasonwhy> if $blockallitems is true, will be an information displayed in checkouts table on patron page.
2509
2510
C<$overduesblockrenew> is the value of the syspref OverduesBlockRenew.
2511
2512
=cut
2513
2514
sub HasWhateverRenewalToBeBlocked {
2515
    my $borrowernumber = shift;
2516
    my $override_limit = shift;
2517
    # get the option selected for the syspref OverduesBlockRenew
2518
    my $overduesblockrenew = C4::Context->preference('OverduesBlockRenew');
2519
    my $blockallitems;
2520
    my $reasonwhy;
2521
    unless ( $override_limit ) {
2522
        # check if patron is restricted or if any of his documents are late
2523
        my ($memberblocked) = C4::Members::IsMemberBlocked($borrowernumber);
2524
        if ($memberblocked == 1) {
2525
            $reasonwhy = 'restriction';
2526
            $blockallitems = 1;
2527
        } elsif ($memberblocked == -1)  {
2528
            # check if renewal must be blocked for all the patron's documents on loan
2529
            if ( $overduesblockrenew eq 'blockall' ) {
2530
                $blockallitems = 1;
2531
                $reasonwhy = 'overdue';
2532
            }
2533
        }
2534
    }
2535
    return($blockallitems,$reasonwhy,$overduesblockrenew);
2536
}
2537
2498
=head2 AddRenewal
2538
=head2 AddRenewal
2499
2539
2500
  &AddRenewal($borrowernumber, $itemnumber, $branch, [$datedue], [$lastreneweddate]);
2540
  &AddRenewal($borrowernumber, $itemnumber, $branch, [$datedue], [$lastreneweddate]);
(-)a/C4/ILSDI/Services.pm (-1 / +2 lines)
Lines 558-564 sub RenewLoan { Link Here
558
    return { code => 'RecordNotFound' } unless $$item{itemnumber};
558
    return { code => 'RecordNotFound' } unless $$item{itemnumber};
559
559
560
    # Add renewal if possible
560
    # Add renewal if possible
561
    my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber );
561
    my ($blockallitems,$reasonwhy,$overduesblockrenew) = HasAnyRenewalToBeBlocked($borrowernumber,undef);
562
    my @renewal = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $itemnumber, undef, $overduesblockrenew );
562
    if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); }
563
    if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); }
563
564
564
    my $issue = GetItemIssue($itemnumber);
565
    my $issue = GetItemIssue($itemnumber);
(-)a/circ/circulation.pl (-3 / +5 lines)
Lines 469-474 my $displayrelissues; Link Here
469
469
470
our $totalprice = 0;
470
our $totalprice = 0;
471
471
472
my ($blockallitems, $reasonwhy, $overduesblockrenew) = HasWhateverRenewalToBeBlocked($borrowernumber, undef);
473
472
sub build_issue_data {
474
sub build_issue_data {
473
    my $issueslist = shift;
475
    my $issueslist = shift;
474
    my $relatives = shift;
476
    my $relatives = shift;
Lines 484-493 sub build_issue_data { Link Here
484
            $it->{'itemnumber'}, $it->{'borrowernumber'}
486
            $it->{'itemnumber'}, $it->{'borrowernumber'}
485
        );
487
        );
486
        $it->{'charge'} = sprintf("%.2f", $it->{'charge'});
488
        $it->{'charge'} = sprintf("%.2f", $it->{'charge'});
487
        my ($can_renew, $can_renew_error) = CanBookBeRenewed( 
489
        my ($can_renew, $can_renew_error) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed(
488
            $it->{'borrowernumber'},$it->{'itemnumber'}
490
        $it->{'borrowernumber'},$it->{'itemnumber'}, undef, $overduesblockrenew);
489
        );
490
        $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error;
491
        $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error;
492
        $it->{'blockrenewal'} = ($can_renew_error=~/overdue|restriction/) ? 1 : 0;
491
        my $restype = C4::Reserves::GetReserveStatus( $it->{'itemnumber'} );
493
        my $restype = C4::Reserves::GetReserveStatus( $it->{'itemnumber'} );
492
        $it->{'can_renew'} = $can_renew;
494
        $it->{'can_renew'} = $can_renew;
493
        $it->{'can_confirm'} = !$can_renew && !$restype;
495
        $it->{'can_confirm'} = !$can_renew && !$restype;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 287-292 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
287
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
287
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
288
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
288
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
289
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
289
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
290
('OverduesBlockRenew','allow','allow|blockitem|blockall','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'),
290
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
291
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
291
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
292
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
292
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
293
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 7306-7311 if ( CheckVersion($DBversion) ) { Link Here
7306
    SetVersion($DBversion);
7306
    SetVersion($DBversion);
7307
}
7307
}
7308
7308
7309
$DBversion = "3.13.00.XXX";
7310
if ( CheckVersion($DBversion) ) {
7311
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverduesBlockRenew','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|blockall','Choice')");
7312
    print "Upgrade to $DBversion done (Bug 8236: Add system preference OverduesBlockRenew)\n";
7313
    SetVersion($DBversion);
7314
}
7315
7309
=head1 FUNCTIONS
7316
=head1 FUNCTIONS
7310
7317
7311
=head2 TableExists($table)
7318
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+8 lines)
Lines 316-321 Circulation: Link Here
316
                  confirmation: Ask for confirmation
316
                  confirmation: Ask for confirmation
317
            - when checking out to a borrower that has overdues outstanding	    
317
            - when checking out to a borrower that has overdues outstanding	    
318
        -
318
        -
319
            - If any of a patron's checked out items are late,
320
            - pref: OverduesBlockRenew
321
              type: choice
322
              choices:
323
                  allow: allow renewing of items.
324
                  blockall: block renewing for all items.
325
                  blockitem: block renewing only for overdue items.
326
        -
319
            - On checkin route the returned item to
327
            - On checkin route the returned item to
320
            - pref: HomeOrHoldingBranchReturn
328
            - pref: HomeOrHoldingBranchReturn
321
              type: choice
329
              type: choice
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-8 / +36 lines)
Lines 28-33 var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); Link Here
28
[% IF ( borrowernumber ) %]if($.cookie("holdfor") != [% borrowernumber %]){ $.cookie("holdfor",null, { path: "/", expires: 0 }); }[% ELSE %]$.cookie("holdfor",null, { path: "/", expires: 0 });[% END %]
28
[% IF ( borrowernumber ) %]if($.cookie("holdfor") != [% borrowernumber %]){ $.cookie("holdfor",null, { path: "/", expires: 0 }); }[% ELSE %]$.cookie("holdfor",null, { path: "/", expires: 0 });[% END %]
29
[% UNLESS ( borrowernumber ) %][% UNLESS ( CGIselectborrower ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %]
29
[% UNLESS ( borrowernumber ) %][% UNLESS ( CGIselectborrower ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %]
30
	 $(document).ready(function() {
30
	 $(document).ready(function() {
31
        $(function(){ hiderenew() });
31
        $('#patronlists').tabs([% IF ( UseTablesortForCirc ) %]{
32
        $('#patronlists').tabs([% IF ( UseTablesortForCirc ) %]{
32
            // Correct table sizing for tables hidden in tabs
33
            // Correct table sizing for tables hidden in tabs
33
            // http://www.datatables.net/examples/api/tabs_and_scrolling.html
34
            // http://www.datatables.net/examples/api/tabs_and_scrolling.html
Lines 71-78 var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); Link Here
71
        $( '#override_limit' ).click( function () {
72
        $( '#override_limit' ).click( function () {
72
            if ( this.checked ) {
73
            if ( this.checked ) {
73
                $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
74
                $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
75
                $("input[name='renew_checked']").val('Renew or Return checked items');
76
                $("input[name='renew_all']").css('display','inline');
74
            } else {
77
            } else {
75
                $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
78
                $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
79
                hiderenew();
76
            }
80
            }
77
        } ).attr( 'checked', false );
81
        } ).attr( 'checked', false );
78
        [% END %][% IF ( CircAutoPrintQuickSlip ) %]
82
        [% END %][% IF ( CircAutoPrintQuickSlip ) %]
Lines 94-99 var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); Link Here
94
    [% END %]
98
    [% END %]
95
    [% END %]
99
    [% END %]
96
 });
100
 });
101
102
function hiderenew () {
103
    var valid=false;
104
    $("input[name^=items]").parent().each(function(){
105
        if($(this).css('display') !='none'){
106
            valid = true;
107
            return;
108
        }
109
    });
110
    if(!valid){
111
        $("input[name='renew_checked']").val('Return checked items');
112
        $("input[name='renew_all']").css('display','none');
113
    }
114
    return;
115
};
116
97
//]]>
117
//]]>
98
</script>
118
</script>
99
</head>
119
</head>
Lines 733-739 No patron matched <span class="ex">[% message %]</span> Link Here
733
        [% ELSE %]
753
        [% ELSE %]
734
            [% IF ( todayissue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
754
            [% IF ( todayissue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
735
                <input type="checkbox" name="all_items[]" value="[% todayissue.itemnumber %]" checked="checked" style="display: none;" />
755
                <input type="checkbox" name="all_items[]" value="[% todayissue.itemnumber %]" checked="checked" style="display: none;" />
736
                [% IF ( todayissue.od ) %]
756
                [% IF ( todayissue.od and !todayissue.blockrenewal ) %]
737
                    <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" checked="checked" />
757
                    <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" checked="checked" />
738
                [% ELSE %]
758
                [% ELSE %]
739
                    <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" />
759
                    <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" />
Lines 744-752 No patron matched <span class="ex">[% message %]</span> Link Here
744
		[% IF ( todayissue.renew_error_on_reserve ) %]
764
		[% IF ( todayissue.renew_error_on_reserve ) %]
745
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% todayissue.biblionumber %]">On hold</a>
765
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% todayissue.biblionumber %]">On hold</a>
746
		[% END %]
766
		[% END %]
747
                [% IF ( todayissue.renew_error_too_many ) %]
767
            [% IF ( todayissue.renew_error_restriction ) %]
748
            Not renewable
768
                Renewal not allowed (restriction)
749
                [% END %]
769
            [% ELSIF ( todayissue.renew_error_overdue ) %]
770
                Renewal not allowed (overdue)
771
            [% ELSIF ( todayissue.renew_error_too_many ) %]
772
                Not renewable
773
            [% END %]
750
            [% IF ( todayissue.can_confirm ) %]
774
            [% IF ( todayissue.can_confirm ) %]
751
                </span>
775
                </span>
752
            [% END %]
776
            [% END %]
Lines 822-828 No patron matched <span class="ex">[% message %]</span> Link Here
822
        [% ELSE %]
846
        [% ELSE %]
823
            [% IF ( previssue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
847
            [% IF ( previssue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
824
                <input type="checkbox" name="all_items[]" value="[% previssue.itemnumber %]" checked="checked" style="display: none;" />
848
                <input type="checkbox" name="all_items[]" value="[% previssue.itemnumber %]" checked="checked" style="display: none;" />
825
                [% IF ( previssue.od ) %]
849
                [% IF ( previssue.od and !previssue.blockrenewal ) %]
826
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" checked="checked" />
850
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" checked="checked" />
827
                [% ELSE %]
851
                [% ELSE %]
828
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" />
852
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" />
Lines 833-841 No patron matched <span class="ex">[% message %]</span> Link Here
833
		[% IF ( previssue.renew_error_on_reserve ) %]
857
		[% IF ( previssue.renew_error_on_reserve ) %]
834
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% previssue.biblionumber %]">On hold</a>
858
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% previssue.biblionumber %]">On hold</a>
835
		[% END %]
859
		[% END %]
836
                [% IF ( previssue.renew_error_too_many ) %]
860
            [% IF ( previssue.renew_error_restriction ) %]
837
            Not renewable
861
                Renewal not allowed (restriction)
838
                [% END %]
862
            [% ELSIF ( previssue.renew_error_overdue ) %]
863
                Renewal not allowed (overdue)
864
            [% ELSIF ( previssue.renew_error_too_many ) %]
865
                Not renewable
866
            [% END %]
839
            [% IF ( previssue.can_confirm ) %]
867
            [% IF ( previssue.can_confirm ) %]
840
                </span>
868
                </span>
841
            [% END %]
869
            [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-3 / +27 lines)
Lines 18-23 Link Here
18
<script type="text/JavaScript">
18
<script type="text/JavaScript">
19
//<![CDATA[
19
//<![CDATA[
20
$(document).ready(function() {
20
$(document).ready(function() {
21
    $(function(){ hiderenew() });
21
    $('#finesholdsissues').tabs({
22
    $('#finesholdsissues').tabs({
22
        // Correct table sizing for tables hidden in tabs
23
        // Correct table sizing for tables hidden in tabs
23
        // http://www.datatables.net/examples/api/tabs_and_scrolling.html
24
        // http://www.datatables.net/examples/api/tabs_and_scrolling.html
Lines 85-92 $(document).ready(function() { Link Here
85
    $( '#override_limit' ).click( function () {
86
    $( '#override_limit' ).click( function () {
86
        if ( this.checked ) {
87
        if ( this.checked ) {
87
           $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
88
           $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
89
           $("input[name='renew_checked']").val('Renew or Return checked items');
90
           $("input[name='renew_all']").css('display','inline');
88
        } else {
91
        } else {
89
           $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
92
           $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
93
           hiderenew();
90
        }
94
        }
91
    } ).attr( 'checked', false );
95
    } ).attr( 'checked', false );
92
    [% END %]
96
    [% END %]
Lines 141-146 function validate1(date) { Link Here
141
        return false;
145
        return false;
142
     }
146
     }
143
};
147
};
148
149
function hiderenew () {
150
    var valid=false;
151
    $("input[name^=items]").parent().each(function(){
152
        if($(this).css('display') !='none'){
153
            valid = true;
154
            return;
155
        }
156
    });
157
    if(!valid){
158
        $("input[name='renew_checked']").val('Return checked items');
159
        $("input[name='renew_all']").css('display','none');
160
    }
161
    return;
162
};
163
144
//]]>
164
//]]>
145
</script>
165
</script>
146
166
Lines 496-502 function validate1(date) { Link Here
496
            [% IF ( issueloo.norenew ) %]
516
            [% IF ( issueloo.norenew ) %]
497
                [% IF ( issueloo.can_confirm ) %]<span class="renewals-allowed" style="display: none">
517
                [% IF ( issueloo.can_confirm ) %]<span class="renewals-allowed" style="display: none">
498
                    <input type="checkbox" name="all_items[]" value="[% issueloo.itemnumber %]" checked="checked" style="display: none;" />
518
                    <input type="checkbox" name="all_items[]" value="[% issueloo.itemnumber %]" checked="checked" style="display: none;" />
499
                    [% IF ( issueloo.od ) %]
519
                    [% IF ( issueloo.od  and !issueloo.blockrenewal ) %]
500
                        <input type="checkbox" name="items[]" value="[% issueloo.itemnumber %]" checked="checked" />
520
                        <input type="checkbox" name="items[]" value="[% issueloo.itemnumber %]" checked="checked" />
501
                    [% ELSE %]
521
                    [% ELSE %]
502
                        <input type="checkbox" name="items[]" value="[% issueloo.itemnumber %]" />
522
                        <input type="checkbox" name="items[]" value="[% issueloo.itemnumber %]" />
Lines 507-515 function validate1(date) { Link Here
507
                [% IF ( issueloo.norenew_reason_on_reserve ) %]
527
                [% IF ( issueloo.norenew_reason_on_reserve ) %]
508
                <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% issueloo.biblionumber %]">On Hold</a>
528
                <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% issueloo.biblionumber %]">On Hold</a>
509
                [% END %]
529
                [% END %]
510
                    [% IF ( issueloo.norenew_reason_too_many ) %]
530
                [% IF ( issueloo.norenew_reason_restriction ) %]
531
                    Renewal not allowed (restriction)
532
                [% ELSIF ( issueloo.norenew_reason_overdue ) %]
533
                    Renewal not allowed (overdue)
534
                [% ELSIF ( issueloo.norenew_reason_too_many ) %]
511
                        Not renewable
535
                        Not renewable
512
                    [% END %]
536
                [% END %]
513
                [% IF ( issueloo.can_confirm ) %]
537
                [% IF ( issueloo.can_confirm ) %]
514
                    </span>
538
                    </span>
515
                [% END %]
539
                [% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (+5 lines)
Lines 191-197 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
191
                [% IF ( OpacRenewalAllowed ) %]
191
                [% IF ( OpacRenewalAllowed ) %]
192
                    <td class="renew">[% IF ( ISSUE.status ) %][% IF ( canrenew ) %]<input type="checkbox" name="item" value="[% ISSUE.itemnumber %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber %]&amp;borrowernumber=[% ISSUE.borrowernumber %]">Renew</a>[% END %] <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
192
                    <td class="renew">[% IF ( ISSUE.status ) %][% IF ( canrenew ) %]<input type="checkbox" name="item" value="[% ISSUE.itemnumber %]"/> <a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% ISSUE.itemnumber %]&amp;borrowernumber=[% ISSUE.borrowernumber %]">Renew</a>[% END %] <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>
193
                        [% ELSE %]
193
                        [% ELSE %]
194
                        [% IF ( ISSUE.norenew_overdue ) %]
195
                           Renewal not allowed <span class="renewals">(overdue on a document)</span>
196
                        [% ELSE %]
194
                        Not renewable[% IF ( ISSUE.too_many ) %] <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>[% ELSE %][% IF ( ISSUE.on_reserve ) %] <span class="renewals">(On hold)</span>[% END %][% END %] 
197
                        Not renewable[% IF ( ISSUE.too_many ) %] <span class="renewals">([% ISSUE.renewsleft %] of [% ISSUE.renewsallowed %] renewals remaining)</span>[% ELSE %][% IF ( ISSUE.on_reserve ) %] <span class="renewals">(On hold)</span>[% END %][% END %] 
198
                        [% END %]
195
                        [% END %]</td>
199
                        [% END %]</td>
196
                [% END %]
200
                [% END %]
197
[% IF ( OPACFinesTab ) %]
201
[% IF ( OPACFinesTab ) %]
Lines 335-340 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
335
[% ELSIF ( OVERDUE.status ) %]
339
[% ELSIF ( OVERDUE.status ) %]
336
[% IF ( canrenew ) %]<a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber %]&amp;bornum=[% OVERDUE.borrowernumber %]">Renew</a>[% END %] <span class="renewals">([% OVERDUE.renewsleft %] of [% OVERDUE.renewsallowed %] renewals remaining)</span>
340
[% IF ( canrenew ) %]<a href="/cgi-bin/koha/opac-renew.pl?from=opac_user&amp;item=[% OVERDUE.itemnumber %]&amp;bornum=[% OVERDUE.borrowernumber %]">Renew</a>[% END %] <span class="renewals">([% OVERDUE.renewsleft %] of [% OVERDUE.renewsallowed %] renewals remaining)</span>
337
[% ELSIF ( OVERDUE.onreserve ) %]On hold
341
[% ELSIF ( OVERDUE.onreserve ) %]On hold
342
[% ELSIF ( OVERDUE.norenew_overdue ) %]Renewal not allowed<span class="renewals">(overdue on a document)</span>
338
[% ELSE %]No renewals left
343
[% ELSE %]No renewals left
339
[% END %]
344
[% END %]
340
</td>[% END %]
345
</td>[% END %]
(-)a/members/moremember.pl (-3 / +4 lines)
Lines 251-256 my @borrowers_with_issues; Link Here
251
my $overdues_exist = 0;
251
my $overdues_exist = 0;
252
my $totalprice = 0;
252
my $totalprice = 0;
253
253
254
my ($blockallitems, $reasonwhy, $overduesblockrenew) = HasWhateverRenewalToBeBlocked($borrowernumber, $override_limit);
255
254
my @issuedata = build_issue_data($issue);
256
my @issuedata = build_issue_data($issue);
255
my @relissuedata = build_issue_data($relissue);
257
my @relissuedata = build_issue_data($relissue);
256
258
Lines 506-517 sub build_issue_data { Link Here
506
508
507
        $row{'charge'} = sprintf( "%.2f", $charge );
509
        $row{'charge'} = sprintf( "%.2f", $charge );
508
510
509
        my ( $renewokay, $renewerror ) =
511
        my ( $renewokay, $renewerror ) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $issue->{itemnumber}, $override_limit, $overduesblockrenew );
510
          CanBookBeRenewed( $borrowernumber, $issue->{itemnumber},
511
            $override_limit );
512
        $row{'norenew'} = !$renewokay;
512
        $row{'norenew'} = !$renewokay;
513
        $row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' );
513
        $row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' );
514
        $row{"norenew_reason_$renewerror"} = 1 if $renewerror;
514
        $row{"norenew_reason_$renewerror"} = 1 if $renewerror;
515
        $row{'blockrenewal'} = ($renewerror=~ /overdue|restriction/) ? 1 : 0;
515
        $row{renew_failed}  = $renew_failed{ $issue->{itemnumber} };
516
        $row{renew_failed}  = $renew_failed{ $issue->{itemnumber} };
516
        $row{return_failed} = $return_failed{ $issue->{barcode} };
517
        $row{return_failed} = $return_failed{ $issue->{barcode} };
517
        push( @{$localissue}, \%row );
518
        push( @{$localissue}, \%row );
(-)a/opac/opac-renew.pl (-1 / +4 lines)
Lines 46-53 my @items = $query->param('item'); Link Here
46
my $opacrenew = C4::Context->preference("OpacRenewalAllowed");
46
my $opacrenew = C4::Context->preference("OpacRenewalAllowed");
47
47
48
my $errorstring='';
48
my $errorstring='';
49
50
my ($blockallitems, $reasonwhy, $overduesblockrenew) = HasWhateverRenewalToBeBlocked($borrowernumber, $override_limit);
51
49
for my $itemnumber ( @items ) {
52
for my $itemnumber ( @items ) {
50
    my ($status,$error) = CanBookBeRenewed( $borrowernumber, $itemnumber );
53
    my ($status,$error) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $itemnumber, undef, $overduesblockrenew );
51
    if ( $status == 1 && $opacrenew == 1 ) {
54
    if ( $status == 1 && $opacrenew == 1 ) {
52
	my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
55
	my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
53
	my $branchcode;
56
	my $branchcode;
(-)a/opac/opac-user.pl (-1 / +8 lines)
Lines 155-160 my @overdues; Link Here
155
my @issuedat;
155
my @issuedat;
156
my $itemtypes = GetItemTypes();
156
my $itemtypes = GetItemTypes();
157
my $issues = GetPendingIssues($borrowernumber);
157
my $issues = GetPendingIssues($borrowernumber);
158
159
my ($blockallitems, $reasonwhy, $overduesblockrenew) = HasWhateverRenewalToBeBlocked($borrowernumber, undef);
160
158
if ($issues){
161
if ($issues){
159
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
162
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
160
        # check for reserves
163
        # check for reserves
Lines 178-188 if ($issues){ Link Here
178
        $issue->{'charges'} = $charges;
181
        $issue->{'charges'} = $charges;
179
        $issue->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($issue->{'biblionumber'}), GetFrameworkCode($issue->{'biblionumber'}));
182
        $issue->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($issue->{'biblionumber'}), GetFrameworkCode($issue->{'biblionumber'}));
180
        # check if item is renewable
183
        # check if item is renewable
181
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
184
        my ($status,$renewerror) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'}, undef, $overduesblockrenew);
182
        ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
185
        ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
183
        if($status && C4::Context->preference("OpacRenewalAllowed")){
186
        if($status && C4::Context->preference("OpacRenewalAllowed")){
184
            $issue->{'status'} = $status;
187
            $issue->{'status'} = $status;
185
        }
188
        }
189
        $issue->{'norenew_overdue'} = 1 if $renewerror and $renewerror eq 'overdue';
186
        $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
190
        $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
187
        $issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
191
        $issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
188
192
Lines 218-223 if ($issues){ Link Here
218
                }
222
                }
219
    }
223
    }
220
}
224
}
225
226
$canrenew = 0 if ($overduesblockrenew ne 'allow' and $overdues_count == $count);
227
221
$template->param( ISSUES       => \@issuedat );
228
$template->param( ISSUES       => \@issuedat );
222
$template->param( issues_count => $count );
229
$template->param( issues_count => $count );
223
$template->param( canrenew     => $canrenew );
230
$template->param( canrenew     => $canrenew );
(-)a/reserve/renewscript.pl (-2 / +3 lines)
Lines 81-91 my $borrowernumber = $input->param("borrowernumber"); Link Here
81
my $exemptfine     = $input->param("exemptfine") || 0;
81
my $exemptfine     = $input->param("exemptfine") || 0;
82
my $override_limit = $input->param("override_limit") || 0;
82
my $override_limit = $input->param("override_limit") || 0;
83
my $failedrenews   = q{};
83
my $failedrenews   = q{};
84
my ($blockallitems, $reasonwhy, $overduesblockrenew) = HasWhateverRenewalToBeBlocked($borrowernumber, $override_limit);
85
84
foreach my $itemno (@data) {
86
foreach my $itemno (@data) {
85
87
86
    # check status before renewing issue
88
    # check status before renewing issue
87
    my ( $renewokay, $error ) =
89
    my ( $renewokay, $error ) =
88
      CanBookBeRenewed( $borrowernumber, $itemno, $override_limit );
90
        $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $itemno, $override_limit, $overduesblockrenew );
89
    if ($renewokay) {
91
    if ($renewokay) {
90
        AddRenewal( $borrowernumber, $itemno, $branch, $datedue );
92
        AddRenewal( $borrowernumber, $itemno, $branch, $datedue );
91
    }
93
    }
92
- 

Return to bug 8236