Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Workflow CPAN distribution.

Report information
The Basics
Id: 52841
Status: resolved
Priority: 0/
Queue: Workflow

People
Owner: jonasbn [...] cpan.org
Requestors: steven [...] echelon.nl
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 1.34_1



Subject: Proposal change to the Workflow Module
Date: Thu, 03 Dec 2009 16:45:51 +0100
To: jonasbn [...] cpan.org
From: Steven van der Vegt <steven [...] echelon.nl>
Hello Jonas, I'm using your Workflow module for a few months with great satisfaction. I noticed that the autorun functionality doesn't work on the INITIAL state. Because I think this feature is kind of handy I made a patch for the Factory.pm file. I also added the feature to include a context in the create_workflow and fetch_workflow method call. The reason for this change is that from the moment a workflow is created I want to connect this to a customer. Therefor direct after the creation an action must be executed. I'm really interested in your view upon this change. Kind regards, -- Steven van der Vegt Echelon BV E: steven@echelon.nl T: (053)4836585 F: (053)4336222 W: www.echelon.nl KVK: 06055381 329c329 < my ( $self, $wf_type, $context ) = @_; --- Show quoted text
> my ( $self, $wf_type ) = @_;
339c339 < $wf->context( $context || Workflow::Context->new ); --- Show quoted text
> $wf->context( Workflow::Context->new );
369,378d368 < my $state = $wf->_get_workflow_state(); < if ($state->autorun) { < $log->is_info < && $log->info( < "State '$state' marked to be run ", < "automatically; executing that state/action..." < ); < $wf->_auto_execute_state($state); < } < 383c373 < my ( $self, $wf_type, $wf_id, $context) = @_; --- Show quoted text
> my ( $self, $wf_type, $wf_id ) = @_;
402c392 < $wf->context( $context || Workflow::Context->new ) if (not $wf->context()); --- Show quoted text
> $wf->context( Workflow::Context->new ) if (not $wf->context());
Hello, What version did you created this diff against, I cannot get the line numbers to match. The block for INITIAL_STATE is teasing me the replacements are in place. jonasbn
Subject: Re: Proposal change to the Workflow Module
Date: Thu, 17 Dec 2009 14:00:21 +0100
To: Jonas Brømsø Nielsen <jonasbn [...] gmail.com>
From: Steven van der Vegt <steven [...] echelon.nl>
Hi Jonas,

Thanks for your response and looking at my changes!

I've another proposal for the library:
When a validation error occurs I'd like to see which fields caused the error. Therefore I added the following lines to Workflow::Exception :

 'Workflow::Exception::Validation' => {
     isa         => 'Workflow::Exception',
     description => 'Validation errors',
-->        fields      => 'invalid_fields', <--
 },

This creates an getter and setter in the exception for the invalid_fields

And I added the following line to Workflow::Validator::HasRequiredField :

validation_error "The following fields require a value: ",
         join ( ', ',@no_value) ,
-->            { invalid_fields => \@no_value }; <--

Now it is possible to access the fields like this:

if ($e = Exception::Class->caught('Workflow::Exception::Validation') ) {
 my @invalid_fields = $e->invalid_fields;
 # do something with the fields like coloring this borders of the field or give feedback to the user.
}

What do you think about it? If you rather like a diff file instead of this code, I can send you one.

Kind regards,

Steven van der Vegt

Jonas Brømsø Nielsen schreef:
Show quoted text
Hi Steven,
Show quoted text

Show quoted text
Thanks for the contribution - I am forwarding it to RT for the reference.
Show quoted text

Show quoted text
I will let you now how it goes with your patch.
Show quoted text

Show quoted text
jonasbn
Show quoted text

Show quoted text
On 03/12/2009, at 16.45, Steven van der Vegt wrote:
Show quoted text

Show quoted text

Show quoted text
Hello Jonas,
Show quoted text

Show quoted text
I'm using your Workflow module for a few months with great satisfaction.
Show quoted text
I noticed that the autorun functionality doesn't work on the INITIAL state. Because I think this feature is kind of handy I made a patch for the Factory.pm file. I also added the feature to include a context in the create_workflow and fetch_workflow method call.
Show quoted text
The reason for this change is that from the moment a workflow is created I want to connect this to a customer. Therefor direct after the creation an action must be executed.
Show quoted text

Show quoted text
I'm really interested in your view upon this change.
Show quoted text

Show quoted text
Kind regards,
Show quoted text

Show quoted text
--
Show quoted text
Steven van der Vegt
Show quoted text
Echelon BV
Show quoted text

Show quoted text
E: steven@echelon.nl
Show quoted text
T: (053)4836585
Show quoted text
F: (053)4336222
Show quoted text
W: www.echelon.nl
Show quoted text

Show quoted text
KVK: 06055381
Show quoted text

Show quoted text
329c329
Show quoted text
<     my ( $self, $wf_type, $context ) = @_;
Show quoted text
---
Show quoted text

Show quoted text
 my ( $self, $wf_type ) = @_;
Show quoted text

Show quoted text
339c339
Show quoted text
<     $wf->context( $context || Workflow::Context->new );
Show quoted text
---
Show quoted text

Show quoted text
 $wf->context( Workflow::Context->new );
Show quoted text

Show quoted text
369,378d368
Show quoted text
<       my $state = $wf->_get_workflow_state();
Show quoted text
<       if ($state->autorun) {
Show quoted text
<                       $log->is_info
Show quoted text
<                       && $log->info(
Show quoted text
<                       "State '$state' marked to be run ",
Show quoted text
<                       "automatically; executing that state/action..."
Show quoted text
<                       );
Show quoted text
<               $wf->_auto_execute_state($state);
Show quoted text
<       }
Show quoted text
<
Show quoted text
383c373
Show quoted text
<     my ( $self, $wf_type, $wf_id, $context) = @_;
Show quoted text
---
Show quoted text

Show quoted text
 my ( $self, $wf_type, $wf_id ) = @_;
Show quoted text

Show quoted text
402c392
Show quoted text
<       $wf->context( $context || Workflow::Context->new ) if (not $wf->context());
Show quoted text
---
Show quoted text

Show quoted text
   $wf->context( Workflow::Context->new ) if (not $wf->context());
Show quoted text

Show quoted text

Show quoted text



--
Steven van der Vegt
Echelon BV

E: steven@echelon.nl
T: (053)4836585
F: (053)4336222
W: www.echelon.nl

KVK: 06055381

RT-Send-CC: steven [...] echelon.nl
Hi Steven, I cannot remember if you responded to me on this. But I cannot apply your patch since the code seems to have changed. Could you please tell me what version you made this change to and possibly provide me with a unified diff (-u) jonasbn
Patch applied, will be part of upcoming developer/beta release. jonasbn
Added to release 1.34_1, closing this ticket. jonasbn