systopia / de.systopia.xcm

CiviCRM Extended Contact Matcher
Other
5 stars 11 forks source link

Diff Helper doesn't work in localised environment #95

Closed bjendres closed 1 year ago

bjendres commented 2 years ago

It seems that the hacky "diff helper" JS module doesn't work in a localised environment, because it cannot determine the attribute name any more - see HERE and HERE.

The right way to do it would be to add the attribute name as a property to the table row.

bjendres commented 2 years ago

For the record: old change activities can be converted with the following pattern:

UPDATE civicrm_activity
SET details = REGEXP_REPLACE(details, "<tr>[\\r\\n\\s]+<td>[LOCALISED_LABEL]</td>", "<tr class=\"xcm-[ATTRIBUTE_NAME]\"><td>[LOCALISED_LABEL]</td>")
WHERE details REGEXP "<tr>[\\r\\n\\s]+<td>[LOCALISED_LABEL]</td>"
AND activity_type_id IN (CHANGE_ACTIVITY_TYPE_IDS)
AND status_id IN (ACTIVE STATUS_IDS)

e.g.

UPDATE civicrm_activity
SET details = REGEXP_REPLACE(details, "<tr>[\\r\\n\\s]+<td>Stadt</td>", "<tr class=\"xcm-city\"><td>Stadt</td>")
WHERE details REGEXP "<tr>[\\r\\n\\s]+<td>Stadt</td>"
AND activity_type_id IN (CHANGE_ACTIVITY_TYPE_IDS)
AND status_id IN (ACTIVE STATUS_IDS)

This has then to be looped through all attributes and (localised) labels.

Implementing this, however, is currently beyond our budget.