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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Civicrm_line_item not updating when financial type changed
Pages: [1]

Author Topic: Civicrm_line_item not updating when financial type changed  (Read 395 times)

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Civicrm_line_item not updating when financial type changed
February 25, 2015, 05:26:29 am
First, apologies if this is the wrong place to put this, but I don't think it belongs in one of the user forums just yet.  Admins should feel to move it there if they do think that is the appropriate place.

I have not confirmed this on a demo site as I don't think I can do that without access to the actual mysql DB, but I have confirmed this happens on both my 4.4.12 and 4.6 alpha7 installs.


Action 1: Edit a 'non-priceset' contribution by changing the financial type from financial_type_id = 1 (which has income financial_account_id = 6) to financial_type_id = 3 (which has income financial_account_id = 9)

Results: contribution.financial_type_id is correctly updated; financial_item.financial_account_id is correctly updated, line_item.financial_type_id is not updated. That is:

field___original___-actual after editing via GUI____what I expected after editing via GUI
contribution.financial_type_id133
financial_item.financial_account_id....699
line_item.financial_type_id113

Consequences: mismatch between financial_item.financial_account_id and line_item.financial_type_id and incorrect reports for people using Fuzion's Line_item report ( the only way I know of to group line item income by financial_type_id)

Suggested solution: have line_item.financial_type_id updated when contribution.financial_type_id is updated for 'non-priceset' contributions

Action 2: Edit a priceset contribution by changing the financial type. Let's say the price set has default financial_type_id = 1, Price field A with financial_type_id = 1 (income financial_account_id = 6) and price field B with financial_type_id = 2 (income financial_account_id = 7). You edit the contribution and set  financial_type_id = 3 (income financial_account_id = 9)

Results: contribution.financial_type_id is correctly updated; financial_item.financial_account_id is (correctly??) updated, line_item.financial_type_id is not updated. That is:

field__original___after editing via GUI___what I expected after editing via GUI
contribution.financial_type_id133
Pricefield A financial_item.financial_account_id.... 69?
Pricefield B financial_item.financial_account_id 79?
Pricefield A line_item.financial_type_id11?
Pricefield B line_item.financial_type_id22?

Consequences:  mismatch between financial_item.financial_account_id and line_item.financial_type_id and incorrect reports for people using Fuzion's Line_item report ( the only way I know of to group line item income by financial_type_id)

Suggested solutions:  Option 1: Remove the ability for people to edit (default) financial type  for price set contributions.
                                    Option 2: Have line_item.financial_type_id updated when contribution.financial_type_id is updated and have popup before saving warning people that new financial type will apply to all line items with option for them to cancel Save.


What do others think?


joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: Civicrm_line_item not updating when financial type changed
February 26, 2015, 05:03:33 am
It would appear not to be a problem for others so far.

I have looked at the code and there is no way I could do anything to fix it, and the organisation I work for is particularly skint at the moment.


I am hoping someone else will think it is a problem and they will have enough skills to write the PR to update the line_item table when the financial type is changed.

If that is done then I can create a PR to add text when a price set as used as shown in the attachment, but it doesn't really apply at the moment as the financial_account_ids are changed but not the line_item.financial_type_ids.
« Last Edit: February 26, 2015, 05:26:36 am by joanne »

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Civicrm_line_item not updating when financial type changed
February 27, 2015, 12:00:21 pm
Thanks Joanne for detailing this out, and JMA for stepping up to do the fix:
https://issues.civicrm.org/jira/browse/CRM-16015
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Civicrm_line_item not updating when financial type changed

This forum was archived on 2017-11-26.