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

(-)a/C4/Circulation.pm (+14 lines)
Lines 60-65 use Koha::Account::Offsets; Link Here
60
use Koha::Config::SysPrefs;
60
use Koha::Config::SysPrefs;
61
use Koha::Charges::Fees;
61
use Koha::Charges::Fees;
62
use Koha::Util::SystemPreferences;
62
use Koha::Util::SystemPreferences;
63
use Koha::Checkouts::ReturnClaims;
63
use Carp;
64
use Carp;
64
use List::MoreUtils qw( uniq any );
65
use List::MoreUtils qw( uniq any );
65
use Scalar::Util qw( looks_like_number );
66
use Scalar::Util qw( looks_like_number );
Lines 2127-2132 sub AddReturn { Link Here
2127
        }
2128
        }
2128
    }
2129
    }
2129
2130
2131
    if ( C4::Context->preference('ClaimReturnedLostValue') ) {
2132
        my $claims = Koha::Checkouts::ReturnClaims->search(
2133
           {
2134
               itemnumber => $item->id,
2135
               resolution => undef,
2136
           }
2137
        );
2138
2139
        if ( $claims->count ) {
2140
            $messages->{ReturnClaims} = $claims;
2141
        }
2142
    }
2143
2130
    return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ));
2144
    return ( $doreturn, $messages, $issue, ( $patron ? $patron->unblessed : {} ));
2131
}
2145
}
2132
2146
(-)a/t/db_dependent/Circulation/Returns.t (-2 / +26 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 4;
20
use Test::More tests => 5;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
23
Lines 339-342 subtest 'BlockReturnOfLostItems' => sub { Link Here
339
    is( $doreturn, 1, "Without BlockReturnOfLostItems, a checkin of a lost item should not be blocked");
339
    is( $doreturn, 1, "Without BlockReturnOfLostItems, a checkin of a lost item should not be blocked");
340
};
340
};
341
341
342
subtest 'Checkin of an item claimed as returned should generate a message' => sub {
343
    plan tests => 1;
344
345
    t::lib::Mocks::mock_preference('ClaimReturnedLostValue', 1);
346
    my $biblio = $builder->build_object( { class => 'Koha::Biblios' } );
347
    my $item = $builder->build_object(
348
        {
349
            class  => 'Koha::Items',
350
            value  => {
351
                biblionumber => $biblio->biblionumber,
352
                notforloan => 0,
353
                itemlost   => 0,
354
                withdrawn  => 0,
355
        }
356
    }
357
    );
358
    my $patron = $builder->build_object({class => 'Koha::Patrons'});
359
    my $checkout = AddIssue( $patron->unblessed, $item->barcode );
360
361
    $checkout->claim_returned({ created_by => $patron->id });
362
363
    my ( $doreturn, $messages, $issue ) = AddReturn($item->barcode);
364
    ok( $messages->{ReturnClaims}, "ReturnClaims is in messages for return of a claimed as returned itm" ); 
365
};
366
342
$schema->storage->txn_rollback;
367
$schema->storage->txn_rollback;
343
- 

Return to bug 14697