From b3237372673e4187061ed89333fb5e30d8e5534e Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Wed, 11 Nov 2009 12:00:18 +0100 Subject: [PATCH] MT1883 : Serials enddate was not cleanly used GetExpirationDate should now be used only to get the NEXT expirationdate based on startdate Perltidying C4/Serials.pm --- C4/Serials.pm | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index b7898ae52b..7d45ea7ecb 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