-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Bulk Handler, Contact Manager
-
Labels:None
-
Bug Tracker:Customer Issue
-
ToDo:
-
Distro Version:16
-
Distro:Self Install Debian
The contact import from the bulk handler creates empty numbers in the database, breaking the contact.
The csv includes headers like `phone_1_number`, `phone_1_type`, ... `phone_2_number`, `phone_2_type`, ...
I have two contacts A and B. A has two numbers, B just one.
If I export the csv from the bulk handler, the `phone_2_number` and the other `phone_2_XXX` columns have empty values for contact B.
On reimport the bulk importer does not check if `phone_2_number` is set for A and B. It just assumes that each contact has two numbers and creates a second phone number entry in the database (contactmanager_entry_numbers).
This bug is a huge dealbreaker for me (e.g. it blocks further editing of imported contacts). If I am right, it should be fixable with 1 line of code here: https://git.freepbx.org/projects/FREEPBX/repos/contactmanager/browse/Contactmanager.class.php#3195
=> before adding the number to the array $contact['numbers'], just check if $value['number'] is empty
EDIT: Tested and works.
A simple
if (!empty($value['number']))
fixes it.
if (!empty($value['number'])) {
$contact['numbers'][] = array(
'number' => $value['number'],
'type' => isset($value['type']) ? $value['type'] : 'other',
'extension' => isset($value['extension']) ? $value['extension'] : '',
'flags' => isset($value['flags']) ? explode(',', $value['flags']) : array(),
'speeddial' => isset($value['speeddial']) ? $value['speeddial'] : '',
'locale' => isset($value['locale']) ? $value['locale'] : '',
);
}
Maybe a dev can make a similar (or better) change to resolve this.