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 2466-2472 already renewed the loan. $error will contain the reason the renewal can not pro Link Here
2466
sub CanBookBeRenewed {
2467
sub CanBookBeRenewed {
2467
2468
2468
    # check renewal status
2469
    # check renewal status
2469
    my ( $borrowernumber, $itemnumber, $override_limit ) = @_;
2470
    my ( $borrowernumber, $itemnumber, $override_limit, $overduesblockrenew ) = @_;
2470
    my $dbh       = C4::Context->dbh;
2471
    my $dbh       = C4::Context->dbh;
2471
    my $renews    = 1;
2472
    my $renews    = 1;
2472
    my $renewokay = 0;
2473
    my $renewokay = 0;
Lines 2475-2487 sub CanBookBeRenewed { Link Here
2475
    my $borrower    = C4::Members::GetMemberDetails( $borrowernumber, 0 )   or return;
2476
    my $borrower    = C4::Members::GetMemberDetails( $borrowernumber, 0 )   or return;
2476
    my $item        = GetItem($itemnumber)                                  or return;
2477
    my $item        = GetItem($itemnumber)                                  or return;
2477
    my $itemissue   = GetItemIssue($itemnumber)                             or return;
2478
    my $itemissue   = GetItemIssue($itemnumber)                             or return;
2479
    my $overdue = $itemissue->{'overdue'};
2478
2480
2479
    my $branchcode  = _GetCircControlBranch($item, $borrower);
2481
    my $branchcode  = _GetCircControlBranch($item, $borrower);
2480
2482
2481
    my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branchcode);
2483
    my $issuingrule = GetIssuingRule($borrower->{categorycode}, $item->{itype}, $branchcode);
2482
2484
2483
    if ( ( $issuingrule->{renewalsallowed} > $itemissue->{renewals} ) || $override_limit ) {
2485
    if ( ( $issuingrule->{renewalsallowed} > $itemissue->{renewals} ) || $override_limit ) {
2484
        $renewokay = 1;
2486
            $renewokay =  ( $overduesblockrenew eq 'blockitem' and $overdue and !$override_limit ) ? 0 : 1;
2487
            $error = 'overdue' unless $renewokay;
2485
    } else {
2488
    } else {
2486
        $error = "too_many";
2489
        $error = "too_many";
2487
    }
2490
    }
Lines 2492-2501 sub CanBookBeRenewed { Link Here
2492
        $renewokay = 0;
2495
        $renewokay = 0;
2493
        $error = "on_reserve";
2496
        $error = "on_reserve";
2494
    }
2497
    }
2495
2496
    return ( $renewokay, $error );
2498
    return ( $renewokay, $error );
2497
}
2499
}
2498
2500
2501
=head2 HasWhateverRenewalToBeBlocked
2502
2503
  ($blockallitems, $reasonwhy, $overduesblockrenew) = &HasWhateverRenewalToBeBlocked($borrowernumber, $override_limit);
2504
2505
Check whether whatever renewal must be blocked in the case patron is restricted or any of his documents are late.
2506
2507
C<$blockallitems> if true, causes the renewal to be blocked for every items.
2508
2509
C<$reasonwhy> if $blockallitems is true, will be an information displayed in checkouts table on patron page.
2510
2511
C<$overduesblockrenew> is the value of the syspref OverduesBlockRenew.
2512
2513
=cut
2514
2515
sub HasWhateverRenewalToBeBlocked {
2516
    my $borrowernumber = shift;
2517
    my $override_limit = shift;
2518
    # get the option selected for the syspref OverduesBlockRenew
2519
    my $overduesblockrenew = C4::Context->preference('OverduesBlockRenew');
2520
    my $blockallitems;
2521
    my $reasonwhy;
2522
    unless ( $override_limit ) {
2523
        # check if patron is restricted or if any of his documents are late
2524
        my ($memberblocked) = C4::Members::IsMemberBlocked($borrowernumber);
2525
        if ($memberblocked == 1) {
2526
            $reasonwhy = 'restriction';
2527
            $blockallitems = 1;
2528
        } elsif ($memberblocked == -1)  {
2529
            # check if renewal must be blocked for all the patron's documents on loan
2530
            if ( $overduesblockrenew eq 'blockall' ) {
2531
                $blockallitems = 1;
2532
                $reasonwhy = 'overdue';
2533
            }
2534
        }
2535
    }
2536
    return($blockallitems,$reasonwhy,$overduesblockrenew);
2537
}
2538
2499
=head2 AddRenewal
2539
=head2 AddRenewal
2500
2540
2501
  &AddRenewal($borrowernumber, $itemnumber, $branch, [$datedue], [$lastreneweddate]);
2541
  &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 25-30 Link Here
