From 7070e5f82fa627efc9c18f45e02cb07376683846 Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Mon, 16 Feb 2015 17:50:10 +0200 Subject: [PATCH] Bug 13540 - Item's permanent_location is set to CART|PROC when... - Followup 1 To fix the failing test "ReturnToShelvingCart: Adding a new Item with location also sets the permanent_location." When adding an Item, set the permanent_location to location if present. This behaviour is consistent with ModItem where permanent_location is set to location. --- C4/Items.pm | 1 + t/db_dependent/Circulation.t | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/Items.pm b/C4/Items.pm index 623b82e..edbc6d5 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -2135,6 +2135,7 @@ sub _set_defaults_for_add { my $item = shift; $item->{dateaccessioned} ||= C4::Dates->new->output('iso'); $item->{$_} ||= 0 for (qw( notforloan damaged itemlost withdrawn)); + $item->{permanent_location} = $item->{location} unless ($item->{permanent_location}); } =head2 _koha_new_item diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index b09944a..54c23b8 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -645,7 +645,7 @@ sub testReturnToShelvingCart { $item->{biblionumber} ); my $addedItem = C4::Items::GetItem($addedItemnumber); - ok($item->{permanent_location} eq $yetAnotherLocation && $item->{location} eq $yetAnotherLocation, "ReturnToShelvingCart: Adding a new Item with location also sets the permanent_location."); + ok($addedItem->{permanent_location} eq $yetAnotherLocation && $addedItem->{location} eq $yetAnotherLocation, "ReturnToShelvingCart: Adding a new Item with location also sets the permanent_location."); C4::Context->set_preference('ReturnToShelvingCart', $originalReturnToShelvingCart) unless $originalReturnToShelvingCart; #Set it to the original value } \ No newline at end of file -- 1.7.9.5