dev/core#3871 Write-off feature for pledges - #36395
Conversation
|
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
PR commands & links...
|
|
The issue associated with the Pull Request can be viewed at https://lab.civicrm.org/dev/core/-/issues/3871 |
| 'status_id' => 'Completed', | ||
| ]); | ||
|
|
||
| $result = civicrm_api3('Activity', 'create', [ |
|
|
||
| //write off the pledge as completed by updating the status | ||
| //and the pledge amount | ||
| $result = civicrm_api3('Pledge', 'create', [ |
|
@colemanw done, thanks! |
|
/squash
|
❌ Command Execution FailedThe workflow failed to execute the command. Please check the action run logs for details. |
|
@colemanw I have added the generated data as well. Thanks! |
|
/squash |
f4fad57 to
6aa4bc7
Compare
|
I haven't tested this but from a code perspective it seems merge-ready. |
|
@colemanw thanks! |
|
Not a blocker, to avoid the hassle of another regen, however: I did a bit of testing on the sandbox and wasn't sure:
pledges.webmhttps://core-36395-7nhxqsa.civi.bid/civicrm/contact/view?reset=1&cid=32 |
| SELECT @max_wt := max(weight) from civicrm_option_value where option_group_id=@option_group_id_activity_type; | ||
| SELECT @pledgeCompId := id FROM `civicrm_component` where `name` like 'CiviPledge'; | ||
|
|
||
| INSERT INTO civicrm_option_value |
There was a problem hiding this comment.
This will insert duplicates if the upgrade step is run twice. You could do something like IF NOT EXISTS (SELECT ...), or can always do it in php.
| INSERT INTO civicrm_option_value | ||
| (option_group_id, {localize field='label'}label{/localize}, {localize field='description'}description{/localize}, value, name, weight, filter, component_id) | ||
| VALUES | ||
| (@option_group_id_activity_type, {localize}'{ts escape="sql"}Pledge write-off{/ts}'{/localize},{localize}''{/localize}, (SELECT @max_val := @max_val+1), 'Pledge write-off', (SELECT @max_wt := @max_wt+1), 0, @pledgeCompId); |
There was a problem hiding this comment.
Minor notes:
- Do some languages translate
''differently? I'm not sure it's needed to localize that. (SELECT @max_wt := @max_wt+1)isn't necessary, can just do@max_wt+1. If you were inserting a bunch in a row then you might want to increment it this way.
There was a problem hiding this comment.
Do some languages translate '' differently? I'm not sure it's needed to localize that
It would be simpler to not include description in the INSERT.
Overview
Write-off feature for pledges
https://lab.civicrm.org/dev/core/-/issues/3871
Functional specifications:
On a pledge, in Edit Scheduled Payment, we can delete a pledge payment. The total pledge amount is reduced by the amount of the scheduled payment and the balance due is recalculated.
But in this scenario, the pledge status is left as is.
We can also cancel a pledge. All scheduled payments are canceled but the pledge status is set to canceled and the pledge balance and the total pledge amount are not recalculated. So I propose a new feature for the write-off.