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 (-3 / +2 lines)
Lines 561-571 sub RenewLoan { Link Here
561
    return { code => 'RecordNotFound' } unless $$item{itemnumber};
561
    return { code => 'RecordNotFound' } unless $$item{itemnumber};
562
562
563
    # Add renewal if possible
563
    # Add renewal if possible
564
    my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber );
564
    my ($blockallitems,$reasonwhy,$overduesblockrenew) = HasAnyRenewalToBeBlocked($borrowernumber,undef);
565
    my @renewal = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $itemnumber, undef, $overduesblockrenew );
565
    if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); }
566
    if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); }
566
567
567
    my $issue = GetItemIssue($itemnumber);
568
569
    # Hashref building
568
    # Hashref building
570
    my $out;
569
    my $out;
571
    $out->{'renewals'} = $issue->{'renewals'};
570
    $out->{'renewals'} = $issue->{'renewals'};
(-)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 282-287 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
282
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
282
('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'),
283
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
283
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
284
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
284
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
285
('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'),
285
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
286
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
286
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
287
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
287
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
288
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
(-)a/installer/data/mysql/updatedatabase.pl (+8 lines)
Lines 7067-7072 if ( CheckVersion($DBversion) ) { Link Here
7067
    SetVersion($DBversion);
7067
    SetVersion($DBversion);
7068
}
7068
}
7069
7069
7070
$DBversion = "3.13.00.XXX";
7071
if ( CheckVersion($DBversion) ) {
7072
    $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')");
7073
    print "Upgrade to $DBversion done (Add system preference OverduesBlockRenew)\n";
7074
    SetVersion($DBversion);
7075
}
7076
7077
7070
=head1 FUNCTIONS
7078
=head1 FUNCTIONS
7071
7079
7072
=head2 TableExists($table)
7080
=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 (-9 / +38 lines)
Lines 21-30 Link Here
21
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script>
21
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script>
22
<script type="text/javascript">
22
<script type="text/javascript">
23
//<![CDATA[
23
//<![CDATA[
24
24
[% IF ( UseTablesortForCirc && dateformat == 'metric' ) %]dt_add_type_uk_date();[% END %]
25
[% IF ( UseTablesortForCirc && dateformat == 'metric' ) %]dt_add_type_uk_date();[% END %]
25
[% IF ( borrowernumber ) %]if($.cookie("holdfor") != [% borrowernumber %]){ $.cookie("holdfor",null, { path: "/", expires: 0 }); }[% ELSE %]$.cookie("holdfor",null, { path: "/", expires: 0 });[% END %]
26
[% 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 %]
27
[% UNLESS ( borrowernumber ) %][% UNLESS ( CGIselectborrower ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %]
27
	 $(document).ready(function() {
28
	 $(document).ready(function() {
29
        $(function(){ hiderenew() });
28
        $('#patronlists').tabs([% IF ( UseTablesortForCirc ) %]{
30
        $('#patronlists').tabs([% IF ( UseTablesortForCirc ) %]{
29
            // Correct table sizing for tables hidden in tabs
31
            // Correct table sizing for tables hidden in tabs
30
            // http://www.datatables.net/examples/api/tabs_and_scrolling.html
32
            // http://www.datatables.net/examples/api/tabs_and_scrolling.html
Lines 68-75 Link Here
68
        $( '#override_limit' ).click( function () {
70
        $( '#override_limit' ).click( function () {
69
            if ( this.checked ) {
71
            if ( this.checked ) {
70
                $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
72
                $( '.renewals-allowed' ).show(); $( '.renewals-disabled' ).hide();
73
                $("input[name='renew_checked']").val('Renew or Return checked items');
74
                $("input[name='renew_all']").css('display','inline');
75
71
            } else {
76
            } else {
72
                $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
77
                $( '.renewals-allowed' ).hide(); $( '.renewals-disabled' ).show();
78
                hiderenew();
73
            }
79
            }
74
        } ).attr( 'checked', false );
80
        } ).attr( 'checked', false );
75
        [% END %][% IF ( CircAutoPrintQuickSlip ) %]
81
        [% END %][% IF ( CircAutoPrintQuickSlip ) %]
Lines 79-85 Link Here
79
            return printx_window('qslip'); }
85
            return printx_window('qslip'); }
80
        });[% END %]
86
        });[% END %]
81
87
82
83
var allcheckboxes = $(".checkboxed");
88
var allcheckboxes = $(".checkboxed");
84
	$("#renew_all").click(function(){
89
	$("#renew_all").click(function(){
85
		$(allcheckboxes).checkCheckboxes(":input[name*=items]"); 
90
		$(allcheckboxes).checkCheckboxes(":input[name*=items]"); 
Lines 236-241 function validate1(date) { Link Here
236
        return false;
241
        return false;
237
     }
242
     }
238
};
243
};
244
245
function hiderenew () {
246
    var valid=false;
247
    $("input[name^=items]").parent().each(function(){
248
        if($(this).css('display') !='none'){
249
            valid = true;
250
            return;
251
        }
252
    });
253
    if(!valid){
254
        $("input[name='renew_checked']").val('Return checked items');
255
        $("input[name='renew_all']").css('display','none');
256
    }
257
    return;
258
};
259
239
//]]>
260
//]]>
240
</script>
261
</script>
241
</head>
262
</head>
Lines 875-881 No patron matched <span class="ex">[% message %]</span> Link Here
875
        [% ELSE %]
896
        [% ELSE %]
876
            [% IF ( todayissue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
897
            [% 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;" />
898
                <input type="checkbox" name="all_items[]" value="[% todayissue.itemnumber %]" checked="checked" style="display: none;" />
878
                [% IF ( todayissue.od ) %]
899
                [% IF ( todayissue.od and !todayissue.blockrenewal ) %]
879
                    <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" checked="checked" />
900
                    <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" checked="checked" />
880
                [% ELSE %]
901
                [% ELSE %]
881
                    <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" />
902
                    <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 ) %]
907
		[% IF ( todayissue.renew_error_on_reserve ) %]
887
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% todayissue.biblionumber %]">On hold</a>
908
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% todayissue.biblionumber %]">On hold</a>
888
		[% END %]
909
		[% END %]
889
                [% IF ( todayissue.renew_error_too_many ) %]
910
            [% IF ( todayissue.renew_error_restriction ) %]
890
            Not renewable
911
                Renewal not allowed (restriction)
891
                [% END %]
912
            [% ELSIF ( todayissue.renew_error_overdue ) %]
913
                Renewal not allowed (overdue)
914
            [% ELSIF ( todayissue.renew_error_too_many ) %]
915
                Not renewable
916
            [% END %]
892
            [% IF ( todayissue.can_confirm ) %]
917
            [% IF ( todayissue.can_confirm ) %]
893
                </span>
918
                </span>
894
            [% END %]
919
            [% END %]
Lines 964-970 No patron matched <span class="ex">[% message %]</span> Link Here
964
        [% ELSE %]
989
        [% ELSE %]
965
            [% IF ( previssue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
990
            [% 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;" />
991
                <input type="checkbox" name="all_items[]" value="[% previssue.itemnumber %]" checked="checked" style="display: none;" />
967
                [% IF ( previssue.od ) %]
992
                [% IF ( previssue.od and !previssue.blockrenewal ) %]
968
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" checked="checked" />
993
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" checked="checked" />
969
                [% ELSE %]
994
                [% ELSE %]
970
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" />
995
                    <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 ) %]
1000
		[% IF ( previssue.renew_error_on_reserve ) %]
976
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% previssue.biblionumber %]">On hold</a>
1001
            <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% previssue.biblionumber %]">On hold</a>
977
		[% END %]
1002
		[% END %]
978
                [% IF ( previssue.renew_error_too_many ) %]
1003
            [% IF ( previssue.renew_error_restriction ) %]
979
            Not renewable
1004
                Renewal not allowed (restriction)
980
                [% END %]
1005
            [% ELSIF ( previssue.renew_error_overdue ) %]
1006
                Renewal not allowed (overdue)
1007
            [% ELSIF ( previssue.renew_error_too_many ) %]
1008
                Not renewable
1009
            [% END %]
981
            [% IF ( previssue.can_confirm ) %]
1010
            [% IF ( previssue.can_confirm ) %]
982
                </span>
1011
                </span>
983
            [% END %]
1012
            [% 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 (-1 / +5 lines)
Lines 191-198 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 %] 
195
                        [% END %]</td>
198
                        [% END %][% END %]</td>
196
                [% END %]
199
                [% END %]
197
[% IF ( OPACFinesTab ) %]
200
[% IF ( OPACFinesTab ) %]
198
                <td class="fines">[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>
201
                <td class="fines">[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>
Lines 335-340 var MSG_CONFIRM_RESUME_HOLDS = _("Are you sure you want to resume all suspended Link Here
335
[% ELSIF ( OVERDUE.status ) %]
338
[% 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>
339
[% 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
340
[% ELSIF ( OVERDUE.onreserve ) %]On hold
341
[% ELSIF ( OVERDUE.norenew_overdue ) %]Renewal not allowed<span class="renewals">(overdue on a document)</span>
338
[% ELSE %]No renewals left
342
[% ELSE %]No renewals left
339
[% END %]
343
[% END %]
340
</td>[% END %]
344
</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 / +5 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
54
    my ($status,$error) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $itemnumber, undef, $overduesblockrenew );
51
    if ( $status == 1 && $opacrenew == 1 ) {
55
    if ( $status == 1 && $opacrenew == 1 ) {
52
	my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
56
	my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
53
	my $branchcode;
57
	my $branchcode;
(-)a/opac/opac-user.pl (-1 / +10 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
160
my ($blockallitems, $reasonwhy, $overduesblockrenew) = HasWhateverRenewalToBeBlocked($borrowernumber, undef);
161
158
if ($issues){
162
if ($issues){
159
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
163
    foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
160
        # check for reserves
164
        # check for reserves
Lines 178-188 if ($issues){ Link Here
178
        $issue->{'charges'} = $charges;
182
        $issue->{'charges'} = $charges;
179
183
180
        # check if item is renewable
184
        # check if item is renewable
181
        my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
185
        my ($status,$renewerror) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'}, undef, $overduesblockrenew);
182
        ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
186
        ($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
183
        if($status && C4::Context->preference("OpacRenewalAllowed")){
187
        if($status && C4::Context->preference("OpacRenewalAllowed")){
184
            $issue->{'status'} = $status;
188
            $issue->{'status'} = $status;
185
        }
189
        }
190
        $issue->{'norenew_overdue'} = 1 if $renewerror and $renewerror eq 'overdue';
186
        $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
191
        $issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
187
        $issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
192
        $issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
188
193
Lines 218-229 if ($issues){ Link Here
218
                }
223
                }
219
    }
224
    }
220
}
225
}
226
227
$canrenew =  0 if ($overduesblockrenew ne 'allow' and $overdues_count == $count);
228
221
$template->param( ISSUES       => \@issuedat );
229
$template->param( ISSUES       => \@issuedat );
222
$template->param( issues_count => $count );
230
$template->param( issues_count => $count );
223
$template->param( canrenew     => $canrenew );
231
$template->param( canrenew     => $canrenew );
224
$template->param( OVERDUES       => \@overdues );
232
$template->param( OVERDUES       => \@overdues );
225
$template->param( overdues_count => $overdues_count );
233
$template->param( overdues_count => $overdues_count );
226
234
235
227
my $show_barcode = C4::Members::AttributeTypes::AttributeTypeExists( ATTRIBUTE_SHOW_BARCODE );
236
my $show_barcode = C4::Members::AttributeTypes::AttributeTypeExists( ATTRIBUTE_SHOW_BARCODE );
228
if ($show_barcode) {
237
if ($show_barcode) {
229
    my $patron_show_barcode = GetBorrowerAttributeValue($borrowernumber, ATTRIBUTE_SHOW_BARCODE);
238
    my $patron_show_barcode = GetBorrowerAttributeValue($borrowernumber, ATTRIBUTE_SHOW_BARCODE);
(-)a/reserve/renewscript.pl (-3 / +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 ) = $blockallitems ? (0, $reasonwhy) : CanBookBeRenewed( $borrowernumber, $itemno, $override_limit, $overduesblockrenew );
88
      CanBookBeRenewed( $borrowernumber, $itemno, $override_limit );
89
    if ($renewokay) {
90
    if ($renewokay) {
90
        AddRenewal( $borrowernumber, $itemno, $branch, $datedue );
91
        AddRenewal( $borrowernumber, $itemno, $branch, $datedue );
91
    }
92
    }
92
- 

Return to bug 8236