Custom workflow event before publishing

Author Message

James Ranson

Thursday 19 October 2006 11:43:06 pm

I am attempting to develop an extension that contains a custom workflow event. The event should occur before publishing and prompt the user for some extra information.

The template appears as expected, but when I submit the form, I am brought back to the editing page. When the execute() function was written to return EZ_WORKFLOW_TYPE_STATUS_FETCH_TEMPLATE_RETURN, it was impossible to actually publish the entry, because it kept looping between the edit form and the event form.

It's probably just something simple, but I'm new to this and would appreciate some help. Thanks.

<?php

define("EZ_WORKFLOW_TYPE_CUSTOMPAY", "custompay");

class customPayType extends eZWorkflowEventType
{
        function customPayType()
        {
                $this->eZWorkflowEventType(EZ_WORKFLOW_TYPE_CUSTOMPAY, "Custom Payment Page");
        }
        function execute(&$process, &$event) 
        {
                $http =& eZHTTPTool::instance();
                if ($http->hasPostVariable("cc_type") && $http->hasPostVariable("cc_number"))
                {
                        return EZ_WORKFLOW_TYPE_STATUS_WORKFLOW_DONE;
                }
                $process->Template = array('templateName' => 'design:workflow/eventtype/result/event_custompay.tpl',
                                'templateVars' => array('request_uri' => eZSys::requestUri(),
                                                                                'event' => $event));
                return EZ_WORKFLOW_TYPE_STATUS_FETCH_TEMPLATE;
        }
}

eZWorkflowEventType::registerType(EZ_WORKFLOW_TYPE_CUSTOMPAY, "custompaytype");

?>

Template:

<form method="post">
<label>Credit Card Type: </label><input type="text" name="cc_type"/><br/>
<label>Credit Card Number: </label><input type="text" name="cc_number"/><br/>
<input type="submit" class="button">
</form>

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

eZ debug

Timing: Jan 19 2025 03:35:36
Script start
Timing: Jan 19 2025 03:35:36
Module start 'layout'
Timing: Jan 19 2025 03:35:36
Module start 'content'
Timing: Jan 19 2025 03:35:37
Module end 'content'
Timing: Jan 19 2025 03:35:37
Script end

Main resources:

Total runtime1.1697 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 589.2734152.6406
Module start 'layout' 0.00540.0039 741.914139.4766
Module start 'content' 0.00931.1590 781.3906408.4219
Module end 'content' 1.16840.0013 1,189.81258.1406
Script end 1.1697  1,197.9531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2948160.0002
Check MTime0.00150.1257160.0001
Mysql Total
Database connection0.00070.058710.0007
Mysqli_queries1.134696.9967460.0247
Looping result0.00050.0392440.0000
Template Total1.137997.320.5690
Template load0.00210.177120.0010
Template processing1.135897.101320.5679
Template load and register function0.00010.010010.0001
states
state_id_array0.00070.059710.0007
state_identifier_array0.00100.083720.0005
Override
Cache load0.00170.144790.0002
Sytem overhead
Fetch class attribute can translate value0.00120.104610.0012
Fetch class attribute name0.00050.044910.0005
XML
Image XML parsing0.00010.009210.0001
class_abstraction
Instantiating content class attribute0.00000.000210.0000
General
dbfile0.00060.0547100.0001
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 7
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs