diff --git a/lib/WebGUI/AssetVersioning.pm b/lib/WebGUI/AssetVersioning.pm index 623a7eeca..dc19e2ef1 100644 --- a/lib/WebGUI/AssetVersioning.pm +++ b/lib/WebGUI/AssetVersioning.pm @@ -371,7 +371,7 @@ sub moveAssetToVersionTag { # my $moveToTagId = $moveToTag; if ( ref($moveToTag) eq "WebGUI::VersionTag" ) { - $moveToTagId = $moveToTag->get('tagId'); + $moveToTagId = $moveToTag->tagId; } else { $moveToTag = WebGUI::VersionTag->new( $self->session, $moveToTagId ); @@ -400,15 +400,15 @@ Requests an autocommit tag be commited. See also getAutoCommitWorkflowId() and s sub requestAutoCommit { my $self = shift; - my $parentAsset; - if ( not defined( $parentAsset = $self->getParent ) ) { - $parentAsset = WebGUI::Asset->newPending( $self->session, $self->get('parentId') ); + my $parentAsset = eval { $self->getParent; }; + if ( Exception::Class->caught() ) { + $parentAsset = WebGUI::Asset->newPending( $self->session, $self->parentId ); } unless ( $parentAsset->hasBeenCommitted ) { - my $tagId = $parentAsset->get('tagId'); + my $tagId = $parentAsset->tagId; if ($tagId) { - if ( $tagId ne $self->get('tagId') ) { + if ( $tagId ne $self->tagId ) { $self->moveAssetToVersionTag($tagId); return; } @@ -486,7 +486,7 @@ A new version tag id. sub setVersionTag { my $self = 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->updateHistory("changed version tag to $tagId"); $self->purgeCache; diff --git a/t/Asset/Asset.t b/t/Asset/Asset.t index f85f155f1..e66a0ded3 100644 --- a/t/Asset/Asset.t +++ b/t/Asset/Asset.t @@ -666,8 +666,8 @@ $properties2 = { url => 'moveVersionToParent_03', }; -my $childAsset = $parentAsset->addChild($properties, $properties2->{id}); -my $testAsset = WebGUI::Asset->newPending($session, $childAsset->parentId); +my $childAsset = $parentAsset->addChild($properties, $properties2->{id}); +my $testAsset = WebGUI::Asset->newPending($session, $childAsset->parentId); my $testVersionTag = WebGUI::VersionTag->new($session, $testAsset->tagId); my $childVersionTag;