From 97338ffefe97ade72e60490b15bc7583e30ebf84 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 18 Jan 2010 14:59:34 -0800 Subject: [PATCH] When duplicating a CS with now children, clear out the replies and threads. When duplicating with children, recalculate them again, since duplicating clears them. Fixes bug #11347. Note, the lastPostId and lastPostDate are cleared, and gone. There is no way to recover it after duplicating the branch since the creationDates and revisionDates are reset when duplicating. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/Collaboration.pm | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 28b4bfd0b..0e10adf00 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -10,6 +10,7 @@ - fixed #11351: Double submits on ITransact checkout - fixed #11353: shop - sales - error - fixed #11355: Duplicate template error + - fixed #11347: copy forum 7.8.9 - fixed #11235: wiki search diff --git a/lib/WebGUI/Asset/Wobject/Collaboration.pm b/lib/WebGUI/Asset/Wobject/Collaboration.pm index afb2e985a..d4c0a7763 100644 --- a/lib/WebGUI/Asset/Wobject/Collaboration.pm +++ b/lib/WebGUI/Asset/Wobject/Collaboration.pm @@ -932,7 +932,8 @@ sub definition { =head2 duplicate -Extend the base method to handle making a subscription group for the new CS. +Extend the base method to handle making a subscription group for the new CS, and +to build a new Cron job. It also recalculates the number of threads and replies. =cut @@ -949,8 +950,24 @@ sub duplicate { parameters=>$self->getId, workflowId=>"csworkflow000000000001" }); - $self->update({getMailCronId=>$newCron->getId}); - return $newAsset; + $newAsset->update({getMailCronId=>$newCron->getId}); + $newAsset->incrementReplies('',''); + return $newAsset; +} + +#------------------------------------------------------------------- + +=head2 duplicateBranch. + +Extend the base method to recalculate the number of threads and replies. + +=cut + +sub duplicateBranch { + my $self = shift; + my $newAsset = $self->next::method(@_); + $newAsset->incrementReplies('',''); + return $newAsset; } #-------------------------------------------------------------------