fix: Events are created with no group information

This commit is contained in:
Doug Bell 2007-02-16 19:37:39 +00:00
parent 11b308df81
commit 6c8e840fe6
3 changed files with 43 additions and 1 deletions

View file

@ -13,6 +13,7 @@
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.
- fix: Events are created with no group information.
7.3.9
- fix: SQL Form and big table imports

View file

@ -21,6 +21,7 @@ my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
fixEventGroups($session);
finish($session); # this line required
@ -32,7 +33,31 @@ finish($session); # this line required
# # and here's our code
#}
#----------------------------------------------------------------------------
sub fixEventGroups {
my $session = shift;
print "\tFixing Event groups for Events created since 7.3.0.....";
my $events = WebGUI::Asset->getRoot($session)->getLineage(['descendents'], {
statesToInclude => ['published','trash','clipboard','clipboard-limbo','trash-limbo'],
statusToInclude => ['pending','approved','deleted','archived'],
includeOnlyClasses => ['WebGUI::Asset::Event'],
returnObjects => 1,
whereClause => q{groupIdView = "" || groupIdEdit = "" || groupIdView IS NULL || groupIdEdit IS NULL},
});
for my $event (@$events) {
my $revisionProperties = $event->get;
$revisionProperties->{groupIdView} ||= $event->getParent->get("groupIdView");
$revisionProperties->{groupIdEdit} ||= $event->getParent->get("groupIdEventEdit")
|| $event->getParent->get("groupIdEdit");
$event->addRevision($revisionProperties, undef, {skipAutoCommitWorkflows=>1});
}
print "\tOK\n";
}
# ---- DO NOT EDIT BELOW THIS LINE ----

View file

@ -1407,10 +1407,26 @@ sub processPropertiesFromFormPost {
}
### Form is verified
### Form is verified, fix properties
# Events are always hidden from navigation
$self->update({ isHidden => 1 });
# If there is no security information, grab it from the parent
if (!$self->get("groupIdView")) {
$self->update({
groupIdView => $self->getParent->get("groupIdView"),
});
}
if (!$self->get("groupIdEdit")) {
my $groupIdEdit = $self->getParent->get("groupIdEventEdit")
|| $self->getParent->get("groupIdEdit")
;
$self->update({
groupIdEdit => $groupIdEdit,
});
}
# Fix times according to input (allday, timezone)
if ($form->param("allday")) {
$self->update({