Bug 23919: Items search by ISBN variations and ISSN variations
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
d5850d8ba4
commit
678bc58bb9
1 changed files with 32 additions and 8 deletions
24
C4/Items.pm
24
C4/Items.pm
|
@ -1299,6 +1299,22 @@ sub _SearchItems_build_where_fragment {
|
|||
}
|
||||
$column = "ExtractValue($sqlfield, '$xpath')";
|
||||
}
|
||||
}
|
||||
elsif ($field eq 'isbn') {
|
||||
if ( C4::Context->preference("SearchWithISBNVariations") and $query ) {
|
||||
my @isbns = C4::Koha::GetVariationsOfISBN( $query );
|
||||
$query = [];
|
||||
push @$query, @isbns;
|
||||
}
|
||||
$column = $field;
|
||||
}
|
||||
elsif ($field eq 'issn') {
|
||||
if ( C4::Context->preference("SearchWithISSNVariations") and $query ) {
|
||||
my @issns = C4::Koha::GetVariationsOfISSN( $query );
|
||||
$query = [];
|
||||
push @$query, @issns;
|
||||
}
|
||||
$column = $field;
|
||||
} else {
|
||||
$column = $field;
|
||||
}
|
||||
|
@ -1308,6 +1324,13 @@ sub _SearchItems_build_where_fragment {
|
|||
}
|
||||
|
||||
if (ref $query eq 'ARRAY') {
|
||||
if ($op eq 'like') {
|
||||
$where_fragment = {
|
||||
str => "($column LIKE " . join (" OR $column LIKE ", ('?') x @$query ) . ")",
|
||||
args => $query,
|
||||
};
|
||||
}
|
||||
else {
|
||||
if ($op eq '=') {
|
||||
$op = 'IN';
|
||||
} elsif ($op eq '!=') {
|
||||
|
@ -1317,6 +1340,7 @@ sub _SearchItems_build_where_fragment {
|
|||
str => "$column $op (" . join (',', ('?') x @$query) . ")",
|
||||
args => $query,
|
||||
};
|
||||
}
|
||||
} elsif ( $op eq 'is' ) {
|
||||
$where_fragment = {
|
||||
str => "$column $op $query",
|
||||
|
|
Loading…
Reference in a new issue