circulation template scripts
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 2 May 2005 17:10:12 +0000 (17:10 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 2 May 2005 17:10:12 +0000 (17:10 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@597 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/circ_rules/calculate_duration.rules [new file with mode: 0644]
Evergreen/circ_rules/calculate_max_fines.rules [new file with mode: 0644]
Evergreen/circ_rules/calculate_recurring_fines.rules [new file with mode: 0644]
Evergreen/circ_rules/circ_main.rules
Evergreen/circ_rules/permit_circ.rules

diff --git a/Evergreen/circ_rules/calculate_duration.rules b/Evergreen/circ_rules/calculate_duration.rules
new file mode 100644 (file)
index 0000000..9049765
--- /dev/null
@@ -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 (file)
index 0000000..08d51db
--- /dev/null
@@ -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 (file)
index 0000000..14581a5
--- /dev/null
@@ -0,0 +1,10 @@
+[%
+
+# ------------------------------------------------------------------
+# Default policy
+# ------------------------------------------------------------------
+ret('books', NORMAL); 
+
+
+
+%]
index 64438be..d2cf9fe 100644 (file)
@@ -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
        # ------------------------------------------------------------------
        # ------------------------------------------------------------------
        # 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;
 
 %]
 
index 98f3200..c7f81e2 100644 (file)
@@ -5,6 +5,7 @@
 # ------------------------------------------------------------------
 
 
+
 # ------------------------------------------------------------------
 # Patron checks
 # ------------------------------------------------------------------
 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");
 
 %]