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

Fix: Duplicated forms are assigned to the campaign of the original form #7712

Open
wants to merge 2 commits into
base: epic/campaigns
Choose a base branch
from

Conversation

kjohnson
Copy link
Member

@kjohnson kjohnson commented Feb 7, 2025

Resolves GIVE-2140

Description

This PR hooks into the give_form_duplicated action to assign the duplicated form to the campaign of the origional form.

Testing Instructions

From the Campaign details on the forms tab, duplicate a form in the list table.

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • Self Review of code and UX completed

@kjohnson kjohnson changed the base branch from develop to epic/campaigns February 7, 2025 15:09
@kjohnson kjohnson marked this pull request as ready for review February 7, 2025 15:18
@kjohnson kjohnson changed the title Fix: Duplicated forms are assigned to the campaign of the origional form Fix: Duplicated forms are assigned to the campaign of the original form Feb 7, 2025
Copy link
Contributor

@jonwaldstein jonwaldstein left a comment

Choose a reason for hiding this comment

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

It's working! just once small suggestion

$campaign = $this->campaignRepository->queryByFormId($originalFormID)->get();

try {
$this->campaignRepository->addCampaignForm($campaign, $duplicatedFormID, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since $campaign is nullable, I would recommend checking if it exists first to avoid the potential of a fatal error from the typed param of addCampaignForm
Screenshot 2025-02-07 at 3 02 38 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants