X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=C4%2FMatcher.pm;h=5da080128898c21b06206ef14659b37ae47a6867;hb=2eac2e7242aa2685df8f511c49bbf50cb55be4fd;hp=c9a1e46881caf9431f51ba05e8d51405052ba0f2;hpb=ed014edad77b212f78c1b300b3e9b18ad25eaacc;p=koha.git diff --git a/C4/Matcher.pm b/C4/Matcher.pm index c9a1e46881..5da0801288 100644 --- a/C4/Matcher.pm +++ b/C4/Matcher.pm @@ -13,9 +13,9 @@ package C4::Matcher; # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; use warnings; @@ -774,26 +774,23 @@ sub _get_match_keys { last FIELD if $j > 0 and $check_only_first_repeat; last FIELD if $i > 0 and $j > $#keys; my $key = ""; + my $string; if ($field->is_control_field()) { - if ($component->{'length'}) { - $key = _normalize(substr($field->data(), $component->{'offset'}, $component->{'length'})) - # FIXME normalize, substr - } else { - $key = _normalize($field->data()); - } + $string=$field->data(); } else { foreach my $subfield ($field->subfields()) { if (exists $component->{'subfields'}->{$subfield->[0]}) { - $key .= " " . $subfield->[1]; + $string .= " " . $subfield->[1]; } } - $key = _normalize($key); - if ($component->{'length'}){ - if (length($key) > $component->{'length'}){ - $key = _normalize(substr($key,$component->{'offset'},$component->{'length'})); - } - } + } + if ($component->{'length'}>0) { + $string= substr($string, $component->{'offset'}, $component->{'length'}); + # FIXME normalize, substr + } elsif ($component->{'offset'}) { + $string= substr($string, $component->{'offset'}); } + $key = _normalize($string); if ($i == 0) { push @keys, $key if $key; } else { @@ -802,7 +799,6 @@ sub _get_match_keys { } } return @keys; - }