- Issue created by @MegaphoneJon
- πΊπΈUnited States MegaphoneJon
- Status changed to Fixed
almost 2 years ago 3:46pm 27 February 2023 Automatically closed - issue fixed for 2 weeks with no activity.
1.0 Problem/Motivation
When you submit an address, and the CiviCRM id of the state/province is > 9999, you get two errors:
CRM_Core_Exception: Value for abbreviation is 5 characters - This field has a maxlength of 4 characters. in civicrm_api3() (line 135 of /code/vendor/civicrm/civicrm-core/api/api.php).
Drupal\Core\Entity\EntityStorageException: Value for abbreviation is 5 characters - This field has a maxlength of 4 characters. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of /code/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
This happens because of PR #813, "Replace state abbreviation with id on normal address state field". We still try to convert the abbreviation to an ID. Which is fine if it's already an ID - unless the API call fails. Which it does because "abbreviation" has a maxlength of 4.
2.0 Detailed steps to reproduce (embed screenshots)
Create a form with a contact and address. Enable country and state/province.
Select a country of "United Kingdom" and state/province of "Derry City and Strabane". Note that the province list isn't alphabetical anymore, but that's out of scope here.
Submit.
3.0 Proposed resolution
I have a patch incoming.
Fixed
6.0
Webform/Drupal
Automatically closed - issue fixed for 2 weeks with no activity.