static function continueWorkflow($workflowProcessID) { $operationResult = null; $theProcess = eZWorkflowProcess::fetch($workflowProcessID); if ($theProcess != null) { //restore memento and run it $bodyMemento = eZOperationMemento::fetchChild($theProcess->attribute('memento_key')); if ($bodyMemento === null) { eZDebug::writeError($bodyMemento, "Empty body memento in workflow.php"); return $operationResult; } $bodyMementoData = $bodyMemento->data(); $mainMemento = $bodyMemento->attribute('main_memento'); if (!$mainMemento) { return $operationResult; } $mementoData = $bodyMemento->data(); $mainMementoData = $mainMemento->data(); $mementoData['main_memento'] = $mainMemento; $mementoData['skip_trigger'] = false; $mementoData['memento_key'] = $theProcess->attribute('memento_key'); $bodyMemento->remove(); $operationParameters = array(); if (isset($mementoData['parameters'])) { $operationParameters = $mementoData['parameters']; } $operationResult = eZOperationHandler::execute($mementoData['module_name'], $mementoData['operation_name'], $operationParameters, $mementoData); } return $operationResult; }
<?php /** * @copyright Copyright (C) eZ Systems AS. All rights reserved. * @license For full copyright and license information view LICENSE file distributed with this source code. * @version //autogentag// * @package kernel */ $Module = $Params['Module']; $WorkflowProcessID = null; if (!isset($Params["WorkflowProcessID"])) { $Module->redirectTo($Module->functionURI("list")); return; } $WorkflowProcessID = $Params["WorkflowProcessID"]; $process = eZWorkflowProcess::fetch($WorkflowProcessID); if ($process === null) { $Module->redirectTo($Module->functionURI("list")); return; } $http = eZHTTPTool::instance(); if ($http->hasPostVariable("Reset")) { $process->reset(); $process->setAttribute("modified", time()); $process->store(); } // Template handling $tpl = eZTemplate::factory(); $workflow = eZWorkflow::fetch($process->attribute("workflow_id")); $workflowEvent = false; if ($process->attribute("event_id") != 0) {
#include_once( 'kernel/classes/ezcontentobjectversion.php' ); $contentObjectVersion = $approveStatus->attribute('object_version'); $contentObjectVersion->setAttribute('status', eZContentObjectVersion::STATUS_PENDING); $contentObjectVersion->sync(); $approveStatus->setAttribute('approve_status', eZXApproveStatus::StatusInApproval); $approveStatus->store(); $workflowProcess = $approveStatus->attribute('workflow_process'); if (!$workflowProcess) { $approveStatus->remove(); return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'); } $workflowProcess->setAttribute('status', eZWorkflow::STATUS_DEFERRED_TO_CRON); $workflowProcess->setAttribute('modified', time()); $parameterList = $workflowProcess->attribute('parameter_list'); if (isset($parameterList['parent_process_id'])) { $parentProcess = eZWorkflowProcess::fetch($parameterList['parent_process_id']); if (is_object($parentProcess)) { $parentProcess->setAttribute('status', eZWorkflow::STATUS_DEFERRED_TO_CRON); $parentProcess->setAttribute('modified', time()); $parentProcess->store(); } } $workflowProcess->store(); $approveINI = eZINI::instance('ezapprove2.ini'); if ($approveINI->variable('ApproveSettings', 'ObjectLockOnEdit') == 'true') { // Lock all related objects for editing and removal $object = $approveStatus->attribute('contentobject'); // #HACK# if ($object->attribute('contentclass_id') == 17) { foreach ($object->relatedContentObjectList($approveStatus->attribute('active_version'), false, false) as $relatedObject) { $relatedObject->setAttribute('flags', $relatedObject->attribute('flags') | EZ_CONTENT_OBJECT_FLAG_LOCK_EDIT | EZ_CONTENT_OBJECT_FLAG_LOCK_REMOVE);
function approve2Event() { #include_once( 'kernel/classes/ezworkflowprocess.php' ); $workflowProcess = eZWorkflowProcess::fetch($this->attribute('workflowprocess_id'), false); $retVal = false; if (!$workflowProcess) { return $retVal; } #include_once( eZExtension::baseDirectory() . '/ezapprove2/eventtypes/event/ezxapprove2/ezxapprove2type.php' ); $retVal = eZApprove2Event::fetch($workflowProcess['event_id']); return $retVal; }