From ec62b5e32ae061b3beed16fdcedd65a05235459b Mon Sep 17 00:00:00 2001 From: doxulting Date: Thu, 3 Mar 2005 09:32:04 +0000 Subject: [PATCH] Added a param to catalogsearch to allow selection of order (ASC or DESC) --- C4/SearchMarc.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/C4/SearchMarc.pm b/C4/SearchMarc.pm index a42fb0e3c5..a033c661d0 100644 --- a/C4/SearchMarc.pm +++ b/C4/SearchMarc.pm @@ -165,7 +165,7 @@ $marcflavour ("MARC21" or "UNIMARC") determines which tags are used for retrievi =cut sub catalogsearch { - my ($dbh, $tags, $and_or, $excluding, $operator, $value, $offset,$length,$orderby) = @_; + my ($dbh, $tags, $and_or, $excluding, $operator, $value, $offset,$length,$orderby, $desc_or_asc) = @_; # build the sql request. She will look like : # select m1.bibid # from marc_subfield_table as m1, marc_subfield_table as m2 @@ -188,7 +188,7 @@ sub catalogsearch { my @not_value = (); my $any_not = 0; $orderby = "biblio.title" unless $orderby; - + $desc_or_asc = "ASC" unless $desc_or_asc; #last minute stripping out of ' and , # paul : quoting, it's done a few lines lated. # foreach $_ (@$value) { @@ -276,11 +276,11 @@ sub catalogsearch { $sql_where1 .= "and TO_DAYS( NOW( ) ) - TO_DAYS( biblio.timestamp ) <30" if $orderby =~ "biblio.timestamp"; my $sth; if ($sql_where2) { - $sth = $dbh->prepare("select distinct m1.bibid from biblio,biblioitems,marc_biblio,$sql_tables where biblio.biblionumber=marc_biblio.biblionumber and biblio.biblionumber=biblioitems.biblionumber and m1.bibid=marc_biblio.bibid and $sql_where2 and ($sql_where1) order by $orderby"); - warn "Q2 : select distinct m1.bibid from biblio,biblioitems,marc_biblio,$sql_tables where biblio.biblionumber=marc_biblio.biblionumber and biblio.biblionumber=biblioitems.biblionumber and m1.bibid=marc_biblio.bibid and $sql_where2 and ($sql_where1) order by $orderby term is @$value"; + $sth = $dbh->prepare("select distinct m1.bibid from biblio,biblioitems,marc_biblio,$sql_tables where biblio.biblionumber=marc_biblio.biblionumber and biblio.biblionumber=biblioitems.biblionumber and m1.bibid=marc_biblio.bibid and $sql_where2 and ($sql_where1) order by $orderby $desc_or_asc"); + warn "Q2 : select distinct m1.bibid from biblio,biblioitems,marc_biblio,$sql_tables where biblio.biblionumber=marc_biblio.biblionumber and biblio.biblionumber=biblioitems.biblionumber and m1.bibid=marc_biblio.bibid and $sql_where2 and ($sql_where1) order by $orderby $desc_or_asc term is @$value"; } else { - $sth = $dbh->prepare("select distinct m1.bibid from biblio,biblioitems,marc_biblio,$sql_tables where biblio.biblionumber=marc_biblio.biblionumber and biblio.biblionumber=biblioitems.biblionumber and m1.bibid=marc_biblio.bibid and $sql_where1 order by $orderby"); - warn "Q : select distinct m1.bibid from biblio,biblioitems,marc_biblio,$sql_tables where biblio.biblionumber=marc_biblio.biblionumber and biblio.biblionumber=biblioitems.biblionumber and m1.bibid=marc_biblio.bibid and $sql_where1 order by $orderby"; + $sth = $dbh->prepare("select distinct m1.bibid from biblio,biblioitems,marc_biblio,$sql_tables where biblio.biblionumber=marc_biblio.biblionumber and biblio.biblionumber=biblioitems.biblionumber and m1.bibid=marc_biblio.bibid and $sql_where1 order by $orderby $desc_or_asc"); + warn "Q : select distinct m1.bibid from biblio,biblioitems,marc_biblio,$sql_tables where biblio.biblionumber=marc_biblio.biblionumber and biblio.biblionumber=biblioitems.biblionumber and m1.bibid=marc_biblio.bibid and $sql_where1 order by $orderby $desc_or_asc"; } $sth->execute(); my @result = (); -- 2.39.5