[Koha-bugs] [Bug 23817] Normalize phone number when searching patrons

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Sep 14 06:15:45 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23817

--- Comment #10 from David Cook <dcook at prosentient.com.au> ---
I think the only way forward is to normalize the data in the database (ie only
store [\+0-9], and normalize the search query in
"koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc" to [\+0-9] as
well.

It would still be necessary to update all the patron data in the database. We'd
need something like "touch_all_patron_records.pl", or a once off SQL update to
strip out everything that isn't [\+0-9]. regexp_replace(phone,'[^0-9]','')
would be useful for that.

This patch doesn't take into account Katrin's edge cases of multiple phone
numbers or text comments in the "phone" field. 

There's no way to do that unless we completely change how DataTables work with
the REST API. 

I've taken a look at a large patron database and over 99% of phone number data
is just 1 phone number. Out of 100,000+ records, I see maybe 5 that have text
comments in them. I see 2 records with 2 phone numbers in them.

If they need to note the phone number belongs to a particular person or is text
only, I think that needs to go in the "Contact note".

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list