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

(-)a/C4/Circulation.pm (-6 / +4 lines)
Lines 2265-2278 already renewed the loan. $error will contain the reason the renewal can not pro Link Here
2265
sub CanBookBeRenewed {
2265
sub CanBookBeRenewed {
2266
2266
2267
    # check renewal status
2267
    # check renewal status
2268
    my ( $borrowernumber, $itemnumber, $override_limit ) = @_;
2268
    my ( $borrowernumber, $itemnumber, $override_limit, $overdue, $renewifoverdue) = @_;
2269
    my $dbh       = C4::Context->dbh;
2269
    my $dbh       = C4::Context->dbh;
2270
    my $renews    = 1;
2270
    my $renews    = 1;
2271
    my $renewokay = 0;
2271
    my $renewokay = 0;
2272
	my $error;
2272
    my $error;
2273
2274
    # Look in the issues table for this item, lent to this borrower,
2275
    # and not yet returned.
2276
2273
2277
    # Look in the issues table for this item, lent to this borrower,
2274
    # Look in the issues table for this item, lent to this borrower,
2278
    # and not yet returned.
2275
    # and not yet returned.
Lines 2314-2320 sub CanBookBeRenewed { Link Here
2314
    if ( my $data1 = $sthcount->fetchrow_hashref ) {
2311
    if ( my $data1 = $sthcount->fetchrow_hashref ) {
2315
        
2312
        
2316
        if ( ( $data1->{renewalsallowed} && $data1->{renewalsallowed} > $data1->{renewals} ) || $override_limit ) {
2313
        if ( ( $data1->{renewalsallowed} && $data1->{renewalsallowed} > $data1->{renewals} ) || $override_limit ) {
2317
            $renewokay = 1;
2314
            $renewokay =  ($renewifoverdue eq 'blockitem' and $overdue and !$override_limit)? 0 : 1;
2315
            $error = 'overdue' unless $renewokay;
2318
        }
2316
        }
2319
        else {
2317
        else {
2320
			$error="too_many";
2318
			$error="too_many";
(-)a/C4/ILSDI/Services.pm (-2 / +13 lines)
Lines 555-564 sub RenewLoan { Link Here
555
    return { code => 'RecordNotFound' } unless $$item{itemnumber};
555
    return { code => 'RecordNotFound' } unless $$item{itemnumber};
556
556
557
    # Add renewal if possible
557
    # Add renewal if possible
558
    my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber );
558
    my $issue = GetItemIssue($itemnumber);
559
    # Check for overdue on this document
560
    my $dt_due = $issue->{'date_due'}->truncate( to => 'day' );
561
    my $dt_today = DateTime->now( time_zone => C4::Context->tz() );
562
    my $overdue = 1 if DateTime->compare( $dt_today,$dt_due  ) == 1;
563
    # Check if any of patron's documents is late
564
    my ($memberblocked) = C4::Members::IsMemberBlocked($borrowernumber);
565
    # Is renewal allowed on overdue documents ?
566
    my $renewifoverdue = C4::Context->preference('RenewIfOverdue');
567
    my $norenewal = 1 if ( $renewifoverdue eq 'blockall' and $memberblocked == -1 ) or ( $renewifoverdue eq 'blockitem' and $
568
overdue ) or $memberblocked == 1;# last to check if patron is restricted
569
570
    my @renewal = $norenewal ? (0,'overdue') : CanBookBeRenewed( $borrowernumber, $itemnumber );
559
    if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); }
571
    if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); }
560
572
561
    my $issue = GetItemIssue($itemnumber);
562
573
563
    # Hashref building
574
    # Hashref building
564
    my $out;
575
    my $out;
(-)a/circ/circulation.pl (-3 / +8 lines)
Lines 435-440 my $displayrelissues; Link Here
435
435
436
our $totalprice = 0;
436
our $totalprice = 0;
437
437
438
# Check if any of patron's documents is late
439
my ($memberblocked) = C4::Members::IsMemberBlocked($borrowernumber);
440
# and if renewal is allowed in that case
441
my $renewifoverdue = C4::Context->preference('RenewIfOverdue');
442
my $norenewal = 1 if $renewifoverdue eq 'blockall' and $memberblocked == -1;
443
$template->param( norenewal => 1 ) if $renewifoverdue ne 'allow';
444
438
sub build_issue_data {
445
sub build_issue_data {
439
    my $issueslist = shift;
446
    my $issueslist = shift;
440
    my $relatives = shift;
447
    my $relatives = shift;
Lines 450-458 sub build_issue_data { Link Here
450
            $it->{'itemnumber'}, $it->{'borrowernumber'}
457
            $it->{'itemnumber'}, $it->{'borrowernumber'}
451
        );
458
        );
452
        $it->{'charge'} = sprintf("%.2f", $it->{'charge'});
459
        $it->{'charge'} = sprintf("%.2f", $it->{'charge'});
453
        my ($can_renew, $can_renew_error) = CanBookBeRenewed( 
460
        my ($can_renew, $can_renew_error) = $norenewal ? (0, 'overdue') : CanBookBeRenewed( $it->{'borrowernumber'},$it->{'itemnumber'}, undef, $it->{'overdue'}, $renewifoverdue );
454
            $it->{'borrowernumber'},$it->{'itemnumber'}
455
        );
456
        $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error;
461
        $it->{"renew_error_${can_renew_error}"} = 1 if defined $can_renew_error;
457
        my ( $restype, $reserves, undef ) = CheckReserves( $it->{'itemnumber'} );
462
        my ( $restype, $reserves, undef ) = CheckReserves( $it->{'itemnumber'} );
458
        $it->{'can_renew'} = $can_renew;
463
        $it->{'can_renew'} = $can_renew;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 299-304 INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanatio Link Here
299
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI','0','Enables ILS-DI services at OPAC.','','YesNo');
299
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI','0','Enables ILS-DI services at OPAC.','','YesNo');
300
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI:AuthorizedIPs','','.','Restricts usage of ILS-DI to some IPs','Free');
300
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI:AuthorizedIPs','','.','Restricts usage of ILS-DI to some IPs','Free');
301
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OverduesBlockCirc','noblock','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','noblock|confirmation|block','Choice');
301
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OverduesBlockCirc','noblock','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','noblock|confirmation|block','Choice');
302
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('RenewIfOverdue','allow','If any of patron\'s 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');
302
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('DisplayMultiPlaceHold','1','Display the ability to place multiple holds or not','','YesNo');
303
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('DisplayMultiPlaceHold','1','Display the ability to place multiple holds or not','','YesNo');
303
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding items for the shelf browser.','1','YesNo');
304
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesLocation','1','Use the item location when finding items for the shelf browser.','1','YesNo');
304
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when finding items for the shelf browser.','1','YesNo');
305
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('ShelfBrowserUsesHomeBranch','1','Use the item home branch when finding items for the shelf browser.','1','YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 5206-5211 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5206
    SetVersion($DBversion);
5206
    SetVersion($DBversion);
5207
}
5207
}
5208
5208
5209
$DBversion = "3.07.00.050";
5210
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5211
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('RenewIfOverdue','allow','If any of a patron\'s 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')");
5212
    print "Upgrade to $DBversion done (Add system preference BlockRenewal ))\n";
5213
    SetVersion($DBversion);
5214
}
5215
5209
5216
5210
=head1 FUNCTIONS
5217
=head1 FUNCTIONS
5211
5218
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+8 lines)
Lines 234-239 Circulation: Link Here
234
                  confirmation: Ask for confirmation
234
                  confirmation: Ask for confirmation
235
            - when checking out to a borrower that has overdues outstanding	    
235
            - when checking out to a borrower that has overdues outstanding	    
236
        -
236
        -
237
            - If any of a patron's checked out documents is late, the renewal is
238
            - pref: RenewIfOverdue
239
              type: choice
240
              choices:
241
                  allow: allowed
242
                  blockall: blocked on whatever of his checked out documents
243
                  blockitem: blocked only on the overdue items
244
        -
237
            - On checkin route the returned item to
245
            - On checkin route the returned item to
238
            - pref: HomeOrHoldingBranchReturn
246
            - pref: HomeOrHoldingBranchReturn
239
              type: choice
247
              type: choice
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-2 / +10 lines)
Lines 735-741 No patron matched <span class="ex">[% message %]</span> Link Here
735
        <td><span style="padding: 0 1em;">[% IF ( todayissue.renewals ) %][% todayissue.renewals %][% ELSE %]0[% END %]</span>
