} else { eZDebug::writeError( "Cannot fetch workflow with WorkfowID = " . $WorkflowID ); $Module->setExitStatus( eZModule::STATUS_FAILED ); return; } } } else { // if WorkflowID was not given then create new workflow $user = eZUser::currentUser(); $user_id = $user->attribute( "contentobject_id" ); $workflow = eZWorkflow::create( $user_id ); $workflowCount = eZWorkflow::fetchListCount(); ++$workflowCount; $workflow->setAttribute( "name", ezpI18n::tr( 'kernel/workflow/edit', "New Workflow" ) . "$workflowCount" ); $db = eZDB::instance(); $db->begin(); $workflow->store(); $WorkflowID = $workflow->attribute( "id" ); $WorkflowVersion = $workflow->attribute( "version" ); $ingroup = eZWorkflowGroupLink::create( $WorkflowID, $WorkflowVersion, $GroupID, $GroupName ); $ingroup->store(); $db->commit(); return $Module->redirectTo( $Module->functionURI( 'edit' ) . '/' . $WorkflowID . '/' . $GroupID ); } $http = eZHTTPTool::instance();