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

(-)a/C4/Circulation.pm (-1 / +1 lines)
Lines 2159-2165 sub AddReturn { Link Here
2159
2159
2160
    my $itemnumber = $item->itemnumber;
2160
    my $itemnumber = $item->itemnumber;
2161
    my $itemtype = $item->effective_itemtype;
2161
    my $itemtype = $item->effective_itemtype;
2162
    my $localuse_count = $item->localuse;
2162
    my $localuse_count = $item->localuse || 0;
2163
2163
2164
    my $issue  = $item->checkout;
2164
    my $issue  = $item->checkout;
2165
    if ( $issue ) {
2165
    if ( $issue ) {
(-)a/t/db_dependent/Circulation.t (-2 / +19 lines)
Lines 6116-6136 subtest 'Tests for transfer not in transit' => sub { Link Here
6116
6116
6117
subtest 'Tests for RecordLocalUseOnReturn' => sub {
6117
subtest 'Tests for RecordLocalUseOnReturn' => sub {
6118
6118
6119
    plan tests => 2;
6119
    plan tests => 5;
6120
6120
6121
    t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 0);
6121
    t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 0);
6122
    my $item = $builder->build_sample_item();
6122
    my $item = $builder->build_sample_item();
6123
    my $item_2 = $builder->build_sample_item(
6124
        {
6125
            onloan => undef,
6126
        }
6127
    );
6128
6123
    $item->withdrawn(1)->itemlost(1)->store;
6129
    $item->withdrawn(1)->itemlost(1)->store;
6124
    my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef );
6130
    my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef );
6125
    is_deeply(
6131
    is_deeply(
6126
        \@return,
6132
        \@return,
6127
        [ 0, { NotIssued => $item->barcode, withdrawn => 1  }, undef, {} ], "RecordLocalUSeOnReturn is off, no local use recorded");
6133
        [ 0, { NotIssued => $item->barcode, withdrawn => 1  }, undef, {} ], "RecordLocalUSeOnReturn is off, no local use recorded");
6128
6134
6135
    AddReturn( $item_2->barcode, $item_2->homebranch );
6136
    $item_2->discard_changes; # refresh
6137
    is( $item_2->localuse, undef , 'Without RecordLocalUseOnReturn no localuse is recorded.');
6138
6129
    t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 1);
6139
    t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 1);
6130
    my @return2 = AddReturn( $item->barcode, $item->homebranch, 0, undef );
6140
    my @return2 = AddReturn( $item->barcode, $item->homebranch, 0, undef );
6131
    is_deeply(
6141
    is_deeply(
6132
        \@return2,
6142
        \@return2,
6133
        [ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1  }, undef, {} ], "Local use is recorded");
6143
        [ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1  }, undef, {} ], "Local use is recorded");
6144
6145
    AddReturn( $item_2->barcode, $item_2->homebranch );
6146
    $item_2->discard_changes; # refresh
6147
    is( $item_2->localuse, 1 , 'With RecordLocalUseOnReturn localuse is recorded.');
6148
6149
    AddReturn( $item_2->barcode, $item_2->homebranch );
6150
    $item_2->discard_changes; # refresh
6151
    is( $item_2->localuse, 2 , 'With RecordLocalUseOnReturn localuse is recorded.');
6134
};
6152
};
6135
6153
6136
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub {
6154
subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub {
6137
- 

Return to bug 16122