{"action":"created","issue":{"url":"https://api.github.com/repos/civicrm/civicrm-core/issues/13114","repository_url":"https://api.github.com/repos/civicrm/civicrm-core","labels_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/13114/labels{/name}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/13114/comments","events_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/13114/events","html_url":"https://github.com/civicrm/civicrm-core/pull/13114","id":381728452,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxNjMwODEw","number":13114,"title":"dev/financial#34 : Incorrect allocation of payment on an edited multi-line item event registration ","user":{"login":"monishdeb","id":3735621,"node_id":"MDQ6VXNlcjM3MzU2MjE=","avatar_url":"https://avatars3.githubusercontent.com/u/3735621?v=4","gravatar_id":"","url":"https://api.github.com/users/monishdeb","html_url":"https://github.com/monishdeb","followers_url":"https://api.github.com/users/monishdeb/followers","following_url":"https://api.github.com/users/monishdeb/following{/other_user}","gists_url":"https://api.github.com/users/monishdeb/gists{/gist_id}","starred_url":"https://api.github.com/users/monishdeb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monishdeb/subscriptions","organizations_url":"https://api.github.com/users/monishdeb/orgs","repos_url":"https://api.github.com/users/monishdeb/repos","events_url":"https://api.github.com/users/monishdeb/events{/privacy}","received_events_url":"https://api.github.com/users/monishdeb/received_events","type":"User","site_admin":false},"labels":[{"id":246037889,"node_id":"MDU6TGFiZWwyNDYwMzc4ODk=","url":"https://api.github.com/repos/civicrm/civicrm-core/labels/master","name":"master","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-11-16T19:22:25Z","updated_at":"2018-12-16T15:54:39Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/13114","html_url":"https://github.com/civicrm/civicrm-core/pull/13114","diff_url":"https://github.com/civicrm/civicrm-core/pull/13114.diff","patch_url":"https://github.com/civicrm/civicrm-core/pull/13114.patch"},"body":"Overview\r\n----------------------------------------\r\nSteps to replicate:\r\n1. Create new Financial Type Event Fees 2. \r\n2. At Administer > Financial Accounts, navigate to the Financial Account this creates also called Event Fees 2 and enter 4301 as the Accounting Code.\r\n3. Create an event with priceset with two fields, first with financial Type Event fees, second with FT of Event Fees 2. \r\n4. Register in event with payment of say $25 for first ticket (Event Fees) and $10 for second ticket (Event fees 2), total $35.\r\n5. Edit Event registration. Click Change selections. Change quantity for second field from 1 to 5, line item total of $50, contribution total of $75, total paid $35. Save. Balance is $40. \r\n6. Click Record Payment and pay the balance.\r\n\r\nBefore\r\n----------------------------------------\r\nAt Contributions > Accounting Batches > Open Batches, select the batch just created and export as csv, open and view the resulting transactions: [Financial_Transactions_3_20180807210702](https://lab.civicrm.org/dev/financial/uploads/0cccae0ceba1707701f9cf699f52a3e3/Financial_Transactions_3_20180807210702.csv)\r\n\r\nAfter\r\n----------------------------------------\r\n[Financial_Transactions_3_20181119192008.csv](https://lab.civicrm.org/dev/financial/uploads/d2d17944c0224b1bc3dff5a1880b3f21/Financial_Transactions_3_20181119192008.csv)\r\n\r\n**RESULT**: If you compare both the CSV results, each file show same number of records in which first two records represent the financial entries for respective tickets ($25 and $10), third entry is the financial entry created to indicate the outstanding balance of $40 and is payable (i.e. is_payment = FALSE). For the last two entries the amount differ whereas now after the fix $40 is being assigned to Ticket2 (as qty is changed from 1 to 5, thus amount $10 is changed to $50) and $0 to Ticket 1 unlike earlier where amount is proportionally distributed to two tickets on basis of total contribution amount, instead of financial item's amount\r\n\r\nTechnical Details\r\n----------------------------------------\r\nI have changed the algorithm to do allocation on basis of financial_item.amount. Ensured that proportional allocation of financial items, in case of partial payment is not changed and we already have existing UTs for this.\r\n    In addition I have made changes in various unit test which does not follow the standard approach to change amount of a existing contribution (in order to calculate proportional amount allocation to different line-items). \r\n\r\nComments\r\n----------------------------------------\r\nping @JoeMurray @kcristiano @pradpnayak @eileenmcnaughton @mattwire \r\n"},"comment":{"url":"https://api.github.com/repos/civicrm/civicrm-core/issues/comments/447653857","html_url":"https://github.com/civicrm/civicrm-core/pull/13114#issuecomment-447653857","issue_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/13114","id":447653857,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NzY1Mzg1Nw==","user":{"login":"kcristiano","id":1892544,"node_id":"MDQ6VXNlcjE4OTI1NDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1892544?v=4","gravatar_id":"","url":"https://api.github.com/users/kcristiano","html_url":"https://github.com/kcristiano","followers_url":"https://api.github.com/users/kcristiano/followers","following_url":"https://api.github.com/users/kcristiano/following{/other_user}","gists_url":"https://api.github.com/users/kcristiano/gists{/gist_id}","starred_url":"https://api.github.com/users/kcristiano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcristiano/subscriptions","organizations_url":"https://api.github.com/users/kcristiano/orgs","repos_url":"https://api.github.com/users/kcristiano/repos","events_url":"https://api.github.com/users/kcristiano/events{/privacy}","received_events_url":"https://api.github.com/users/kcristiano/received_events","type":"User","site_admin":false},"created_at":"2018-12-16T15:54:39Z","updated_at":"2018-12-16T15:54:39Z","author_association":"CONTRIBUTOR","body":"The difference I can see is that I am changing the options (Price set line items) by selecting/deselecting and not changing quantities.\r\n\r\nI can provide a copy of the database(s) I am suing to test.   Ping me if you want a download link."}}
{"actor":{"display_login":"kcristiano"}}