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 => 67;
30
use Test::More tests => 69;
31
31
32
BEGIN {
32
BEGIN {
33
    use_ok('C4::Circulation');
33
    use_ok('C4::Circulation');
Lines 685-689 C4::Context->dbh->do("DELETE FROM accountlines"); Link Here
685
    is( $renewokay, 0, 'Bug 14337 - Verify the borrower can not renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is enabled but the only available item is notforloan' );
685
    is( $renewokay, 0, 'Bug 14337 - Verify the borrower can not renew with a hold on the record if AllowRenewalIfOtherItemsAvailable is enabled but the only available item is notforloan' );
686
}
686
}
687
687
688
{
689
    # Don't allow renewing onsite checkout
690
    my $barcode  = 'R00000XXX';
691
    my $branch   = 'CPL';
692
693
    #Create another record
694
    my $biblio = MARC::Record->new();
695
    $biblio->append_fields(
696
        MARC::Field->new('100', ' ', ' ', a => 'Anonymous'),
697
        MARC::Field->new('245', ' ', ' ', a => 'A title'),
698
    );
699
    my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, '');
700
701
    my (undef, undef, $itemnumber) = AddItem(
702
        {
703
            homebranch       => $branch,
704
            holdingbranch    => $branch,
705
            barcode          => $barcode,
706
        },
707
        $biblionumber
708
    );
709
710
    my $borrowernumber = AddMember(
711
        firstname =>  'fn',
712
        surname => 'dn',
713
        categorycode => 'S',
714
        branchcode => $branch,
715
    );
716
717
    my $borrower = GetMember( borrowernumber => $borrowernumber );
718
    my $issue = AddIssue( $borrower, $barcode, undef, undef, undef, undef, { onsite_checkout => 1 } );
719
    my ( $renewed, $error ) = CanBookBeRenewed( $borrowernumber, $itemnumber );
720
    is( $renewed, 0, 'CanBookBeRenewed should not allow to renew on-site checkout' );
721
    is( $error, 'onsite_checkout', 'A correct error code should be returned by CanBookBeRenewed for on-site checkout' );
722
}
723
688
$schema->storage->txn_rollback();
724
$schema->storage->txn_rollback();
689
1;
725
1;
690
- 

Return to bug 14470