diff --git a/lib/WebGUI/Asset/Event.pm b/lib/WebGUI/Asset/Event.pm index a7d9bb867..c8dcc0d65 100644 --- a/lib/WebGUI/Asset/Event.pm +++ b/lib/WebGUI/Asset/Event.pm @@ -230,7 +230,7 @@ sub generateRecurringEvents $properties->{endDate} = $dt->clone->add(days => $duration_days)->strftime('%F'); - $parent->addChild($properties)->requestCommit; + $parent->addChild($properties); } return 1; @@ -240,6 +240,23 @@ sub generateRecurringEvents +#################################################################### + +=head2 getAutoCommitWorkflowId + +Gets the WebGUI::VersionTag workflow to use to automatically commit Events. +By specifying this method, you activate this feature. + +=cut + +sub getAutoCommitWorkflowId { + my $self = shift; + return "pbworkflow000000000003"; +} + + + + #################################################################### @@ -1458,59 +1475,13 @@ sub processPropertiesFromFormPost $properties->{endDate} = $event->get("endDate"); $event->addRevision($self->get); - - # Request the commit - $event->requestCommit; } } } - - - $self->requestCommit; } -#################################################################### - -=head2 requestCommit - -Requests that this event (and all events with the same recurId) are committed -using the parent element's approval workflow. - -If the user is already working under a version tag, will remove the events from -the version tag and place them under a new version tag, then try to commit using -the parent element's approval workflow. - -=cut - -sub requestCommit -{ - my $self = shift; - my $currentTag = WebGUI::VersionTag->getWorking($self->session); - my $workflowId = "pbworkflow000000000003"; ###!!TODO: make a config value for this - - if ($currentTag->getAssetCount <= 1) - { - $currentTag->set({workflowId=>$workflowId}); - $currentTag->requestCommit; - } - else - { - my $newTag = WebGUI::VersionTag->create($self->session, - { - name => $self->getTitle." / ".$self->session->user->username, - workflowId => $workflowId, - }); - $self->session->db->write("update assetData set tagId=? where assetId=? and tagId=?",[$newTag->getId, $self->getId, $currentTag->getId]); - $self->purgeCache; - $newTag->requestCommit; - } -} - - - - #################################################################### @@ -1679,7 +1650,8 @@ sub www_edit my $tz = $session->user->profileField("timeZone"); my $func = lc $session->form->param("func"); my $var = {}; - + + return $self->session->privilege->noAccess() unless $self->getParent->canAddEvent(); if ($func eq "add" || $form->param("assetId") eq "new") { @@ -1803,22 +1775,7 @@ sub www_edit