Fix for Bug 7085 - Problems with searching for orders in acquisitions
authorOwen Leonard <oleonard@myacpl.org>
Tue, 25 Oct 2011 14:16:02 +0000 (10:16 -0400)
committerPaul Poulain <paul.poulain@biblibre.com>
Sun, 6 Nov 2011 09:23:47 +0000 (10:23 +0100)
Changing "if ( defined $input )" to "if ( $input )" in the section
of the script which builds the order search query seems to give
successful searches where they didn't exist before. Searches from
the advanced order search screen work with title, author, vendor,
basket number, date, etc.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Searches for date ranges, title and author keywords give
me the correct results now.

C4/Acquisition.pm

index 19c4f08..a0dda42 100644 (file)
@@ -1581,33 +1581,33 @@ sub GetHistory {
 
     my @query_params  = ();
 
-    if ( defined $title ) {
+    if ( $title ) {
         $query .= " AND biblio.title LIKE ? ";
         $title =~ s/\s+/%/g;
         push @query_params, "%$title%";
     }
 
-    if ( defined $author ) {
+    if ( $author ) {
         $query .= " AND biblio.author LIKE ? ";
         push @query_params, "%$author%";
     }
 
-    if ( defined $isbn ) {
+    if ( $isbn ) {
         $query .= " AND biblioitems.isbn LIKE ? ";
         push @query_params, "%$isbn%";
     }
 
-    if ( defined $name ) {
+    if ( $name ) {
         $query .= " AND aqbooksellers.name LIKE ? ";
         push @query_params, "%$name%";
     }
 
-    if ( defined $from_placed_on ) {
+    if ( $from_placed_on ) {
         $query .= " AND creationdate >= ? ";
         push @query_params, $from_placed_on;
     }
 
-    if ( defined $to_placed_on ) {
+    if ( $to_placed_on ) {
         $query .= " AND creationdate <= ? ";
         push @query_params, $to_placed_on;
     }