adding search orders history feature
authortipaul <tipaul>
Tue, 19 Oct 2004 12:24:56 +0000 (12:24 +0000)
committertipaul <tipaul>
Tue, 19 Oct 2004 12:24:56 +0000 (12:24 +0000)
C4/Acquisition.pm
acqui/histsearch.pl [new file with mode: 0755]
koha-tmpl/intranet-tmpl/default/en/acqui/acqui-home.tmpl
koha-tmpl/intranet-tmpl/default/en/acqui/histsearch.tmpl [new file with mode: 0644]

index a7dffc3..0530d27 100644 (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
diff --git a/acqui/histsearch.pl b/acqui/histsearch.pl
new file mode 100755 (executable)
index 0000000..168b0e6
--- /dev/null
@@ -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;
index c75de15..fab27bb 100644 (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-->
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 (file)
index 0000000..f942575
--- /dev/null
@@ -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" -->