From 8e933e3320d822b2fd5e5f1d5baab064c50ce979 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 'start_with' is the default value of $searchtype, it can be explicit. Tested 4 patches together, works as expected Signed-off-by: Marc VĂ©ron --- 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 31af767..1ebecd7 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}; @@ -90,8 +90,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} ) { @@ -210,11 +209,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 -- 1.7.10.4