fix: 7.2.3-7.3.0 upgrade now grabs the latest committed version of Events, instead of a random version

fix: 7.2.3-7.3.0 upgrade now does not modify the URL of the Calendars it migrates
This commit is contained in:
Doug Bell 2007-02-16 18:36:43 +00:00
parent efb0109465
commit 11b308df81
3 changed files with 44 additions and 8 deletions

View file

@ -9,6 +9,10 @@
- fix: Rich Text Editor - Add Asset Tree Link doesn't work with images
- fix: Calendar Next / Previous when startTime was involved (Jukka Raimovaara / Axxion Oy)
- fix: Creating users with same e-mail address doesn't work.
- fix: Problem with the 7.2.3-7.3.0 upgrade -- Upgrade now gets the last
committed revision of an Event, instead of a random revision.
- fix: Calendars created with the 7.2.3-7.3.0 upgrade now have the same URL as
the Events Calendars they replace.
7.3.9
- fix: SQL Form and big table imports

View file

@ -7,6 +7,17 @@ upgrading from one version to the next, or even between multiple
versions. Be sure to heed the warnings contained herein as they will
save you many hours of grief.
7.3.10
--------------------------------------------------------------------
* This version fixes a bug in the 7.2.3-7.3.0 upgrade where the
incorrect revision of an Event would be migrated.
If you have already upgraded, either restore from a backup or
go over your Calendars and ensure that your Event's informations
are accurate.
If you have not yet upgraded, you do not need to do anything.
7.3.9
--------------------------------------------------------------------
* This upgrade may appear to freeze when it gets to the "Adding

View file

@ -235,12 +235,11 @@ sub migrateCalendars {
$properties->{defaultDate} = delete $properties->{defaultMonth};
#warn "Found calendar ".$properties->{title};
$properties->{className} = "WebGUI::Asset::Wobject::Calendar";
# Add the new asset
my $newAsset = $asset->getParent->addChild($properties);
#warn "Added Calendar ".$newAsset->get("title")." ".$newAsset->get("className");
# Get this calendar's events and change to new parent
my $events = $asset->getLineage(['descendants'],
{
@ -251,14 +250,30 @@ sub migrateCalendars {
#warn "Got lineage";
for my $event (@{$events})
{
for my $event (@{$events}) {
#warn "Got event: $event";
# Add a child to the new calendar using the properties
# from EventsCalendar_event
my %eventProperties = $session->db->quickHash("select * from asset left join assetData on asset.assetId=assetData.assetId left join EventsCalendar_event on asset.assetId = EventsCalendar_event.assetId where asset.assetId = ?",[$event]);
my %eventProperties = $session->db->quickHash("
select
*
from
asset
left join
assetData on asset.assetId=assetData.assetId
left join
EventsCalendar_event on asset.assetId = EventsCalendar_event.assetId and assetData.revisionDate=EventsCalendar_event.revisionDate
where
asset.assetId = ?
and assetData.revisionDate=(
select
max(revisionDate)
from assetData
where assetData.assetId=asset.assetId
and (status='approved' or status='archived')
)
",[$event]);
delete $eventProperties{assetId};
my ($startDate, $startTime) = split / /, WebGUI::DateTime->new(delete $eventProperties{eventStartDate})->toMysql;
@ -283,9 +298,15 @@ sub migrateCalendars {
#warn "Set parents on events";
# Remove the old asset
# Save the old Calendar's URL so we can fix it
my $fixUrl = $asset->get("url");
# Remove the old asset
$asset->purge;
#warn "Purged old calendar";
# Fix the new Calendar's URL
$newAsset->update({ url => $fixUrl });
}
}