From: Henri-Damien LAURENT Date: Wed, 11 Nov 2009 11:00:18 +0000 (+0100) Subject: MT1883 : Serials enddate was not cleanly used X-Git-Tag: v3.02.00-alpha~54^2~14 X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=b3237372673e4187061ed89333fb5e30d8e5534e;p=koha.git 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 --- 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;