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 2467-2473 already renewed the loan. $error will contain the reason the renewal can not pro Link Here
2467
sub CanBookBeRenewed {
2468
sub CanBookBeRenewed {
2468
2469
2469
    # check renewal status
2470
    # check renewal status
2470
    my ( $borrowernumber, $itemnumber, $override_limit ) = @_;
2471
    my ( $borrowernumber, $itemnumber, $override_limit, $overduesblockrenew ) = @_;
2471
    my $dbh       = C4::Context->dbh;
2472
    my $dbh       = C4::Context->dbh;
2472
    my $renews    = 1;
2473
    my $renews    = 1;
2473
    my $renewokay = 0;
2474
    my $renewokay = 0;
Lines 2476-2488 sub CanBookBeRenewed { Link Here
2476
    my $borrower    = C4::Members::GetMemberDetails( $borrowernumber, 0 )   or return;
2477
    my $borrower    = C4::Members::GetMemberDetails( $borrowernumber, 0 )   or return;
2477
    my $item        = GetItem($itemnumber)                                  or return;
2478
    my $item        = GetItem($itemnumber)                                  or return;
2478
    my $itemissue   = GetItemIssue($itemnumber)                             or return;
2479
    my $itemissue   = GetItemIssue($itemnumber)                             or return;
2480
    my $overdue = $itemissue->{'overdue'};
2479
2481
2480
    my $branchcode  = _GetCircControlBranch($item, $borrower);
2482
    my $branchcode  = _GetCircControlBranch($item, $borrower);
2481
2483
2482
    my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branchcode);
2484
    my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branchcode);
2483
2485
2484
    if ( ( $issuingrule->{renewalsallowed} > $itemissue->{renewals} ) || $override_limit ) {
2486
    if ( ( $issuingrule->{renewalsallowed} > $itemissue->{renewals} ) || $override_limit ) {
2485
        $renewokay = 1;
2487
            $renewokay =  ( $overduesblockrenew eq 'blockitem' and $overdue and !$override_limit ) ? 0 : 1;
2488
            $error = 'overdue' unless $renewokay;
2486
    } else {
2489
    } else {
2487
        $error = "too_many";
2490
        $error = "too_many";
2488
    }
2491
    }
Lines 2493-2502 sub CanBookBeRenewed { Link Here
2493
        $renewokay = 0;
2496
        $renewokay = 0;
2494
        $error = "on_reserve";
2497
        $error = "on_reserve";
2495
    }
2498
    }
2496
2497
    return ( $renewokay, $error );
2499
    return ( $renewokay, $error );
2498
}
2500
}
2499
2501
2502
=head2 HasWhateverRenewalToBeBlocked
2503
2504
  ($blockallitems, $reasonwhy, $overduesblockrenew) = &HasWhateverRenewalToBeBlocked($borrowernumber, $override_limit);
2505
2506
Check whether whatever renewal must be blocked in the case patron is restricted or any of his documents are late.
2507
2508
C<$blockallitems> if true, causes the renewal to be blocked for every items.
2509
2510
C<$reasonwhy> if $blockallitems is true, will be an information displayed in checkouts table on patron page.
2511
2512
C<$overduesblockrenew> is the value of the syspref OverduesBlockRenew.
2513
2514
=cut
2515
2516
sub HasWhateverRenewalToBeBlocked {
2517
    my $borrowernumber = shift;
2518
    my $override_limit = shift;
2519
    # get the option selected for the syspref OverduesBlockRenew
2520
    my $overduesblockrenew = C4::Context->preference('OverduesBlockRenew');
2521
    my $blockallitems;
2522
    my $reasonwhy;
2523
    unless ( $override_limit ) {
2524
        # check if patron is restricted or if any of his documents are late
2525
        my ($memberblocked) = C4::Members::IsMemberBlocked($borrowernumber);
2526
        if ($memberblocked == 1) {
2527
            $reasonwhy = 'restriction';
2528
            $blockallitems = 1;
2529
        } elsif ($memberblocked == -1)  {
2530
            # check if renewal must be blocked for all the patron's documents on loan
2531
            if ( $overduesblockrenew eq 'blockall' ) {
2532
                $blockallitems = 1;
2533
                $reasonwhy = 'overdue';
2534
            }
2535
        }
2536
    }
2537
    return($blockallitems,$reasonwhy,$overduesblockrenew);
2538
}
2539
2500
=head2 AddRenewal
2540
=head2 AddRenewal
2501
2541
2502
  &AddRenewal($borrowernumber, $itemnumber, $branch, [$datedue], [$lastreneweddate]);
2542
  &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 285-290 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
285
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
285
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
286
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
286
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
287
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
287
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
288
('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'),
288
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
289
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
289
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
290
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
290
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
291
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 7139-7144 if ( CheckVersion($DBversion) ) { Link Here
7139
    SetVersion ($DBversion);
7139
    SetVersion ($DBversion);
7140
}
7140
}
7141
7141
7142
$DBversion = "3.13.00.XXX";
7143
if ( CheckVersion($DBversion) ) {
7144
    $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')");
7145
    print "Upgrade to $DBversion done (Bug 8236: Add system preference OverduesBlockRenew)\n";
7146
    SetVersion($DBversion);
7147
}
7148
7142
=head1 FUNCTIONS
7149
=head1 FUNCTIONS
7143
7150
7144
=head2 TableExists($table)
7151
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+8 lines)
Lines 310-315 Circulation: Link Here
310
                  confirmation: Ask for confirmation
310
                  confirmation: Ask for confirmation
311
            - when checking out to a borrower that has overdues outstanding	    
311
            - when checking out to a borrower that has overdues outstanding	    
312
        -
312
        -
313
            - If any of a patron's checked out items are late,
314
            - pref: OverduesBlockRenew
315
              type: choice
316
              choices:
317
                  allow: allow renewing of items.
318
                  blockall: block renewing for all items.
319
                  blockitem: block renewing only for overdue items.
320
        -
313
            - On checkin route the returned item to
321
            - On checkin route the returned item to
314
            - pref: HomeOrHoldingBranchReturn
322
            - pref: HomeOrHoldingBranchReturn
315
              type: choice
323
              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