New workflow event causes workflow view crash

Author Message

Eirik Alfstad Johansen

Wednesday 14 January 2004 4:20:12 am

Hi,

Trying to create a new workflow event, I get the error "Page can not be displayed" (generated by IE) when I click the "New workflow" button in the workflowlist view of the workflow module, which I'm guessing is due to some error in the code syntax. Here's the content of the ezcreateaccounttype.php file:

<?php

include_once( 'kernel/classes/ezworkflowtype.php' );
include_once( "kernel/classes/ezorder.php" );

define( "EZ_WORKFLOW_TYPE_CREATEACCOUNT_ID", "ezcreateaccount" );

class eZCreateAccountType extends eZWorkflowEventType
{
/*!
Constructor
*/
function eZCreateAccountType()
{
$this->eZCreateAccountType( EZ_WORKFLOW_TYPE_CREATEACCOUNT_ID, "Create account" );
}

function execute( &$process, &$event )
{
// order fetch parameters
$offset = 0;
$limit = 1;
$sortField = 'created';
$sortOrder = 'asc';

// fetch most recent order in an array
$orderArray =& eZOrder::active( true, $offset, $limit, $sortField, $sortOrder );

// for each order id (only one)
foreach($orderArray as $k => $v) {
$order_id = $v['order_nr'];
}

// fetch order
$order = eZOrder::fetch($order_id);

// save data used by account creation process
$address = $order[account_information][address];

// email me the order address to make sure it's A-OK
mail('user@domain.com', 'Adressen er ' . $address, 'Body', 'From: user@domain.com');

return EZ_WORKFLOW_TYPE_STATUS_ACCEPTED;
}
}

eZWorkflowEventType::registerType( EZ_WORKFLOW_TYPE_CREATEACCOUNT_ID, "ezcreateaccounttype" );

?>

And here's the content of the workflow.ini.append.php file:

[EventSettings]
ExtensionDirectories[]=createaccount
AvailableEventTypes[]=event_ezcreateaccount

Any idea what I could be doing wrong?

Thanks in advance !

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Balazs Halasy

Wednesday 14 January 2004 4:25:35 am

Did you check that this only happens when you add the actual extension that contains the new event? If so then there is definetively something wrong with your code.. try to cut it down to the bare minimum and work (add more and more logic) towards the goal. Having too many lines within a new event is not a good idea cause it is hard to see if it actually works or not.

Balazs

Eirik Alfstad Johansen

Wednesday 14 January 2004 6:03:29 am

OK, I've stripped it down to the bare basics, and still the page isn't displayed. Here's the code again.

include_once( 'kernel/classes/ezworkflowtype.php' );

define( "EZ_WORKFLOW_TYPE_CREATEACCOUNT_ID", "ezcreateaccount" );

class eZCreateAccountType extends eZWorkflowEventType
{
/*!
Constructor
*/
function eZCreateAccountType()
{
$this->eZCreateAccountType( EZ_WORKFLOW_TYPE_CREATEACCOUNT_ID, "Create account" );
}

function execute( &$process, &$event )
{
return EZ_WORKFLOW_TYPE_STATUS_ACCEPTED;
}
}

eZWorkflowEventType::registerType( EZ_WORKFLOW_TYPE_CREATEACCOUNT_ID, "ezcreateaccounttype" );

Am I missing something very basic, here?

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Eirik Alfstad Johansen

Wednesday 14 January 2004 6:07:12 am

Never mind, I located the bug. I was trying to do

$this->eZCreateAccountType

in the constructor when what I should've done was

$this->eZWorkflowEventType

Thanks anyways !

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

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 04:28:09
Script start
Timing: Jan 19 2025 04:28:09
Module start 'layout'
Timing: Jan 19 2025 04:28:09
Module start 'content'
Timing: Jan 19 2025 04:28:10
Module end 'content'
Timing: Jan 19 2025 04:28:10
Script end

Main resources:

Total runtime1.0027 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 589.2891152.6406
Module start 'layout' 0.00590.0027 741.929739.4766
Module start 'content' 0.00860.9927 781.4063570.0625
Module end 'content' 1.00130.0014 1,351.468816.1250
Script end 1.0027  1,367.5938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3280160.0002
Check MTime0.00130.1295160.0001
Mysql Total
Database connection0.00070.073210.0007
Mysqli_queries0.924592.1971600.0154
Looping result0.00060.0646580.0000
Template Total0.967896.520.4839
Template load0.00250.245620.0012
Template processing0.965396.265820.4826
Template load and register function0.00010.010210.0001
states
state_id_array0.00120.116310.0012
state_identifier_array0.00090.092020.0005
Override
Cache load0.00210.2071930.0000
Sytem overhead
Fetch class attribute can translate value0.00050.053620.0003
Fetch class attribute name0.00130.124760.0002
XML
Image XML parsing0.00090.093220.0005
class_abstraction
Instantiating content class attribute0.00000.002280.0000
General
dbfile0.00260.2550220.0001
String conversion0.00000.001540.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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs