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#4213 Make frontend_title, name required for Group entity #26546
Changes from all commits
9e5c06a
90a1101
8f31a8d
e3850c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
{* file to handle db changes in 5.65.alpha1 during upgrade *} | ||
|
||
-- Ensure new name field is not null/unique. Setting to ID is a bit lazy - but it works. | ||
UPDATE civicrm_group SET `name` = `id` WHERE name IS NULL; | ||
|
||
-- Add name field, make frontend_title required (in conjunction with php function) | ||
{if $multilingual} | ||
{foreach from=$locales item=locale} | ||
UPDATE `civicrm_group` | ||
SET `frontend_title_{$locale}` = `title_{$locale}` | ||
WHERE `frontend_title_{$locale}` IS NULL OR `frontend_title_{$locale}` = ''; | ||
|
||
UPDATE `civicrm_group` | ||
SET `frontend_description_{$locale}` = `description` | ||
WHERE `frontend_description_{$locale}` IS NULL OR `frontend_description_{$locale}` = '' AND `description` <> ''; | ||
{/foreach} | ||
{else} | ||
UPDATE `civicrm_group` | ||
SET `frontend_title` = `title` | ||
WHERE `frontend_title` IS NULL OR `frontend_title` = ''; | ||
|
||
UPDATE `civicrm_group` | ||
SET `frontend_description` = `description` | ||
WHERE `frontend_description` IS NULL OR `frontend_description` = '' AND description <> ''; | ||
{/if} | ||
|
||
UPDATE civicrm_mailing_component | ||
SET body_html = REPLACE(body_html, '{welcome.group}', '{group.frontend_title}'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't work because it tries to interpret these tokens as smarty. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR: #26871 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks @demeritcowboy |
||
body_text = REPLACE(body_text, '{welcome.group}', '{group.frontend_title}'), | ||
subject = REPLACE(subject, '{welcome.group}', '{group.frontend_title}') | ||
WHERE component_type = 'Welcome'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My eye just caught this now too. I think it's intended to be
(frontend_description_{$locale} IS NULL OR frontend_description_{$locale} = '') AND description <> ''
but it gets evaluated asfrontend_description_{$locale} IS NULL OR (frontend_description_{$locale} = '' AND description <> '')
. In mysql, unlike everything else, AND has a higher precedence than OR: https://dev.mysql.com/doc/refman/8.0/en/operator-precedence.htmlThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you fixed this too - thanks!