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: Fix email invoices not sending #41172

Merged
merged 4 commits into from
Jan 20, 2025

Conversation

gogdzl
Copy link
Contributor

@gogdzl gogdzl commented Jan 19, 2025

Fixes https://github.com/Automattic/zero-bs-crm/issues/3523

Proposed changes:

  • This PR fixes a bug introduced in 6.5.0 where invoice emails are prevented from being sent.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

https://github.com/Automattic/zero-bs-crm/issues/3523

Does this pull request change what data or activity we track or use?

No.

Testing instructions:

  • Create an invoice
  • Assign invoice to contact with a valid email address
  • Try sending invoice via email and see the error

image

This PR should fix the error.

@gogdzl gogdzl added [Status] Needs Team Review [Plugin] CRM Issues about the Jetpack CRM plugin labels Jan 19, 2025
@gogdzl gogdzl added this to the crm/6.5.1 milestone Jan 19, 2025
@gogdzl gogdzl self-assigned this Jan 19, 2025
Copy link
Contributor

github-actions bot commented Jan 19, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Jan 19, 2025
@gogdzl gogdzl added [Type] Bug When a feature is broken and / or not performing as intended and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Jan 19, 2025
@mikestottuk
Copy link
Contributor

👋 Hi Diego

Another way to do this is in https://github.com/Automattic/jetpack/blob/trunk/projects/plugins/crm/js/ZeroBSCRM.admin.invoicebuilder.js#L2094

Grab the invoice ID like this
const invID = window.zbs_invoice.invoiceObj.id;

and use it later instead of window.invoice_id

@mikestottuk mikestottuk self-requested a review January 19, 2025 10:21
@gogdzl
Copy link
Contributor Author

gogdzl commented Jan 19, 2025

👋 Hi Diego

Another way to do this is in https://github.com/Automattic/jetpack/blob/trunk/projects/plugins/crm/js/ZeroBSCRM.admin.invoicebuilder.js#L2094

Grab the invoice ID like this
const invID = window.zbs_invoice.invoiceObj.id;

and use it later instead of window.invoice_id

I've kept the original structure to avoid any undesired side effects. I think it's good enough for a quick fix, and then we can restructure it, right?

@mikestottuk
Copy link
Contributor

mikestottuk commented Jan 20, 2025

I've kept the original structure to avoid any undesired side effects. I think it's good enough for a quick fix, and then we can restructure it, right?

Ok, makes sense and this tests OK. I also tested other email sends

  • send a quote works
  • send an invoice statement works
  • send an email from the CRM contact record works

@gogdzl gogdzl merged commit 873bdac into trunk Jan 20, 2025
57 checks passed
@gogdzl gogdzl deleted the fix/crm/3523-email-invoices-not-sending branch January 20, 2025 09:50
Copy link
Contributor

@tbradsha tbradsha left a comment

Choose a reason for hiding this comment

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

Looks good to me!

coder-karen pushed a commit that referenced this pull request Jan 24, 2025
* Make the var invoice_id global

* Add changelog

* Initialize global var invoice_id

* Update invoice_id param to use global var
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] CRM Issues about the Jetpack CRM plugin [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants