[Koha-cvs] CVS: koha/C4 Search.pm,1.81,1.82
Paul POULAIN
tipaul at users.sourceforge.net
Mon Dec 8 17:27:12 CET 2003
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)=@_;
+
+ 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
More information about the Koha-cvs
mailing list