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

(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 137-143 sub store { Link Here
137
137
138
        my %updated_columns = $self->_result->get_dirty_columns;
138
        my %updated_columns = $self->_result->get_dirty_columns;
139
        return $self->SUPER::store unless %updated_columns;
139
        return $self->SUPER::store unless %updated_columns;
140
        if (    defined $self->location
140
        if (    exists $updated_columns{location}
141
            and $self->location ne 'CART'
141
            and $self->location ne 'CART'
142
            and $self->location ne 'PROC'
142
            and $self->location ne 'PROC'
143
            and not exists $updated_columns{permanent_location} )
143
            and not exists $updated_columns{permanent_location} )
(-)a/t/db_dependent/Items.t (-6 / +6 lines)
Lines 108-122 subtest 'General Add, Get and Del tests' => sub { Link Here
108
    is( $getitem->location, $location, "The location should not have been modified" );
108
    is( $getitem->location, $location, "The location should not have been modified" );
109
    is( $getitem->permanent_location, 'my permanent location', "The permanent_location should not have modified" );
109
    is( $getitem->permanent_location, 'my permanent location', "The permanent_location should not have modified" );
110
110
111
    $getitem->location($location)->store;
111
    my $new_location = "New location";
112
    $getitem->location($new_location)->store;
112
    $getitem = Koha::Items->find($itemnumber);
113
    $getitem = Koha::Items->find($itemnumber);
113
    is( $getitem->location, $location, "The location should have been set to correct location" );
114
    is( $getitem->location, $new_location, "The location should have been set to correct location" );
114
    is( $getitem->permanent_location, $location, "The permanent_location should have been set to location" );
115
    is( $getitem->permanent_location, $new_location, "The permanent_location should have been set to location" );
115
116
116
    $getitem->location('CART')->store;
117
    $getitem->location('CART')->store;
117
    $getitem = Koha::Items->find($itemnumber);
118
    $getitem = Koha::Items->find($itemnumber);
118
    is( $getitem->location, 'CART', "The location should have been set to CART" );
119
    is( $getitem->location, 'CART', "The location should have been set to CART" );
119
    is( $getitem->permanent_location, $location, "The permanent_location should not have been set to CART" );
120
    is( $getitem->permanent_location, $new_location, "The permanent_location should not have been set to CART" );
120
121
121
    t::lib::Mocks::mock_preference('item-level_itypes', '1');
122
    t::lib::Mocks::mock_preference('item-level_itypes', '1');
122
    $getitem = Koha::Items->find($itemnumber);
123
    $getitem = Koha::Items->find($itemnumber);
Lines 840-846 subtest 'Test logging for ModItem' => sub { Link Here
840
841
841
    # True means logging
842
    # True means logging
842
    $schema->resultset('ActionLog')->search()->delete();
843
    $schema->resultset('ActionLog')->search()->delete();
843
    $item->location($location)->store({ log_action => 1 });
844
    $item->location('new location')->store({ log_action => 1 });
844
    is( $schema->resultset('ActionLog')->count(), 1, 'True value does trigger logging' );
845
    is( $schema->resultset('ActionLog')->count(), 1, 'True value does trigger logging' );
845
846
846
    # Undefined defaults to true
847
    # Undefined defaults to true
847
- 

Return to bug 23463