use Lingua::EN::Inflect::Number qw(to_PL);
use Class::DBI::AsForm;
use Class::DBI::FromCGI;
+use Class::DBI::AbstractSearch;
use CGI::Untaint;
use strict;
sub search :Exported {
my ($self, $r) = @_;
my %fields = map {$_ => 1 } $self->columns;
- my %values = map { $_ => $params{$_} }
- grep { $params{$_} and $fields{$_} } keys %{$r->{params}};
- $r->objects([ %values ? $self->search_like(%values) : $self->retrieve_all ]);
+ my $oper = "like"; # For now
+ my %params = %{$r->{params}};
+ my %values = map { $_ => {$oper, $oper eq "like" ? "%".$params{$_}."%"
+ :$params{$_} } }
+ grep { $params{$_} and $fields{$_} } keys %params;
+
+ $r->objects([ %values ? $self->search_where(%values) : $self->retrieve_all ]);
$r->template("list");
$r->{template_args}{search} = 1;
}