fix - Shortcut causes endless loop

This commit is contained in:
Roy Johnson 2006-10-04 15:10:40 +00:00
parent ff2344cdad
commit dba346de69
2 changed files with 4 additions and 1 deletions

View file

@ -12,6 +12,7 @@
- change: PM asset task editor now defaults start date to start of project
- Rearranged the autotag name creation to be easier to read.
- add: progressive (duration-tracked but untimed) tasks now possible in Project Manager
- fix: Shortcut causes endless loop
7.0.8
- Fixed a couple of minor bugs with the default values of the Request

View file

@ -144,8 +144,10 @@ sub paste {
my $self = shift;
my $assetId = shift;
my $pastedAsset = WebGUI::Asset->newByDynamicClass($self->session,$assetId);
return 0 unless ($self->get("state") eq "published");
return 0 unless ($self->get("state") eq "published");
if ($self->getId eq $pastedAsset->get("parentId") || $pastedAsset->setParent($self)) {
# Don't allow a shortcut to create an endless loop
return 0 if ($pastedAsset->get("className") eq "WebGUI::Asset::Shortcut" && $pastedAsset->get("shortcutToAssetId") eq $self->getId);
$pastedAsset->publish(['clipboard','clipboard-limbo']); # Paste only clipboard items
$pastedAsset->updateHistory("pasted to parent ".$self->getId);
return 1;