From 50c980b028b675bc66a13fd8b8490df2bce250e9 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Tue, 10 Nov 2009 18:28:53 +0100 Subject: [PATCH] revamping a little opac-detail for subscription (adding more history information) --- C4/Serials.pm | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 7d45ea7ecb..b7898ae52b 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -623,37 +623,37 @@ sub GetSubscriptions { my @bind_params; my $sqlwhere; if ($biblionumber) { - $sqlwhere = " WHERE biblio.biblionumber=?"; - push @bind_params, $biblionumber; + $sqlwhere=" WHERE biblio.biblionumber=?"; + push @bind_params,$biblionumber; } - if ($string) { - my @sqlstrings; + if ($string){ + my @sqlstrings; my @strings_to_search; - @strings_to_search = map { "%$_%" } split( / /, $string ); - foreach my $index qw(biblio.title subscription.callnumber subscription.location subscription.notes subscription.internalnotes) { - push @bind_params, @strings_to_search; - my $tmpstring = "AND $index LIKE ? " x scalar(@strings_to_search); - $debug && warn "$tmpstring"; - $tmpstring =~ s/^AND //; - push @sqlstrings, $tmpstring; + @strings_to_search=map {"%$_%"} split (/ /,$string); + foreach my $index qw(biblio.title subscription.callnumber subscription.location subscription.notes subscription.internalnotes){ + push @bind_params,@strings_to_search; + my $tmpstring= "AND $index LIKE ? "x scalar(@strings_to_search); + $debug && warn "$tmpstring"; + $tmpstring=~s/^AND //; + push @sqlstrings,$tmpstring; } - $sqlwhere .= ( $sqlwhere ? " AND " : " WHERE " ) . "(" . join( ") OR (", @sqlstrings ) . ")"; + $sqlwhere.= ($sqlwhere?" AND ":" WHERE ")."(".join(") OR (",@sqlstrings).")"; } - if ($issn) { - my @sqlstrings; + if ($issn){ + my @sqlstrings; my @strings_to_search; - @strings_to_search = map { "%$_%" } split( / /, $issn ); - foreach my $index qw(biblioitems.issn subscription.callnumber) { - push @bind_params, @strings_to_search; - my $tmpstring = "OR $index LIKE ? " x scalar(@strings_to_search); - $debug && warn "$tmpstring"; - $tmpstring =~ s/^OR //; - push @sqlstrings, $tmpstring; + @strings_to_search=map {"%$_%"} split (/ /,$issn); + foreach my $index qw(biblioitems.issn subscription.callnumber){ + push @bind_params,@strings_to_search; + my $tmpstring= "OR $index LIKE ? "x scalar(@strings_to_search); + $debug && warn "$tmpstring"; + $tmpstring=~s/^OR //; + push @sqlstrings,$tmpstring; } - $sqlwhere .= ( $sqlwhere ? " AND " : " WHERE " ) . "(" . join( ") OR (", @sqlstrings ) . ")"; - } - $sql .= "$sqlwhere ORDER BY title"; - $debug and warn "GetSubscriptions query: $sql params : ", join( " ", @bind_params ); + $sqlwhere.= ($sqlwhere?" AND ":" WHERE ")."(".join(") OR (",@sqlstrings).")"; + } + $sql.="$sqlwhere ORDER BY title"; + $debug and warn "GetSubscriptions query: $sql params : ", join (" ",@bind_params); $sth = $dbh->prepare($sql); $sth->execute(@bind_params); my @results; -- 2.39.5