For anyone who also has this issue, I got an solution coded now.
You can add for example to your contacts advanced search a new field “all phone numbers” which goes through the fields you define.
File:
custom\modules\Contacts\metadata\SearchFields.php
add:
'phone_all_numbers' =>
array (
'query_type' => 'format',
'operator' => 'subquery',
'subquery' => array(
'SELECT id FROM contacts WHERE phone_work LIKE "%"',
'SELECT id FROM contacts WHERE REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( phone_work, "+", "" ) , "-", "" ) , "(", "" ) , ")", "" ) , " ", "" ) LIKE "%"',
'SELECT id FROM contacts WHERE phone_mobile LIKE "%"',
'SELECT id FROM contacts WHERE REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( phone_mobile, "+", "" ) , "-", "" ) , "(", "" ) , ")", "" ) , " ", "" ) LIKE "%"',
'OR' =>true
),
'db_field'=>array('id'),
'vname' => 'LBL_OFFICE_PHONE',
),
and in file:
custom\modules\contacts\metadata\searchdefs.php add:
'phone_all_numbers' => array(
'name' => 'phone_all_numbers',
'label' => 'PHONE NUMBER SEARCH',
'type' => 'name',
'width' => '40%'
),
Now you get a new field in the advanced search for Contacts which goes through phone_work and phone_mobile fields in contact,
and ignores all characters in the phone fields.
What I now need, is that this also works in the global search.
Maybe someone can give me a hint how to get this going.