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

(-)a/C4/Circulation.pm (-1 / +7 lines)
Lines 938-944 sub CanBookBeIssued { Link Here
938
            $item->{'itemnumber'}
938
            $item->{'itemnumber'}
939
        );
939
        );
940
        if ( $CanBookBeRenewed == 0 ) {    # no more renewals allowed
940
        if ( $CanBookBeRenewed == 0 ) {    # no more renewals allowed
941
            $issuingimpossible{NO_MORE_RENEWALS} = 1;
941
            if ( $renewerror eq 'onsite_checkout' ) {
942
                $issuingimpossible{NO_RENEWAL_FOR_ONSITE_CHECKOUTS} = 1;
943
            }
944
            else {
945
                $issuingimpossible{NO_MORE_RENEWALS} = 1;
946
            }
942
        }
947
        }
943
        else {
948
        else {
944
            $needsconfirmation{RENEW_ISSUE} = 1;
949
            $needsconfirmation{RENEW_ISSUE} = 1;
Lines 2667-2672 sub CanBookBeRenewed { Link Here
2667
2672
2668
    my $item      = GetItem($itemnumber)      or return ( 0, 'no_item' );
2673
    my $item      = GetItem($itemnumber)      or return ( 0, 'no_item' );
2669
    my $itemissue = GetItemIssue($itemnumber) or return ( 0, 'no_checkout' );
2674
    my $itemissue = GetItemIssue($itemnumber) or return ( 0, 'no_checkout' );
2675
    return ( 0, 'onsite_checkout' ) if $itemissue->{onsite_checkout};
2670
2676
2671
    $borrowernumber ||= $itemissue->{borrowernumber};
2677
    $borrowernumber ||= $itemissue->{borrowernumber};
2672
    my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber )
2678
    my $borrower = C4::Members::GetMember( borrowernumber => $borrowernumber )
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/checkouts.js (-13 / +13 lines)
Lines 328-333 $(document).ready(function() { Link Here
328
328
329
                            span_style = "display: none";
329
                            span_style = "display: none";
330
                            span_class = "renewals-allowed";
330
                            span_class = "renewals-allowed";
331
                        } else if ( oObj.can_renew_error == "onsite_checkout" ) {
332
                            // Don't display something if it's an onsite checkout
331
                        } else {
333
                        } else {
332
                            content += "<span class='renewals-disabled'>"
334
                            content += "<span class='renewals-disabled'>"
333
                                    + oObj.can_renew_error
335
                                    + oObj.can_renew_error
Lines 339-358 $(document).ready(function() { Link Here
339
341
340
                        var can_force_renew = ( oObj.onsite_checkout == 0 ) && ( oObj.can_renew_error != "on_reserve" );
342
                        var can_force_renew = ( oObj.onsite_checkout == 0 ) && ( oObj.can_renew_error != "on_reserve" );
341
                        var can_renew = ( oObj.renewals_remaining > 0  && !oObj.can_renew_error );
343
                        var can_renew = ( oObj.renewals_remaining > 0  && !oObj.can_renew_error );
342
                        if ( oObj.onsite_checkout == 0 ) {
344
                        if ( can_renew || can_force_renew ) {
343
                            if ( can_renew || can_force_renew ) {
345
                            content += "<span class='" + span_class + "' style='" + span_style + "'>"
344
                                content += "<span class='" + span_class + "' style='" + span_style + "'>"
346
                                    +  "<input type='checkbox' ";
345
                                        +  "<input type='checkbox' ";
347
                            if ( oObj.date_due_overdue && can_renew ) {
346
                                if ( oObj.date_due_overdue && can_renew ) {
348
                                content += "checked='checked' ";
347
                                    content += "checked='checked' ";
348
                                }
349
                                content += "class='renew' id='renew_" + oObj.itemnumber + "' name='renew' value='" + oObj.itemnumber +"'/>"
350
                                        +  "</span>";
351
352
                                content += "<span class='renewals'>("
353
                                        + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed )
354
                                        + ")</span>";
355
                            }
349
                            }
350
                            content += "class='renew' id='renew_" + oObj.itemnumber + "' name='renew' value='" + oObj.itemnumber +"'/>"
351
                                    +  "</span>";
352
353
                            content += "<span class='renewals'>("
354
                                    + RENEWALS_REMAINING.format( oObj.renewals_remaining, oObj.renewals_allowed )
355
                                    + ")</span>";
356
                        }
356
                        }
357
357
358
                        content += "</span>";
358
                        content += "</span>";
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+4 lines)
Lines 481-486 $(document).ready(function() { Link Here
481
            <li>No more renewals possible</li>
481
            <li>No more renewals possible</li>
482
        [% END %]
482
        [% END %]
483
483
484
        [% IF NO_RENEWAL_FOR_ONSITE_CHECKOUTS %]
485
            <li>This issue can not be renewed, it's an on-site checkout</li>
486
        [% END %]
487
484
        [%IF ( AGE_RESTRICTION ) %]
488
        [%IF ( AGE_RESTRICTION ) %]
485
            <li>Age restriction [% AGE_RESTRICTION %].</li>
489
            <li>Age restriction [% AGE_RESTRICTION %].</li>
486
        [% END %]
490
        [% END %]
(-)a/t/db_dependent/Circulation.t (-2 / +37 lines)
Lines 27-33 use C4::Overdues qw(UpdateFine); Link Here
27
use Koha::DateUtils;
27
use Koha::DateUtils;
28
use Koha::Database;
28
use Koha::Database;
29
29
30
use Test::More tests => 61;
30
use Test::More tests => 63;
31
31
32
BEGIN {
32
BEGIN {
33
    use_ok('C4::Circulation');
33
    use_ok('C4::Circulation');
Lines 594-599 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
594
    is ( $count, 0, "Calling UpdateFine on non-existant fine with an amount of 0 does not result in an empty fine" );
594
    is ( $count, 0, "Calling UpdateFine on non-existant fine with an amount of 0 does not result in an empty fine" );
595
}
595
}
596
596
597
{
598
    # Don't allow renewing onsite checkout
599
    my $barcode  = 'R00000XXX';
600
    my $branch   = 'CPL';
601
602
    #Create another record
603
    my $biblio = MARC::Record->new();
604
    $biblio->append_fields(
605
        MARC::Field->new('100', ' ', ' ', a => 'Anonymous'),
606
        MARC::Field->new('245', ' ', ' ', a => 'A title'),
607
    );
608
    my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, '');
609
610
    my (undef, undef, $itemnumber) = AddItem(
611
        {
612
            homebranch       => $branch,
613
            holdingbranch    => $branch,
614
            barcode          => $barcode,
615
        },
616
        $biblionumber
617
    );
618
619
    my $borrowernumber = AddMember(
620
        firstname =>  'fn',
621
        surname => 'dn',
622
        categorycode => 'S',
623
        branchcode => $branch,
624
    );
625
626
    my $borrower = GetMember( borrowernumber => $borrowernumber );
627
    my $issue = AddIssue( $borrower, $barcode, undef, undef, undef, undef, { onsite_checkout => 1 } );
628
    my ( $renewed, $error ) = CanBookBeRenewed( $borrowernumber, $itemnumber );
629
    is( $renewed, 0, 'CanBookBeRenewed should not allow to renew on-site checkout' );
630
    is( $error, 'onsite_checkout', 'A correct error code should be returned by CanBookBeRenewed for on-site checkout' );
631
}
632
597
$dbh->rollback;
633
$dbh->rollback;
598
634
599
1;
635
1;
600
- 

Return to bug 14470