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

(-)a/C4/Items.pm (-7 / +2 lines)
Lines 276-290 sub ModItemFromMarc { Link Here
276
276
277
    my $localitemmarc = MARC::Record->new;
277
    my $localitemmarc = MARC::Record->new;
278
    $localitemmarc->append_fields( $item_marc->field($itemtag) );
278
    $localitemmarc->append_fields( $item_marc->field($itemtag) );
279
    my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' );
280
    my $default_values = _build_default_values_for_mod_marc();
281
    my $item_object = Koha::Items->find($itemnumber);
279
    my $item_object = Koha::Items->find($itemnumber);
282
    foreach my $item_field ( keys %$default_values ) {
280
    my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' );
283
        $item_object->$item_field($default_values->{$item_field})
281
    $item_object->set($item);
284
          unless exists $item->{$item_field};
285
    }
286
    my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode );
282
    my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode );
287
288
    $item_object->more_subfields_xml(_get_unlinked_subfields_xml($unlinked_item_subfields))->store;
283
    $item_object->more_subfields_xml(_get_unlinked_subfields_xml($unlinked_item_subfields))->store;
289
    $item_object->store;
284
    $item_object->store;
290
285
(-)a/Koha/Item.pm (-2 / +7 lines)
Lines 135-142 sub store { Link Here
135
            }
135
            }
136
        }
136
        }
137
137
138
        if ( defined $self->location and $self->location ne 'CART' and $self->location ne 'PROC' and not $self->permanent_location ) {
138
        my %updated_columns = $self->_result->get_dirty_columns;
139
            $self->permanent_location($self->location);
139
        if (    defined $self->location
140
            and $self->location ne 'CART'
141
            and $self->location ne 'PROC'
142
            and not exists $updated_columns{permanent_location} )
143
        {
144
            $self->permanent_location( $self->location );
140
        }
145
        }
141
146
142
        $self->timestamp(undef) if $self->timestamp; # Maybe move this to Koha::Object->store?
147
        $self->timestamp(undef) if $self->timestamp; # Maybe move this to Koha::Object->store?
(-)a/t/db_dependent/Acquisition/CancelReceipt.t (-1 / +1 lines)
Lines 167-172 my $item1 = Koha::Items->find( $itemnumber1 ); Link Here
167
is( $item1->notforloan, 9, "The notforloan value has been updated with '9'" );
167
is( $item1->notforloan, 9, "The notforloan value has been updated with '9'" );
168
168
169
my $item2 = Koha::Items->find( $itemnumber2 );
169
my $item2 = Koha::Items->find( $itemnumber2 );
170
is( $item2->notforloan, 0, "The notforloan value has been updated with '9'" );
170
is( $item2->notforloan, 0, "The notforloan value has been updated with '0'" );
171
171
172
$schema->storage->txn_rollback();
172
$schema->storage->txn_rollback();
(-)a/t/db_dependent/Circulation/issue.t (-3 / +2 lines)
Lines 394-401 ok( $item2->location eq 'FIC', 'UpdateItemLocationOnCheckin does not modify valu Link Here
394
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' );
394
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' );
395
AddReturn( 'barcode_4', $branchcode_1 );
395
AddReturn( 'barcode_4', $branchcode_1 );
396
$item2 = Koha::Items->find( $itemnumber2 );
396
$item2 = Koha::Items->find( $itemnumber2 );
397
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
397
is( $item2->location, 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
398
ok( $item2->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
398
is( $item2->permanent_location, 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
399
AddReturn( 'barcode_4', $branchcode_1 );
399
AddReturn( 'barcode_4', $branchcode_1 );
400
$item2 = Koha::Items->find( $itemnumber2 );
400
$item2 = Koha::Items->find( $itemnumber2 );
401
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} );
401
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} );
402
- 

Return to bug 23463