fixed a duplicate bug where the original asset would get trashed

This commit is contained in:
JT Smith 2007-01-26 04:50:33 +00:00
parent dc8cbd5fb2
commit f94791fed0

View file

@ -78,7 +78,8 @@ Assets that normally autocommit their workflows (like CS Posts, and Wiki Pages)
sub duplicate {
my $self = shift;
my $options = shift;
my $newAsset = $self->getParent->addChild($self->get, undef, undef, {skipAutoCommitWorkflows=>$options->{skipAutoCommitWorkflows}});
my %assetProperties = %{$self->get()};
my $newAsset = $self->getParent->addChild(\%assetProperties, undef, undef, {skipAutoCommitWorkflows=>$options->{skipAutoCommitWorkflows}});
my $sth = $self->session->db->read("select * from metaData_values where assetId = ?", [$self->getId]);
while (my $h = $sth->hashRef) {
$self->session->db->write("insert into metaData_values (fieldId, assetId, value) values (?, ?, ?)", [$h->{fieldId}, $newAsset->getId, $h->{value}]);