[Jifty-commit] r6582 - jifty/trunk/lib/Jifty/Action/Record

Jifty commits jifty-commit at lists.jifty.org
Sun Mar 15 13:14:25 EDT 2009


Author: clkao
Date: Sun Mar 15 13:14:24 2009
New Revision: 6582

Modified:
   jifty/trunk/lib/Jifty/Action/Record/Search.pm

Log:
- Make action::record::search skip container columns.
- "contains" should not be search condition if its length is 0.


Modified: jifty/trunk/lib/Jifty/Action/Record/Search.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Action/Record/Search.pm	(original)
+++ jifty/trunk/lib/Jifty/Action/Record/Search.pm	Sun Mar 15 13:14:24 2009
@@ -107,6 +107,10 @@
             delete $args->{$field}
              if UNIVERSAL::isa($refers_to, 'Jifty::Collection');
         }
+        if ($info->{container}) {
+            delete $args->{$field};
+            next;
+        }
 
         # XXX TODO: What about booleans? Checkbox doesn't quite work,
         # since there are three choices: yes, no, either.
@@ -310,13 +314,15 @@
 
         # See if any column contains the text described
         my $any = $self->argument_value('contains');
-        for my $col ($self->record->columns) {
-            if($col->type =~ /(?:text|varchar)/) {
-                $collection->limit(column   => $col->name,
-                                   value    => "%$any%",
-                                   operator => 'LIKE',
-                                   entry_aggregator => 'OR',
-                                   subclause => 'contains');
+        if (length $any) {
+            for my $col ($self->record->columns) {
+                if($col->type =~ /(?:text|varchar)/) {
+                    $collection->limit(column   => $col->name,
+                                       value    => "%$any%",
+                                       operator => 'LIKE',
+                                       entry_aggregator => 'OR',
+                                       subclause => 'contains');
+                }
             }
         }
     }


More information about the Jifty-commit mailing list