adding search orders history feature

This commit is contained in:
tipaul 2004-10-19 12:24:56 +00:00
parent b489690e1e
commit 2eda32b247
4 changed files with 123 additions and 1 deletions

View File

@ -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

31
acqui/histsearch.pl Executable file
View File

@ -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;

View File

@ -8,6 +8,7 @@
Supplier name : <input type="text" size="25" name="supplier">
<input type="submit" class="button acquisition" value="OK">
</form>
<p>or <a href="histsearch.pl" class="button acquisition">Search order history</a></p>
</div>
<!-- currencies-->

View File

@ -0,0 +1,69 @@
<!-- TMPL_INCLUDE NAME="acquisitions-top.inc" -->
<div id="mainbloc">
<h1 class="acquisition">Order search</h1>
<table>
<tr>
<th class="acquisition">&nbsp;</th>
<th class="acquisition">Title</th>
<th class="acquisition">Author</th>
<th class="acquisition">Supplier</th>
<th class="acquisition">Placed on</th>
<th class="acquisition">Recieved on</th>
<th class="acquisition">Quantity ordered</th>
</tr>
<tr>
<form>
<th class="acquisition">
Filter on
</th>
<th class="acquisition">
<input type="text" name="title" value="<!-- TMPL_VAR name="title"-->">
</th>
<th class="acquisition">
<input type="text" name="author" value="<!-- TMPL_VAR name="author" -->">
</th>
<th class="acquisition">
<input type="text" name="name" value="<!-- TMPL_VAR name="name" -->">
</th>
<th class="acquisition">
&nbsp;
</th>
<th class="acquisition">
&nbsp;
</th>
<th class="acquisition">
&nbsp;
</th>
<th class="acquisition">
<input type="submit" class="button acquisition" value="Set Filter">
</th>
</form>
</tr>
<!-- TMPL_LOOP NAME="suggestions_loop" -->
<tr>
<td>
&nbsp;
</td>
<td>
<a href="basket.pl?basket=<!-- TMPL_VAR name="basketno" -->"><!-- TMPL_VAR NAME="title" --></a>
</td>
<td>
<!-- TMPL_VAR NAME="author" -->
</td>
<td>
<!-- TMPL_VAR NAME="name" -->
</td>
<td>
<!-- TMPL_VAR name="creationdate" -->
</td>
<td>
<!-- TMPL_VAR name="datereceived" -->
</td>
<td>
<!-- TMPL_VAR name="quantity" -->
</td>
</tr>
<!-- /TMPL_LOOP -->
</table>
</div>
<!-- TMPL_INCLUDE NAME="acquisitions-bottom.inc" -->