Uploaded image for project: 'FreePBX'
  1. FreePBX
  2. FREEPBX-23229

Bulk import of contacts creates empty number entries in database

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Bug Tracker:
      Customer Issue
    • ToDo:
    • Distro Version:
      16
    • Distro:
      Self Install Debian

      Description

      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.

      Change: https://git.freepbx.org/projects/FREEPBX/repos/contactmanager/browse/Contactmanager.class.php?until=4eb64af10e032a67c89ec08f035d5de6e5932cd9&untilPath=Contactmanager.class.php#3195

      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.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                prashobk Prashob K
                Reporter:
                adro adro
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  NextupJiraPlusStatus

                  Error rendering 'slack.nextup.jira:nextup-jira-plus-status'. Please contact your Jira administrators.