[Koha-patches] [PATCH] [SIGNED-OFF] Bug 6807 - Add ISBN filter to advanced order search.

Nicole C. Engard nengard at bywatersolutions.com
Thu Sep 8 04:35:38 CEST 2011


From: Amit Gupta <amit.gupta at osslabs.biz>

Signed-off-by: Nicole C. Engard <nengard at bywatersolutions.com>
---
 C4/Acquisition.pm                                  |    8 ++++++++
 acqui/histsearch.pl                                |    5 ++++-
 .../prog/en/modules/acqui/histsearch.tt            |    3 ++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm
index f682256..cfc261f 100644
--- a/C4/Acquisition.pm
+++ b/C4/Acquisition.pm
@@ -1530,6 +1530,7 @@ sub GetHistory {
     my %params = @_;
     my $title = $params{title};
     my $author = $params{author};
+    my $isbn   = $params{isbn};
     my $name = $params{name};
     my $from_placed_on = $params{from_placed_on};
     my $to_placed_on = $params{to_placed_on};
@@ -1546,6 +1547,7 @@ sub GetHistory {
         SELECT
             biblio.title,
             biblio.author,
+	    biblioitems.isbn,
             aqorders.basketno,
     aqbasket.basketname,
     aqbasket.basketgroupid,
@@ -1564,6 +1566,7 @@ sub GetHistory {
         LEFT JOIN aqbasket ON aqorders.basketno=aqbasket.basketno
     LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id
         LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id
+	LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber
         LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber";
 
     $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber"
@@ -1584,6 +1587,11 @@ sub GetHistory {
         push @query_params, "%$author%";
     }
 
+    if ( defined $isbn ) {
+        $query .= " AND biblioitems.isbn LIKE ? ";
+        push @query_params, "%$isbn%";
+    }
+
     if ( defined $name ) {
         $query .= " AND aqbooksellers.name LIKE ? ";
         push @query_params, "%$name%";
diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl
index e158842..99ea937 100755
--- a/acqui/histsearch.pl
+++ b/acqui/histsearch.pl
@@ -61,6 +61,7 @@ use C4::Debug;
 my $input = new CGI;
 my $title                   = $input->param( 'title');
 my $author                  = $input->param('author');
+my $isbn          	    = $input->param('isbn');
 my $name                    = $input->param( 'name' );
 my $basket                  = $input->param( 'basket' );
 my $booksellerinvoicenumber = $input->param( 'booksellerinvoicenumber' );
@@ -89,12 +90,13 @@ if ( $d = $input->param('iso') ) {
 
 my ( $order_loop, $total_qty, $total_price, $total_qtyreceived );
 # If we're supplied any value then we do a search. Otherwise we don't.
-my $do_search = $title || $author || $name || $basket || $booksellerinvoicenumber ||
+my $do_search = $title || $author || $isbn || $name || $basket || $booksellerinvoicenumber ||
     $from_placed_on || $to_placed_on;
 if ($do_search) {
     ( $order_loop, $total_qty, $total_price, $total_qtyreceived ) = GetHistory(
         title => $title,
         author => $author,
+	isbn   => $isbn,
         name => $name,
         from_placed_on => $from_iso,
         to_placed_on => $to_iso,
@@ -114,6 +116,7 @@ $template->param(
     numresults              => $order_loop ? scalar(@$order_loop) : undef,
     title                   => $title,
     author                  => $author,
+    isbn		    => $isbn,
     name                    => $name,
     basket                  => $basket,
     booksellerinvoicenumber => $booksellerinvoicenumber,
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 495f313..9321cf9 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt
@@ -21,6 +21,7 @@
 		<ol>
 		<li><label for="title">Title: </label> <input type="text" name="title" id="title" value="[% title %]" /></li>
 		<li><label for="author">Author: </label> <input type="text" name="author" id="author" value="[% author %]" /></li>
+		<li><label for="isbn">ISBN: </label> <input type="isbn" name="isbn" id="isbn" value="[% isbn %]" /></li>
 		<li><label for="name">Vendor: </label> <input type="text" name="name" id="name" value="[% name %]" /></li>
 		<li><label for="basket">Basket: </label> <input type="text" name="basket" id="basket" value="[% basket %]" /></li>
 		<li><label for="booksellerinvoicenumber ">Bookseller Invoice No: </label> <input type="text" name="booksellerinvoicenumber" id="booksellerinvoicenumber" value="[% booksellerinvoicenumber %]" /></li>
@@ -83,7 +84,7 @@
 					    [% END %]
 					</td>
 					<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestions_loo.biblionumber %]">[% suggestions_loo.title |html %]</a>
-                        <br />[% suggestions_loo.author %]</td>
+                        <br />[% suggestions_loo.author %] <br /> [% suggestions_loo.isbn %]</td>
 					<td><a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=[% suggestions_loo.id %]">[% suggestions_loo.name %]</a></td>
 					<td>[% suggestions_loo.creationdate %]</td>
 					<td>[% suggestions_loo.datereceived %]</td>
-- 
1.7.2.3



More information about the Koha-patches mailing list