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 <mathieu.saby@univ-rennes2.fr> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
bfc0a2cb81
commit
4651bbff21
|
|
@ -682,6 +682,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}%";
|
||||
|
|
@ -694,6 +698,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}";
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
[% USE Branches %]
|
||||
[% INCLUDE 'doc-head-open.inc' %]
|
||||
[% USE KohaDates %]
|
||||
[% USE KohaAuthorisedValues %]
|
||||
<title>Koha › Serials [% biblionumber %]</title>
|
||||
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
[% INCLUDE 'calendar.inc' %]
|
||||
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
|
||||
[% INCLUDE 'datatables-strings.inc' %]
|
||||
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
|
||||
|
|
@ -72,6 +74,10 @@
|
|||
<input type="text" id="ean" name="EAN_filter" value="[% EAN_filter %]" />
|
||||
</li>
|
||||
[% END %]
|
||||
<li>
|
||||
<label for="callnumber">Callnumber:</label>
|
||||
<input type="text" id="callnumber" name="callnumber_filter" value="[% callnumber_filter %]" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="publisher">Publisher:</label>
|
||||
<input type="text" id="publisher" name="publisher_filter" value="[% publisher_filter %]" />
|
||||
|
|
@ -93,6 +99,25 @@
|
|||
[% END %]
|
||||
</select>
|
||||
</li>
|
||||
[% IF locations %]
|
||||
<li>
|
||||
<label for="location">Location:</label>
|
||||
<select name="location_filter">
|
||||
<option value="">All</option>
|
||||
[% FOR loc IN locations %]
|
||||
[% IF loc.selected %]
|
||||
<option value="[% loc.authorised_value %]" selected="selected">[% loc.lib %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% loc.authorised_value %]">[% loc.lib %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
</li>
|
||||
[% END %]
|
||||
<li>
|
||||
<label for="to">Expiration date:</label>
|
||||
<input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />
|
||||
</li>
|
||||
</ol>
|
||||
<input type="hidden" name="searched" value="1" />
|
||||
<fieldset class="action">
|
||||
|
|
@ -118,6 +143,7 @@
|
|||
<th>Title</th>
|
||||
<th> Notes </th>
|
||||
<th>Library</th>
|
||||
<th>Location</th>
|
||||
<th>Call number</th>
|
||||
<th>Expiration date</th>
|
||||
[% IF ( routing && CAN_user_serials_routing ) %]
|
||||
|
|
@ -133,8 +159,9 @@
|
|||
<td><input type="text" class="filter" data-column_num="1" placeholder="Search title" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="2" placeholder="Search notes" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="3" placeholder="Search library" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="4" placeholder="Search callnumber" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="5" placeholder="Search expiration date" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="4" placeholder="Search location" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="5" placeholder="Search callnumber" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="6" placeholder="Search expiration date" /></td>
|
||||
[% IF ( routing && CAN_user_serials_routing ) %]<td></td>[% END %]
|
||||
<td></td>
|
||||
<td></td>
|
||||
|
|
@ -156,6 +183,9 @@
|
|||
<td>
|
||||
[% IF ( subscription.branchcode ) %][% Branches.GetName( subscription.branchcode ) %][% END %]
|
||||
</td>
|
||||
<td>
|
||||
[% IF ( subscription.location ) %][% KohaAuthorisedValues.GetByCode( 'LOC', subscription.location ) %][% END %]
|
||||
</td>
|
||||
<td>
|
||||
[% IF ( subscription.callnumber ) %][% subscription.callnumber %][% END %]
|
||||
</td>
|
||||
|
|
@ -203,6 +233,7 @@
|
|||
<th>Title</th>
|
||||
<th> Notes </th>
|
||||
<th>Library</th>
|
||||
<th>Location</th>
|
||||
<th>Call number</th>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
|
|
@ -214,7 +245,8 @@
|
|||
<td><input type="text" class="filter" data-column_num="1" placeholder="Search title" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="2" placeholder="Search notes" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="3" placeholder="Search library" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="4" placeholder="Search callnumber" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="4" placeholder="Search location" /></td>
|
||||
<td><input type="text" class="filter" data-column_num="5" placeholder="Search callnumber" /></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
|
@ -238,6 +270,9 @@
|
|||
<td>
|
||||
[% IF ( subscription.branchcode ) %][% Branches.GetName( subscription.branchcode ) %][% END %]
|
||||
</td>
|
||||
<td>
|
||||
[% IF ( subscription.location ) %][% KohaAuthorisedValues.GetByCode( 'LOC', subscription.location ) %][% END %]
|
||||
</td>
|
||||
<td>
|
||||
[% IF ( subscription.callnumber ) %][% subscription.callnumber %][% END %]
|
||||
</td>
|
||||
|
|
@ -294,6 +329,10 @@
|
|||
<input type="text" id="ean" name="EAN_filter" value="[% EAN_filter %]" />
|
||||
</li>
|
||||
[% END %]
|
||||
<li>
|
||||
<label for="callnumber">Callnumber:</label>
|
||||
<input type="text" id="callnumber" name="callnumber_filter" value="[% callnumber_filter %]" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="publisher">Publisher:</label>
|
||||
<input type="text" id="publisher" name="publisher_filter" value="[% publisher_filter %]" />
|
||||
|
|
@ -315,6 +354,26 @@
|
|||
[% END %]
|
||||
</select>
|
||||
</li>
|
||||
[% IF locations %]
|
||||
<li>
|
||||
<label for="location">Location:</label>
|
||||
<select name="location_filter">
|
||||
<option value="">All</option>
|
||||
[% FOR loc IN locations %]
|
||||
[% IF loc.selected %]
|
||||
<option value="[% loc.authorised_value %]" selected="selected">[% loc.lib %]</option>
|
||||
[% ELSE %]
|
||||
<option value="[% loc.authorised_value %]">[% loc.lib %]</option>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</select>
|
||||
</li>
|
||||
[% END %]
|
||||
<li>
|
||||
<label for="to">Expiration date:</label>
|
||||
<input type="text" id="to" name="expiration_date_filter" value="[% expiration_date_filter | $KohaDates %]" size="10" maxlength="10" class="datepickerto" />
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
<input type="hidden" name="searched" value="1" />
|
||||
<fieldset class="action">
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -115,6 +124,7 @@ foreach (sort keys %$branches){
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
$template->param(
|
||||
openedsubscriptions => \@openedsubscriptions,
|
||||
closedsubscriptions => \@closedsubscriptions,
|
||||
|
|
@ -122,9 +132,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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue