From 870ea1a734884bf2a4d12203229b2fb7caaa311c Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 2 Jul 2020 01:13:52 +1200 Subject: [PATCH] Ensure pricefield value label column is not null on upgrade On testing locally I found I did have a null value in a field & this fatalled if I enabled multilingual --- CRM/Upgrade/Incremental/php/FiveTwentySeven.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CRM/Upgrade/Incremental/php/FiveTwentySeven.php b/CRM/Upgrade/Incremental/php/FiveTwentySeven.php index 5ee49a29ce..4ed67f51e6 100644 --- a/CRM/Upgrade/Incremental/php/FiveTwentySeven.php +++ b/CRM/Upgrade/Incremental/php/FiveTwentySeven.php @@ -74,10 +74,12 @@ class CRM_Upgrade_Incremental_php_FiveTwentySeven extends CRM_Upgrade_Incrementa if ($domain->locales) { $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales); foreach ($locales as $locale) { + CRM_Core_DAO::executeQuery("UPDATE civicrm_price_field_value SET label_{$locale} = '' WHERE label_{$locale} IS NULL", [], TRUE, NULL, FALSE, FALSE); CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_price_field_value CHANGE `label_{$locale}` `label_{$locale}` varchar(255) NOT NULL COMMENT 'Price field option label'", [], TRUE, NULL, FALSE, FALSE); } } else { + CRM_Core_DAO::executeQuery("UPDATE civicrm_price_field_value SET label = '' WHERE label IS NULL"); CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_price_field_value CHANGE `label` `label` varchar(255) NOT NULL COMMENT 'Price field option label'", [], TRUE, NULL, FALSE, FALSE); } return TRUE; @@ -89,10 +91,12 @@ class CRM_Upgrade_Incremental_php_FiveTwentySeven extends CRM_Upgrade_Incrementa if ($domain->locales) { $locales = explode(CRM_Core_DAO::VALUE_SEPARATOR, $domain->locales); foreach ($locales as $locale) { + CRM_Core_DAO::executeQuery("UPDATE civicrm_membership_type SET name_{$locale} = '' WHERE name_{$locale} IS NULL", [], TRUE, NULL, FALSE, FALSE); CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_membership_type CHANGE `name_{$locale}` `name_{$locale}` varchar(128) NOT NULL COMMENT 'Name of Membership Type'", [], TRUE, NULL, FALSE, FALSE); } } else { + CRM_Core_DAO::executeQuery("UPDATE civicrm_membership_type SET name = '' WHERE name IS NULL"); CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_membership_type CHANGE `name` `name` varchar(128) NOT NULL COMMENT 'Name of Membership Type'", [], TRUE, NULL, FALSE, FALSE); } return TRUE; -- 2.25.1