From 4f8c51c90e5690cf5857bc8c2e8df51d3ac84e7f Mon Sep 17 00:00:00 2001 From: Slava Shishkin Date: Sun, 24 Apr 2022 00:51:00 +0300 Subject: [PATCH] Bug 28269: Add feature to search Acquisitions Orders by ISSN - add search form field for ISSN number - add search logic including ISSN variations search if SearchWithISSNVariations preference is set --- C4/Acquisition.pm | 22 +++++++++++++++++++ acqui/histsearch.pl | 1 + .../prog/en/includes/filter-orders.inc | 1 + 3 files changed, 24 insertions(+) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 76b6e647c6..d5bc67f884 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2083,6 +2083,7 @@ sub GetHistory { my $title = $params{title}; my $author = $params{author}; my $isbn = $params{isbn}; + my $issn = $params{issn}; my $ean = $params{ean}; my $name = $params{name}; my $internalnote = $params{internalnote}; @@ -2124,6 +2125,20 @@ sub GetHistory { } } + #get variation of issn + my @issn_params; + my @issns; + if ($issn){ + if ( C4::Context->preference("SearchWithISSNVariations") ){ + @issns = C4::Koha::GetVariationsOfISSN( $issn ); + push @issn_params, ('?') x @issns; + } + unless (@issns){ + push @issns, $issn; + push @issn_params, '?'; + } + } + my $dbh = C4::Context->dbh; my $query =" SELECT @@ -2202,6 +2217,13 @@ sub GetHistory { } } + if ( @issns ) { + $query .= " AND ( biblioitems.issn LIKE " . join (" OR biblioitems.issn LIKE ", @issn_params ) . ")"; + foreach my $isn (@issns){ + push @query_params, "%$isn%"; + } + } + if ( $ean ) { $query .= " AND biblioitems.ean = ? "; push @query_params, "$ean"; diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl index e1bdb3851f..ff00c28442 100755 --- a/acqui/histsearch.pl +++ b/acqui/histsearch.pl @@ -75,6 +75,7 @@ my $filters = { title => scalar $input->param('title'), author => scalar $input->param('author'), isbn => scalar $input->param('isbn'), + issn => scalar $input->param('issn'), name => scalar $input->param('name'), internalnote => scalar $input->param('internalnote'), vendornote => scalar $input->param('vendornote'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc index 2ba0802684..84db77943d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc @@ -6,6 +6,7 @@
  • +
  • [% IF Koha.Preference('marcflavour') == 'UNIMARC' %]
  • [% END %] -- 2.35.1