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

dev/core#4213 Make frontend_title, name required for Group entity #26546

Merged
merged 4 commits into from Jul 14, 2023

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

dev/core#4213 Make frontend_title, name required for Group entity

This follows up on having done this for contribution_page recently.

It will mean we can consistently refer to frontend_title in tokens and other places where what we really mean is ... frontend_title.

Before

frontend_title, name & title optional at db level, frontend_title optional at form level, title required (name is calculated)

After

Now required at db level, frontend_title required at form level

Technical Details

I'll hit all the same problems as #26259

Comments

@civibot
Copy link

civibot bot commented Jun 16, 2023

(Standard links)

@eileenmcnaughton
Copy link
Contributor Author

Fails are because we need to call the parent writeRecord function

@eileenmcnaughton eileenmcnaughton force-pushed the frontend_group branch 3 times, most recently from 75f450a to 03ba6fa Compare June 24, 2023 03:28
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Jun 24, 2023
This also removes a bunch of tests that are redundant due to
the various other levels of api & entity testing & does other
minor cleanup like fixing expected & actual variables to be in the right order

A cause of test fails for
civicrm#26546
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Jun 24, 2023
This also removes a bunch of tests that are redundant due to
the various other levels of api & entity testing & does other
minor cleanup like fixing expected & actual variables to be in the right order

A cause of test fails for
civicrm#26546
eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this pull request Jun 24, 2023
This also removes a bunch of tests that are redundant due to
the various other levels of api & entity testing & does other
minor cleanup like fixing expected & actual variables to be in the right order

A cause of test fails for
civicrm#26546
@eileenmcnaughton eileenmcnaughton force-pushed the frontend_group branch 2 times, most recently from 19261bd to 7f3c28b Compare June 24, 2023 21:05
mattwire pushed a commit to mattwire/civicrm-core that referenced this pull request Jun 25, 2023
This also removes a bunch of tests that are redundant due to
the various other levels of api & entity testing & does other
minor cleanup like fixing expected & actual variables to be in the right order

A cause of test fails for
civicrm#26546
@eileenmcnaughton eileenmcnaughton force-pushed the frontend_group branch 2 times, most recently from b302870 to 9aeb31f Compare June 26, 2023 06:17
@eileenmcnaughton eileenmcnaughton changed the title [wip] dev/core#4213 Make frontend_title, name required for Group entity dev/core#4213 Make frontend_title, name required for Group entity Jun 30, 2023
@colemanw
Copy link
Member

colemanw commented Jul 4, 2023

@eileenmcnaughton I see this is passing! Is it ready to be merged in your opinion?

@eileenmcnaughton
Copy link
Contributor Author

@colemanw yeah I think so - I'm on the fence about merging it now though because it another day we will cut a new rc - which means on one hand I'd have to re-do the upgrade but on the other it would get more time to find any issues

@seamuslee001
Copy link
Contributor

@eileenmcnaughton are you able to move the upgrade step now that we have cut the new RC?

UPDATE `civicrm_group`
SET `frontend_title_{$locale}` = `title_{$locale}`,
`frontend_description_{$locale}` = `description`
WHERE `frontend_description_{$locale}` IS NULL OR `frontend_description_{$locale}` = '';
Copy link
Contributor

Choose a reason for hiding this comment

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

@eileenmcnaughton doesn't this need to be 2 separate queries to handle where frontend_description is NULL or an empty string

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seamuslee001 I don't think so - or rather I'm not following why it would

@eileenmcnaughton eileenmcnaughton force-pushed the frontend_group branch 3 times, most recently from 5a762f2 to f5778c8 Compare July 9, 2023 23:11
UPDATE `civicrm_group`
SET `frontend_title_{$locale}` = `title_{$locale}`,
`frontend_description_{$locale}` = `description`
WHERE `frontend_description_{$locale}` IS NULL OR `frontend_description_{$locale}` = '';
Copy link
Contributor

Choose a reason for hiding this comment

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

@eileenmcnaughton my only thought is that it should be like below where we have 2 separate queries in case frontend_description is NOT NULL i.e. what if for some reason some one had set the frontend_description but not the frontend_title this SQL wouldn't run also why don't you have the same where clause as in L21 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah got it - I pushed the change up

@@ -33,9 +33,14 @@ public function upgrade_5_64_alpha1($rev): void {
$this->addTask('Drop unused civicrm_action_mapping table', 'dropTable', 'civicrm_action_mapping');
$this->addTask('Update post_URL/cancel_URL in logging tables', 'updateLogging');
$this->addTask('Add in Everybody ACL Role option value', 'addEveryBodyAclOptionValue');
$this->addTask('Fix double json encoding of accepted_credit_cards field in payment processor table', 'fixDoubleEscapingPaymentProcessorCreditCards');
Copy link
Contributor

Choose a reason for hiding this comment

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

@eileenmcnaughton this should be kept iirc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

argh

@eileenmcnaughton eileenmcnaughton force-pushed the frontend_group branch 4 times, most recently from d8478be to ab799d6 Compare July 13, 2023 22:03
This follows up on having done this for contribution_page recently.

It will mean we can consistently refer to frontend_title in tokens
and other places where what we really mean is ... frontend_title.
It now uses tokens not the now-deprecated function
@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 it passed!!!!!

@seamuslee001
Copy link
Contributor

ok this looks good to me lets merge and we can review

@seamuslee001 seamuslee001 merged commit 798b1c1 into civicrm:master Jul 14, 2023
3 checks passed
@seamuslee001 seamuslee001 deleted the frontend_group branch July 14, 2023 00:07
@eileenmcnaughton
Copy link
Contributor Author

phew - got there

{/if}

UPDATE civicrm_mailing_component
SET body_html = REPLACE(body_html, '{welcome.group}', '{group.frontend_title}'),
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

PR: #26871

Copy link
Contributor Author

Choose a reason for hiding this comment

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


UPDATE `civicrm_group`
SET `frontend_description_{$locale}` = `description`
WHERE `frontend_description_{$locale}` IS NULL OR `frontend_description_{$locale}` = '' AND `description` <> '';
Copy link
Contributor

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 as frontend_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.html

Copy link
Contributor Author

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!

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