Skip to content

Commit

Permalink
[#83667878] Titles not displaying correctly in serials search results
Browse files Browse the repository at this point in the history
Implemented some of the SQL building logic from LAK.
  • Loading branch information
dlbptfs authored and ctfliblime committed Jan 16, 2015
1 parent 085a7d3 commit b27a3c8
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions lib/C4/Serials.pm
Original file line number Diff line number Diff line change
Expand Up @@ -639,17 +639,27 @@ sub GetSubscriptions {
$query .= ' biblio.biblionumber = ? OR';
push(@bind, $biblionumber);
}
if (defined $ISSN) {
$query .= ' biblioitems.issn LIKE ? OR';
push(@bind, $ISSN);
}
if ($title) {
$query .= ' (';
foreach my $title_element (split(/\s+/, $title)) {
$query .= ' biblio.title LIKE ? AND';
push(@bind, "%$title_element%");
else {
if (defined $ISSN and $title) {
$query .= ' ( biblioitems.issn = ? OR ' .
(join(' AND ', map{ qq{biblio.title LIKE "%$_%"} } split (/\s+/,$title))) .
' )';
push(@bind, $ISSN);
}
else {
if (defined $ISSN) {
$query .= ' biblioitems.issn LIKE ?';
push(@bind, "%" . $ISSN . "%");
}
else {
$query .= ' (';
foreach my $title_element (split(/\s+/, $title)) {
$query .= ' biblio.title LIKE ? AND';
push(@bind, "%$title_element%");
}
$query =~ s/ AND$/)/;
}
}
$query =~ s/ AND$/)/;
}
$query =~ s/ OR$//;
$query .= ' ORDER BY title';
Expand Down

0 comments on commit b27a3c8

Please sign in to comment.