CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 4.5 Release Testing »
  • 4.5.beta1 - Payment & Refund activity types being added incorrectly [FIXED]
Pages: [1]

Author Topic: 4.5.beta1 - Payment & Refund activity types being added incorrectly [FIXED]  (Read 1103 times)

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
4.5.beta1 - Payment & Refund activity types being added incorrectly [FIXED]
July 14, 2014, 11:56:48 pm
[See explanation in comment below]

On my system I have an activity type I created called "Communication Card" and its activity type ID is 10.

There's a piece of code in 4.5.beta1 that thinks activity type Id 10 is 'Payment'.

So I can create a "Communication Card" activity for a contact, but then cannot see that activity listed in the Activity tab of that contact's record.

In the file CRM/Activity/Selector/Activity.php, in the actionLinks() function,
  • Line 134 - the call to CRM_Core_PseudoConstant::activityType() returns an array that maps 10 => 'Payment'
  • Line 155 - the call to CRM_Core_DAO::getFieldValue() dies because $sourceRecordId is NULL

The trace is ...
Quote
Jul 15 16:07:50  [info] $backTrace = #0 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Error.php(387): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/DAO.php(790): CRM_Core_Error::fatal()
#2 /var/www/drupal/sites/all/modules/civicrm/CRM/Activity/Selector/Activity.php(155): CRM_Core_DAO::getFieldValue("CRM_Event_BAO_ParticipantPayment", NULL, "participant_id", "contribution_id")
#3 /var/www/drupal/sites/all/modules/civicrm/CRM/Activity/BAO/Activity.php(2586): CRM_Activity_Selector_Activity::actionLinks("10", NULL, FALSE, "163686")
#4 /var/www/drupal/sites/all/modules/civicrm/CRM/Activity/Page/AJAX.php(460): CRM_Activity_BAO_Activity::getContactActivitySelector((Array:36))
#5 [internal function](): CRM_Activity_Page_AJAX::getContactActivity()
#6 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(296): call_user_func((Array:2))
#7 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(75): CRM_Core_Invoke::runItem((Array:12))
#8 /var/www/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#9 /var/www/drupal/sites/all/modules/civicrm/drupal/civicrm.module(456): CRM_Core_Invoke::invoke((Array:3))
#10 [internal function](): civicrm_invoke("ajax", "contactactivity")
#11 /var/www/drupal/includes/menu.inc(517): call_user_func_array("civicrm_invoke", (Array:2))
#12 /var/www/drupal/index.php(21): menu_execute_active_handler()
#13 {main}

When I load the page civicrm/contact/view?reset=1 while viewing my contact's Activities tab, I see that CRM_Core_PseudoConstant::activityType() is called in a number of contexts ...
  • CRM/Activity/Form/ActivityLinks.php line 89 - with argument (FALSE) this maps 10 => 'Communication Card'
  • CRM/Activity/Form/ActivityFilter.php line 43 - with argument (TRUE, TRUE, FALSE, 'label', TRUE) this maps 10 => 'Payment'
  • CRM/Activity/Selector/Activity.php line 134 - with argument (TRUE, TRUE, FALSE, 'name', TRUE) this maps 10 => 'Payment'

The first result means that I can create a Communication Card as a new activity, but the second and third results mean I can't filter on those activities or view them.
« Last Edit: July 29, 2014, 08:05:06 pm by ken »

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: 4.5.beta1 - local activity type not being shown in activity lists
July 15, 2014, 12:00:29 am
BTW the Communication Card activity works fine in 4.4.2 so it's an upgrade issue.

I can't reproduce on the sandbox because when I create an activity type it is allocated an activity type of 62.

I suspect my issue will affect anyone who has defined local activity types.

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: 4.5.beta1 - local activity type not being shown in activity lists
July 15, 2014, 05:02:54 pm
The problem is due to line 185 of CRM/Upgrade/Incremental/sql/4.5.alpha1.mysql.tpl

Quote
SELECT @option_group_id_act_val := MAX(value) FROM civicrm_option_value WHERE option_group_id = @option_group_id_act;

The value column is a varchar(512) so max() selects '9' rather than '72' (in my case).

Looking at previous upgrade scripts that add an activity_type, the max(value) should be max(round(value)) so value is treated as an integer.
« Last Edit: July 15, 2014, 08:28:43 pm by ken »

ken

  • I live on this forum
  • *****
  • Posts: 916
  • Karma: 53
    • City Bible Forum
  • CiviCRM version: 4.6.3
  • CMS version: Drupal 7.36
  • MySQL version: 5.5.41
  • PHP version: 5.3.10
Re: 4.5.beta1 - Payment & Refund activity types being added with incorrect value
July 15, 2014, 09:15:00 pm
See https://issues.civicrm.org/jira/browse/CRM-14994 and https://github.com/civicrm/civicrm-core/pull/3678

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: 4.5.beta1 - Payment & Refund activity types being added with incorrect value
July 15, 2014, 11:19:32 pm
ken :

Thanks for your patch! I 've merged your PR and it will be available in our beta2 release :)
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Alpha and Beta Release Testing »
  • 4.5 Release Testing »
  • 4.5.beta1 - Payment & Refund activity types being added incorrectly [FIXED]

This forum was archived on 2017-11-26.