MT1883 : Serials enddate was not cleanly used
authorHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 11 Nov 2009 11:00:18 +0000 (12:00 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Thu, 19 Nov 2009 22:09:47 +0000 (23:09 +0100)
GetExpirationDate should now be used only to get the NEXT expirationdate based on startdate
Perltidying C4/Serials.pm

C4/Serials.pm

index b7898ae..7d45ea7 100644 (file)
@@ -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;