koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/C4 Search.pm,1.81,1.82


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/C4 Search.pm,1.81,1.82
Date: Mon, 08 Dec 2003 08:27:12 -0800

Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv4765/C4

Modified Files:
        Search.pm 
Log Message:
new feature : recent acquisition in opac.

Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -r1.81 -r1.82
*** Search.pm   4 Dec 2003 09:33:32 -0000       1.81
--- Search.pm   8 Dec 2003 16:27:10 -0000       1.82
***************
*** 57,61 ****
  
  @ISA = qw(Exporter);
! @EXPORT = qw(&CatSearch &BornameSearch &ItemInfo &KeywordSearch &subsearch
  &itemdata &bibdata &GetItems &borrdata &itemnodata &itemcount
  &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues
--- 57,63 ----
  
  @ISA = qw(Exporter);
! @EXPORT = qw(
! &newsearch
! &CatSearch &BornameSearch &ItemInfo &KeywordSearch &subsearch
  &itemdata &bibdata &GetItems &borrdata &itemnodata &itemcount
  &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues
***************
*** 65,68 ****
--- 67,98 ----
  &isbnsearch &breedingsearch &getallthemes &getalllanguages &getbranchname 
&getborrowercategory);
  # make all your functions, whether exported or not;
+ 
+ 
+ =item newsearch
+       my (@results) = 
newsearch($itemtype,$duration,$number_of_results,$startfrom);
+ c<newsearch> find biblio acquired recently (last 30 days)
+ =cut
+ sub newsearch {
+       my ($itemtype,$duration,$num,$offset)address@hidden;
+ 
+       my $dbh = C4::Context->dbh;
+       my $sth=$dbh->prepare("SELECT to_days( now( ) ) - to_days( 
dateaccessioned ) AS duration,  biblio.biblionumber, barcode, title, author, 
classification, itemtype, dewey, dateaccessioned, price, replacementprice
+                                               FROM items, biblio, biblioitems
+                                               WHERE biblio.biblionumber = 
biblioitems.biblionumber AND
+                                               items.biblionumber = 
biblio.biblionumber AND
+                                               to_days( now( ) ) - to_days( 
dateaccessioned ) < ? and itemtype=?
+                                               ORDER BY duration ASC ");
+       $sth->execute($duration,$itemtype);
+       my $i=0;
+       my @result;
+       while (my $line = $sth->fetchrow_hashref) {
+               if ($i>=$offset && $i+$offset<$num) {
+                       push @result,$line;
+               }
+               $i++
+       }
+       return(@result);
+ 
+ }
  
  =item findguarantees




reply via email to

[Prev in Thread] Current Thread [Next in Thread]