From 7c312eca53d19e8a810b940e40b5738e1b44222b Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 2 Sep 2013 12:57:40 -0700 Subject: [PATCH] CRM-13187 - CRM_Upgrade_Incremental_php_FourFour - Match 675605a ---------------------------------------- * CRM-13187: hrui: Change breadcrumb from "CiviCRM" to "CiviHR" http://issues.civicrm.org/jira/browse/CRM-13187 --- CRM/Upgrade/Incremental/php/FourFour.php | 44 ++++++++++++++---------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/CRM/Upgrade/Incremental/php/FourFour.php b/CRM/Upgrade/Incremental/php/FourFour.php index 1d412112d9..df30f2d264 100644 --- a/CRM/Upgrade/Incremental/php/FourFour.php +++ b/CRM/Upgrade/Incremental/php/FourFour.php @@ -213,16 +213,18 @@ WHERE source_contact_id IS NOT NULL"; */ static function wordReplacements(CRM_Queue_TaskContext $ctx) { $query = " -CREATE TABLE IF NOT EXISTS civicrm_word_replacement ( - id int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Word replacement ID', - find_word varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Word which need to be replaced', - replace_word varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Word which will replace the word in find', - is_active tinyint(4) DEFAULT NULL COMMENT 'Is this entry active?', - domain_id int(10) unsigned DEFAULT NULL COMMENT 'FK to Domain ID. This is for Domain specific word replacement', - PRIMARY KEY (id), - UNIQUE KEY UI_find (find_word), - KEY FK_civicrm_word_replacement_domain_id (domain_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4"; +CREATE TABLE IF NOT EXISTS `civicrm_word_replacement` ( + `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Word replacement ID', + `find_word` varchar(255) COMMENT 'Word which need to be replaced', + `replace_word` varchar(255) COMMENT 'Word which will replace the word in find', + `is_active` tinyint COMMENT 'Is this entry active?', + `match_type` enum('wildcardMatch', 'exactMatch') DEFAULT 'wildcardMatch', + `domain_id` int unsigned COMMENT 'FK to Domain ID. This is for Domain specific word replacement', + PRIMARY KEY ( `id` ), + UNIQUE INDEX `UI_find`(find_word), + CONSTRAINT FK_civicrm_word_replacement_domain_id FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain`(`id`) +) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ; + "; $dao = CRM_Core_DAO::executeQuery($query); self::rebuildWordReplacementTable(); @@ -286,22 +288,26 @@ CREATE TABLE IF NOT EXISTS civicrm_word_replacement ( if (!empty($result["values"])) { foreach ($result["values"] as $value) { $params = array(); - $params["is_active"] = TRUE; $params["domain_id"] = $value["id"]; $params["options"] = array('wp-rebuild' => $rebuildEach); // unserialize word match string $localeCustomArray = unserialize($value["locale_custom_strings"]); if (!empty($localeCustomArray)) { $wordMatchArray = array(); + // Traverse Language array foreach ($localeCustomArray as $localCustomData) { - $wordMatchArray = $localCustomData["enabled"]["wildcardMatch"]; - } - - if (!empty($wordMatchArray)) { - foreach ($wordMatchArray as $word => $replace) { - $params["find_word"] = $word; - $params["replace_word"] = $replace; - $wordReplacementCreateParams[] = $params; + // Traverse status array "enabled" "disabled" + foreach ($localCustomData as $status => $matchTypes) { + $params["is_active"] = ($status == "enabled")?TRUE:FALSE; + // Traverse Match Type array "wildcardMatch" "exactMatch" + foreach ($matchTypes as $matchType => $words) { + $params["match_type"] = $matchType; + foreach ($words as $word => $replace) { + $params["find_word"] = $word; + $params["replace_word"] = $replace; + $wordReplacementCreateParams[] = $params; + } + } } } } -- 2.25.1