From 68c1318ff6a417e855d1cb6083174d260944760e Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 4 May 2021 18:29:05 +0000 Subject: [PATCH] Bug 28290: Don't send subfields to 'as_string' if none to send This fixes an error where we send a blank string to Marc::Field->as_string The subroutine fails as the regex is marked as incomplete as there is nothing between the brackets Also fixes a missing hidden input for 'item_action' when no items are staged during import 1 - Define a new matching rule with no subfields Match-threshold: 1000 Record type: bibliographic record Search-index: Other-control-number Score: 1000 Tag: 035 Subfields: Offset: Length: 2 - Attempt to stage a record with an 035 using this rule (i will attach example to bug) 3 - Staging fails 4 - Stage again with no matching rule 5 - Manage the staged record, try to apply the matching rule 6 - It fails, 500 error 7 - Apply patch 8 - Restart all the things 9 - Apply rule again, it works! 10 - Stage the record again using the rule for matching 11 - It stages and matches! Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit eded6edacc5e3bf8dd0be21ed05842c3b78aadce) Signed-off-by: Lucas Gass (cherry picked from commit 0c8e4780d78c0c90e2fb5d6c08868104a91e1f2c) Signed-off-by: Arthur Suzuki --- C4/Matcher.pm | 4 +++- .../intranet-tmpl/prog/en/includes/tools-item-action.inc | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/C4/Matcher.pm b/C4/Matcher.pm index e8a8ec3f74..77716f736c 100644 --- a/C4/Matcher.pm +++ b/C4/Matcher.pm @@ -838,10 +838,12 @@ sub _get_match_keys { } elsif ( $field->is_control_field() ) { $string = $field->data(); - } else { + } elsif ( defined $component->{subfields} && keys %{$component->{subfields}} ){ $string = $field->as_string( join('', keys %{ $component->{ subfields } }), ' ' # ' ' as separator ); + } else { + $string = $field->as_string(); } if ($component->{'length'}>0) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-item-action.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-item-action.inc index 27fb6dadbd..e58f05f551 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/tools-item-action.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/tools-item-action.inc @@ -1,5 +1,6 @@ [% IF item_action_ignore AND num_items == 0 %] No items were found during staging + [% ELSE %]