25
[% IF ( borrowernumber ) %]if($.cookie("holdfor") != [% borrowernumber %]){ $.cookie("holdfor",null, { path: "/", expires: 0 }); }[% ELSE %]$.cookie("holdfor",null, { path: "/", expires: 0 });[% END %]
25
[% IF ( borrowernumber ) %]if($.cookie("holdfor") != [% borrowernumber %]){ $.cookie("holdfor",null, { path: "/", expires: 0 }); }[% ELSE %]$.cookie("holdfor",null, { path: "/", expires: 0 });[% END %]
26
[% UNLESS ( borrowernumber ) %][% UNLESS ( CGIselectborrower ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %]
26
[% UNLESS ( borrowernumber ) %][% UNLESS ( CGIselectborrower ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %]
27
	 $(document).ready(function() {
27
	 $(document).ready(function() {
28
        $(function(){ hiderenew() });
28
        $('#patronlists').tabs([% IF ( UseTablesortForCirc ) %]{
29
        $('#patronlists').tabs([% IF ( UseTablesortForCirc ) %]{
29
            // Correct table sizing for tables hidden in tabs
30
            // Correct table sizing for tables hidden in tabs
30
            // http://www.datatables.net/examples/api/tabs_and_scrolling.html
31
            // http://www.datatables.net/examples/api/tabs_and_scrolling.html
Lines 68-75 Link Here
68
        $( '#override_limit' ).click( function () {
69
        $( '#override_limit' ).click( function () {
69
            if ( this.checked ) {
70
            if ( this.checked ) {
70
                $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
71
                $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
72
                $("input[name='renew_checked']").val('Renew or Return checked items');
73
                $("input[name='renew_all']").css('display','inline');
71
            } else {
74
            } else {
72
                $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
75
                $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
76
                hiderenew();
73
            }
77
            }
74
        } ).attr( 'checked', false );
78
        } ).attr( 'checked', false );
75
        [% END %][% IF ( CircAutoPrintQuickSlip ) %]
79
        [% END %][% IF ( CircAutoPrintQuickSlip ) %]
Lines 236-241 function validate1(date) { Link Here
236
        return false;
240
        return false;
237
     }
241
     }
238
};
242
};
243
244
function hiderenew () {
245
    var valid=false;
246
    $("input[name^=items]").parent().each(function(){
247
        if($(this).css('display') !='none'){
248
            valid = true;
249
            return;
250
        }
251
    });
252
    if(!valid){
253
        $("input[name='renew_checked']").val('Return checked items');
254
        $("input[name='renew_all']").css('display','none');
255
    }
256
    return;
257
};
258
239
//]]>
259
//]]>
240
</script>
260
</script>
241
</head>
261
</head>
Lines 875-881 No patron matched <span class="ex">[% message %]</span> Link Here
875
        [% ELSE %]
895
        [% ELSE %]
876
            [% IF ( todayissue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
896
            [% IF ( todayissue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
877
                <input type="checkbox" name="all_items[]" value="[% todayissue.itemnumber %]" checked="checked" style="display: none;" />
897
                <input type="checkbox" name="all_items[]" value="[% todayissue.itemnumber %]" checked="checked" style="display: none;" />
878
                [% IF ( todayissue.od ) %]
898
                [% IF ( todayissue.od and !todayissue.blockrenewal ) %]
879
                    <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" checked="checked" />
899
                    <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" checked="checked" />
880
                [% ELSE %]
900
                [% ELSE %]
881
                    <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" />
901
                    <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" />
Lines 886-894 No patron matched <span class="ex">[% message %]</span> Link Here
886
		[% IF ( todayissue.renew_error_on_reserve ) %]
906
		[% IF ( todayissue.renew_error_on_reserve ) %]
887
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% todayissue.biblionumber %]">On hold</a>
907
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% todayissue.biblionumber %]">On hold</a>
888
		[% END %]
908
		[% END %]
889
                [% IF ( todayissue.renew_error_too_many ) %]
909
            [% IF ( todayissue.renew_error_restriction ) %]
890
            Not renewable
910
                Renewal not allowed (restriction)
891
                [% END %]
911
            [% ELSIF ( todayissue.renew_error_overdue ) %]
912
                Renewal not allowed (overdue)
913
            [% ELSIF ( todayissue.renew_error_too_many ) %]
914
                Not renewable
915
            [% END %]
892
            [% IF ( todayissue.can_confirm ) %]
916
            [% IF ( todayissue.can_confirm ) %]
893
                </span>
917
                </span>
894
            [% END %]
918
            [% END %]
Lines 964-970 No patron matched <span class="ex">[% message %]</span> Link Here
964
        [% ELSE %]
988
        [% ELSE %]
965
            [% IF ( previssue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
989
            [% IF ( previssue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
966
                <input type="checkbox" name="all_items[]" value="[% previssue.itemnumber %]" checked="checked" style="display: none;" />
990
                <input type="checkbox" name="all_items[]" value="[% previssue.itemnumber %]" checked="checked" style="display: none;" />
967
                [% IF ( previssue.od ) %]
991
                [% IF ( previssue.od and !previssue.blockrenewal ) %]
968
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" checked="checked" />
992
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" checked="checked" />
969
                [% ELSE %]
993
                [% ELSE %]
970
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" />
994
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" />
Lines 975-983 No patron matched <span class="ex">[% message %]</span> Link Here
975
		[% IF ( previssue.renew_error_on_reserve ) %]
999
		[% IF ( previssue.renew_error_on_reserve ) %]
976
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% previssue.biblionumber %]">On hold</a>
1000
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% previssue.biblionumber %]">On hold</a>
977
		[% END %]
1001
		[% END %]
978
                [% IF ( previssue.renew_error_too_many ) %]
1002
            [% IF ( previssue.renew_error_restriction ) %]
979
            Not renewable
1003
                Renewal not allowed (restriction)
980
                [% END %]
1004
            [% ELSIF ( previssue.renew_error_overdue ) %]
1005
                Renewal not allowed (overdue)
1006
            [% ELSIF ( previssue.renew_error_too_many ) %]
1007
                Not renewable
1008
            [% END %]
981
            [% IF ( previssue.can_confirm ) %]
1009
            [% IF ( previssue.can_confirm ) %]
982
                </span>
1010
                </span>
983
            [% END %]
1011
            [% 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