Fix requestAutoCommit. All tests in t/Asset/Asset.t passing.

This commit is contained in:
Colin Kuskie 2010-01-22 15:10:23 -08:00
parent e5affbd0c2
commit 451eb33f0f
2 changed files with 9 additions and 9 deletions

View file

@ -371,7 +371,7 @@ sub moveAssetToVersionTag {
# #
my $moveToTagId = $moveToTag; my $moveToTagId = $moveToTag;
if ( ref($moveToTag) eq "WebGUI::VersionTag" ) { if ( ref($moveToTag) eq "WebGUI::VersionTag" ) {
$moveToTagId = $moveToTag->get('tagId'); $moveToTagId = $moveToTag->tagId;
} }
else { else {
$moveToTag = WebGUI::VersionTag->new( $self->session, $moveToTagId ); $moveToTag = WebGUI::VersionTag->new( $self->session, $moveToTagId );
@ -400,15 +400,15 @@ Requests an autocommit tag be commited. See also getAutoCommitWorkflowId() and s
sub requestAutoCommit { sub requestAutoCommit {
my $self = shift; my $self = shift;
my $parentAsset; my $parentAsset = eval { $self->getParent; };
if ( not defined( $parentAsset = $self->getParent ) ) { if ( Exception::Class->caught() ) {
$parentAsset = WebGUI::Asset->newPending( $self->session, $self->get('parentId') ); $parentAsset = WebGUI::Asset->newPending( $self->session, $self->parentId );
} }
unless ( $parentAsset->hasBeenCommitted ) { unless ( $parentAsset->hasBeenCommitted ) {
my $tagId = $parentAsset->get('tagId'); my $tagId = $parentAsset->tagId;
if ($tagId) { if ($tagId) {
if ( $tagId ne $self->get('tagId') ) { if ( $tagId ne $self->tagId ) {
$self->moveAssetToVersionTag($tagId); $self->moveAssetToVersionTag($tagId);
return; return;
} }
@ -486,7 +486,7 @@ A new version tag id.
sub setVersionTag { sub setVersionTag {
my $self = shift; my $self = shift;
my $tagId = shift; my $tagId = shift;
$self->session->db->write("update assetData set tagId=? where assetId=? and tagId = ?", [$tagId, $self->getId,$self->get('tagId')]); $self->session->db->write("update assetData set tagId=? where assetId=? and tagId = ?", [$tagId, $self->getId,$self->tagId]);
$self->tagId($tagId); $self->tagId($tagId);
$self->updateHistory("changed version tag to $tagId"); $self->updateHistory("changed version tag to $tagId");
$self->purgeCache; $self->purgeCache;