While #3079700: saved_segment_id attribute should be optional when a campaign has segment options opens the path to not be forced to use 'saved_segment_id', it is still not possible to save a campaign. This is because mailchimp_campaign_save_campaign() tries to compare $recipients->segment_opts->saved_segment_id before checking if it exist first.
Patch coming up.

The (partial) error.

Notice: Undefined property: stdClass::$saved_segment_id in mailchimp_campaign_save_campaign() (line 95 of modules/contrib/mailchimp/modules/mailchimp_campaign/mailchimp_campaign.module).

mailchimp_campaign_save_campaign(Array, Object, Object, '63457', NULL) (Line: 460)
Drupal\mailchimp_campaign\Form\MailchimpCampaignForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 112)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 591)
Drupal\Core\Form\FormBuilder->processForm('mailchimp_campaign_add_form', Array, Object) (Line: 320)

404: Resource Not Found - The requested resource could not be found.

CommentFileSizeAuthor
#3 mailchimp-3156283-3.patch972 bytesbrendanthinkshout

Comments

firfin created an issue. See original summary.

firfin’s picture

Issue summary: View changes
brendanthinkshout’s picture

StatusFileSize
new972 bytes

Took a crack at this. @firfin, am I understanding the problem correctly?

brendanthinkshout’s picture

Status: Active » Needs review
firfin’s picture

Code seems to make sense to me. Also applied cleanly. Also similar to whatI had in mind (although this solution is better than what I thought of). No problems so far, but as I am 'edging cases' and developing new features I am still hesitant to put this on RTBC till I have tested more.
Will get back to this later this week.

firfin’s picture

Status: Needs review » Reviewed & tested by the community

Took a bit longer than a week, but this is running fine for over a month on development and live installs.

brendanthinkshout’s picture

Assigned: firfin » brendanthinkshout
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.