Page MenuHomePhabricator

Activity field failing
Closed, ResolvedPublic

Description

Amber flagged an issue where she received the error message below and was unable to view the activity for CID 43432239. Michael and Kristie, on the other hand, couldn’t see the activity either, but they did not encounter the error message.

Screenshot 2025-01-07 at 5.12.32 PM.png (384×72 px, 11 KB)

Event Timeline

Here's another CID 67344496, displaying the same issue.

These seem to be happening on a couple of activity types - one historical & the other being created now - which is probably what we are getting problems from & probably requires a code change

select activity_type_id, MIN(activity_date_time), MAX(activity_date_time), count(*) FROM civicrm_activity WHERE source_record_id = 0 GROUP BY
activity_type_id;

activity_type_idMIN(activity_date_time)MAX(activity_date_time)count(*)
80 (refund)2024-10-09 07:40:022025-01-13 19:08:022140
129 (Event - Fundraising Reception)2020-10-28 00:00:002020-10-28 00:00:0021604

This is coming from - why does $parentTxnID = 0 - should we cast it NULL below (ie ->addValue('source_record_id', $parentTxn ?: NULL) - or should we fix it earlier

// add activity to record refund reason (e.g. why do we get chargeback),
// currently only adyen has this field, need to ask gr4vy if they can also pass it back
if (!empty($reason)) {
  // Log the refund reason to activity
  \Civi\Api4\Activity::create(FALSE)
    ->addValue('date', $message['date'])
    ->addValue('activity_type_id:name', 'Refund')
    ->addValue('subject', ts('Refund Reason'))
    ->addValue('status_id:name', 'Completed')
    ->addValue('details', $contributionStatus . ' reason: ' . $message['reason'])
    ->addValue('source_contact_id', $contributions[0]['contact_id'])
    ->addValue('target_contact_id', $contributions[0]['contact_id'])
    ->addValue('source_record_id', $parentTxn)
    ->execute();
}

It looks like in these case the parent_trxn_id was either missing or invalid - perhaps we need to check

Change #1110901 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Stop passing 'contributions' when we only want one

https://gerrit.wikimedia.org/r/1110901

Change #1110902 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Unpack the contributions to the single one we want earlier

https://gerrit.wikimedia.org/r/1110902

Change #1110904 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Fix Refund activity to hold correct value for source_record_id

https://gerrit.wikimedia.org/r/1110904

Change #1110905 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Fix data errors on source_record_id

https://gerrit.wikimedia.org/r/1110905

Change #1110950 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Standardise Contribution.get calls

https://gerrit.wikimedia.org/r/1110950

Change #1110951 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Remove last calls to old drupal module function

https://gerrit.wikimedia.org/r/1110951

Change #1110901 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Stop passing 'contributions' when we only want one

https://gerrit.wikimedia.org/r/1110901

Change #1110902 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Unpack the contributions to the single one we want earlier

https://gerrit.wikimedia.org/r/1110902

Change #1110904 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Fix Refund activity to hold correct value for source_record_id

https://gerrit.wikimedia.org/r/1110904

Change #1110905 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Fix data errors on source_record_id

https://gerrit.wikimedia.org/r/1110905

Change #1110950 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Standardise Contribution.get calls

https://gerrit.wikimedia.org/r/1110950

Change #1110951 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Remove last calls to old drupal module function

https://gerrit.wikimedia.org/r/1110951

I'm happy to confirm that we can see the activities for the CIDs shared here. Thanks a million, @Eileenmcnaughton, for the speedy fix!

Eileenmcnaughton set Final Story Points to 4.

Change #1117286 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/crm@master] Port upstream activity display fix

https://gerrit.wikimedia.org/r/1117286

Change #1117286 merged by Ejegg:

[wikimedia/fundraising/crm@master] Port upstream activity display fix

https://gerrit.wikimedia.org/r/1117286