Skip to content

Fail if contact has data in more than one type of data being tracked

DaveD requested to merge DaveD/formercommunicationdata:multiple into master

e.g. If a contact has both an email and a phone, then when you save, even without making any changes, you get an error "Failed to save former ..." and "Could not find any pre data of ..."

This happens because PreData is using the same static variable for all the different types, so it only "remembers" the last one when it comes time to retrieve the "before" state.

I've just made it an array instead, keyed on the type and id.

There also doesn't seem to be any reason to clear the static var. When another page starts it always starts out clear.

Merge request reports