diff --git a/docs/gotcha.txt b/docs/gotcha.txt index f147418d8..542b205b1 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -19,6 +19,12 @@ save you many hours of grief. will not display your questions for editing in Admin mode. You will need to put your questions loop inside of a section loop. See the default view template for an example. + + * If you have any SQL reports going against the asset table, note that + it has been split into two tables "asset" and "assetData" and + your SQL reports will need to change. + + 6.6.4 -------------------------------------------------------------------- * Please ensure you're running HTML::Template version 2.7, which diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index 0c75bd483..5d10a283e 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -180,7 +180,7 @@ sub getNextThread { unless (exists $self->{_next}) { my $sortBy = $self->getParent->getValue("sortBy"); my ($id, $class, $version) = WebGUI::SQL->quickHashRef(" - select asset.assetId,asset.className,assetData.revisionDate + select asset.assetId,asset.className,max(assetData.revisionDate) from Thread left join asset on asset.assetId=Thread.assetId left join assetData on assetData.assetId=Thread.assetId and assetData.revisionDate=Thread.revisionDate @@ -218,7 +218,7 @@ sub getPreviousThread { unless (exists $self->{_previous}) { my $sortBy = $self->getParent->getValue("sortBy"); my ($id, $class, $version) = WebGUI::SQL->quickHashRef(" - select asset.assetId,asset.className,assetData.revisionDate + select asset.assetId,asset.className,max(assetData.revisionDate) from Thread left join asset on asset.assetId=Thread.assetId left join assetData on assetData.assetId=Thread.assetId and assetData.revisionDate=Thread.revisionDate @@ -233,7 +233,7 @@ sub getPreviousThread { or (assetData.ownerUserId=".quote($session{user}{userId})." and assetData.ownerUserId<>'1') ) group by assetData.assetId - order by ".$sortBy." desc ",WebGUI::SQL->getSlave); + order by ".$sortBy." desc, assetData.revisionDate desc ",WebGUI::SQL->getSlave); $self->{_previous} = WebGUI::Asset::Post->new($id,$class,$version); delete $self->{_previous} unless ($self->{_previous}->{_properties}{className} =~ /Thread/); }; @@ -625,7 +625,7 @@ sub view { $var->{'unlock.url'} = $self->getUnlockUrl; my $p = WebGUI::Paginator->new($self->getUrl,$self->getParent->get("postsPerPage")); - my $sql = "select asset.assetId, asset.className, assetData.revisionDate from asset + my $sql = "select asset.assetId, asset.className, max(assetData.revisionDate) from asset left join assetData on assetData.assetId=asset.assetId left join Post on Post.assetId=assetData.assetId and assetData.revisionDate=Post.revisionDate where asset.lineage like ".quote($self->get("lineage").'%') diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index 7685f6e8e..dde6a7095 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -904,7 +904,7 @@ sub view { $constraints .= " or assetData.status='pending'"; } $constraints .= ")"; - my $sql = "select asset.assetId,asset.className,assetData.revisionDate + my $sql = "select asset.assetId,asset.className,max(assetData.revisionDate) from Thread left join asset on Thread.assetId=asset.assetId left join Post on Post.assetId=Thread.assetId and Thread.revisionDate = Post.revisionDate @@ -1031,7 +1031,7 @@ sub www_search { } # please note that the SQL generated here-in is not for the feint of heart, mind, or stomach # this is for trained professionals only and should not be attempted at home - my $sql = "select asset.assetId, asset.className, assetData.revisionDate + my $sql = "select asset.assetId, asset.className, max(assetData.revisionDate) from asset left join assetData on assetData.assetId=asset.assetId left join Thread on Thread.assetId=assetData.assetId and assetData.revisionDate = Thread.revisionDate @@ -1131,7 +1131,7 @@ sub www_viewRSS { $encUrl $encDescription ~; - my $sth = WebGUI::SQL->read("select * + my $sth = WebGUI::SQL->read("select asset.assetId, asset.className, max(assetData.revisionDate) from Thread left join asset on Thread.assetId=asset.assetId left join Post on Post.assetId=Thread.assetId and Thread.revisionDate=Post.revisionDate @@ -1143,8 +1143,8 @@ sub www_viewRSS { group by assetData.assetId order by ".$self->getValue("sortBy")." ".$self->getValue("sortOrder")); my $i = 1; - while (my $data = $sth->hashRef) { - my $post = WebGUI::Asset::Wobject::Collaboration->newByPropertyHashRef($data); + while (my ($id, $class, $version) = $sth->hashRef) { + my $post = WebGUI::Asset::Wobject::Collaboration->new($id, $class, $version); my $encUrl = _xml_encode(WebGUI::URL::getSiteURL().$post->getUrl); my $encTitle = _xml_encode($post->get("title"));