Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Won't Fix
-
Affects Version/s: 4.2.6
-
Fix Version/s: Unscheduled
-
Component/s: Core CiviCRM
-
Labels:None
-
Documentation Required?:None
-
Funding Source:Needs Funding
Description
This issue was reported twice with two different symptoms. But the problem is the same:
- Edit a contact who has > 1 address
- Delete an address
- It hasn't really been deleted, as evidenced by:
1) If you click "add new address" the old address will reappear instead of a blank one
2) If you submit the form and it fails validation, the deleted address will be back (although since the accordion is collapsed you won't notice). You will have to manually delete it again to make it go away.
The second problem is particularly annoying if the address form contains any required fields, because after a second submit, form validation will fail again for something that shouldn't even be there.
I have examined the code and had trouble thinking of a way to fix this without any major refactoring. The form uses some ancient code that deals with addresses based on their "block no" rather than their id which makes everything more difficult than it should be. Here are some possibilities for 4.3:
1) Do nothing, punt the issue to 4.4 - the problem is rare, and now even more so because it's convenient to delete addresses via inline edit.
2) Implement an ajax-api-based solution similar to what was done for CRM-12218. Two issues with this:
- This would mean the address would be permanently deleted as soon as the user clicked the "delete" button. This may not be desirable since the expected behavior is for changes not to be saved until the whole form is submitted.
- Addresses are referred to by block-no and so I don't know how to find their actual id. I'm sure it's possible, I just haven't figured it out so far.
3) Implement a quickform-based solution. Do a better job of keeping track of deleted addresses during form validation. This bug does not affect emails or phones even though they use the same block code. Find out why.
Attachments
Issue Links
- is duplicated by
-
CRM-12226 'delete this address' still triggers validation
- Done/Fixed