Forums / Developer / New workflow event causes workflow view crash

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/

eZ debug

Timing: Jan 19 2025 00:59:59
Script start
Timing: Jan 19 2025 00:59:59
Module start 'content'
Timing: Jan 19 2025 01:00:00
Module end 'content'
Timing: Jan 19 2025 01:00:00
Script end

Main resources:

Total runtime0.7595 sec
Peak memory usage4,096.0000 KB
Database Queries197

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0067 589.0859180.8125
Module start 'content' 0.00670.6029 769.8984575.1563
Module end 'content' 0.60950.1499 1,345.0547336.7422
Script end 0.7594  1,681.7969 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.5285210.0002
Check MTime0.00140.1836210.0001
Mysql Total
Database connection0.00090.114510.0009
Mysqli_queries0.656086.37221970.0033
Looping result0.00230.29791950.0000
Template Total0.723895.320.3619
Template load0.00200.259320.0010
Template processing0.721995.046020.3609
Template load and register function0.00010.018110.0001
states
state_id_array0.00120.151710.0012
state_identifier_array0.00110.144820.0005
Override
Cache load0.00190.2503930.0000
Sytem overhead
Fetch class attribute can translate value0.00160.209530.0005
Fetch class attribute name0.00100.137660.0002
XML
Image XML parsing0.00190.245330.0006
class_abstraction
Instantiating content class attribute0.00000.002480.0000
General
dbfile0.00530.7027330.0002
String conversion0.00000.001030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs