fix - Couple Calendar bugs
This commit is contained in:
parent
9d315264c6
commit
426ffce9e3
2 changed files with 68 additions and 29 deletions
|
|
@ -45,6 +45,10 @@
|
||||||
gotchas.txt for details.
|
gotchas.txt for details.
|
||||||
- fix: AssetExportHtml now handles periods in URLs more gracefully.
|
- fix: AssetExportHtml now handles periods in URLs more gracefully.
|
||||||
- fix: Calendar Event Details template now uses nice dateSpan variable
|
- fix: Calendar Event Details template now uses nice dateSpan variable
|
||||||
|
- fix: Calendar Recurring Event Duplication (when the original event
|
||||||
|
occurs on a day that ALSO has a recurrence of that event).
|
||||||
|
- fix: Calendar Event Edit erroneously apply time zone changes to all day
|
||||||
|
events.
|
||||||
|
|
||||||
7.3.8
|
7.3.8
|
||||||
- Fixed a template variable rewriting problem with HTML::Template::Expr
|
- Fixed a template variable rewriting problem with HTML::Template::Expr
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,9 @@ there is an error creating the recurrence pattern.
|
||||||
If not given recurrence data, will use the event's existing recurrence. This is
|
If not given recurrence data, will use the event's existing recurrence. This is
|
||||||
used for generating future occurrences of events that don't end.
|
used for generating future occurrences of events that don't end.
|
||||||
|
|
||||||
|
Returns the new recurrence pattern's ID, or undef if failure. (NOTE: This
|
||||||
|
should probably use croak instead)
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub generateRecurringEvents {
|
sub generateRecurringEvents {
|
||||||
|
|
@ -173,19 +176,19 @@ sub generateRecurringEvents {
|
||||||
my $recur = shift;
|
my $recur = shift;
|
||||||
my $parent = $self->getParent;
|
my $parent = $self->getParent;
|
||||||
my $session = $self->session;
|
my $session = $self->session;
|
||||||
my $id;
|
my $recurId;
|
||||||
|
|
||||||
if ($recur) {
|
if ($recur) {
|
||||||
$id = $self->setRecurrence($recur);
|
$recurId = $self->setRecurrence($recur);
|
||||||
return () unless $id;
|
return () unless $recurId;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$id = $self->get("recurId");
|
$recurId = $self->get("recurId");
|
||||||
$recur = {$self->getRecurrence};
|
$recur = {$self->getRecurrence};
|
||||||
}
|
}
|
||||||
|
|
||||||
my $properties = {%{$self->get}};
|
my $properties = {%{$self->get}};
|
||||||
$properties->{recurId} = $id;
|
$properties->{recurId} = $recurId;
|
||||||
|
|
||||||
# Get the distance between the event startDate and endDate
|
# Get the distance between the event startDate and endDate
|
||||||
# Only days, since event recurrence only changes the Date the event occurs, not
|
# Only days, since event recurrence only changes the Date the event occurs, not
|
||||||
|
|
@ -220,7 +223,7 @@ sub generateRecurringEvents {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return $recurId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1446,11 +1449,14 @@ sub processPropertiesFromFormPost {
|
||||||
# Pattern keys
|
# Pattern keys
|
||||||
if (nfreeze(\%recurrence_new) ne nfreeze(\%recurrence_old)) {
|
if (nfreeze(\%recurrence_new) ne nfreeze(\%recurrence_old)) {
|
||||||
# Delete all old events and create new ones
|
# Delete all old events and create new ones
|
||||||
my $old_id = $self->get("recurId");
|
my $old_id = $self->get("recurId");
|
||||||
|
|
||||||
return ["There's something wrong with your recurrence pattern."]
|
my $new_id = $self->generateRecurringEvents(\%recurrence_new);
|
||||||
unless $self->generateRecurringEvents(\%recurrence_new);
|
return ["There is something wrong with your recurrence pattern."]
|
||||||
|
unless $new_id;
|
||||||
|
|
||||||
|
## Update with the new recurId
|
||||||
|
$self->update({ recurId => $new_id });
|
||||||
|
|
||||||
## Delete old events
|
## Delete old events
|
||||||
my $events = $self->getLineage(["siblings"], {
|
my $events = $self->getLineage(["siblings"], {
|
||||||
|
|
@ -1662,6 +1668,7 @@ Edit the event.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
# Author's note: This sub is ugly and should be refactored according to PBP
|
||||||
sub www_edit
|
sub www_edit
|
||||||
{
|
{
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
@ -1743,28 +1750,56 @@ sub www_edit
|
||||||
});
|
});
|
||||||
|
|
||||||
# start date
|
# start date
|
||||||
my $default_start = WebGUI::DateTime->new($self->session, $session->form->param("start") || time)
|
my $default_start;
|
||||||
->set_time_zone($tz);
|
if ($session->form->param("start")) {
|
||||||
my ($startDate,$startTime) = split / /, $self->getDateTimeStart->toUserTimeZone
|
$default_start
|
||||||
unless $func eq "add" || $self->get("assetId") eq "new";
|
= WebGUI::DateTime->new($session, $session->form->param("start"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$default_start = WebGUI::DateTime->new($session, time);
|
||||||
|
}
|
||||||
|
|
||||||
$var->{"formStartDate"}= WebGUI::Form::date($session,
|
my ($startDate, $startTime);
|
||||||
{
|
if ($form->param("func") ne "add") {
|
||||||
name => "startDate",
|
my $dtStart = $self->getDateTimeStart;
|
||||||
value => $form->process("startDate") || $startDate,
|
if ($self->isAllDay) {
|
||||||
defaultValue => $default_start->toUserTimeZoneDate,
|
$startDate = $dtStart->toUserTimeZoneDate;
|
||||||
});
|
$startTime = $dtStart->toUserTimeZoneTime;
|
||||||
$var->{"formStartTime"} = WebGUI::Form::timeField($session,
|
}
|
||||||
{
|
else {
|
||||||
name => "startTime",
|
$startDate = $dtStart->toDatabaseDate;
|
||||||
value => $form->process("startTime") || $startTime,
|
}
|
||||||
defaultValue => $default_start->toUserTimeZoneTime,
|
}
|
||||||
});
|
|
||||||
|
$var->{"formStartDate"}
|
||||||
|
= WebGUI::Form::date($session, {
|
||||||
|
name => "startDate",
|
||||||
|
value => $form->process("startDate") || $startDate,
|
||||||
|
defaultValue => $default_start->toUserTimeZoneDate,
|
||||||
|
});
|
||||||
|
$var->{"formStartTime"}
|
||||||
|
= WebGUI::Form::timeField($session, {
|
||||||
|
name => "startTime",
|
||||||
|
value => $form->process("startTime") || $startTime,
|
||||||
|
defaultValue => $default_start->toUserTimeZoneTime,
|
||||||
|
});
|
||||||
|
|
||||||
# end date
|
# end date
|
||||||
|
# By default, it's the default start date plus an hour
|
||||||
$default_start->add(hours => 1);
|
$default_start->add(hours => 1);
|
||||||
my ($endDate,$endTime) = split / /, $self->getDateTimeEnd->toUserTimeZone
|
|
||||||
unless $func eq "add" || $self->get("assetId") eq "new";
|
my ($endDate, $endTime);
|
||||||
|
if ($form->process("func") ne "add") {
|
||||||
|
my $dtEnd = $self->getDateTimeEnd;
|
||||||
|
if ($self->isAllDay) {
|
||||||
|
$endDate = $dtEnd->toUserTimeZoneDate;
|
||||||
|
$endTime = $dtEnd->toUserTimeZoneTime;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$endDate = $dtEnd->toDatabaseDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$var->{"formEndDate"} = WebGUI::Form::date($session,
|
$var->{"formEndDate"} = WebGUI::Form::date($session,
|
||||||
{
|
{
|
||||||
name => "endDate",
|
name => "endDate",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue