From 0eed1cfd37bb6459b173d76e2a2c77a01fcd65b2 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Wed, 25 Nov 2015 12:23:10 +0100 Subject: [PATCH] Bug 15252 - Patron search on start with does not work with several terms - followup 1 'start_with' is the default value of $searchtype, it can be explicit. --- C4/Utils/DataTables/Members.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm index 9628b1e..59a7e17 100644 --- a/C4/Utils/DataTables/Members.pm +++ b/C4/Utils/DataTables/Members.pm @@ -13,7 +13,7 @@ sub search { my $firstletter = $params->{firstletter}; my $categorycode = $params->{categorycode}; my $branchcode = $params->{branchcode}; - my $searchtype = $params->{searchtype}; + my $searchtype = $params->{searchtype} || 'start_with'; my $searchfieldstype = $params->{searchfieldstype} || 'standard'; my $dt_params = $params->{dt_params}; @@ -88,8 +88,7 @@ sub search { $term .= '%' # end with anything if $term !~ /%$/; $term = "%$term" # begin with anythin unless start_with - if (defined $searchtype) && $searchtype eq "contain" - && $term !~ /^%/; + if $searchtype eq 'contain' && $term !~ /^%/; my @where_strs_or; for my $searchfield ( split /,/, $searchfields->{$searchfieldstype} ) { @@ -208,11 +207,11 @@ $params is a hashref with some keys: =item searchtype - Can be 'contain' or 'start_with'. Used for the searchmember parameter. + Can be 'contain' or 'start_with' (default value). Used for the searchmember parameter. =item searchfieldstype - Can be 'standard', 'email', 'borrowernumber', 'phone', 'address' or 'dateofbirth', 'sort1', 'sort2' + Can be 'standard' (default value), 'email', 'borrowernumber', 'phone', 'address' or 'dateofbirth', 'sort1', 'sort2' =item dt_params -- 2.1.4