fixed a couple of bugs with the new autocommit functionality for cs posts and the like

This commit is contained in:
JT Smith 2006-12-07 00:17:54 +00:00
parent c55feb8bcd
commit 430583ef1c
9 changed files with 42 additions and 14 deletions

View file

@ -61,15 +61,24 @@ sub cut {
#-------------------------------------------------------------------
=head2 duplicate ( )
=head2 duplicate ( [ options ] )
Duplicates this asset, returning the new asset.
=head3 options
A hash reference of options that can modify how this method works.
=head4 skipAutoCommitWorkflows
Assets that normally autocommit their workflows (like CS Posts, and Wiki Pages) won't if this is true.
=cut
sub duplicate {
my $self = shift;
my $newAsset = $self->getParent->addChild($self->get);
my $options = shift;
my $newAsset = $self->getParent->addChild($self->get, 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}]);