Bugzilla – Attachment 120565 Details for
Bug 27837
Permanent location is reverted to location when location updated and permanent_location mapped to MARC field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27837: Unit tests for blank permanent location
Bug-27837-Unit-tests-for-blank-permanent-location.patch (text/plain), 3.41 KB, created by
Nick Clemens (kidclamp)
on 2021-05-05 18:47:03 UTC
(
hide
)
Description:
Bug 27837: Unit tests for blank permanent location
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-05-05 18:47:03 UTC
Size:
3.41 KB
patch
obsolete
>From a86f485ed1a1b7baa184d78ccc16a16bbc0f6bf9 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 3 May 2021 14:44:49 +0000 >Subject: [PATCH] Bug 27837: Unit tests for blank permanent location > >--- > t/db_dependent/Items.t | 41 +++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 39 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index ef4de8f20b..ff611b4d0e 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -1038,7 +1038,7 @@ subtest 'ModItemFromMarc' => sub { > }; > > subtest 'permanent_location' => sub { >- plan tests => 6; >+ plan tests => 10; > > # Make sure items.permanent_location is not mapped > Koha::MarcSubfieldStructures->search( >@@ -1047,6 +1047,13 @@ subtest 'ModItemFromMarc' => sub { > kohafield => 'items.permanent_location', > } > )->delete; >+ Koha::MarcSubfieldStructures->search( >+ { >+ frameworkcode => q{}, >+ tagfield => '952', >+ tagsubfield => 'C', >+ } >+ )->delete; > Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); > > my $item = $builder->build_sample_item; >@@ -1072,7 +1079,9 @@ subtest 'ModItemFromMarc' => sub { > tagfield => '952', > tagsubfield => 'C', > kohafield => 'items.permanent_location', >- repeatable => 0 >+ repeatable => 0, >+ tab => 10, >+ hidden => 0, > } > )->store; > Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); >@@ -1085,6 +1094,34 @@ subtest 'ModItemFromMarc' => sub { > $item = $item->get_from_storage; > is( $item->location, 'C', 'next new location set as expected' ); > is( $item->permanent_location, 'B', 'permanent location remains unchanged as expected' ); >+ >+ $item->permanent_location(undef)->more_subfields_xml(undef)->store; >+ # Clear values from the DB >+ $item = $item->get_from_storage; >+ >+ # Update the location >+ $item->location('D'); >+ $marc = C4::Items::Item2Marc( $item->unblessed, $item->biblionumber ); >+ # Remove the permanent_location field from the form >+ $marc->field('952')->delete_subfield("C"); >+ ModItemFromMarc( $marc, $item->biblionumber, $item->itemnumber ); >+ $item = $item->get_from_storage; >+ is( $item->location, 'D', 'next new location set as expected' ); >+ is( $item->permanent_location, 'D', 'permanent location is updated if not previously set and no value passed' ); >+ >+ # Clear values from the DB >+ $item->permanent_location(undef)->more_subfields_xml(undef)->store; >+ $item = $item->get_from_storage; >+ >+ # This time nothing is set, but we pass an emty string >+ $item->permanent_location(""); >+ $item->location('E'); >+ $marc = C4::Items::Item2Marc( $item->unblessed, $item->biblionumber ); >+ ModItemFromMarc( $marc, $item->biblionumber, $item->itemnumber ); >+ $item = $item->get_from_storage; >+ is( $item->location, 'E', 'next new location set as expected' ); >+ is( $item->permanent_location, undef, 'permanent location is not updated if previously set as blank string' ); >+ > }; > > $schema->storage->txn_rollback; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27837
:
117570
|
117572
|
117625
|
117626
|
117627
|
117628
|
117634
|
117728
|
117729
|
117730
|
117735
|
117738
|
120361
|
120362
|
120363
|
120364
|
120562
|
120563
|
120564
|
120565
|
120566
|
120616
|
120628
|
120629
|
120832
|
121044
|
121045
|
121046
|
121047
|
121048
|
121049
|
121050
|
121051
|
121052