Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.4.5, 4.4.7
-
Fix Version/s: 4.5
-
Component/s: None
-
Labels:None
Description
== Issue Description ==
When used with Drupal for sure, but I believe in all systems. If a field that has a drop-down that defaults to " - select - ", like the State address field, is set to View Only you can get the following error (taken from reproducing error on demo site:
Fatal error: Call to a member function freeze() on a non-object in /home/webeditor/jenkins-node/workspace/buildkit-demos.civicrm.org/build/d7-demo/sites/all/modules/civicrm/CRM/Contact/Form/Edit/Address.php on line 484
The error is only present if the current user hasn't filled that field else where, if the field already has a select like a State name, the page will load fine. Hence why this error doesn't seam to effect Country as much, since it can be set to a default value.
== How to Reproduce on Demo Site ==
1. Log in and go to the "Name and Address" profile: http://drupal.demo.civicrm.org/civicrm/admin/uf/group/field?reset=1&action=browse&gid=1
2. Edit "State (Home)" and check "View Only" and click Save
3. Now if in a new browser session you go to "http://drupal.demo.civicrm.org/user/register" you will see the error.
4. You can also go to the preview of the filled and get the error. "http://drupal.demo.civicrm.org/civicrm/admin/uf/group?action=preview&id=1&reset=1&field=0&context=field"
- Note: if you are logged in as a user and view the Drupal edit name and address page you will not have the error, its only if the profile is on the Signup page, or in other similar places.
== Code Causing Issue ==
Looks like a freeze(); is applied to the state since it is in View Only, this was added due to butCRM-9070since the field "State (Home)" was editable while in view only back in version 4.1.0, which if I comment out the code for the freeze, the user can edit the State field.