From cfd89edc048bb0b6748b44b72988618e473b107c Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 14 Jun 2024 12:36:12 +0000 Subject: [PATCH] Bug 34805: Add order search form to acq start page This patch adds the order search form to the Acquisitions home page. I've modified acqui-home.pl so that it will pass the same default date limiters as histsearch.pl. To test, apply the patch and go to Acquisitions. Test the order search form to confirm that it works as expected. Any search from this version of the form should return identical results to seraches performed from the "Advanced search" link in the sidebar. Sponsored-by: Athens County Public Libraries Signed-off-by: Michaela Sieber Signed-off-by: Paul Derscheid Signed-off-by: Katrin Fischer --- acqui/acqui-home.pl | 29 ++++++++++++------- .../prog/en/includes/filter-orders.inc | 20 ++++++++++++- .../prog/en/includes/html_helpers.inc | 18 ++++++++++++ .../prog/en/modules/acqui/acqui-home.tt | 5 +++- .../prog/en/modules/acqui/histsearch.tt | 22 ++------------ 5 files changed, 61 insertions(+), 33 deletions(-) diff --git a/acqui/acqui-home.pl b/acqui/acqui-home.pl index 07b1cce899..143983ca56 100755 --- a/acqui/acqui-home.pl +++ b/acqui/acqui-home.pl @@ -36,6 +36,7 @@ use C4::Members; use Koha::Acquisition::Currencies; use Koha::Patrons; use Koha::Suggestions; +use Koha::DateUtils qw( dt_from_string ); my $query = CGI->new; my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( @@ -117,18 +118,24 @@ foreach my $budget ( @{$budget_arr} ) { push @budget_loop, $budget; } +my $filters; +$filters->{from_placed_on} = my $from_placed_on = dt_from_string; +$filters->{to_placed_on} = my $to_placed_on = dt_from_string; +$filters->{from_placed_on}->set_time_zone('floating')->subtract( years => 1 ); + $template->param( - type => 'intranet', - loop_budget => \@budget_loop, - total => $total, - totspent => $totspent, - totordered => $totordered, - totcomtd => $totcomtd, - totavail => $totavail, - total_active => $total_active, - totspent_active => $totspent_active, - totordered_active => $totordered_active, - totavail_active => $totavail_active, + type => 'intranet', + loop_budget => \@budget_loop, + total => $total, + totspent => $totspent, + totordered => $totordered, + totcomtd => $totcomtd, + totavail => $totavail, + total_active => $total_active, + totspent_active => $totspent_active, + totordered_active => $totordered_active, + totavail_active => $totavail_active, + filters => $filters, ); my $cur = Koha::Acquisition::Currencies->get_active; 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 626a9f2bd1..948c624755 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc @@ -1,6 +1,10 @@ [% USE Koha %] [% USE Branches %] [% PROCESS 'html_helpers.inc' %] +[% IF context == "main" %] +
+
+[% END %]
  1. @@ -26,6 +30,12 @@ [% PROCESS options_for_libraries libraries => Branches.all(selected => '') %] +[% IF context == "main" %] +
+
+
+
    +[% END %]
  1. @@ -35,7 +45,9 @@
  2. -
  3. +
  4. +
  5. +
+[% IF context == "main" %] +
+
+[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc index 609dc3f0d0..16736e5c1a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -523,3 +523,21 @@ [% END %] + +[% BLOCK acquisitions_filter_form %] +
+ [% IF ( context == "sidebar" ) %] +
+

Search orders

+ [% ELSE %] +
+ Search orders + [% END %] + [% INCLUDE 'filter-orders.inc' context == context %] + +
+
+ +
+ +[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt index 58702c8a4d..66a04d29e1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt @@ -49,7 +49,7 @@
- Manage orders + Search vendors

@@ -83,6 +83,8 @@

+[% PROCESS acquisitions_filter_form context => "main" %] + [% IF ( loop_budget ) %]
@@ -218,6 +220,7 @@
[% MACRO jsinclude BLOCK %] + [% INCLUDE 'calendar.inc' %] [% INCLUDE 'datatables.inc' %] [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %] [% Asset.js("js/acquisitions-menu.js") | $raw %] 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 6ab7a044bf..a3883f3cbf 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt @@ -59,7 +59,7 @@ [% END %] [% UNLESS ( order_loop ) %] - [% PROCESS filter_form context => "main" %] + [% PROCESS acquisitions_filter_form context => "main" %] [% END %] @@ -149,7 +149,7 @@
@@ -201,22 +201,4 @@ [% END %] -[% BLOCK filter_form %] - - [% IF ( context == "sidebar" ) %] -
-

Search orders

- [% ELSE %] -
- Search orders - [% END %] - [% INCLUDE 'filter-orders.inc' search_form=1 %] - -
-
- -
- -[% END %] - [% INCLUDE 'intranet-bottom.inc' %] -- 2.39.5