From 2ea269607d4c320226c9843a9dc79532087ac9b9 Mon Sep 17 00:00:00 2001 From: Mathieu Lu Date: Sat, 30 Sep 2023 18:01:45 -0400 Subject: [PATCH] Upgrade: rename the Draft/Sent Mailing menu labels --- .../Incremental/php/FiveSixtySeven.php | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/CRM/Upgrade/Incremental/php/FiveSixtySeven.php b/CRM/Upgrade/Incremental/php/FiveSixtySeven.php index a620d3b41b..cb7ebc5d9b 100644 --- a/CRM/Upgrade/Incremental/php/FiveSixtySeven.php +++ b/CRM/Upgrade/Incremental/php/FiveSixtySeven.php @@ -56,7 +56,29 @@ class CRM_Upgrade_Incremental_php_FiveSixtySeven extends CRM_Upgrade_Incremental $this->addTask('Add cache_fill_took column to Group table', 'addColumn', 'civicrm_group', 'cache_fill_took', 'DOUBLE DEFAULT NULL COMMENT "Seconds taken to fill smart group cache, not always related to cache_date"', FALSE); - $this->addTask('Update civicrm_mailing_event_queue to permit deleting records from civicrm_mailing_job', 'updateMailingEventQueueTable', 'updateMailingEventQueueTable'); + $this->addTask('Update civicrm_mailing_event_queue to permit deleting records from civicrm_mailing_job', 'updateMailingEventQueueTable'); + $this->addTask('Update CiviMail menus labels', 'updateMailingMenuLabels'); + } + + /** + * Some time ago, the labels for Mailing menu items were simplified for new + * installs. Now that the old strings have been removed from Transifex, it + * breaks translations, so we force the update, but only if the label was not + * customized (if name=label). + */ + public static function updateMailingMenuLabels(CRM_Queue_TaskContext $ctx): bool { + $changes = [ + 'Draft and Unscheduled Mailings' => 'Draft Mailings', + 'Scheduled and Sent Mailings' => 'Sent Mailings', + ]; + foreach ($changes as $old => $new) { + CRM_Core_DAO::executeQuery('UPDATE civicrm_navigation SET label = %1 WHERE name = %2 AND label = %3', [ + 1 => [$new, 'String'], + 2 => [$old, 'String'], + 3 => [$old, 'String'], + ]); + } + return TRUE; } /** -- 2.25.1