Fixed First event in the calendar not working right

This commit is contained in:
Martin Kamerbeek 2007-05-04 15:18:06 +00:00
parent 767b89c1c9
commit 1f0dd18f61
2 changed files with 18 additions and 14 deletions

View file

@ -1,3 +1,8 @@
7.3.17
- fix: First event in the calendar not working right (Martin Kamerbeek / Oqapi)
http://www.plainblack.com/bugs/tracker/first-event-in-the-calendar-not-working-right
7.3.16
- fix: Wiki titles not automatically linked
- fix: Search indexer on Windows not indexing content, opening associated

View file

@ -574,6 +574,7 @@ sub getEvent {
$self->session->errorHandler->warn("WebGUI::Asset::Wobject::Calendar->getEvent :: Event '$assetId' not a child of calendar '".$self->getId."'"), return
unless $event->get("parentId") eq $self->getId;
return $event;
}
@ -724,20 +725,18 @@ Gets the first event in this calendar. Returns the Event object.
=cut
sub getFirstEvent {
my $self = shift;
my $lineage = $self->get("lineage");
my ($assetId) = $self->session->db->quickArray(<<ENDSQL);
SELECT asset.assetId
FROM asset
JOIN Event ON asset.assetId = Event.assetId
WHERE lineage LIKE "$lineage\%"
AND className = "WebGUI::Asset::Event"
ORDER BY startDate ASC, startTime ASC, revisionDate DESC
LIMIT 1
ENDSQL
return $self->getEvent($assetId);
my $self = shift;
my $eventAsset = $self->getLineage(['children'], {
includeOnlyClasses => ['WebGUI::Asset::Event'],
joinClass => 'WebGUI::Asset::Event',
whereClause => 'Event.startDate >= date( now() )',
orderByClause => 'Event.startdate asc, Event.startTime asc, revisionDate desc',
limit => 1,
returnObjects => 1,
})->[0];
return $eventAsset;
}