Bugzilla – Attachment 134384 Details for
Bug 23919
Make ISSN searchable with and without hyphen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23919: Items search by ISBN variations and ISSN variations
Bug-23919-Items-search-by-ISBN-variations-and-ISSN.patch (text/plain), 2.74 KB, created by
Slava Shishkin
on 2022-04-29 13:32:04 UTC
(
hide
)
Description:
Bug 23919: Items search by ISBN variations and ISSN variations
Filename:
MIME Type:
Creator:
Slava Shishkin
Created:
2022-04-29 13:32:04 UTC
Size:
2.74 KB
patch
obsolete
>From 8c09253c52e55f804d6a0a70d3fcd98bc7344664 Mon Sep 17 00:00:00 2001 >From: Slava Shishkin <slavashishkin@gmail.com> >Date: Wed, 27 Apr 2022 00:22:54 +0300 >Subject: [PATCH] Bug 23919: Items search by ISBN variations and ISSN > variations > >--- > C4/Items.pm | 44 ++++++++++++++++++++++++++++++++++++-------- > 1 file changed, 36 insertions(+), 8 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index a7f06dd876..97fecf7bd8 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1345,6 +1345,26 @@ sub _SearchItems_build_where_fragment { > } > $column = "ExtractValue($sqlfield, '$xpath')"; > } >+ } >+ elsif ($field eq 'isbn') { >+ if ( C4::Context->preference("SearchWithISBNVariations") ) { >+ my @isbns = C4::Koha::GetVariationsOfISBN( $query ); >+ $query = []; >+ foreach my $isb (@isbns){ >+ push @$query, "%$isb%"; >+ } >+ } >+ $column = $field; >+ } >+ elsif ($field eq 'issn') { >+ if ( C4::Context->preference("SearchWithISSNVariations") ) { >+ my @issns = C4::Koha::GetVariationsOfISSN( $query ); >+ $query = []; >+ foreach my $isn (@issns){ >+ push @$query, "%$isn%"; >+ } >+ } >+ $column = $field; > } else { > $column = $field; > } >@@ -1354,15 +1374,23 @@ sub _SearchItems_build_where_fragment { > } > > if (ref $query eq 'ARRAY') { >- if ($op eq '=') { >- $op = 'IN'; >- } elsif ($op eq '!=') { >- $op = 'NOT IN'; >+ 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 '!=') { >+ $op = 'NOT IN'; >+ } >+ $where_fragment = { >+ str => "$column $op (" . join (',', ('?') x @$query) . ")", >+ args => $query, >+ }; > } >- $where_fragment = { >- str => "$column $op (" . join (',', ('?') x @$query) . ")", >- args => $query, >- }; > } elsif ( $op eq 'is' ) { > $where_fragment = { > str => "$column $op $query", >-- >2.35.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23919
:
134381
|
134382
|
134383
|
134384
|
134385
|
134422
|
134423
|
134424
|
134425
|
134426
|
134440
|
134441
|
134442
|
134443
|
134444
|
135288
|
135289
|
135290
|
135291
|
135292
|
138311
|
138312
|
138313
|
138314
|
138315
|
138480