From 28fd67e02734d1d3b93d655dd56f4fdbbd7a56a3 Mon Sep 17 00:00:00 2001 From: Matthew Wilson Date: Sat, 3 Dec 2005 14:28:40 +0000 Subject: [PATCH] adding shortcut overrides conversion. --- docs/upgrades/upgrade_6.7.8-6.8.0.pl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/upgrades/upgrade_6.7.8-6.8.0.pl b/docs/upgrades/upgrade_6.7.8-6.8.0.pl index aca6c15ae..57014da03 100644 --- a/docs/upgrades/upgrade_6.7.8-6.8.0.pl +++ b/docs/upgrades/upgrade_6.7.8-6.8.0.pl @@ -149,7 +149,7 @@ sub addDashboardStuff { WebGUI::SQL->write("CREATE TABLE `wgFieldUserData` ( `assetId` VARCHAR(22) BINARY NOT NULL DEFAULT '', `userId` VARCHAR(22) BINARY NOT NULL DEFAULT '', - `userValue` TEXT DEFAULT '', + `userValue` TEXT, PRIMARY KEY(`assetId`, `userId`) )"); @@ -761,10 +761,29 @@ my $newAsset = $folder->addChild({ isHidden=>1 }, 'MultiSearchTmpl0000001'); $newAsset->commit; +print "\tConverting Shortcut overrides.\n" unless ($quiet); +my $a = WebGUI::SQL->read("select assetId from asset where className='WebGUI::Asset::Shortcut'"); +my @overrides; +while (my ($assetId) = $a->array) { + my $sc = WebGUI::Asset->newByDynamicClass($assetId); + push(@overrides,{assetId=>$sc->getId,fieldName=>'title',newValue=>$sc->get("title")}) if $sc->get("overrideTitle"); + if ($sc->get("overrideTemplate")) { + my $fieldName = ref $sc->getShortcutOriginal eq 'WebGUI::Asset::Wobject::Collaboration' ? 'collaborationTemplateId' : 'templateId'; + push(@overrides,{assetId=>$sc->getId,fieldName=>$fieldName,newValue=>$sc->get("overrideTemplateId")}); + } + push(@overrides,{assetId=>$sc->getId,fieldName=>'displayTitle',newValue=>$sc->get("displayTitle")}) if $sc->get("overrideDisplayTitle"); + push(@overrides,{assetId=>$sc->getId,fieldName=>'description',newValue=>$sc->get("description")}) if $sc->get("overrideDescription"); +} +$a->finish; +foreach my $hash (@overrides) { + WebGUI::SQL->write("insert into Shortcut_overrides values (".quote($hash->{assetId}).",".quote($hash->{fieldName}).",".quote($hash->{newValue}).")"); +} + } #------------------------------------------------- sub fixVeryLateDates { + print "\tFixing very late endDates.\n" unless ($quiet); WebGUI::SQL->write("update assetdata set endDate='2082783600' where endDate>=4294967294"); }