From b1f2d795defee116ce30522eb76f4981ca21b804 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Fri, 7 Dec 2018 15:58:54 +0100 Subject: [PATCH] Bug 21975: get item field in substitutions substitutions field stores the item field with 'items.' prefix. Looks like call of C4::Items::ModItem() works but it will not if ORM object is used in the futur. So I prefer fix it now and it is needed for main patch. Test plan : Run t/db_dependent/Items/AutomaticItemModificationByAge.t Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens (cherry picked from commit 003b70b697f9c57da8bfb0aca1223c867a07ac97) Signed-off-by: Martin Renvoize --- C4/Items.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/C4/Items.pm b/C4/Items.pm index e0cc72f690..7aabf5838d 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -2660,6 +2660,9 @@ sub ToggleNewStatus { my $age = $rule->{age}; my $conditions = $rule->{conditions}; my $substitutions = $rule->{substitutions}; + foreach ( @$substitutions ) { + ( $_->{item_field} ) = ( $_->{field} =~ /items\.(.*)/ ); + } my @params; my $query = q| @@ -2697,7 +2700,7 @@ sub ToggleNewStatus { my $item = C4::Items::GetItem( $itemnumber ); for my $substitution ( @$substitutions ) { next unless $substitution->{field}; - C4::Items::ModItem( {$substitution->{field} => $substitution->{value}}, $biblionumber, $itemnumber ) + C4::Items::ModItem( { $substitution->{item_field} => $substitution->{value} }, $biblionumber, $itemnumber ) unless $report_only; push @{ $report->{$itemnumber} }, $substitution; } -- 2.39.5