From 003b70b697f9c57da8bfb0aca1223c867a07ac97 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 --- C4/Items.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/C4/Items.pm b/C4/Items.pm index 547d8358c9..66ce7af00e 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -2604,6 +2604,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| @@ -2640,7 +2643,7 @@ sub ToggleNewStatus { my $itemnumber = $values->{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