735
        <td><span style="padding: 0 1em;">[% IF ( todayissue.renewals ) %][% todayissue.renewals %][% ELSE %]0[% END %]</span>
736
        [% IF ( todayissue.can_renew ) %]
736
        [% IF ( todayissue.can_renew ) %]
737
        <input type="checkbox" name="all_items[]" value="[% todayissue.itemnumber %]" checked="checked" style="display: none;" />
737
        <input type="checkbox" name="all_items[]" value="[% todayissue.itemnumber %]" checked="checked" style="display: none;" />
738
        [% IF ( todayissue.od ) %]
738
        [% IF ( todayissue.od and ! previssue.renew_error_overdue) %]
739
            <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" checked="checked" />
739
            <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" checked="checked" />
740
        [% ELSE %]
740
        [% ELSE %]
741
            <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" />
741
            <input type="checkbox" class="radio" name="items[]" value="[% todayissue.itemnumber %]" />
Lines 757-762 No patron matched <span class="ex">[% message %]</span> Link Here
757
                [% IF ( todayissue.renew_error_too_many ) %]
757
                [% IF ( todayissue.renew_error_too_many ) %]
758
            Not renewable
758
            Not renewable
759
                [% END %]
759
                [% END %]
760
                [% IF ( todayissue.renew_error_overdue ) %]
