Bug 7105: Bad request in GetSubscriptions bug_5399-rebase-master
authorChristophe Croullebois <christophe.croullebois@biblibre.com>
Thu, 27 Oct 2011 13:50:19 +0000 (15:50 +0200)
committerPaul Poulain <paul.poulain@biblibre.com>
Sat, 3 Dec 2011 07:21:21 +0000 (08:21 +0100)
If $string or $issn is passed to GetSubscriptions, the request is false.
See Bug 5864, especially the last comment from Frédérick Capovilla.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Serials.pm

index 18e0ce4..1471184 100644 (file)
@@ -588,7 +588,7 @@ sub GetSubscriptions {
             $tmpstring =~ s/^AND //;
             push @sqlstrings, $tmpstring;
         }
-        $sqlwhere .= ( $sqlwhere ? " AND " : " WHERE " ) . "(" . join( ") OR (", @sqlstrings ) . ")";
+        $sqlwhere .= ( $sqlwhere ? " AND " : " WHERE " ) . "((" . join( ") OR (", @sqlstrings ) . "))";
     }
     if ($issn) {
         my @sqlstrings;
@@ -601,7 +601,7 @@ sub GetSubscriptions {
             $tmpstring =~ s/^OR //;
             push @sqlstrings, $tmpstring;
         }
-        $sqlwhere .= ( $sqlwhere ? " AND " : " WHERE " ) . "(" . join( ") OR (", @sqlstrings ) . ")";
+        $sqlwhere .= ( $sqlwhere ? " AND " : " WHERE " ) . "((" . join( ") OR (", @sqlstrings ) . "))";
     }
     $sql .= "$sqlwhere ORDER BY title";
     $debug and warn "GetSubscriptions query: $sql params : ", join( " ", @bind_params );