From 2eda32b247480f270d332d893b4079abe91ccb52 Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 19 Oct 2004 12:24:56 +0000 Subject: [PATCH] adding search orders history feature --- C4/Acquisition.pm | 23 ++++++- acqui/histsearch.pl | 31 +++++++++ .../default/en/acqui/acqui-home.tmpl | 1 + .../default/en/acqui/histsearch.tmpl | 69 +++++++++++++++++++ 4 files changed, 123 insertions(+), 1 deletion(-) create mode 100755 acqui/histsearch.pl create mode 100644 koha-tmpl/intranet-tmpl/default/en/acqui/histsearch.tmpl diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index a7dffc3b24..0530d27a02 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -53,7 +53,7 @@ orders, converting money to different currencies, and so forth. &getorders &getallorders &getrecorders &getorder &neworder &delorder - &ordersearch + &ordersearch &histsearch &modorder &getsingleorder &invoice &receiveorder &updaterecorder &newordernum @@ -595,6 +595,27 @@ sub ordersearch { return(scalar(@results),@results); } + +sub histsearch { + my ($title,$author,$name)=@_; + my $dbh= C4::Context->dbh; + my $query = "select biblio.title,aqorders.basketno,name,aqbasket.creationdate,aqorders.datereceived, aqorders.quantity + from aqorders,aqbasket,aqbooksellers,biblio + where aqorders.basketno=aqbasket.basketno and aqbasket.booksellerid=aqbooksellers.id and + biblio.biblionumber=aqorders.biblionumber"; + $query .= " and biblio.title like ".$dbh->quote("%".$title."%") if $title; + $query .= " and biblio.author like ".$dbh->quote("%".$author."%") if $author; + $query .= " and name like ".$dbh->quote("%".$name."%") if $name; + warn "Q : $query"; + my $sth = $dbh->prepare($query); + $sth->execute; + my @order_loop; + while (my $line = $sth->fetchrow_hashref) { + push @order_loop, $line; + } + return \@order_loop; +} + # # # MONEY diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl new file mode 100755 index 0000000000..168b0e6c8b --- /dev/null +++ b/acqui/histsearch.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl +use strict; +require Exporter; +use CGI; +use HTML::Template; + +use C4::Auth; # get_template_and_user +use C4::Interface::CGI::Output; +use C4::Acquisition; + +my $input = new CGI; +my $title = $input->param('title'); +my $author = $input->param('author'); +my $name = $input->param('name'); + +my $dbh = C4::Context->dbh; +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "acqui/histsearch.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {acquisition => 1}, + debug => 1, + }); +my $order_loop= &histsearch($title,$author,$name); +$template->param(suggestions_loop => $order_loop, + title => $title, + author => $author, + name => $name, +); +output_html_with_http_headers $input, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui/acqui-home.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui/acqui-home.tmpl index c75de15f5b..fab27bb0f5 100644 --- a/koha-tmpl/intranet-tmpl/default/en/acqui/acqui-home.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/acqui/acqui-home.tmpl @@ -8,6 +8,7 @@ Supplier name : +

or Search order history

diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui/histsearch.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui/histsearch.tmpl new file mode 100644 index 0000000000..f942575370 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/acqui/histsearch.tmpl @@ -0,0 +1,69 @@ + +
+

Order search

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 TitleAuthorSupplierPlaced onRecieved onQuantity ordered
+ Filter on + + "> + + "> + + "> + +   + +   + +   + + +
+   + + "> + + + + + + + + + + +
+
+ -- 2.39.5