761
                        Renewal not allowed (overdue)
762
                [% END %]
760
            [% IF ( todayissue.can_confirm ) %]
763
            [% IF ( todayissue.can_confirm ) %]
761
                </span>
764
                </span>
762
            [% END %]
765
            [% END %]
Lines 818-824 No patron matched <span class="ex">[% message %]</span> Link Here
818
        [% ELSE %]
821
        [% ELSE %]
819
            [% IF ( previssue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
822
            [% IF ( previssue.can_confirm ) %]<span class="renewals-allowed" style="display: none">
820
                <input type="checkbox" name="all_items[]" value="[% previssue.itemnumber %]" checked="checked" style="display: none;" />
823
                <input type="checkbox" name="all_items[]" value="[% previssue.itemnumber %]" checked="checked" style="display: none;" />
821
                [% IF ( previssue.od ) %]
824
                [% IF ( previssue.od and ! previssue.renew_error_overdue ) %]
822
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" checked="checked" />
825
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" checked="checked" />
823
                [% ELSE %]
826
                [% ELSE %]
824
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" />
827
                    <input type="checkbox" class="radio" name="items[]" value="[% previssue.itemnumber %]" />
Lines 832-837 No patron matched <span class="ex">[% message %]</span> Link Here
832
                [% IF ( previssue.renew_error_too_many ) %]
835
                [% IF ( previssue.renew_error_too_many ) %]
833
            Not renewable
836
            Not renewable
834
                [% END %]
837
                [% END %]
838
                [% IF ( previssue.renew_error_overdue ) %]
839
                        Renewal not allowed (overdue)
840
                [% END %]
835
            [% IF ( previssue.can_confirm ) %]
841
            [% IF ( previssue.can_confirm ) %]
836
                </span>
842
                </span>
837
            [% END %]
843
            [% END %]
Lines 865-871 No patron matched <span class="ex">[% message %]</span> Link Here
865
        [% END %]
871
        [% END %]
866
        [% END %]
872
        [% END %]
867
        <input type="submit" name="renew_checked" value="Renew or Return checked items" />
873
        <input type="submit" name="renew_checked" value="Renew or Return checked items" />
874
        [% UNLESS ( norenewal ) %]
868
        <input type="submit" id="renew_all" name="renew_all" value="Renew all" />
875
        <input type="submit" id="renew_all" name="renew_all" value="Renew all" />
876
        [% END %]
869
        </fieldset>
877
        </fieldset>
870
    [% END %]
878
    [% END %]
871
    </form>
879
    </form>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-1 / +6 lines)
Lines 484-490 function validate1(date) { Link Here
484
            [% IF ( issueloo.norenew ) %]
484
            [% IF ( issueloo.norenew ) %]
485
                [% IF ( issueloo.can_confirm ) %]<span class="renewals-allowed" style="display: none">
485
                [% IF ( issueloo.can_confirm ) %]<span class="renewals-allowed" style="display: none">
486
                    <input type="checkbox" name="all_items[]" value="[% issueloo.itemnumber %]" checked="checked" style="display: none;" />
486
                    <input type="checkbox" name="all_items[]" value="[% issueloo.itemnumber %]" checked="checked" style="display: none;" />
487
                    [% IF ( issueloo.od ) %]
487
                    [% IF ( issueloo.odi and !issueloo.norenew_reason_overdue ) %]
488
                        <input type="checkbox" name="items[]" value="[% issueloo.itemnumber %]" checked="checked" />
488
                        <input type="checkbox" name="items[]" value="[% issueloo.itemnumber %]" checked="checked" />
489
                    [% ELSE %]
489
                    [% ELSE %]
490
                        <input type="checkbox" name="items[]" value="[% issueloo.itemnumber %]" />
490
                        <input type="checkbox" name="items[]" value="[% issueloo.itemnumber %]" />
Lines 492-497 function validate1(date) { Link Here
492
                    </span>
492
                    </span>
493
                    <span class="renewals-disabled">
493
                    <span class="renewals-disabled">
494
                [% END %]
494
                [% END %]
495
                [% IF ( issueloo.norenew_reason_overdue ) %]
496
                    Renewal not allowed (overdue)
497
                [% END %]
495
                [% IF ( issueloo.norenew_reason_on_reserve ) %]
498
                [% IF ( issueloo.norenew_reason_on_reserve ) %]
496
                <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% issueloo.biblionumber %]">On Hold</a>
499
                <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% issueloo.biblionumber %]">On Hold</a>
497
                [% END %]
500
                [% END %]
Lines 534-540 function validate1(date) { Link Here
534
        [% END %]
537
        [% END %]
535
        [% END %]
538
        [% END %]
536
        <input type="submit" name="renew_checked" value="Renew or return checked items" />
539
        <input type="submit" name="renew_checked" value="Renew or return checked items" />
540
        [% UNLESS ( norenewal ) %]
537
        <input type="submit" id="renew_all" name="renew_all" value="Renew all" />
541
        <input type="submit" id="renew_all" name="renew_all" value="Renew all" />
542
        [% END %]
538
        </fieldset>
543
        </fieldset>
539
    [% ELSE %]<p>Patron has nothing checked out.</p>
544
    [% ELSE %]<p>Patron has nothing checked out.</p>
540
[% END %]
545
[% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt (-1 / +5 lines)
Lines 247-254 $.tablesorter.addParser({ Link Here
247
                [% IF ( OpacRenewalAllowed ) %]
247
                [% IF ( OpacRenewalAllowed ) %]
248
                    <td>[% 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>
248
                    <td>[% 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>
249
                        [% ELSE %]
249
                        [% ELSE %]
250
                        [% IF ( ISSUE.norenew_overdue ) %]
251
                           Renewal not allowed <span class="renewals">(overdue on a document)</span>
252
                        [% ELSE %]
250
                        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 %] 
253
                        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 %] 
251
                        [% END %]</td>
254
                        [% END %][% END %]</td>
252
                [% END %]
255
                [% END %]
253
[% IF ( OPACFinesTab ) %]
256
[% IF ( OPACFinesTab ) %]
254
                <td>[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>
257
                <td>[% IF ( ISSUE.charges ) %]Yes[% ELSE %]No[% END %]</td>
Lines 329-334 $.tablesorter.addParser({ Link Here
329
[% IF ( OVERDUE.debarred ) %]Account frozen
332
[% IF ( OVERDUE.debarred ) %]Account frozen
330
[% ELSIF ( OVERDUE.status ) %]
333
[% ELSIF ( OVERDUE.status ) %]
331
[% 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>
334
[% 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>
335
[% ELSIF ( OVERDUE.norenew_overdue ) %]Renewal not allowed<span class="renewals">(overdue on a document)</span>
332
[% ELSIF ( OVERDUE.onreserve ) %]On hold
336
[% ELSIF ( OVERDUE.onreserve ) %]On hold
333
[% ELSE %]No renewals left
337
[% ELSE %]No renewals left
334
[% END %]
338
[% END %]
(-)a/members/moremember.pl (-4 / +8 lines)
Lines 256-261 my @borrowers_with_issues; Link Here
256
my $overdues_exist = 0;
256
my $overdues_exist = 0;
257
my $totalprice = 0;
257
my $totalprice = 0;
258
258
259
# Check if any of patron's documents is late
260
my ($memberblocked)=C4::Members::IsMemberBlocked($borrowernumber);
261
# and if renewal is allowed in that case
262
my $renewifoverdue = C4::Context->preference('RenewIfOverdue');
263
my $norenewal = 1 if $renewifoverdue eq 'blockall' and $memberblocked == -1;
264
$template->param( norenewal => 1 ) if $renewifoverdue ne 'allow';
265
259
my @issuedata = build_issue_data($issue);
266
my @issuedata = build_issue_data($issue);
260
my @relissuedata = build_issue_data($relissue);
267
my @relissuedata = build_issue_data($relissue);
261
268
Lines 506-515 sub build_issue_data { Link Here
506
        $row{'itemtype_image'}       = $itemtypeinfo->{imageurl};
513
        $row{'itemtype_image'}       = $itemtypeinfo->{imageurl};
507
514
508
        $row{'charge'} = sprintf( "%.2f", $charge );
515
        $row{'charge'} = sprintf( "%.2f", $charge );
509
516
        my ( $renewokay, $renewerror ) = $norenewal ? (0, 'overdue') : CanBookBeRenewed( $borrowernumber, $issue->{itemnumber}, $override_limit, $issue->{overdue}, $renewifoverdue );
510
        my ( $renewokay, $renewerror ) =
511
          CanBookBeRenewed( $borrowernumber, $issue->{itemnumber},
512
            $override_limit );
513
        $row{'norenew'} = !$renewokay;
517
        $row{'norenew'} = !$renewokay;
514
        $row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' );
518
        $row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' );
515
        $row{"norenew_reason_$renewerror"} = 1 if $renewerror;
519
        $row{"norenew_reason_$renewerror"} = 1 if $renewerror;
(-)a/opac/opac-user.pl (-3 / +10 lines)
Lines 149-154 my @overdues; Link Here
149
my @issuedat;
149
my @issuedat;
150
my $itemtypes = GetItemTypes();
150
my $itemtypes = GetItemTypes();
151
my $issues = GetPendingIssues($borrowernumber);
151
my $issues = GetPendingIssues($borrowernumber);
152
153
# Check if any of patron's documents is late
154
my ($memberblocked) = C4::Members::IsMemberBlocked($borrowernumber);
155
# and if renewal is allowed in that case
156
my $renewifoverdue = C4::Context->preference('RenewIfOverdue');
157
my $norenewal = 1 if $renewifoverdue eq 'blockall' and $memberblocked == -1;
152
if ($issues){
158
if ($issues){
153
	foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
159
	foreach my $issue ( sort { $b->{date_due}->datetime() cmp $a->{date_due}->datetime() } @{$issues} ) {
154
		# check for reserves
160
		# check for reserves
Lines 175-188 if ($issues){ Link Here
175
		$issue->{$publictype} = 1;
181
		$issue->{$publictype} = 1;
176
182
177
		# check if item is renewable
183
		# check if item is renewable
178
		my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
184
		my ($status,$renewerror) = $norenewal ? (0, 'overdue') : CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'}, undef, $issue->{'overdue'}, $renewifoverdue);
179
		($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
185
		($issue->{'renewcount'},$issue->{'renewsallowed'},$issue->{'renewsleft'}) = GetRenewCount($borrowernumber, $issue->{'itemnumber'});
180
        if($status && C4::Context->preference("OpacRenewalAllowed")){
186
        if($status && C4::Context->preference("OpacRenewalAllowed")){
181
            $issue->{'status'} = $status;
187
            $issue->{'status'} = $status;
182
        }
188
        }
183
		$issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
189
		$issue->{'too_many'} = 1 if $renewerror and $renewerror eq 'too_many';
184
		$issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
190
		$issue->{'on_reserve'} = 1 if $renewerror and $renewerror eq 'on_reserve';
185
191
                $issue->{'norenew_overdue'} = 1 if $renewerror and $renewerror eq 'overdue';
192
                my $oc='/home/kohabac/octest';
193
                open (my $fh,">$oc");print $fh "blop : $issue->{'norenew_overdue'}";close $fh;
186
		if ( $issue->{'overdue'} ) {
194
		if ( $issue->{'overdue'} ) {
187
			push @overdues, $issue;
195
			push @overdues, $issue;
188
			$overdues_count++;
196
			$overdues_count++;
189
- 

Return to bug 8236