From 2b175e1f65e89173890a54a64c54eb0ece36f64e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 20 Aug 2013 15:06:08 +0200 Subject: [PATCH][SIGNED OFF] Bug 10852: serials search improvements This patch adds 3 filters for the serials search: - location - callnumber - expiration date To test: - Search serials by location and/or callnumber and/or expiration date and check that results are consistent. Signed-off-by: Mathieu Saby --- C4/Serials.pm | 12 ++++ .../prog/en/modules/serials/serials-search.tt | 65 +++++++++++++++++++- serials/serials-search.pl | 15 ++++- 3 files changed, 88 insertions(+), 4 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index a1ce054..84636b6 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -687,6 +687,10 @@ sub SearchSubscriptions { push @where_strs, "biblioitems.ean LIKE ?"; push @where_args, "%$args->{ean}%"; } + if ( $args->{callnumber} ) { + push @where_strs, "subscription.callnumber LIKE ?"; + push @where_args, "%$args->{callnumber}%"; + } if( $args->{publisher} ){ push @where_strs, "biblioitems.publishercode LIKE ?"; push @where_args, "%$args->{publisher}%"; @@ -699,6 +703,14 @@ sub SearchSubscriptions { push @where_strs, "subscription.branchcode = ?"; push @where_args, "$args->{branch}"; } + if ( $args->{location} ) { + push @where_strs, "subscription.location = ?"; + push @where_args, "$args->{location}"; + } + if ( $args->{expiration_date} ) { + push @where_strs, "subscription.enddate <= ?"; + push @where_args, "$args->{expiration_date}"; + } if( defined $args->{closed} ){ push @where_strs, "subscription.closed = ?"; push @where_args, "$args->{closed}"; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt index 459a80a..7578a04 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt @@ -1,8 +1,10 @@ [% INCLUDE 'doc-head-open.inc' %] [% USE KohaDates %] +[% USE KohaAuthorisedValues %] Koha › Serials [% biblionumber %] [% INCLUDE 'doc-head-close.inc' %] +[% INCLUDE 'calendar.inc' %] [% INCLUDE 'datatables-strings.inc' %] @@ -72,6 +74,10 @@ [% END %]
  • + + +
  • +
  • @@ -92,6 +98,25 @@ [% END %] + [% IF locations %] +
  • + + +
  • + [% END %] +
  • + + +
  • @@ -117,6 +142,7 @@ Title Notes Library + Location Call number Expiration date [% IF ( routing && CAN_user_serials_routing ) %] @@ -132,8 +158,9 @@ - - + + + [% IF ( routing && CAN_user_serials_routing ) %][% END %] @@ -155,6 +182,9 @@ [% IF ( subscription.branchname ) %][% subscription.branchname %][% END %] + [% IF ( subscription.location ) %][% KohaAuthorisedValues.GetByCode( 'LOC', subscription.location ) %][% END %] + + [% IF ( subscription.callnumber ) %][% subscription.callnumber %][% END %] @@ -202,6 +232,7 @@ Title Notes Library + Location Call number     @@ -213,7 +244,8 @@ - + + @@ -237,6 +269,9 @@ [% IF ( subscription.branchname ) %][% subscription.branchname %][% END %] + [% IF ( subscription.location ) %][% KohaAuthorisedValues.GetByCode( 'LOC', subscription.location ) %][% END %] + + [% IF ( subscription.callnumber ) %][% subscription.callnumber %][% END %] @@ -292,6 +327,10 @@ [% END %]
  • + + +
  • +
  • @@ -312,6 +351,26 @@ [% END %] + [% IF locations %] +
  • + + +
  • + [% END %] +
  • + + +
  • +
    diff --git a/serials/serials-search.pl b/serials/serials-search.pl index bc84ed6..5ea3b14 100755 --- a/serials/serials-search.pl +++ b/serials/serials-search.pl @@ -36,14 +36,19 @@ use C4::Context; use C4::Output; use C4::Serials; +use Koha::DateUtils; + my $query = new CGI; my $title = $query->param('title_filter') || ''; my $ISSN = $query->param('ISSN_filter') || ''; my $EAN = $query->param('EAN_filter') || ''; +my $callnumber = $query->param('callnumber_filter') || ''; my $publisher = $query->param('publisher_filter') || ''; my $bookseller = $query->param('bookseller_filter') || ''; my $biblionumber = $query->param('biblionumber') || ''; my $branch = $query->param('branch_filter') || ''; +my $location = $query->param('location_filter') || ''; +my $expiration_date = $query->param('expiration_date_filter') || ''; my $routing = $query->param('routing') || C4::Context->preference("RoutingSerials"); my $searched = $query->param('searched') || 0; my @subscriptionids = $query ->param('subscriptionid'); @@ -51,7 +56,7 @@ my $op = $query->param('op'); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => "serials/serials-search.tmpl", + template_name => "serials/serials-search.tt", query => $query, type => "intranet", authnotrequired => 0, @@ -70,6 +75,7 @@ if ( $op and $op eq "close" ) { } } +my $expiration_date_dt = $expiration_date ? dt_from_string( $expiration_date ) : undef; my @subscriptions; if ($searched){ @subscriptions = SearchSubscriptions( @@ -78,9 +84,12 @@ if ($searched){ title => $title, issn => $ISSN, ean => $EAN, + callnumber => $callnumber, publisher => $publisher, bookseller => $bookseller, branch => $branch, + location => $location, + expiration_date => $expiration_date_dt, } ); } @@ -114,6 +123,7 @@ foreach (sort keys %$branches){ }; } + $template->param( openedsubscriptions => \@openedsubscriptions, closedsubscriptions => \@closedsubscriptions, @@ -121,9 +131,12 @@ $template->param( title_filter => $title, ISSN_filter => $ISSN, EAN_filter => $EAN, + callnumber_filter => $callnumber, publisher_filter => $publisher, bookseller_filter => $bookseller, branch_filter => $branch, + locations => C4::Koha::GetAuthorisedValues('LOC', $location), + expiration_date_filter => $expiration_date_dt, branches_loop => \@branches_loop, done_searched => $searched, routing => $routing, -- 1.7.10.4