From f8909f21c41966f8ad56c2f562d2686a40ec5500 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 26 Apr 2005 22:05:48 +0000 Subject: [PATCH] circ scripts git-svn-id: svn://svn.open-ils.org/ILS/trunk@578 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Evergreen/circ_rules/circ_main.rules | 62 ++++++++++++++++++++++++++ Evergreen/circ_rules/permit_circ.rules | 39 ++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 Evergreen/circ_rules/circ_main.rules create mode 100644 Evergreen/circ_rules/permit_circ.rules diff --git a/Evergreen/circ_rules/circ_main.rules b/Evergreen/circ_rules/circ_main.rules new file mode 100644 index 0000000000..64438be700 --- /dev/null +++ b/Evergreen/circ_rules/circ_main.rules @@ -0,0 +1,62 @@ +[% + + + # ------------------------------------------------------------------ + # Macros for simpler syntax + # ------------------------------------------------------------------ + MACRO jump(n) PROCESS "$n"; + 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; + + BLOCK ret_block; + result.0 = s; + result.1 = t; + "Circ Template Result: "; result.0; " "; result.1; + STOP; + END; + + + + # ------------------------------------------------------------------ + # These are passed in to every script + # ------------------------------------------------------------------ + # Objects : Methods + # ------------------- + # patron : + # copy : + # circlib : + # standings : + # title : + # ------------------------------------------------------------------ + + # ------------------------------------------------------------------ + # Constants + # ------------------------------------------------------------------ + OK = 0; + COPY_ISREF = 2; + COPY_NOCIRC = 3; + COPY_UNAVAIL = 4; + COPY_LOCATION = 5; + + PATRON_STANDING = 10; + PATRON_FINE = 11; + PATRON_CHARGE_COUNT = 12; + + + + # ------------------------------------------------------------------ + # Run the rules files + # ------------------------------------------------------------------ + PROCESS "$run_block" + patron = circ_objects.patron + copy = circ_objects.copy + circlib = circ_objects.copy.circlib() + title = circ_objects.title + standings = circ_objects.standings; + + +%] + + diff --git a/Evergreen/circ_rules/permit_circ.rules b/Evergreen/circ_rules/permit_circ.rules new file mode 100644 index 0000000000..98f320000a --- /dev/null +++ b/Evergreen/circ_rules/permit_circ.rules @@ -0,0 +1,39 @@ +[% + +# ------------------------------------------------------------------ +# Permissibility script. +# ------------------------------------------------------------------ + + +# ------------------------------------------------------------------ +# Patron checks +# ------------------------------------------------------------------ + +IF patron.standing != "Good"; + ret(PATRON_STANDING, "Patron not in good standing: ${patron.standing}"); END; + + +# ------------------------------------------------------------------ +# Copy checks +# ------------------------------------------------------------------ + +IF ! copy.circulate; + ret(COPY_NOCIRC, "Copy is not allowed to circulate"); END; + +IF copy.status != "Available"; + ret(COPY_UNAVAIL, "Copy is unavailable: ${copy.status}"); END; + +IF !copy.location.circulate; + ret(COPY_LOCATION, "Copy location not allowed to curculate"); END; + +IF copy.ref; + ret(COPY_ISREF, "Copy is reference material"); END; + + + + + + +ret(OK,"Allowed"); + +%] -- 2.43.2