-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
[REF] Add in upgrade step to populate missing contact_type.name field #17570
[REF] Add in upgrade step to populate missing contact_type.name field #17570
Conversation
(Standard links)
|
$contactTypes = \Civi\Api4\ContactType::get() | ||
->setCheckPermissions(FALSE) | ||
->execute(); | ||
foreach ($contactTypes as $contactTypes) { |
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.
Shouldn't that be ($contactTypes as $contactType)
? And also $contactType (no 's') in the following lines for id and label?
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.
thanks Fixed now
0268753
to
e5f1ba9
Compare
if (empty($contactType['name'])) { | ||
\Civi\Api4\ContactType::update() | ||
->addWhere('id', '=', $contactType['id']) | ||
->addValue('name', ucfirst(CRM_Utils_String::munge($contactTypes['label']))) |
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.
$contactType['label']
not $contactTypes['label']
e5f1ba9
to
471e466
Compare
Should we also update any blank 'is_reserved' and 'is_active' since those defaults were also set in #17548 ? |
471e466
to
d638f47
Compare
Hopefully done now @aydun |
d638f47
to
257383b
Compare
Looks good to me @seamuslee001 ! |
Make changes to the other columns
257383b
to
faf0012
Compare
Thanks @seamuslee001 and @aydun |
Hi all just a side note here: I worry that adding |
It was a follow up to a refactor but that is probably fair comment |
Overview
As picked up by @aydun there was no fixing up of hte current name column data when it was missing as requested by @totten in https://github.com/civicrm/civicrm-core/pull/17548/files
Before
No populating of the name column if empty
After
Upgrade script with test
ping @eileenmcnaughton