From 60f2d8504e10243a24fdd8badb8448ca8e7a36b8 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 --- 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 d939531a26..4e06f42713 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 872388b317..16b72ce2ae 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc @@ -518,3 +518,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 b2d862f073..5255cfbd37 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 @@ -53,7 +53,7 @@ [% END %]
- Manage orders + Search vendors

@@ -87,6 +87,8 @@

+[% PROCESS acquisitions_filter_form context => "main" %] + [% IF ( loop_budget ) %]
@@ -222,6 +224,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 4c2e5b17fc..b12d7adf81 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' %] - -
-
- -
- -[% END %] - [% INCLUDE 'intranet-bottom.inc' %] -- 2.39.2