[OPEN-ILS-GENERAL] Action Trigger Event Parameters
Bill Erickson
erickson at esilibrary.com
Wed Jan 4 16:53:49 EST 2012
On Wed, Jan 04, 2012 at 11:57:17AM -0800, David Busby wrote:
> Howdy,
>
> I've constructed a custom Action Trigger Validator
> (Actor::StatCatMatch) it's working pretty OK, but I've got some hard
> coded values in there that I want to remove.
> I was thinking that I would use the Action Trigger Event Parameters
> to configure the way this validator works.
> In my mind I would set to parameters there, eg: StatCatEntry which
> would be the name (or ID) of the stat-cat to match; and StatCatMatch
> which would be a regular expression.
> In this fashion, my Validator module could use those, when running
> this little snip...
>
> my $circ = $env->{target};
> my $u = $circ->usr;
> foreach my $sce (@{$u->stat_cat_entries}) {
> # Logic here
> }
>
> The issue I'm having is that the data is not getting into this
> module as I expected. That is.
> What I set in the UI, does not get into the validator verbatim; it's mangled.
> Vis:
> ---
> (postgres@[local]:5432) [evergreen] > select * from action_trigger.event_params;
> id | event_def | param | value
> ----+-----------+---------------+------------------------
> 3 | 101 | Stat-Cat.ID | 3,5
> 1 | 101 | StatCat+Name | email_reciept_due_date
> 2 | 101 | Stat_CatMatch | Yes!
> ---
>
> My event is 101, when I am in the perl code for this, my values are
> mangled to things like: "5", "email_reciept_due_date" and "Yes". As
> if it only matches \w+. What's odd is that the param value comes
> through un-mangled, with spaces and all. I basically was logging with
> Dumper() to see this.
>
> Thoughts? This related to a LP I created too,
> https://bugs.launchpad.net/evergreen/+bug/911904
Hi David,
Event parameter values are eval'd on the server, so they have to be
stored as valid Perl values. For Perl strings, of course, they need to
be wrapped in quotes.
E.g.
id | event_def | param | value
---+-----------+---------------+----------
2 | 101 | Stat_CatMatch | 'Yes!'
-b
--
Bill Erickson
| Senior Software Developer
| phone: 877-OPEN-ILS (673-6457)
| email: erickson at esilibrary.com
| web: http://esilibrary.com
| Equinox Software, Inc. / Your Library's Guide to Open Source
More information about the Open-ils-general
mailing list