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

Craft 4 → 5 Migrated Event fields uneditable on multi-site #342

Open
andypullen opened this issue Oct 25, 2024 · 11 comments
Open

Craft 4 → 5 Migrated Event fields uneditable on multi-site #342

andypullen opened this issue Oct 25, 2024 · 11 comments
Assignees
Labels
issue Something isn't working correctly

Comments

@andypullen
Copy link

We upgraded recently to Craft 5 and found that any fields with pre-existing content before the migration cannot be edited on events in calendars that are enabled only on secondary sites. When editing the fields, the notice at the bottom of the control panel shows that the event was updated, but its content never gets adjusted. I am able to edit content on an empty field, and then come back and edit just fine.

I'm not 100% I've got the exact issue pinned down, but I've tested the best I can. I hope the description helps enough to reproduce, if possible.

Steps to reproduce

  1. Start on Craft CMS 4 (though I'm not sure if this is related to the migration)
  2. Create multiple sites
  3. Add a calendar that is only enabled on each site (we have 4 sites and one calendar enabled for each site, and each calendar contains the same fields).
  4. Create some events on each calendar, populating fields with data
  5. Upgrade to Craft CMS 5, and then run the php craft calendar/events/fix-titles migration step
  6. Edit an event in one of the calendars on a site that is not the primary site, changing the contents of one of the populated fields — the field edits are not retained

Expected behavior
All fields should be editable in every scenario.

Craft & Plugin Info (please complete the following information):

  • Craft Version: 5.4.9
  • Calendar Version: 5.0.10
  • Calendar Edition: Pro
  • Fresh Install or Upgrade:

Additional context
Here are the scenarios I've found:

  • Editing a pre-populated or empty field on an event on the primary site works as expected.
  • Editing an empty field on an event on a non-primary site works as expected.
  • Editing a pre-populated field on a non-primary site results in the changes not being retained.
  • Adding content to an empty field on a non-primary site works as expected, and can be edited afterwards as expected.
@andypullen andypullen added the issue Something isn't working correctly label Oct 25, 2024
@danbrellis
Copy link

I think I'm running into a similar issue, though not on multisite.

I have 3 calendars, all use the same field "background" in their field layout. When I change and save the value in an event belonging to two of those calendars the event saves fine, but in one of them it doesn't save. I also get a notice that the event saved, but the change is not there.

I noticed if I change the handle for the calendar with the issue, it does save and the changes stick.

I also noticed that in the db table element_sites in the content column for an event in that calendar there are 2 items for that field, one with the correct uid and one for a uid belonging to the other calendar's copy of that field.

Some config from the database:

The relevant items from the elements_sites table's content column for the entry. This entry belongs to Calendar A and such it should only have content for 65819b05-7e9f-4919-9a69-b5f53ac321b3 (associated with Calendar A), not the 7cc6cee... which belongs to Calendar B.

{
  "65819b05-7e9f-4919-9a69-b5f53ac321b3": "<p>An agenda (with webinar information) will be posted below when available</p>",
  "7cc6cee3-40f5-4d27-9ea7-8c13316a3db6": "<p>An agenda (with webinar information) will be posted below when available</p>"
}
# Relevant element from the Calendar A config
dateAdded: '2024-11-23T04:24:45+00:00'
elementCondition: null
fieldUid: 67d5853e-9524-4f93-9d85-5a384d089370 # Background
handle: null
includeInCards: false
instructions: ''
label: Purpose
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 65819b05-7e9f-4919-9a69-b5f53ac321b3
userCondition: null
warning: null
width: 100
# Relevant element from the Calendar B config
dateAdded: '2024-11-23T04:24:47+00:00'
elementCondition: null
fieldUid: 67d5853e-9524-4f93-9d85-5a384d089370 # Background
handle: null
includeInCards: false
instructions: ''
label: Purpose
providesThumbs: false
required: false
tip: null
type: craft\fieldlayoutelements\CustomField
uid: 7cc6cee3-40f5-4d27-9ea7-8c13316a3db6
userCondition: null
warning: null
width: 100

@kjmartens
Copy link
Contributor

Sorry for the delay and the trouble you're experiencing, @andypullen and @danbrellis.

A developer will be checking into this shortly. 🙂

@seandelaney
Copy link
Contributor

seandelaney commented Dec 16, 2024

@andypullen

I'm trying to follow your reproduce steps. I want to make sure that I have same setup.

Create multiple sites

I've got an English and Dutch site

image

Add a calendar that is only enabled on each site (we have 4 sites and one calendar enabled for each site, and each calendar contains the same fields).

I've added a calendar called English and only enabled for English site
I've added another calendar called Dutch and only enabled for Dutch Site

image
image
image

Create some events on each calendar, populating fields with data

Okay

Upgrade to Craft CMS 5, and then run the php craft calendar/events/fix-titles migration step

Okay

Edit an event in one of the calendars on a site that is not the primary site, changing the contents of one of the populated
fields — the field edits are not retained

This is the part I'm not following.

I can edit the Dutch event. My English site is my primary site. But my Dutch event saves fine and I can see my changes saved when I go back to view it again.

image

@seandelaney
Copy link
Contributor

seandelaney commented Dec 16, 2024

My DB

image
image

@seandelaney
Copy link
Contributor

I was running the latest versions of Craft Calendar in both instances, CraftCMS 4 and then CraftCMS 5.

@andypullen
Copy link
Author

andypullen commented Dec 19, 2024

@seandelaney Sorry for the confusing description! It is still happening for us. The important piece is that the field must have been populated before the upgrade. Here is an example of it not working:

Screen.Shot.2024-12-19.at.14.09.33.mp4

If the field was blank before the upgrade from CraftCMS 4 → 5, its edits will be retained. I hope this helps!

@nku-multi-concept
Copy link

@seandelaney This happens to me as well, and on a single site. The fields are not getting saved when submitted, and there is no error message or anything. These are custom fields added into section.
2019-Vector-Summit---NACCHO.webm

@seandelaney
Copy link
Contributor

seandelaney commented Jan 6, 2025

Happy New Year @nku-multi-concept @danbrellis @andypullen !

Before we go any further, can all of you please update to the latest version of Calendar 5 and test saving again. Before Christmas we found a issue with saving fields.

Let me know how you get on?

@andypullen
Copy link
Author

Happy New Year!

It unfortunately still does not work for me. Let me know how else I can help!

@seandelaney
Copy link
Contributor

@andypullen

Can I get a copy of your Craft 4 DB before you upgraded to Craft 5 please? You can remove any sensitive/private info.

Email to [email protected]

@danbrellis
Copy link

@seandelaney - it seems some combination of merging fields, converting from redactor to ckeditor, and updating the calendar plugin as you suggested did the trick and this issue is resolved for me. Good luck to others and thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something isn't working correctly
Development

No branches or pull requests

5 participants