just some tweakings (no changes).

nonfillingchar systempref won't work in UNIMARC (as there is no indicator to set it)
This commit is contained in:
tipaul 2006-04-04 13:32:08 +00:00
parent 7eeda65a58
commit ae98e61004
1 changed files with 4 additions and 10 deletions

View File

@ -335,7 +335,7 @@ sub catalogsearch {
push @result,$bibid;
}
}
if (C4::Context->preference("sortbynonfiling")==1) {
if (C4::Context->preference("sortbynonfiling")) {
#~~#~~# next part added by SH Modified by JF
# This code resorts the biblio.title results eliminating the
# marc non-filing chars
@ -351,13 +351,7 @@ if (C4::Context->preference("sortbynonfiling")==1) {
#
#
if ($orderby eq "biblio.title") { #don't sort by title if another orderby is specified
my $msth = $dbh->prepare("SELECT tagfield, tagsubfield FROM marc_subfield_structure WHERE kohafield='biblio.title'");
$msth->execute(); # get MARC tag and subfield that is mapped to biblio.title
my $tagdata = $msth->fetchrow_hashref;
my $tag = $tagdata->{tagfield};
my $subfieldcode = $tagdata->{tagsubfield};
$msth->finish;
my ($tag,$subfieldcode) = MARCfind_marc_from_kohafield($dbh,'biblio.title','');
my $tsth = $dbh->prepare("SELECT title, tag_indicator FROM marc_biblio, marc_subfield_table, biblio
WHERE marc_biblio.bibid = ?
AND marc_subfield_table.bibid=marc_biblio.bibid
@ -372,11 +366,11 @@ if (C4::Context->preference("sortbynonfiling")==1) {
$tsth->execute($bibidno,$tag,$subfieldcode);
my $titledat = $tsth->fetchrow_hashref;
$sorttitle = lc($titledat->{title});
#warn "Here's the sorttitle beforehand:".$sorttitle;
# warn "Here's the sorttitle beforehand: $titledat->{tag_indicator}=".$sorttitle;
if (length($titledat->{tag_indicator})==2) {
my $filechar=substr($titledat->{tag_indicator},1,1);
$sorttitle = substr($sorttitle,$filechar,-1,""); #remove nonfiling characters
# warn "Here it is afterwards:".$sorttitle;
# warn "Here it is afterwards:".$sorttitle;
}
$titles{$bibidno} = $sorttitle; #} = $bibidno;
# push @resultnew, $titles{$sorttitle};