Problem/Motivation

Can't add phone number or address to contact. (email addresses are fine)

Steps to reproduce

1. Install CRM
2. Navigate to a contact entity add form (e.g. `/crm/contact/add/person`) or edit form (e.g. `/crm/contact/3/edit`)
3. Click "Add new telephone" (or "Add new address")
4. Enter a phone number and click "Create telephone" (or "Create address")

Expected:
Telephone number (or address) created

Actual:
Resulting AJAX request errors and telephone number (or address) is not created:

Error: Object of class Drupal\telephone\Plugin\Field\FieldType\TelephoneItem could not be converted to string in Drupal\crm\Entity\ContactDetail\TelephoneContactDetail->label() (line 21 of /var/www/html/src/Entity/ContactDetail/TelephoneContactDetail.php).

TypeError: strlen(): Argument #1 ($string) must be of type string, Drupal\telephone\Plugin\Field\FieldType\TelephoneItem given in strlen() (line 397 of /var/www/html/web/core/lib/Drupal/Component/Utility/Unicode.php)

TypeError: strlen(): Argument #1 ($string) must be of type string, Drupal\address\Plugin\Field\FieldType\AddressItem given in strlen() (line 397 of /var/www/html/web/core/lib/Drupal/Component/Utility/Unicode.php)

Proposed resolution

Remaining tasks

Issue fork crm-3541270

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jdleonard created an issue. See original summary.

jdleonard’s picture

Title: Error prevents adding phone number to contact » Errors prevent adding phone number or address to contact
Issue summary: View changes
jdleonard’s picture

Assigned: Unassigned » jdleonard

jdleonard’s picture

Assigned: jdleonard » Unassigned
Status: Active » Needs review

Only lightly tested. The code makes more sense to me this way.

bluegeek9 made their first commit to this issue’s fork.

bluegeek9 changed the visibility of the branch 1.0.x to hidden.

bluegeek9’s picture

Status: Needs review » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support makes this project sustainable.
There are multiple ways to show appreciation for the work contributed to this project including:
  • Triage issues and adding more context to existing issues.
  • Flagging CRM as a favorite on the project page to help others discover it and show your support.
  • Review the Developer Docs for accuracy and clarity.

  • bluegeek9 committed 4d07b34f on 1.0.x authored by jdleonard
    Issue #3541270 by jdleonard, bluegeek9: Errors prevent adding phone...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.