-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
dev/core#745 do not filter on 'on_hold' if it is an empty string #13754
Conversation
Although I couldn't replicate this apparently in groups created in an earlier version it could be. We only care about number (0 or 1) or arrays (from the select widget) so add an extra check
(Standard links)
|
test this please |
1 similar comment
test this please |
@eileenmcnaughton we've run into this issue on a few sites, happy to review – but I wonder if this needs a unit test? |
@agileware-fj yes ideally it does! I think if getting it into this week's release relies on me writing a unit test for it it won't happen though. We do sometimes loosen the test requirement when fixing rc regressions because we generally have people who neither created the bug or are affected by the bug dropping other things to try to ensure we get a good stable release. It's kinda the vaccine theory - we get herd immunity by pushing for tests overall so when we urgently need to get a regression fixed on a release that is about to be dropped or has already gone out we can hopefully get away with an unvaccinated fix (If I were fixing it on paid time or had not spent a lot of unpaid time trying to replicate this & other reported bugs already this week, or even if I had succeeded in replicating it I would have done a test, but in the end I just threw this in as 'might help someone, don't think it could hurt') |
test this please |
1 similar comment
test this please |
@agileware-fj can you clarify how this happens exactly - ie. what format the legacy groups are in as @seamuslee001 & I couldn't replicate it so it's kinda a blind fix - but I can see it's also somewhat important & the release is due out tomorrow |
@seamuslee001 the problem is that smart groups have been previously created with the on_hold field saved as part of the search criteria, it's not that the user has explicitly set the "on hold" value in the search criteria. Because the search form used to save the "on hold" value = empty string. Our fix in all cases has been to execute SQL to remove the on_hold from the saved search field criteria and then the smart group can be loaded again. These smart groups may have been created with CiviCRM 4.6, 4.7 or 5.x - in all cases the smart group was created many releases ago. Below is a copy of our internal FAQ for this issue. CiviCRM Error - civicrm_email.on_hold - Truncated incorrect DOUBLE value Solution Problem |
@eileenmcnaughton just a random thought, it might be useful to store the CiviCRM version in some metadata when a smart group is created. Could help in situations like this, possibly. |
@jusfreeman so my understanding is that 'on_hold";s:0:""' means Whereas 'on_hold";i:0' means so your sql might change the meaning of it Possibly we should cull empty keys in an upgrade script but I feel like 'not for 5.11' |
Lol - then we'd have to trawl through every version to figure out what format was when - but you are right it could add some useful debugging. |
@eileenmcnaughton from what I could tell, having no value in the on_hold field was actually equivalent to "is not on hold", although that may not have been the intention when the individual searches were built. Of course, use of serialised PHP meant that we couldn't do a quick fix in the database that just removed the value anyway. |
@agileware-fj & is it your read that this PR would alleviate the sympton without causing further harm for those with the original values |
@eileenmcnaughton Yes, that's what I'm reading. More specifically, I think this is probably the workaround that causes the least harm, as if the group was really trying to exclude on_hold emails it was almost definitely to work around that bug for mailings where the on_hold status wasn't being honoured. |
So just for formality
|
@agileware-fj @jusfreeman i'm happy to go with this however i just want to check i have only seen form values like this
or
or
What i am not understanding is how this is fixing the '' strings cases maybe there is some cleaning function later on |
@seamuslee001 - the first 2 above should result in no filter on on_hold being applied. The latter should render to on_hold IN (1) |
I'm going to merge this on the grounds its safe and an improvement based on Agileware's comments |
Overview
Fixes a regression on smart groups where an on-hold filter is added to some legacy groups
Before
Legacy groups in correctly filter for on-hold
After
Filter shouldn't happen
Technical Details
Although I couldn't find a way to create a group on an earlier version with the format that causes this; that doesn't mean there aren't systems with those groups.
We only care about number (0 or 1) or arrays (from the select widget)
so add an extra check before filtering
Comments
@scardinius this is slightly different to yours as I see it as a temporary hack & tried to make it look like one - can you check
https://lab.civicrm.org/dev/core/issues/745