[Koha-patches] [biblibre-integration 18/19] [3.0.x](bug #3560) This add a filter to search by itemtype
Henri-Damien LAURENT
henridamien.laurent at biblibre.com
Fri Aug 28 23:47:53 CEST 2009
From: Jean-André Santoni <jeanandre.santoni at biblibre.com>
The value builder for 4XX should be able to filter results by itemtype.
---
cataloguing/value_builder/unimarc_field_4XX.pl | 6 ++++++
.../value_builder/unimarc_field_4XX.tmpl | 13 ++++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/cataloguing/value_builder/unimarc_field_4XX.pl b/cataloguing/value_builder/unimarc_field_4XX.pl
index a55ceef..195fb5c 100755
--- a/cataloguing/value_builder/unimarc_field_4XX.pl
+++ b/cataloguing/value_builder/unimarc_field_4XX.pl
@@ -31,6 +31,7 @@ use C4::Biblio;
use C4::Koha;
use MARC::Record;
use C4::Branch; # GetBranches
+use C4::ItemType;
sub plugin_parameters {
my ( $dbh, $record, $tagslib, $i, $tabloop ) = @_;
@@ -327,9 +328,11 @@ sub plugin {
}
elsif ( $op eq "do_search" ) {
my $search = $query->param('search');
+ my $itype = $query->param('itype');
my $startfrom = $query->param('startfrom');
my $resultsperpage = $query->param('resultsperpage') || 20;
my $orderby;
+ $search = 'kw,wrdl='.$search.' and mc-itemtype='.$itype if $itype;
my ( $errors, $results, $total_hits ) = SimpleSearch($search, $startfrom * $resultsperpage, $resultsperpage );
my $total = scalar(@$results);
@@ -530,10 +533,13 @@ sub plugin {
# }
# $sth->finish;
+ my @itemtypes = C4::ItemType->all;
+
$template->param( #classlist => $classlist,
CGIitemtype => $CGIitemtype,
CGIbranch => $CGIbranch,
CGIPublisher => $CGIpublisher,
+ itypeloop => \@itemtypes,
index => $query->param('index'),
Search => 1,
);
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_4XX.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_4XX.tmpl
index cbcb961..253e8a3 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_4XX.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_4XX.tmpl
@@ -112,7 +112,18 @@
<input type="hidden" name="result" value="unimarc field 4 <!--TMPL_VAR Name="index" -->">
<input type="hidden" name="op" value="do_search">
<label class="label100" for="searchbox">Any word</label>
- <input type="text" name="search" id="searchbox" size="35">
+ <input type="text" name="search" id="searchbox" size="35"><br />
+ <label for="itypeloop">Item type:</label>
+ <select name="itype">
+ <option value="">All Item Types</option>
+ <!-- TMPL_LOOP NAME="itypeloop" -->
+ <!-- TMPL_IF NAME="selected" -->
+ <option value="<!-- TMPL_VAR NAME="itemtype" -->" selected="selected"><!-- TMPL_VAR NAME="description" --></option>
+ <!-- TMPL_ELSE -->
+ <option value="<!-- TMPL_VAR NAME="itemtype" -->"><!-- TMPL_VAR NAME="description" --></option>
+ <!-- /TMPL_IF -->
+ <!-- /TMPL_LOOP -->
+ </select>
</p>
<p>
<input type="submit" value="Start search">
--
1.6.0.4
More information about the Koha-patches
mailing list