[OPEN-ILS-GENERAL] Action Trigger using ApplyPatronPenalty

Martha Driscoll driscoll at noblenet.org
Wed Jan 30 13:44:48 EST 2013


The event definition did contain 'usr' for the Group Field.  I removed 
it but still get a 'missing parameters' error when the trigger runs.

I'm thinking that it may be more straightforward to run an SQL nightly 
that would add users to the patron block table if they meet the criteria 
and remove them if they don't.

If anyone has any cautions about updating the database directly I would 
be interested.  Here is the SQL I have written:

--Add the block if they need it
INSERT INTO actor.usr_standing_penalty (org_unit, usr, standing_penalty, 
staff)
    SELECT DISTINCT
         1 as org_unit,
         acirc.usr as usr,
         103 as standing_penalty,
         1 as staff
    FROM action.circulation acirc
    WHERE acirc.due_date < (now() - '42 days'::interval)
    AND acirc.checkin_time is null
    AND usr not in (select distinct usr from actor.usr_standing_penalty
    where standing_penalty = 103)
    ;

--remove the block if the items are no longer long overdue
DELETE FROM actor.usr_standing_penalty
    WHERE standing_penalty = 103
    AND usr not in (
    SELECT DISTINCT usr
    FROM action.circulation acirc
    WHERE acirc.due_date < (now() - '42 days'::interval)
    AND acirc.checkin_time is null)
    ;

Martha Driscoll
Systems Manager
North of Boston Library Exchange
Danvers, Massachusetts
www.noblenet.org

On 1/29/2013 8:28 AM, Bill Erickson wrote:
> Hi Martha,
>
> Does the event definition contain a value for Group Field?  If so, I
> recommend removing the value and seeing of that helps.
>
> -b
>
> On Mon, Jan 28, 2013 at 10:00 AM, Martha Driscoll <driscoll at noblenet.org
> <mailto:driscoll at noblenet.org>> wrote:
>
>     We are trying to create an action trigger using the
>     ApplyPatronPenalty reactor.  The idea is to run an action trigger
>     daily that will look for copies that are 42 days overdue and set a
>     penalty we created called PATRON_EXCEEDS_LONG_OD.  We are using
>     checkout.due as the hook.
>
>     Our libraries want to see an alert when a patron has material long
>     overdue, but we don't want to set these copies to bills yet because
>     of the financial implications.
>
>     We are getting an error when the trigger runs:
>
>        ApplyPatronPenalty: missing parameters
>
>     The event environment consists of:
>
>        Field Path        Label
>        circ_lib          context_org
>        usr               user
>
>     The event parameters consist of:
>
>        Parameter Name     Parameter Value
>        standing_penalty   PATRON_EXCEEDS_LONG_OD
>
>     The parameters that are missing are user and context_org.  The
>     penalty PATRON_EXCEEDS_LONG_OD is being passed to the reactor.
>
>     Has anyone had any success using the ApplyPatronPenalty reactor?
>
>     --
>     Martha Driscoll
>     Systems Manager
>     North of Boston Library Exchange
>     Danvers, Massachusetts
>     www.noblenet.org <http://www.noblenet.org>
>
>
>
>
> --
> Bill Erickson
> | Senior Software Developer
> | phone: 877-OPEN-ILS (673-6457)
> | email: berick at esilibrary.com <mailto:berick 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