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

dev/core#889 - Refund throws a fatal error if the main contribution a… #14103

Merged
merged 1 commit into from
Jun 10, 2019

Conversation

jitendrapurohit
Copy link
Contributor

…mount is 0

Overview

Refund throws a fatal error if the main contribution amount is 0

Before

To replicate -

  • Create an event with fee amount options = $0, $50, $100.
  • Register contact A for an event with price $50.
  • Change selection to $0. Main contribution amount updates to $0.
  • Record refund of $50 -> Submit.
  • Payment is refunded but the ajax form is stuck with an Error.

image

After

Refund form is submitted correctly.

Technical Details

As main contribution amount $contributionDAO->total_amount is 0, there is a division by zero error assignment to $paid var which throws an error when it is tried to insert as a row in financial item table.

Comments

Gitlab - https://lab.civicrm.org/dev/core/issues/889

@civibot
Copy link

civibot bot commented Apr 22, 2019

(Standard links)

@civibot civibot bot added the master label Apr 22, 2019
@eileenmcnaughton
Copy link
Contributor

eileenmcnaughton commented Apr 24, 2019

In general I'm trying not to merge anything to do with handling payments until we finish the work on rationalising the payment create api function with the on-form function - currently stalled on this

#13689

However, if you want to add a unit test then even though this fix will likely be thrown away in the course of that work the bug-fix would be locked in by a test

(@monishdeb fyi)

@seamuslee001
Copy link
Contributor

Jenkins re test this please

@seamuslee001
Copy link
Contributor

I have added a unit test which replicates the issue for me locally in #14488

@eileenmcnaughton
Copy link
Contributor

Merging since @seamuslee001 has added a test - fix seems sensible

@eileenmcnaughton eileenmcnaughton merged commit 7050d7b into civicrm:master Jun 10, 2019
@jitendrapurohit jitendrapurohit deleted the core-889 branch June 19, 2019 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants