[Koha-cvs] CVS: koha/C4 SearchMarc.pm,1.26,1.27 Search.pm,1.96,1.97

Paul POULAIN tipaul at users.sourceforge.net
Thu Sep 16 11:21:09 CEST 2004


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13078/C4

Modified Files:
	SearchMarc.pm Search.pm 
Log Message:
modifs in new acquisition option : the search is now managed through the standard search API, with an "order by timestamp" order.
opac-new.pl can be removed

Index: SearchMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/SearchMarc.pm,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** SearchMarc.pm	13 Sep 2004 15:23:35 -0000	1.26
--- SearchMarc.pm	16 Sep 2004 09:21:05 -0000	1.27
***************
*** 23,26 ****
--- 23,28 ----
  use C4::Context;
  use C4::Biblio;
+ use C4::Date;
+ use Date::Manip;
  
  use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
***************
*** 284,287 ****
--- 286,290 ----
  			    $newline{'even'} = 1 if $#finalresult % 2 == 0;
  				$newline{'odd'} = 1 if $#finalresult % 2 == 1;
+ 				$newline{'timestamp'} = format_date($newline{timestamp});
  				@CNresults = ();
  				push @finalresult, \%newline;

Index: Search.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Search.pm,v
retrieving revision 1.96
retrieving revision 1.97
diff -C2 -r1.96 -r1.97
*** Search.pm	13 Sep 2004 15:26:42 -0000	1.96
--- Search.pm	16 Sep 2004 09:21:05 -0000	1.97
***************
*** 58,62 ****
  @ISA = qw(Exporter);
  @EXPORT = qw(
- &newsearch
  &CatSearch &BornameSearch &ItemInfo &KeywordSearch &subsearch
  &itemdata &bibdata &GetItems &borrdata &itemnodata &itemcount
--- 58,61 ----
***************
*** 69,158 ****
  
  
- =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 $data = $sth->fetchrow_hashref) {
- 		if ($i>=$offset && $i<$num+$offset) {
- 			my ($counts) = itemcount2("", $data->{'biblionumber'}, 'intra');
- 			my $subject2=$data->{'subject'};
- 			$subject2=~ s/ /%20/g;
- 			$data->{'itemcount'}=$counts->{'total'};
- 			my $totalitemcounts=0;
- 			foreach my $key (keys %$counts){
- 				if ($key ne 'total'){	# FIXME - Should ignore 'order', too.
- 					#$data->{'location'}.="$key $counts->{$key} ";
- 					$totalitemcounts+=$counts->{$key};
- 					$data->{'locationhash'}->{$key}=$counts->{$key};
- 				}
- 			}
- 			my $locationtext='';
- 			my $locationtextonly='';
- 			my $notavailabletext='';
- 			foreach (sort keys %{$data->{'locationhash'}}) {
- 				if ($_ eq 'notavailable') {
- 					$notavailabletext="Not available";
- 					my $c=$data->{'locationhash'}->{$_};
- 					$data->{'not-available-p'}=$totalitemcounts;
- 					if ($totalitemcounts>1) {
- 					$notavailabletext.=" ($c)";
- 					$data->{'not-available-plural-p'}=1;
- 					}
- 				} else {
- 					$locationtext.="$_ ";
- 					my $c=$data->{'locationhash'}->{$_};
- 					if ($_ eq 'Item Lost') {
- 					$data->{'lost-p'}=$totalitemcounts;
- 					$data->{'lost-plural-p'}=1
- 							if $totalitemcounts > 1;
- 					} elsif ($_ eq 'Withdrawn') {
- 					$data->{'withdrawn-p'}=$totalitemcounts;
- 					$data->{'withdrawn-plural-p'}=1
- 							if $totalitemcounts > 1;
- 					} elsif ($_ eq 'On Loan') {
- 					$data->{'on-loan-p'}=$totalitemcounts;
- 					$data->{'on-loan-plural-p'}=1
- 							if $totalitemcounts > 1;
- 					} else {
- 					$locationtextonly.=$_;
- 					$locationtextonly.=" ($c), "
- 							if $totalitemcounts>1;
- 					}
- 					if ($totalitemcounts>1) {
- 					$locationtext.=" ($c), ";
- 					}
- 				}
- 			}
- 			if ($notavailabletext) {
- 				$locationtext.=$notavailabletext;
- 			} else {
- 				$locationtext=~s/, $//;
- 			}
- 			$data->{'location'}=$locationtext;
- 			$data->{'location-only'}=$locationtextonly;
- 			$data->{'subject2'}=$subject2;
- 			$data->{'use-location-flags-p'}=1; # XXX
- 
- 			push @result,$data;
- 		}
- 		$i++
- 	}
- 	return($i, at result);
- 
- }
- 
  =item findguarantees
  
--- 68,71 ----





More information about the Koha-cvs mailing list