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

(-)a/C4/Circulation.pm (-2 / +2 lines)
Lines 1728-1734 sub AddIssue { Link Here
1728
            }
1728
            }
1729
1729
1730
            # Update item location
1730
            # Update item location
1731
            $item_object->update_item_location( 'checkout' );
1731
            $item_object->location_update_trigger( 'checkout' );
1732
1732
1733
            if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) {
1733
            if ( C4::Context->preference('UpdateTotalIssuesOnCirc') ) {
1734
                UpdateTotalIssues( $item_object->biblionumber, 1, undef, { skip_holds_queue => 1 } );
1734
                UpdateTotalIssues( $item_object->biblionumber, 1, undef, { skip_holds_queue => 1 } );
Lines 2199-2205 sub AddReturn { Link Here
2199
    my $patron_unblessed = $patron ? $patron->unblessed : {};
2199
    my $patron_unblessed = $patron ? $patron->unblessed : {};
2200
2200
2201
    # Update item location
2201
    # Update item location
2202
    my $loc_messages = $item->update_item_location( 'checkin' );
2202
    my $loc_messages = $item->location_update_trigger( 'checkin' );
2203
    foreach my $loc_msg_key ( keys %$loc_messages ) {
2203
    foreach my $loc_msg_key ( keys %$loc_messages ) {
2204
        $messages->{ $loc_msg_key } = $loc_messages->{ $loc_msg_key };
2204
        $messages->{ $loc_msg_key } = $loc_messages->{ $loc_msg_key };
2205
    }
2205
    }
(-)a/Koha/Item.pm (-3 / +3 lines)
Lines 2356-2370 sub strings_map { Link Here
2356
}
2356
}
2357
2357
2358
2358
2359
=head3 update_item_location
2359
=head3 location_update_trigger
2360
2360
2361
    $item->update_item_location( $action );
2361
    $item->location_update_trigger( $action );
2362
2362
2363
Update the item location on checkin or checkout.
2363
Update the item location on checkin or checkout.
2364
2364
2365
=cut
2365
=cut
2366
2366
2367
sub update_item_location {
2367
sub location_update_trigger {
2368
    my ( $self, $action ) = @_;
2368
    my ( $self, $action ) = @_;
2369
2369
2370
    my ( $update_loc_rules, $messages );
2370
    my ( $update_loc_rules, $messages );
(-)a/t/db_dependent/Koha/Item.t (-7 / +6 lines)
Lines 2302-2308 subtest 'current_branchtransfers relationship' => sub { Link Here
2302
    $schema->storage->txn_rollback;
2302
    $schema->storage->txn_rollback;
2303
};
2303
};
2304
2304
2305
subtest 'update_item_location() tests' => sub {
2305
subtest 'location_update_trigger() tests' => sub {
2306
2306
2307
    plan tests => 10;
2307
    plan tests => 10;
2308
2308
Lines 2320-2345 subtest 'update_item_location() tests' => sub { Link Here
2320
2320
2321
        my $item = $builder->build_sample_item( { location => $location, permanent_location => $permanent_location } );
2321
        my $item = $builder->build_sample_item( { location => $location, permanent_location => $permanent_location } );
2322
2322
2323
        $item->update_item_location($action);
2323
        $item->location_update_trigger($action);
2324
2324
2325
        is( $item->location, $location, "$pref does not modify value when not enabled" );
2325
        is( $item->location, $location, "$pref does not modify value when not enabled" );
2326
2326
2327
        t::lib::Mocks::mock_preference( $pref, qq{$location: GEN} );
2327
        t::lib::Mocks::mock_preference( $pref, qq{$location: GEN} );
2328
2328
2329
        $item->update_item_location($action);
2329
        $item->location_update_trigger($action);
2330
2330
2331
        is( $item->location, 'GEN', qq{'location' value set from '$location' to 'GEN' with setting `$location: GEN`} );
2331
        is( $item->location, 'GEN', qq{'location' value set from '$location' to 'GEN' with setting `$location: GEN`} );
2332
2332
2333
        t::lib::Mocks::mock_preference( $pref, q{_ALL_: BOO} );
2333
        t::lib::Mocks::mock_preference( $pref, q{_ALL_: BOO} );
2334
2334
2335
        $item->update_item_location($action);
2335
        $item->location_update_trigger($action);
2336
2336
2337
        is( $item->location, 'BOO', q{`_ALL_` does the job} );
2337
        is( $item->location, 'BOO', q{`_ALL_` does the job} );
2338
2338
2339
        t::lib::Mocks::mock_preference( $pref, qq{$location: _BLANK_} );
2339
        t::lib::Mocks::mock_preference( $pref, qq{$location: _BLANK_} );
2340
        $item->location($location)->store();
2340
        $item->location($location)->store();
2341
2341
2342
        $item->update_item_location($action);
2342
        $item->location_update_trigger($action);
2343
        is( $item->location, q{}, q{`_BLANK_` does the job} );
2343
        is( $item->location, q{}, q{`_BLANK_` does the job} );
2344
2344
2345
        t::lib::Mocks::mock_preference( $pref, qq{GEN: _BLANK_\n_BLANK_: PROC\n$location: _PERM_} );
2345
        t::lib::Mocks::mock_preference( $pref, qq{GEN: _BLANK_\n_BLANK_: PROC\n$location: _PERM_} );
Lines 2352-2358 subtest 'update_item_location() tests' => sub { Link Here
2352
            }
2352
            }
2353
        )->store;
2353
        )->store;
2354
2354
2355
        $item->update_item_location($action);
2355
        $item->location_update_trigger($action);
2356
2356
2357
        is(
2357
        is(
2358
            $item->location, $permanent_location,
2358
            $item->location, $permanent_location,
2359
- 

Return to bug 35269