From 0c911c312b532453890bc8ffa1eddd7e27a64934 Mon Sep 17 00:00:00 2001 From: Hayley Pelham Date: Tue, 10 Aug 2021 10:54:09 +1200 Subject: [PATCH] Bug 27287: Make note fields from orders history searchable This patch adds aqorders.order_internalnote and aqorders.order_vendornote to the Acquisitions history search. To test: 1) Apply patch and restart services 2) Create an order in Acquisitions and set an internal note and a vendor note 3) Go to /cgi-bin/acqui/histsearch.pl and search by internal or vendor note using the terms you set in step 2 4) Note your order is returned and internal note and vendor note are included in the search results at the end of the table Sponsored-by: Bibliotheksservice-Zentrum Baden-Wuerttemberg https://bugs.koha-community.org/show_bug.cgi?id=27827 --- C4/Acquisition.pm | 14 ++++++++++++++ acqui/histsearch.pl | 2 ++ koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc | 2 ++ .../intranet-tmpl/prog/en/modules/acqui/histsearch.tt | 4 ++++ 4 files changed, 22 insertions(+) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 3d74f847a6..b70813b8f8 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2084,6 +2084,8 @@ sub GetHistory { my $isbn = $params{isbn}; my $ean = $params{ean}; my $name = $params{name}; + my $internalnote = $params{internalnote}; + my $vendornote = $params{vendornote}; my $from_placed_on = $params{from_placed_on}; my $to_placed_on = $params{to_placed_on}; my $basket = $params{basket}; @@ -2149,6 +2151,8 @@ sub GetHistory { aqorders.biblionumber, aqorders.orderstatus, aqorders.parent_ordernumber, + aqorders.order_internalnote, + aqorders.order_vendornote, aqbudgets.budget_name "; $query .= ", aqbudgets.budget_id AS budget" if defined $budget; @@ -2241,6 +2245,16 @@ sub GetHistory { } } + if ( $internalnote ) { + $query .= " AND aqorders.order_internalnote LIKE ? "; + push @query_params, "%$internalnote%"; + } + + if ( $vendornote ) { + $query .= " AND aqorders.order_vendornote LIKE ?"; + push @query_params, "%$vendornote%"; + } + if ($booksellerinvoicenumber) { $query .= " AND aqinvoices.invoicenumber LIKE ? "; push @query_params, "%$booksellerinvoicenumber%"; diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl index cbb371d4df..6423bd1881 100755 --- a/acqui/histsearch.pl +++ b/acqui/histsearch.pl @@ -76,6 +76,8 @@ my $filters = { author => scalar $input->param('author'), isbn => scalar $input->param('isbn'), name => scalar $input->param('name'), + internalnote => scalar $input->param('internalnote'), + vendornote => scalar $input->param('vendornote'), ean => scalar $input->param('ean'), basketgroupname => scalar $input->param('basketgroupname'), budget => scalar $input->param('budget'), 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 a2a7fc090e..93d008b463 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc @@ -11,6 +11,8 @@ [% END %]
  • +
  • +
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt index 3cde09995a..4bb0e1bb7c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt @@ -76,6 +76,8 @@ Quantity ordered Unit cost Fund + Internal note + Vendor note @@ -124,6 +126,8 @@ [% order.quantity | html %] [% order.ecost | html %] [% order.budget_name | html %] + [% order.order_internalnote | html %] + [% order.order_vendornote | html %] [% END %] -- 2.11.0