fixed #10544: Child assets under uncommitted parents

This commit is contained in:
Doug Bell 2009-10-02 01:03:34 -05:00
parent 8f7d01691d
commit 5c03cfbfbe
4 changed files with 65 additions and 38 deletions

View file

@ -85,7 +85,8 @@ sub addChild {
$properties->{assetId} = $id;
$properties->{parentId} = $self->getId;
my $temp = WebGUI::Asset->newByPropertyHashRef($self->session,$properties) || croak "Couldn't create a new $properties->{className} asset!";
$temp->{_parent} = $self;
# Do not set the parent here, since it could be stale and poison the child
#$temp->{_parent} = $self;
my $newAsset = $temp->addRevision($properties, $now, $options);
$self->updateHistory("added child ".$id);
$self->session->http->setStatus(201,"Asset Creation Successful");

View file

@ -101,7 +101,16 @@ sub addRevision {
} );
}
else {
$workingTag = WebGUI::VersionTag->getWorking($self->session);
my $parentAsset;
if ( not defined( $parentAsset = $self->getParent ) ) {
$parentAsset = WebGUI::Asset->newPending( $self->session, $self->get('parentId') );
}
if ( $parentAsset->hasBeenCommitted ) {
$workingTag = WebGUI::VersionTag->getWorking( $self->session );
}
else {
$workingTag = WebGUI::VersionTag->new( $self->session, $parentAsset->get('tagId') );
}
}
#Create a dummy revision to be updated with real data later