]> git.evergreen-ils.org Git - Evergreen.git/commit
Patch from Thomas Berezansky to implement circulation matchpoint value fallthrough...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Feb 2011 20:47:11 +0000 (20:47 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Feb 2011 20:47:11 +0000 (20:47 +0000)
commitec5f6b2e2c018815e7b3b8f889540b3eeed21277
treede25882265112f79c8182c3e3d6842476492089e
parent84ae450f5df5040a1536389795ea76155e93bcee
Patch from Thomas Berezansky to implement circulation matchpoint value fallthrough, whereby specific rules can inherit values from generic rules.

Background, taken from https://bugs.launchpad.net/evergreen/+bug/635463:

Theory:
Make the things returned (circulate, duration_rule, recurring_fine_rule, max_fine_rule, hard_due_date, total_copy_hold_ratio, available_copy_hold_ratio and renewals) "fall through" when set to NULL.

The circ matrix edit screen has had some changes too, partially for showing "Inherited" in some places where appropriate, partially for field ordering and editing display and consistency. The fields that show up earlier contribute to tests that will be applied to the circulation attempt, while the "results" that do not change what rows are considered are grouped at the end.

Pros:

You can override a subset of those fields with a specific rule while allowing broader rules to fill in the holes.
This may result in less duplication of information across rules, making things easier to maintain.
Thus, this may result in less rules in general, and thus less processing time on sorting them overall.

Cons:

Manually figuring out the specifics of what will happen will take more time/effort.
Changing a single rule may have a greater unintended effect on other rules.
Staff would need training for when to have a rule fall through and when to set it specifically.
More time to return from the DB for any rule that is "falling through" to broader rules.

Examples for the following org tree:

CONS
-SYSA
--LIBC
--LIBD
-SYSB
--LIBE
--LIBF

Implementing the following "business" rules:

At the CONS level:
By default, everything circulates, uses DFLT_DUR duration, DFLT_RFINE recurring fine, and DFLT_MFINE max fine.
Circ Modifier "book" uses the duration BOOK_DUR
Reference flagged materials don't circulate

At the SYSA level there are no special rules.

At the SYSB level the max fine should be SYSB_MFINE.

At the LIBC level the recurring fine is LIBC_RFINE

At the LIBD level circ modifier "book" uses the DFLT_DUR duration instead of "BOOK_DUR"

At the LIBE level reference flagged materials circulate.

At the LIBF level there are no special rules.

The current method would require the following circ rules to implement those business rules:

CIRC_LIB CIRC_MOD REFERENCE CIRC? DURATION_RULE RECURRING_FINE MAX_FINE
CONS NULL NULL TRUE DFLT_DUR DFLT_RFINE DFLT_MFINE
CONS NULL TRUE FALSE DFLT_DUR DFLT_RFINE DFLT_MFINE
CONS book NULL TRUE BOOK_DUR DFLT_RFINE DFLT_MFINE
CONS book TRUE FALSE BOOK_DUR DFLT_RFINE DFLT_MFINE
SYSB NULL NULL TRUE DFLT_DUR DFLT_RFINE SYSB_MFINE
SYSB NULL TRUE FALSE DFLT_DUR DFLT_RFINE SYSB_MFINE
SYSB book NULL TRUE BOOK_DUR DFLT_RFINE SYSB_MFINE
SYSB book TRUE FALSE BOOK_DUR DFLT_RFINE SYSB_MFINE
LIBC NULL NULL TRUE DFLT_DUR LIBC_RFINE DFLT_MFINE
LIBC NULL TRUE FALSE DFLT_DUR LIBC_RFINE DFLT_MFINE
LIBC book NULL TRUE BOOK_DUR LIBC_RFINE DFLT_MFINE
LIBC book TRUE FALSE BOOK_DUR LIBC_RFINE DFLT_MFINE
LIBD book NULL TRUE DFLT_DUR DFLT_RFINE DFLT_MFINE
LIBD book TRUE FALSE DFLT_DUR DFLT_RFINE DFLT_MFINE
LIBE NULL NULL TRUE DFLT_DUR DFLT_RFINE SYSB_MFINE
LIBE book NULL TRUE BOOK_DUR DFLT_RFINE SYSB_MFINE

16 circ rules total.

The new method would require the following circ rules to implement those business rules:

CIRC_LIB CIRC_MOD REFERENCE CIRC? DURATION_RULE RECURRING_FINE MAX_FINE
CONS NULL NULL TRUE DFLT_DUR DFLT_RFINE DFLT_MFINE
CONS book NULL NULL BOOK_DUR NULL NULL
CONS NULL TRUE FALSE NULL NULL NULL
SYSB NULL NULL NULL NULL NULL SYSB_MFINE
LIBC NULL NULL NULL NULL LIBC_RFINE NULL
LIBD book NULL NULL DFLT_DUR NULL NULL
LIBE NULL TRUE TRUE NULL NULL NULL

7 circ rules total.

Starting with the above, lets assume that SYSA wants to change their recurring fine to SYSA_RFINE.
LIBC's recurring fine is to be unchanged.

The current method requires the following changes:

ADD the following entries:
CIRC_LIB CIRC_MOD REFERENCE CIRC? DURATION_RULE RECURRING_FINE MAX_FINE
SYSA NULL NULL TRUE DFLT_DUR SYSA_RFINE DFLT_MFINE
SYSA NULL TRUE FALSE DFLT_DUR SYSA_RFINE DFLT_MFINE
SYSA book NULL TRUE BOOK_DUR SYSA_RFINE DFLT_MFINE
SYSA book TRUE FALSE BOOK_DUR SYSA_RFINE DFLT_MFINE

UPDATE the LIBD entries:
CIRC_LIB CIRC_MOD REFERENCE CIRC? DURATION_RULE RECURRING_FINE MAX_FINE
LIBD book NULL TRUE DFLT_DUR SYSA_RFINE DFLT_MFINE
LIBD book TRUE FALSE DFLT_DUR SYSA_RFINE DFLT_MFINE

4 rules added, 2 changed, total is now 20 rules.

The new method would require the following changes:

ADD the following entry:
CIRC_LIB CIRC_MOD REFERENCE CIRC? DURATION_RULE RECURRING_FINE MAX_FINE
SYSA NULL NULL NULL NULL SYSA_RFINE NULL

1 rule added, 0 changed, total is now 8 rules.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@19453 dcc99617-32d9-48b4-a31d-7c20da2025e4
13 files changed:
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/100.circ_matrix.sql
Open-ILS/src/sql/Pg/110.hold_matrix.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/0487.circ_matrix_fallthrough.sql [new file with mode: 0644]
Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js
Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
Open-ILS/web/js/dojo/openils/widget/EditPane.js
Open-ILS/web/js/dojo/openils/widget/nls/AutoFieldWidget.js
Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js
Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2