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

(-)a/C4/Items.pm (-7 / +2 lines)
Lines 277-291 sub ModItemFromMarc { Link Here
277
277
278
    my $localitemmarc = MARC::Record->new;
278
    my $localitemmarc = MARC::Record->new;
279
    $localitemmarc->append_fields( $item_marc->field($itemtag) );
279
    $localitemmarc->append_fields( $item_marc->field($itemtag) );
280
    my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' );
281
    my $default_values = _build_default_values_for_mod_marc();
282
    my $item_object = Koha::Items->find($itemnumber);
280
    my $item_object = Koha::Items->find($itemnumber);
283
    foreach my $item_field ( keys %$default_values ) {
281
    my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' );
284
        $item_object->$item_field($default_values->{$item_field})
282
    $item_object->set($item);
285
          unless exists $item->{$item_field};
286
    }
287
    my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode );
283
    my $unlinked_item_subfields = _get_unlinked_item_subfields( $localitemmarc, $frameworkcode );
288
289
    $item_object->more_subfields_xml(_get_unlinked_subfields_xml($unlinked_item_subfields))->store;
284
    $item_object->more_subfields_xml(_get_unlinked_subfields_xml($unlinked_item_subfields))->store;
290
    $item_object->store;
285
    $item_object->store;
291
286
(-)a/Koha/Item.pm (-2 / +7 lines)
Lines 133-140 sub store { Link Here
133
            }
133
            }
134
        }
134
        }
135
135
136
        if ( defined $self->location and $self->location ne 'CART' and $self->location ne 'PROC' and not $self->permanent_location ) {
136
        my %updated_columns = $self->_result->get_dirty_columns;
137
            $self->permanent_location($self->location);
137
        if (    defined $self->location
138
            and $self->location ne 'CART'
139
            and $self->location ne 'PROC'
140
            and not exists $updated_columns{permanent_location} )
141
        {
142
            $self->permanent_location( $self->location );
138
        }
143
        }
139
144
140
        $self->timestamp(undef) if $self->timestamp; # Maybe move this to Koha::Object->store?
145
        $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 387-394 ok( $item2->location eq 'FIC', 'UpdateItemLocationOnCheckin does not modify valu Link Here
387
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' );
387
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' );
388
AddReturn( 'barcode_4', $branchcode_1 );
388
AddReturn( 'barcode_4', $branchcode_1 );
389
$item2 = Koha::Items->find( $itemnumber2 );
389
$item2 = Koha::Items->find( $itemnumber2 );
390
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
390
is( $item2->location, 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
391
ok( $item2->permanent_location eq 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
391
is( $item2->permanent_location, 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
392
AddReturn( 'barcode_4', $branchcode_1 );
392
AddReturn( 'barcode_4', $branchcode_1 );
393
$item2 = Koha::Items->find( $itemnumber2 );
393
$item2 = Koha::Items->find( $itemnumber2 );
394
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} );
394
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} );
395
- 

Return to bug 23463