[OPEN-ILS-DEV] [RFC] Price (or percent thereof) as max fine amount.

Mike Rylander mrylander at gmail.com
Sat Jul 26 22:52:43 EDT 2008


We've had requests in the past for the ability to use an item's price
as the max fine amount on a circulation, instead of a predefined
amount.  Because of how rules are defined and chosen in Evergreen
today, the solution to this request had not presented itself in a
clear and consistent manner.  However, John Craig of Alpha-G
Consulting (another firm getting into the  Evergreen support and
migration biz) was wondering about a specialization of this idea and
how it might be implemented.  He has had a request to be able to use a
percentage of the item price as the max fine amount -- and this, it
turns out, is the twist that finally made the solution stand out,
bright as day as if it had always been right there, as a consistent
and general extension of the existing framework.

John and I went to our separate corners and dummied up a plan for
this, and it turns out that we both saw the same solution.  Here
attached is an implementation of that solution, which works thusly:

* The config.rule_max_fine table gets a new boolean column called
is_percent which defaults to false
* The IDL (and, for good measure, the storage server's ancient
equivelant) is taught about this new field
* OpenILS::Circ::Circulate::build_checkout_circ_object inspects this
field on the chosen rule for truthiness, and finding a positive
result:
  - gets the item price from the copy and
  - if that's null (not allowed yet, but will be in 1.4) attempts to
find an org_unit-appropriate default item price (also used for LOST
fee)
  - or, if price == 0 and the "charge default on 0-price" org unit
setting is true, attempts to find an org_unit-appropriate default item
price (also used for LOST fee)
  - and now, having found an appropriate full price for the item,
interprets the max fine amount as a percentage value, scaling the full
price as specified
  - and finally, uses that amount as the max fine amount, instead of a
specific value

As an example, say you have an item being checked out and the max fine
rule chosen for this circulation looks like this:

  name = up_to_half_of_price
  amount = 50.00
  is_percent = true

and the item price is 20.00.  The max fine for that circ would be set
to 10.00 ...

Another example with the same rule, but the copy has a null (in 1.4)
price or a price of 0.00 and "charge default on 0-price" org unit
setting is in effect, and that default price is 25.00.  The max fine
would be set to 12.50.

And, finally, if the max fine amount is 100.00, the full price of the
copy or the default price (the original request) would be used.  We
have come full circle.

Thoughts?

-- 
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / The Evergreen Experts
 | phone: 1-877-OPEN-ILS (673-6457)
 | email: miker at esilibrary.com
 | web: http://www.esilibrary.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: percent-of-price-max_fine.patch
Type: text/x-diff
Size: 3674 bytes
Desc: not available
Url : http://list.georgialibraries.org/pipermail/open-ils-dev/attachments/20080726/ee65113e/percent-of-price-max_fine.bin


More information about the Open-ils-dev mailing list