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 7.3.16
- fix: Wiki titles not automatically linked - fix: Wiki titles not automatically linked
- fix: Search indexer on Windows not indexing content, opening associated - 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 $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; unless $event->get("parentId") eq $self->getId;
return $event; return $event;
} }
@ -724,20 +725,18 @@ Gets the first event in this calendar. Returns the Event object.
=cut =cut
sub getFirstEvent { sub getFirstEvent {
my $self = shift; my $self = shift;
my $lineage = $self->get("lineage");
my $eventAsset = $self->getLineage(['children'], {
my ($assetId) = $self->session->db->quickArray(<<ENDSQL); includeOnlyClasses => ['WebGUI::Asset::Event'],
SELECT asset.assetId joinClass => 'WebGUI::Asset::Event',
FROM asset whereClause => 'Event.startDate >= date( now() )',
JOIN Event ON asset.assetId = Event.assetId orderByClause => 'Event.startdate asc, Event.startTime asc, revisionDate desc',
WHERE lineage LIKE "$lineage\%" limit => 1,
AND className = "WebGUI::Asset::Event" returnObjects => 1,
ORDER BY startDate ASC, startTime ASC, revisionDate DESC })->[0];
LIMIT 1
ENDSQL return $eventAsset;
return $self->getEvent($assetId);
} }