[Koha-patches] [PATCH] Extend SearchMyLibraryFirst to Staff Item Label Manager

Michael Hafen mdhafen at tech.washk12.org
Tue Oct 7 23:13:04 CEST 2008


When searching for barcodes to add to an item label batch limit the
search to the users branch if SearchMyLibraryFirst is set.
---
 .../prog/en/modules/labels/search.tmpl             |    3 +++
 labels/label-item-search.pl                        |    5 +++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tmpl
index 0626f75..b309192 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/search.tmpl
@@ -18,6 +18,9 @@ to add to Batch <!-- TMPL_VAR NAME="batch_id" -->
 	<input type="hidden" name="op" value="do_search" />
 	<input type="hidden" name="batch_id" value="<!-- TMPL_VAR NAME="batch_id" -->" />
 	<input type="hidden" name="type" value="<!-- TMPL_VAR NAME="type" -->" />
+	<!-- TMPL_IF name="mylibraryfirst" -->
+	<input name="limit" value="branch:<!-- TMPL_VAR name="LoginBranchcode" -->" type="hidden" />
+	<!-- /TMPL_IF -->
 	<fieldset class="rows">
 <ol><li>
     <select name="idx" disabled="disabled"><!-- FIXME: script does keyword search regardless -->
diff --git a/labels/label-item-search.pl b/labels/label-item-search.pl
index 6871616..d8f986e 100755
--- a/labels/label-item-search.pl
+++ b/labels/label-item-search.pl
@@ -75,6 +75,11 @@ if ( $op eq "do_search" ) {
       #catalogsearch( $dbh, \@tags, \@and_or, \@excluding, \@operator, \@value,
       #  $startfrom * $resultsperpage,
       #  $resultsperpage, $orderby );
+		if ( $query->param('limit') ) {
+			my $limit = $query->param('limit');
+			$limit =~ s|:|=|;
+			$marclist[0] .= " and $limit";
+		}
 		( $error, $marcresults, $total_hits ) = SimpleSearch( $marclist[0], $startfrom, $resultsperpage );
 		if ($marcresults) {
 			$show_results = scalar @$marcresults;
-- 
1.5.4.3




More information about the Koha-patches mailing list