Lines 40-46
sub to_koha {
Link Here
|
40 |
my ($self, $mappings) = @_; |
40 |
my ($self, $mappings) = @_; |
41 |
|
41 |
|
42 |
my $attrs = $self->{'attributes'}; |
42 |
my $attrs = $self->{'attributes'}; |
43 |
my $fields = $mappings->{use}{default} // '_all'; |
43 |
my $fields = $mappings->{use}{default}; |
44 |
my $split = 0; |
44 |
my $split = 0; |
45 |
my $prefix = ''; |
45 |
my $prefix = ''; |
46 |
my $suffix = ''; |
46 |
my $suffix = ''; |
Lines 62-68
sub to_koha {
Link Here
|
62 |
} |
62 |
} |
63 |
} |
63 |
} |
64 |
|
64 |
|
65 |
$fields = [$fields] unless ref($fields) eq 'ARRAY'; |
65 |
$fields = [$fields] unless !defined $fields || ref($fields) eq 'ARRAY'; |
66 |
|
66 |
|
67 |
if ($split) { |
67 |
if ($split) { |
68 |
my @terms; |
68 |
my @terms; |
Lines 72-79
sub to_koha {
Link Here
|
72 |
next if (!$word); |
72 |
next if (!$word); |
73 |
$word = $self->escape($word); |
73 |
$word = $self->escape($word); |
74 |
my @words; |
74 |
my @words; |
75 |
foreach my $field (@{$fields}) { |
75 |
if( $fields ) { |
76 |
push(@words, "$field:($prefix$word$suffix)"); |
76 |
foreach my $field (@{$fields}) { |
|
|
77 |
push(@words, "$field:($prefix$word$suffix)"); |
78 |
} |
79 |
} else { |
80 |
push(@words, "($prefix$word$suffix)"); |
77 |
} |
81 |
} |
78 |
push (@terms, join(' OR ', @words)); |
82 |
push (@terms, join(' OR ', @words)); |
79 |
} |
83 |
} |
Lines 82-87
sub to_koha {
Link Here
|
82 |
|
86 |
|
83 |
my @terms; |
87 |
my @terms; |
84 |
$term = $self->escape($term); |
88 |
$term = $self->escape($term); |
|
|
89 |
return ("($prefix$term$suffix)") unless $fields; |
85 |
foreach my $field (@{$fields}) { |
90 |
foreach my $field (@{$fields}) { |
86 |
push(@terms, "$field:($prefix$term$suffix)"); |
91 |
push(@terms, "$field:($prefix$term$suffix)"); |
87 |
} |
92 |
} |