From 17b521ce329d88eb490a8cd5be9664feaf6f440f Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 2 May 2005 17:10:12 +0000 Subject: [PATCH 1/1] circulation template scripts git-svn-id: svn://svn.open-ils.org/ILS/trunk@597 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Evergreen/circ_rules/calculate_duration.rules | 15 +++++++++ .../circ_rules/calculate_max_fines.rules | 9 ++++++ .../calculate_recurring_fines.rules | 10 ++++++ Evergreen/circ_rules/circ_main.rules | 32 ++++++++++++------- Evergreen/circ_rules/permit_circ.rules | 12 +++++-- 5 files changed, 64 insertions(+), 14 deletions(-) create mode 100644 Evergreen/circ_rules/calculate_duration.rules create mode 100644 Evergreen/circ_rules/calculate_max_fines.rules create mode 100644 Evergreen/circ_rules/calculate_recurring_fines.rules diff --git a/Evergreen/circ_rules/calculate_duration.rules b/Evergreen/circ_rules/calculate_duration.rules new file mode 100644 index 0000000000..9049765804 --- /dev/null +++ b/Evergreen/circ_rules/calculate_duration.rules @@ -0,0 +1,15 @@ +[% + + rule = "2wk_default"; + loan_duration = copy.loan_duration; + + + + + + # ------------------------------------------------------------------ + # Default policy + # ------------------------------------------------------------------ + ret(rule, loan_duration); + +%] diff --git a/Evergreen/circ_rules/calculate_max_fines.rules b/Evergreen/circ_rules/calculate_max_fines.rules new file mode 100644 index 0000000000..08d51db0cc --- /dev/null +++ b/Evergreen/circ_rules/calculate_max_fines.rules @@ -0,0 +1,9 @@ +[% + +# ------------------------------------------------------------------ +# Default policy +# ------------------------------------------------------------------ +ret('books', NORMAL); + + +%] diff --git a/Evergreen/circ_rules/calculate_recurring_fines.rules b/Evergreen/circ_rules/calculate_recurring_fines.rules new file mode 100644 index 0000000000..14581a57a4 --- /dev/null +++ b/Evergreen/circ_rules/calculate_recurring_fines.rules @@ -0,0 +1,10 @@ +[% + +# ------------------------------------------------------------------ +# Default policy +# ------------------------------------------------------------------ +ret('books', NORMAL); + + + +%] diff --git a/Evergreen/circ_rules/circ_main.rules b/Evergreen/circ_rules/circ_main.rules index 64438be700..d2cf9fe412 100644 --- a/Evergreen/circ_rules/circ_main.rules +++ b/Evergreen/circ_rules/circ_main.rules @@ -5,8 +5,8 @@ # Macros for simpler syntax # ------------------------------------------------------------------ MACRO jump(n) PROCESS "$n"; - MACRO policy(p) PROCESS policy_block val=p; - BLOCK policy_block; val; STOP; END; +# MACRO policy(p) PROCESS policy_block val=p; +# BLOCK policy_block; val; STOP; END; MACRO ret(status,text) PROCESS ret_block s=status t=text; @@ -18,7 +18,6 @@ END; - # ------------------------------------------------------------------ # These are passed in to every script # ------------------------------------------------------------------ @@ -34,15 +33,23 @@ # ------------------------------------------------------------------ # Constants # ------------------------------------------------------------------ - OK = 0; - COPY_ISREF = 2; - COPY_NOCIRC = 3; - COPY_UNAVAIL = 4; - COPY_LOCATION = 5; + OK = 0; + COPY_ISREF = 2; + COPY_NOCIRC = 3; + COPY_UNAVAIL = 4; + COPY_LOCATION = 5; + + PATRON_STANDING = 10; + PATRON_FINE = 11; + PATRON_CHECKOUT_COUNT = 12; - PATRON_STANDING = 10; - PATRON_FINE = 11; - PATRON_CHARGE_COUNT = 12; + LOW = 1; + NORMAL = 2; + HIGH = 3; + + SHORT = 1; + NORMAL = 2; + EXTENDED = 3; @@ -55,7 +62,8 @@ circlib = circ_objects.copy.circlib() title = circ_objects.title standings = circ_objects.standings; - + patron_copies = circ_objects.patron_copies; + patron_fines = circ_objects.patron_fines; %] diff --git a/Evergreen/circ_rules/permit_circ.rules b/Evergreen/circ_rules/permit_circ.rules index 98f320000a..c7f81e2e62 100644 --- a/Evergreen/circ_rules/permit_circ.rules +++ b/Evergreen/circ_rules/permit_circ.rules @@ -5,6 +5,7 @@ # ------------------------------------------------------------------ + # ------------------------------------------------------------------ # Patron checks # ------------------------------------------------------------------ @@ -12,6 +13,15 @@ IF patron.standing != "Good"; ret(PATRON_STANDING, "Patron not in good standing: ${patron.standing}"); END; +IF patron.profile == "STAFF" && patron_copies > 50; + ret(PATRON_CHECKOUT_COUNT, "Patron checkout count exceeds limit"); END; + +IF patron.profile == "ADULT" && patron_copies > 10; + ret(PATRON_CHECKOUT_COUNT, "Patron checkout count exceeds limit"); END; + +IF patron.profile == "JUVENILE" && patron_copies > 5; + ret(PATRON_CHECKOUT_COUNT, "Patron checkout count exceeds limit"); END; + # ------------------------------------------------------------------ # Copy checks @@ -32,8 +42,6 @@ IF copy.ref; - - ret(OK,"Allowed"); %] -- 2.43.2