[Koha-devel] Handling normalized phone number data

dcook at prosentient.com.au dcook at prosentient.com.au
Thu Sep 15 02:36:46 CEST 2022


I think at some point both the phone and email details should be moved into their own table(s), and then 1 would get a primary flag. 

 

With the DataTables and REST API, I suppose we could hard-code a join into Koha/REST/V1/Patrons.pm.

 

If we had a “phone” table, we could potentially store both free-text (potentially formatted) and normalized versions of the phone number. Then we’d just update the patron search to use the normalized version. 

 

But all of that sounds like a lot of effort :/

 

David Cook

Senior Software Engineer

Prosentient Systems

Suite 7.03

6a Glen St

Milsons Point NSW 2061

Australia

 

Office: 02 9212 0899

Online: 02 8005 0595

 

From: Tomas Cohen Arazi <tomascohen at theke.io> 
Sent: Wednesday, 14 September 2022 11:10 PM
To: dcook at prosentient.com.au
Cc: koha-devel <koha-devel at lists.koha-community.org>; Kyle Hall <kyle at bywatersolutions.com>; Martin Renvoize <martin.renvoize at ptfs-europe.com>
Subject: Re: Handling normalized phone number data

 

Should we also think of moving phones to their own table?

 

El mié, 14 sept 2022 a las 3:43, <dcook at prosentient.com.au <mailto:dcook at prosentient.com.au> > escribió:

Hi all,

 

I’ve been working lately on https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23817 in an effort to let staff users easily search phone numbers in the Patrons module.

 

Currently, phone number searching doesn’t work if you have punctuation or other formatting inconsistent with your search query. 

 

So I’m proposing normalizing phone numbers. Normalizing the search query is easy, but normalizing the data in the database is harder. In older versions of Koha, I used SQL to normalize the phone column in the WHERE clause, but that’s seemingly impossible now that we’re using DataTables and the REST API.

 

So it seems to me the only way forward is to normalize the data in the database. I’ve attached a patch which provides a Koha::Patron->phone() set method which normalizes the phone number before it’s saved in the database, but I don’t know what other Koha folk think about that. 

 

Thoughts?

 

David Cook

Senior Software Engineer

Prosentient Systems

Suite 7.03

6a Glen St

Milsons Point NSW 2061

Australia

 

Office: 02 9212 0899

Online: 02 8005 0595

 




 

-- 

Tomás Cohen Arazi

Theke Solutions (http://theke.io)
✆ +54 9351 3513384
GPG: B2F3C15F

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20220915/2d4c4898/attachment-0001.htm>


More information about the Koha-devel mailing list