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

(-)a/C4/Circulation.pm (-1 lines)
Lines 2671-2677 sub CanBookBeRenewed { Link Here
2671
2671
2672
    my $item      = Koha::Items->find($itemnumber)      or return ( 0, 'no_item' );
2672
    my $item      = Koha::Items->find($itemnumber)      or return ( 0, 'no_item' );
2673
    my $issue = $item->checkout or return ( 0, 'no_checkout' );
2673
    my $issue = $item->checkout or return ( 0, 'no_checkout' );
2674
    return ( 0, 'onsite_checkout' ) if $issue->is_onsite_checkout;
2675
    return ( 0, 'item_denied_renewal') if _item_denied_renewal({ item => $item });
2674
    return ( 0, 'item_denied_renewal') if _item_denied_renewal({ item => $item });
2676
2675
2677
    my $patron = $issue->patron or return;
2676
    my $patron = $issue->patron or return;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt (-4 / +1 lines)
Lines 30-36 Link Here
30
30
31
                [% IF error %]
31
                [% IF error %]
32
                    <div class="dialog alert">
32
                    <div class="dialog alert">
33
                        <h3>Cannot renew:</h3>
33
                        <h3>Cannot renew[% IF issue.onsite_checkout %] on-site checkout[% END %]:</h3>
34
34
35
                            [% IF error == "no_item" %]
35
                            [% IF error == "no_item" %]
36
36
Lines 134-142 Link Here
134
134
135
                                <p>Item is not allowed renewal.</p>
135
                                <p>Item is not allowed renewal.</p>
136
136
137
                            [% ELSIF error == "onsite_checkout" %]
138
                                <p>Item cannot be renewed because it's an onsite checkout</p>
139
140
                            [% ELSE %]
137
                            [% ELSE %]
141
138
142
                                [% error | html %]
139
                                [% error | html %]
(-)a/t/db_dependent/Circulation.t (-32 / +1 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 47;
21
use Test::More tests => 45;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Deep qw( cmp_deeply );
23
use Test::Deep qw( cmp_deeply );
24
24
Lines 1536-1571 subtest "AllowRenewalIfOtherItemsAvailable tests" => sub { Link Here
1536
    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' );
1536
    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' );
1537
};
1537
};
1538
1538
1539
{
1540
    # Don't allow renewing onsite checkout
1541
    my $branch   = $library->{branchcode};
1542
1543
    #Create another record
1544
    my $biblio = $builder->build_sample_biblio();
1545
1546
    my $item = $builder->build_sample_item(
1547
        {
1548
            biblionumber     => $biblio->biblionumber,
1549
            library          => $branch,
1550
            itype            => $itemtype,
1551
        }
1552
    );
1553
1554
    my $borrowernumber = Koha::Patron->new({
1555
        firstname =>  'fn',
1556
        surname => 'dn',
1557
        categorycode => $patron_category->{categorycode},
1558
        branchcode => $branch,
1559
    })->store->borrowernumber;
1560
1561
    my $borrower = Koha::Patrons->find( $borrowernumber )->unblessed;
1562
1563
    my $issue = AddIssue( $borrower, $item->barcode, undef, undef, undef, undef, { onsite_checkout => 1 } );
1564
    my ( $renewed, $error ) = CanBookBeRenewed( $borrowernumber, $item->itemnumber );
1565
    is( $renewed, 0, 'CanBookBeRenewed should not allow to renew on-site checkout' );
1566
    is( $error, 'onsite_checkout', 'A correct error code should be returned by CanBookBeRenewed for on-site checkout' );
1567
}
1568
1569
{
1539
{
1570
    my $library = $builder->build({ source => 'Branch' });
1540
    my $library = $builder->build({ source => 'Branch' });
1571
1541
1572
- 

Return to bug 24101