Forums / Developer / Problems with my own workflow

Problems with my own workflow

Author Message

Tore Skobba

Friday 10 December 2004 6:37:46 am

Hi

I am trying to write my first workflow for EZ. But I find it very difficult, firstly because there is no real way of debuging it.. For instance now when I Edit an workflow and insert my own Event I get an:

Error: eZWorkflow Dec 10 2004 15:21:03
Undefined attribute 'type', cannot get

This is after my constructor in my own workflow has been executed. What I find very confusing is that when I search within the eZWorkflow class the error message is not found. so I suspect that it is crashing somewhere else, secondly I do not find the message very informative.

Probably needless to say but when adding the workflow to an trigger nothing is working.

Hopefully someone might point me in an direction. I have included the source for my event below here:

<?php

define( "EZ_WORKFLOW_TYPE_PLACEUSERS_ID", "placeusers" );
include_once("kernel/classes/ezworkflowtype.php");

class placeusersType extends eZWorkflowEventType
{
    function placeusersType() {
        $this->eZWorkflowEventType( EZ_WORKFLOW_TYPE_PLACEUSERS_ID, "Placeusers" );
        eZDebug::writeNotice("Start placeusers","Constructor");
    }

    function execute( &$process, &$event ) 
    {
		eZDebug::writeNotice("Start","Workflow placeusers");
    }		
}	

eZWorkflowEventType::registerType( EZ_WORKFLOW_TYPE_PLACEUSERS_ID, "placeuserstype" );

?>

Hmm no one know anything about workflow.. I am really desperate here. I have found that the error happens in: "eZPersistentObject" function &attribute( $attr ) with parameter named "type".

Eirik Alfstad Johansen

Wednesday 15 December 2004 5:52:56 am

Hi Tore,

I too have gotten the error msg "Undefined attribute 'type', cannot get" when I add a custom event type to my workflow. However, the workflow still runs fine. Also, I've had experience with workflows not returning variables to my templates, so that might be why your debug notices don't appear.

Could you try inserting for instance a mail() function in the execute function to make sure that the event is(n't) run?

Sincerely,

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

Tore Skobba

Wednesday 15 December 2004 6:18:42 am

Hi Eirik

Thanks for responding. In my execute I have:
<cod>eZDebug::writeNotice("Start","Workflow placeusers");
</code>

But I never see this debug message, neither when viewing the register page, or when viewing the post registration page. I have added the workflow and then connected it to content publish before/after. As I have from previously postings observed that it would also work for users.

Cheers
Tore

Eirik Alfstad Johansen

Wednesday 15 December 2004 6:31:51 am

Hi Tore,

Could you try out my suggestion: inserting a mail() function which sends an email to yourself in order to make sure that the event isn't run?

Sincerely,

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

Tore Skobba

Thursday 16 December 2004 1:55:01 am

Hi

Thanks Eirik, I tried to insert an mail function as shown below:

 function execute( &$process, &$event ) 
    {
		eZDebug::writeNotice("Start placeuserstyrpeexecute","Workflow placeusers");
		
		$mail = new eZMail();
		$mail->setReceiver("[email protected]");
			
		eZDebug::writeNotice("receiver: $receivers_email","Workflow clubapplication");
			
		$mail->setSubject("test");
		$mail->setBody("Hei dette er meg");
		$headerArray[] = array( 'name' => 'Content-Type',
                             		'content' => 'text/html' );
		$mail->headers($headerArray);
		$mail->setSender("[email protected]");
		$mailResult = eZMailTransport::send( $mail );
			
		eZDebug::writeNotice("receiver: $mailResult","Emailversand");
		
		return EZ_WORKFLOW_TYPE_STATUS_ACCEPTED;
    }		

I never get any mail (do you know why, my standard system mail is working fine cause I do get the new user registred email).. But I notice that if I enter something wrong in the above code, for instance not initalizing mail, then I get an error when the user registers in my workflow. So it seems to be executed... After searching my logs (files in log) I have can see my debug messages as weel, they are found in the notice.log. Why dosent they appear on screen.

Cheers
Tore

Eirik Alfstad Johansen

Thursday 16 December 2004 2:16:17 am

Hi Tore,

Perhaps it could be related to this bug which has just recently been fixed:

http://ez.no/community/bugs/workflow_results_are_ignored_in_content_edit_php

Sincerely,

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

Tore Skobba

Thursday 16 December 2004 3:04:34 am

Yes maybee, I am new to this workflow stuff.. I am just so glad that I am moving forward again.. Thank you very much Eirik.. You have really helped me here... I think my solution is, if I manage to make this workflow much more sustainable after I leave. Secondly, I think that learning how to make EZ workflows is going to hugely increase my possibilities with EZ.

However, again I have had huge problems with EZ due to poor docs... How was I to know that writenotice in my workflows did not write to the debug table in the browser.

Tusen Takk Eirik
Tore