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 107-121 subtest 'General Add, Get and Del tests' => sub { Link Here
107
    is( $getitem->location, $location, "The location should not have been modified" );
107
    is( $getitem->location, $location, "The location should not have been modified" );
108
    is( $getitem->permanent_location, 'my permanent location', "The permanent_location should not have modified" );
108
    is( $getitem->permanent_location, 'my permanent location', "The permanent_location should not have modified" );
109
109
110
    $getitem->location($location)->store;
110
    my $new_location = "New location";
111
    $getitem->location($new_location)->store;
111
    $getitem = Koha::Items->find($itemnumber);
112
    $getitem = Koha::Items->find($itemnumber);
112
    is( $getitem->location, $location, "The location should have been set to correct location" );
113
    is( $getitem->location, $new_location, "The location should have been set to correct location" );
113
    is( $getitem->permanent_location, $location, "The permanent_location should have been set to location" );
114
    is( $getitem->permanent_location, $new_location, "The permanent_location should have been set to location" );
114
115
115
    $getitem->location('CART')->store;
116
    $getitem->location('CART')->store;
116
    $getitem = Koha::Items->find($itemnumber);
117
    $getitem = Koha::Items->find($itemnumber);
117
    is( $getitem->location, 'CART', "The location should have been set to CART" );
118
    is( $getitem->location, 'CART', "The location should have been set to CART" );
118
    is( $getitem->permanent_location, $location, "The permanent_location should not have been set to CART" );
119
    is( $getitem->permanent_location, $new_location, "The permanent_location should not have been set to CART" );
119
120
120
    t::lib::Mocks::mock_preference('item-level_itypes', '1');
121
    t::lib::Mocks::mock_preference('item-level_itypes', '1');
121
    $getitem = Koha::Items->find($itemnumber);
122
    $getitem = Koha::Items->find($itemnumber);
Lines 879-885 subtest 'Test logging for ModItem' => sub { Link Here
879
880
880
    # True means logging
881
    # True means logging
881
    $schema->resultset('ActionLog')->search()->delete();
882
    $schema->resultset('ActionLog')->search()->delete();
882
    $item->location($location)->store({ log_action => 1 });
883
    $item->location('new location')->store({ log_action => 1 });
883
    is( $schema->resultset('ActionLog')->count(), 1, 'True value does trigger logging' );
884
    is( $schema->resultset('ActionLog')->count(), 1, 'True value does trigger logging' );
884
885
885
    # Undefined defaults to true
886
    # Undefined defaults to true
886
- 

Return to bug 23463