From 6c9ab3678a9ab747eb9f5a89a4a6972a861fa9ca Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Tue, 30 Aug 2011 12:23:54 +0530 Subject: [PATCH] Bug 6807 - Add ISBN filter to advanced order search. Signed-off-by: Nicole C. Engard Signed-off-by: Ian Walls Signed-off-by: Chris Cormack --- C4/Acquisition.pm | 8 ++++++++ acqui/histsearch.pl | 5 ++++- .../intranet-tmpl/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 f682256a5f..cfc261f158 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 82ba04f618..ff68599f45 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' ); @@ -91,12 +92,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, @@ -116,6 +118,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 495f313772..9321cf9294 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 @@
  1. +
  2. @@ -83,7 +84,7 @@ [% END %] [% suggestions_loo.title |html %] -
    [% suggestions_loo.author %] +
    [% suggestions_loo.author %]
    [% suggestions_loo.isbn %] [% suggestions_loo.name %] [% suggestions_loo.creationdate %] [% suggestions_loo.datereceived %] -- 2.39.5