Fetching template in a workflow event

Author Message

Hans Melis

Monday 12 January 2004 9:00:14 am

I've tried to fetch a template in a workflow event, but it doesn't seem to work. My code is nearly an exact replica of the ezwrapping event, only even more simple.


function execute( &$process, &$event )
    {
        include_once( 'lib/ezutils/classes/ezhttptool.php' );
		
		$http =& eZHTTPTool::instance();
		
		if( $http->hasPostVariable("Next") )
		{
			return EZ_WORKFLOW_TYPE_STATUS_ACCEPTED;
		}
		
		$node =& eZContentObjectTreeNode::fetch(2);
		$requestUri = eZSys::requestUri();
		$process->Template = array( 'templateName' => 'design:workflow/eventtype/result/event_eztemplate.tpl',
									'templateVars' => array( 'score' => 6,
															 'request_uri' => $requestUri ));
		return EZ_WORKFLOW_TYPE_STATUS_FETCH_TEMPLATE_REPEAT;
    }

There are no errors in the debug. The workflow seems to end (running the cronjob doesn't help either), but the original contentobject is still in "My pending list". The template is fine, I've cleared the cache and all.

This looks like a bug, but the ezwrapping event is quite old so maybe the code has changed. Anyone got any ideas how to get this to work?

--
Hans

Hans
http://blog.hansmelis.be

Willie Seabrook

Wednesday 14 January 2004 9:01:50 pm

Hi Hans,

The fetch template feature in workflows is broken. You will find that the event is actually executing if you also write to a log for example. In fact you should check this point first.

Second to that I have a fix for fetching templates. However, its gotten a bit messy: I'm now on ezpublish 3.3 except for the entire folder of /kernel/content which contains all files from 3.1 or 3.2 I think along with my modified edit.php. This is because when I upgraded I couldn't get it to work with only replacing edit.php. Email me willie dot seabrook at levity dot co dot nz if your interested. I warn you of its hackyness though ;-)

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.