From b5b6dc9e5bbeea308997546d62e595fe97a4077d 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 Signed-off-by: David Nind Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- C4/Acquisition.pm | 14 ++++++++++++++ acqui/histsearch.pl | 2 ++ .../prog/en/includes/filter-orders.inc | 2 ++ .../prog/en/modules/acqui/histsearch.tt | 4 ++++ 4 files changed, 22 insertions(+) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index dc733b221a..1874289bb3 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2085,6 +2085,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}; @@ -2150,6 +2152,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; @@ -2242,6 +2246,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 17f1d1dc3a..2ba0802684 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.39.5