@@ -, +, @@ searching in Patrons module --- Koha/Patron.pm | 22 +++++++++++++++++++ .../prog/en/includes/patron-search.inc | 5 ++++- 2 files changed, 26 insertions(+), 1 deletion(-) --- a/Koha/Patron.pm +++ a/Koha/Patron.pm @@ -2196,6 +2196,28 @@ sub virtualshelves { return Koha::Virtualshelves->_new_from_dbic( scalar $self->_result->virtualshelves ); } +=head3 phone + + my $phone = $patron->phone; + +=cut + +sub phone { + my ($self,@data) = @_; + if (@data){ + foreach my $datum (@data){ + $datum =~ s/[^\+0-9]//g; + } + $self->_result()->set_column( 'phone', @data ); + return $self; + } + else { + my $value = $self->_result()->get_column( 'phone' ); + return $value; + } +} + + =head2 Internal methods =head3 _type --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -318,7 +318,10 @@ if ( !search_fields ) { search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]"; } - + if (search_fields == 'phone'){ + //Normalize phone numbers + patterns = [pattern.replace(/[^\+0-9]/g,'')]; + } let subquery_and = []; patterns.forEach(function(pattern,i){ let sub_or = []; --