Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-19126 Tax amount fix #8835

Merged
merged 6 commits into from
Aug 8, 2016

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Aug 7, 2016

@seamuslee001 this is my take on what the fix should look like

  1. move check tax amount to the BAO
  2. use the existing pre-load of the prevContribution
  3. exit early if at all possible

One thing you did that I wasn't clear about was $params['total_amount'] = $prevContributionValue->total_amount - $prevContributionValue->tax_amount;

I thought the saved total would be right?


@seamuslee001
Copy link
Contributor

@eileenmcnaughton you got style fixes to do. The reason why I did that was because if your re-calculating tax amount the total amount value may already include the tax amount previously calculated. So there is a possible situation of double taxation

@eileenmcnaughton
Copy link
Contributor Author

ah so this function adds tax on top of the total_amount? rather than treating a component as tax?

@seamuslee001
Copy link
Contributor

As far as I know yes. Hence my test.

On Monday, 8 August 2016, Eileen McNaughton notifications@github.com
wrote:

ah so this function adds tax on top of the total_amount? rather than
treating a component as tax?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#8835 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGe_FdiXVH9aQ3I4eeQ94D5y12iOc7aTks5qdnB7gaJpZM4JeneP
.

This includes moving the setting of tax values from the api to the BAO.

Unfortunately an awful lot of the tax work was done in the form layer & it would
be a big job to figure out which parts can be left to the BAO
@seamuslee001
Copy link
Contributor

@eileenmcnaughton failures look geniune

}

// CRM-16189
CRM_Financial_BAO_FinancialAccount::checkFinancialTypeHasDeferred($params, $contributionID);

if (!isset($params['tax_amount']) && $setPrevContribution && (isset($params['total_amount']) || isset
($params['financial_type_id']))) {
$params = CRM_Contribute_BAO_Contribution::checkTaxAmount($params);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton i was finding that the $params being passed to the copyValues was the original and not updated to include the relevant tax amount for some reason

@eileenmcnaughton
Copy link
Contributor Author

I tried editing contributions through the back end forms to make sure there was no change. I managed to configure a financial type that was sales-taxable & changing it back & forth from no-tax to taxed type works.

I could not figure out how to change the amount on an existing contribution with a tax_amount - but that issue pre-existed & is in the form layer - not from this

The sum of fee amount and net amount must be equal to total amoun

@eileenmcnaughton
Copy link
Contributor Author

blah blah (typed by Luke)

@seamuslee001
Copy link
Contributor

:-)

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 let me know if you think we are there with this now it's passing... I did test the backoffice contribution edit

@seamuslee001
Copy link
Contributor

I think this is good to be merged now.

@litespeedmarc
Copy link
Contributor

I've been off in nature for the last week, with little Internet. Finally back on some CiviCRM stuff. There sure has been a lot of action here. Pretty impressive to see everyone work together. This all sounds good to me. I look forward to the next update.

@litespeedmarc
Copy link
Contributor

One thought on this. If recalculating the taxes. Which financial type/account is used? The one associated at the line-item I hope? Going back on one of my earlier comments in https://issues.civicrm.org/jira/browse/CRM-19126, I recall that it was the one associated with the membership type, which wouldn't be right if that is still happening. The original quick & dirty fix ignoring when total_amount was == 0 sort of circumvented this. But based on my reading of the last set of changes here, this could still now be an issue?

@seamuslee001
Copy link
Contributor

@litespeedmarc Yes tho that was an issue before this and is IMO separate to the issue of total_amount being 0. I think another JIRA ticket should be opened for that and also maybe tag in Joe Murray and Pradeep in as well as they have been working on account stuff so this maybe of an issue to them but this specific issue of the tax amount getting wrongly set when total amount is not set has been fixed

@eileenmcnaughton
Copy link
Contributor Author

I think you can test against master & see now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants