fix - Deleted assets reappear upon paste of parent
This commit is contained in:
parent
fa89e57bb6
commit
37c7f002ac
3 changed files with 17 additions and 5 deletions
|
|
@ -23,6 +23,7 @@
|
||||||
over from scratch.
|
over from scratch.
|
||||||
- fix: Very very bad commerce bug that caused ITransact to charge the user more
|
- fix: Very very bad commerce bug that caused ITransact to charge the user more
|
||||||
than it was supposed to and more than it told them it was charging.
|
than it was supposed to and more than it told them it was charging.
|
||||||
|
- fix: Deleted assets reappear upon paste of parent
|
||||||
|
|
||||||
|
|
||||||
6.99.4
|
6.99.4
|
||||||
|
|
|
||||||
|
|
@ -1641,17 +1641,28 @@ sub processTemplate {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 publish ( )
|
=head2 publish ( arrayref )
|
||||||
|
|
||||||
Sets an asset and it's descendants to a state of 'published' regardless of it's current state.
|
Sets an asset and it's descendants to a state of 'published' regardless of it's current state by default.
|
||||||
|
Otherwise sets state to published only for assests matching one of the states passed in.
|
||||||
|
|
||||||
|
=head3 arrayref
|
||||||
|
|
||||||
|
[ 'clipboard', 'clipboard-limbo', 'trash', 'trash-limbo', 'published' ]
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub publish {
|
sub publish {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $assetIds = $self->session->db->buildArrayRef("select assetId from asset where lineage like ".$self->session->db->quote($self->get("lineage").'%'));
|
my $statesToPublish = shift;
|
||||||
|
|
||||||
|
my $stateList = $self->session->db->quoteAndJoin($statesToPublish);
|
||||||
|
my $where = "and state in (".$stateList.")" if $statesToPublish;
|
||||||
|
|
||||||
|
my $assetIds = $self->session->db->buildArrayRef("select assetId from asset where lineage like ".$self->session->db->quote($self->get("lineage").'%')." $where");
|
||||||
my $idList = $self->session->db->quoteAndJoin($assetIds);
|
my $idList = $self->session->db->quoteAndJoin($assetIds);
|
||||||
$self->session->db->write("update asset set state='published', stateChangedBy=".$self->session->db->quote($self->session->user->userId).", stateChanged=".$self->session->datetime->time()." where assetId in (".$idList.")");
|
|
||||||
|
$self->session->db->write("update asset set state='published', stateChangedBy=".$self->session->db->quote($self->session->user->userId).", stateChanged=".$self->session->datetime->time()." where assetId in (".$idList.")");
|
||||||
my $cache = WebGUI::Cache->new($self->session);
|
my $cache = WebGUI::Cache->new($self->session);
|
||||||
foreach my $id (@{$assetIds}) {
|
foreach my $id (@{$assetIds}) {
|
||||||
# we do the purge directly cuz it's a lot faster than instantiating all these assets
|
# we do the purge directly cuz it's a lot faster than instantiating all these assets
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ sub paste {
|
||||||
my $pastedAsset = WebGUI::Asset->newByDynamicClass($self->session,$assetId);
|
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)) {
|
if ($self->getId eq $pastedAsset->get("parentId") || $pastedAsset->setParent($self)) {
|
||||||
$pastedAsset->publish;
|
$pastedAsset->publish(['published']); # Paste only published assets
|
||||||
$pastedAsset->updateHistory("pasted to parent ".$self->getId);
|
$pastedAsset->updateHistory("pasted to parent ".$self->getId);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue