Skip to content

dev/core#6606 Default status Pending for new backoffice contributions#36065

Merged
mattwire merged 2 commits into
civicrm:masterfrom
magnolia61:fix/eventfees-pending-contribution-default
Jul 13, 2026
Merged

dev/core#6606 Default status Pending for new backoffice contributions#36065
mattwire merged 2 commits into
civicrm:masterfrom
magnolia61:fix/eventfees-pending-contribution-default

Conversation

@magnolia61

@magnolia61 magnolia61 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Overview

When creating a new contribution via the back-office — either by editing a participant registration and checking "Record Contribution", or by creating a contribution directly — the Payment Status field defaulted to Completed instead of Pending. Pending is the correct initial status according to the new philosophy on contributions and payments. See also: lab.civicrm.org issue #6606

Before

The Payment Status dropdown defaults to Completed when opening the participant edit form with "Record Contribution" checked (and no existing online pending contribution), or when opening the new contribution form. The administrator must manually switch to Pending before saving.

Payment Status: [Completed] ← incorrect default

After

The Payment Status dropdown defaults to Pending in both forms.

Payment Status: [Pending] ← correct default

Technical Details

The fix adds an else block in two places that explicitly sets contribution_status_id to Pending when no existing contribution status is present:

  • CRM/Event/Form/EventFees.php — participant edit back-office:
  • CRM/Contribute/Form/Contribution.php — back-office contribution form:

Without this, the browser selects the first rendered option. Because getPendingAndCompleteStatuses() happens to return Completed (id=1) before Pending (id=2), Completed was silently selected as default.

Comments

This is more in line with the philosophy of a contribution that is always pending and payments that are made towards it.

@civibot

civibot Bot commented Jun 24, 2026

Copy link
Copy Markdown

🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷

Introduction for new contributors...
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
PR commands & links...
  • /rebase <branch-name> will rebase your branch and change the base of the PR.
  • /squash will combine all commits (keeping only the first commit messsage).
  • /port <branch-name> will create a copy of this PR against a different branch.
  • /lintroll will automatically fix linting errors, amending commits as needed.
  • retest this please will rerun the tests and rebuild the demo site.
  • 📖 Review standards
  • 🗒️ Review template (brief or verbose)

➡️ Online demo of this PR 🔗

@civibot civibot Bot added the master label Jun 24, 2026
@magnolia61 magnolia61 changed the title NFC: Default contribution_status to Pending when recording back-offic… NFC: Default contribution_status Pending for new backoffice contribtions Jun 24, 2026
@magnolia61
magnolia61 force-pushed the fix/eventfees-pending-contribution-default branch from 998c81c to 53f6d54 Compare June 24, 2026 07:12
…e event contribution

When editing a participant registration in the back office and checking
"Record Contribution", the Payment Status field had no explicit default,
causing the browser to select the first option — Completed (id=1) — because
getPendingAndCompleteStatuses() orders Completed before Pending by numeric ID.

A newly recorded back-office contribution has not been received yet, so
Pending is the semantically correct default.
@magnolia61
magnolia61 force-pushed the fix/eventfees-pending-contribution-default branch from 53f6d54 to 29d9efe Compare June 24, 2026 07:14
@magnolia61 magnolia61 changed the title NFC: Default contribution_status Pending for new backoffice contribtions NFC: Default status Pending for new backoffice contribtions Jun 24, 2026
@magnolia61 magnolia61 changed the title NFC: Default status Pending for new backoffice contribtions NFC: Default status Pending for new backoffice contributions Jun 24, 2026
@mattwire

Copy link
Copy Markdown
Contributor

This is not the only place it defaults to completed on backoffice forms. I agree that it is better to default to pending.

@mattwire mattwire added the merge ready PR will be merged after a few days if there are no objections label Jun 24, 2026
@mattwire mattwire changed the title NFC: Default status Pending for new backoffice contributions Default status Pending for new backoffice contributions Jun 24, 2026
@mattwire mattwire removed the merge ready PR will be merged after a few days if there are no objections label Jun 24, 2026
…ibutions

When creating a new contribution via the back-office contribution form, the
Payment Status field had no explicit default, causing the browser to select
the first rendered option (Completed) because buildOptions() returns statuses
in numeric order and Completed has id=1.

A newly recorded back-office contribution has not been received yet, so
Pending is the semantically correct default.
@magnolia61 magnolia61 changed the title Default status Pending for new backoffice contributions dev/core#6606 Default status Pending for new backoffice contributions Jun 25, 2026
@mlutfy

mlutfy commented Jul 3, 2026

Copy link
Copy Markdown
Member

I agree this makes sense.

A common use-case would be for invoicing people. The payment must be pending, then send a payment link (or PDF). You have to remember to set to pending, otherwise you cannot edit and set it back to pending.

If they are entering contributions received by direct transfers, then worst case they later record a payment.

@mlutfy

mlutfy commented Jul 10, 2026

Copy link
Copy Markdown
Member

@mattwire I noticed you removed merge-ready, is it because you would like the other places to be changed as well? Do you know where they are?

For example:

  • New Event Registration? to be consistent, we should make it Pending by default here too
  • New Membership?

Fun fact: New Membership does not "record payment" by default, but New Event does. Separate topic, but I would be tempted to not "record payment" by default.

@mattwire

Copy link
Copy Markdown
Contributor

@mlutfy well @magnolia61 pushed another commit since. Yes I would like to see the other places updated but let's do that in a follow -up PR

@mattwire
mattwire merged commit 435e35d into civicrm:master Jul 13, 2026
1 check passed
@demeritcowboy

Copy link
Copy Markdown
Contributor

I've made some comments on the lab ticket.

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