Index: branches/unlabeled/unlabeled-1.6.2/core/install/upgrades.php =================================================================== diff -u -r8154 -r8245 --- branches/unlabeled/unlabeled-1.6.2/core/install/upgrades.php (.../upgrades.php) (revision 8154) +++ branches/unlabeled/unlabeled-1.6.2/core/install/upgrades.php (.../upgrades.php) (revision 8245) @@ -41,6 +41,33 @@ } /** + * Moves ReplacementTags functionality from EmailMessage to Events table + * + * @param string $mode when called mode {before, after) + */ + function Upgrade_4_1_1($mode) + { + if ($mode == 'after') { + $sql = 'SELECT ReplacementTags, EventId + FROM '.TABLE_PREFIX.'EmailMessage + WHERE (ReplacementTags IS NOT NULL) AND (ReplacementTags <> "") AND (LanguageId = 1)'; + $replacement_tags = $this->Conn->GetCol($sql, 'EventId'); + + foreach ($replacement_tags as $event_id => $replacement_tag) { + $sql = 'UPDATE '.TABLE_PREFIX.'Events + SET ReplacementTags = '.$this->Conn->qstr($replacement_tag).' + WHERE EventId = '.$event_id; + $this->Conn->Query($sql); + } + + // drop moved field from source table + $sql = 'ALTER TABLE '.TABLE_PREFIX.'EmailMessage + DROP `ReplacementTags`'; + $this->Conn->Query($sql); + } + } + + /** * Callback function, that makes all ml fields of text type null with same default value * * @param string $prefix