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

(-)a/C4/Circulation.pm (-4 / +4 lines)
Lines 41-46 use Algorithm::CheckDigits; Link Here
41
use Data::Dumper;
41
use Data::Dumper;
42
use Koha::Account;
42
use Koha::Account;
43
use Koha::AuthorisedValues;
43
use Koha::AuthorisedValues;
44
use Koha::Biblioitems;
44
use Koha::DateUtils;
45
use Koha::DateUtils;
45
use Koha::Calendar;
46
use Koha::Calendar;
46
use Koha::Checkouts;
47
use Koha::Checkouts;
Lines 1820-1829 sub AddReturn { Link Here
1820
    }
1821
    }
1821
1822
1822
    my $itemnumber = $item->{ itemnumber };
1823
    my $itemnumber = $item->{ itemnumber };
1823
1824
    my $itemtype = C4::Context->preference("item-level_itypes")
1824
    my $item_level_itypes = C4::Context->preference("item-level_itypes");
1825
        ? $item->{itype}
1825
    my $biblio   = $item_level_itypes ? undef : Koha::Biblios->find( $item->{ biblionumber } ); # don't get bib data unless we need it
1826
        : Koha::Biblioitems->find( $item->{biblioitemnumber} )->itemtype;
1826
    my $itemtype = $item_level_itypes ? $item->{itype} : $biblio->biblioitem->itemtype;
1827
1827
1828
    my $issue  = Koha::Checkouts->find( { itemnumber => $itemnumber } );
1828
    my $issue  = Koha::Checkouts->find( { itemnumber => $itemnumber } );
1829
    if ( $issue ) {
1829
    if ( $issue ) {
(-)a/t/db_dependent/Circulation/Returns.t (-2 / +3 lines)
Lines 202-208 subtest "AddReturn logging on statistics table (item-level_itypes=0)" => sub { Link Here
202
    t::lib::Mocks::mock_preference( "IssueLog", 1 );
202
    t::lib::Mocks::mock_preference( "IssueLog", 1 );
203
    t::lib::Mocks::mock_preference( "ReturnLog", 1 );
203
    t::lib::Mocks::mock_preference( "ReturnLog", 1 );
204
204
205
    # Set item-level item types
205
    # Set biblio level item types
206
    t::lib::Mocks::mock_preference( "item-level_itypes", 0 );
206
    t::lib::Mocks::mock_preference( "item-level_itypes", 0 );
207
207
208
    # Create an itemtype for biblio-level item type
208
    # Create an itemtype for biblio-level item type
Lines 234-239 subtest "AddReturn logging on statistics table (item-level_itypes=0)" => sub { Link Here
234
        source => 'Item',
234
        source => 'Item',
235
        value  => {
235
        value  => {
236
            biblionumber  => $biblionumber,
236
            biblionumber  => $biblionumber,
237
            biblioitemnumber => $biblioitemnumber,
237
            homebranch    => $branch,
238
            homebranch    => $branch,
238
            holdingbranch => $branch,
239
            holdingbranch => $branch,
239
            itype         => $ilevel_itemtype
240
            itype         => $ilevel_itemtype
Lines 243-248 subtest "AddReturn logging on statistics table (item-level_itypes=0)" => sub { Link Here
243
        source => 'Item',
244
        source => 'Item',
244
        value  => {
245
        value  => {
245
            biblionumber  => $biblionumber,
246
            biblionumber  => $biblionumber,
247
            biblioitemnumber => $biblioitemnumber,
246
            homebranch    => $branch,
248
            homebranch    => $branch,
247
            holdingbranch => $branch,
249
            holdingbranch => $branch,
248
            itype         => undef
250
            itype         => undef
249
- 

Return to bug 19004