From 3f45819b49c1c796b36c6677be6be032240ad366 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 22 Sep 2006 18:09:08 +0000 Subject: [PATCH] fixed a bug that would only happen when you tried to deploy a package that contained collaboration systems with posts --- docs/changelog/7.x.x.txt | 4 ++++ lib/WebGUI/VersionTag.pm | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index c24c63612..e8b08960f 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -11,6 +11,10 @@ - fix: search functionality throwing fatal errors - fix: DBI connect errors infinitely recurse - add: setting cookieTTL to "session" now creates browser-session cookies + - Added a reverse option for the getAssets method in VersionTag. + - Fixed a bug that would occur when deploying a package that contained a + collaboration system with posts. + 7.0.7 - rfe: Image Management (funded by Formation Design Systems) diff --git a/lib/WebGUI/VersionTag.pm b/lib/WebGUI/VersionTag.pm index c8bfb89bf..a7ed42d30 100644 --- a/lib/WebGUI/VersionTag.pm +++ b/lib/WebGUI/VersionTag.pm @@ -92,7 +92,7 @@ Commits all assets edited under a version tag, and then sets the version tag to sub commit { my $self = shift; - foreach my $asset (@{$self->getAssets}) { + foreach my $asset (@{$self->getAssets({"reverse"=>1})}) { $asset->commit; } $self->{_data}{isCommitted} = 1; @@ -133,16 +133,26 @@ sub getAssetCount { #------------------------------------------------------------------- -=head2 getAssets ( ) +=head2 getAssets ( [options] ) Returns a list of asset objects that are part of this version tag. +=head3 options + +A hash reference containing options to change the output. + +=head4 reverse + +A boolean that will reverse the order of the assets. The default is to return the assets in descending order. + =cut sub getAssets { my $self = shift; + my $options = shift; my @assets = (); - my $sth = $self->session->db->read("select asset.assetId,asset.className,assetData.revisionDate from assetData left join asset on asset.assetId=assetData.assetId where assetData.tagId=? order by revisionDate desc", [$self->getId]); + my $direction = $options->{reverse} ? "asc" : "desc"; + my $sth = $self->session->db->read("select asset.assetId,asset.className,assetData.revisionDate from assetData left join asset on asset.assetId=assetData.assetId where assetData.tagId=? order by revisionDate ".$direction, [$self->getId]); while (my ($id,$class,$version) = $sth->array) { push(@assets, WebGUI::Asset->new($self->session,$id,$class,$version)); }