Bug 18501: Don't use paidfor for DB fields not mapped with a MARC field
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 21 Aug 2020 10:02:07 +0000 (12:02 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 21 Aug 2020 10:03:09 +0000 (12:03 +0200)
On "Bug 25964: Prevent data loss when editing items from a MARC record"
we picked paidfor as an example, but it has a specific behaviour and is
now handled in Koha::Item->store.
Let's pick another one, new_status

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

t/db_dependent/Items.t

index 3da406a..4e7fecb 100755 (executable)
@@ -984,7 +984,7 @@ subtest 'ModItemFromMarc' => sub {
     my $item = Koha::Items->find($itemnumber);
     is( $item->itemlost, 1, 'itemlost picked from the item marc');
 
-    $item->paidfor("this is something")->store;
+    $item->new_status("this is something")->store;
 
     my $updated_item_record = new MARC::Record;
     $updated_item_record->append_fields(
@@ -996,8 +996,8 @@ subtest 'ModItemFromMarc' => sub {
 
     my $updated_item = ModItemFromMarc($updated_item_record, $biblio->biblionumber, $itemnumber);
     is( $updated_item->{itemlost}, 0, 'itemlost should have been reset to the default value in DB' );
-    is( $updated_item->{paidfor}, "this is something", "Non mapped field has not been reset" );
-    is( Koha::Items->find($itemnumber)->paidfor, "this is something" );
+    is( $updated_item->{new_status}, "this is something", "Non mapped field has not been reset" );
+    is( Koha::Items->find($itemnumber)->new_status, "this is something" );
 
     $schema->storage->txn_rollback;
 };