circ scripts
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Apr 2005 22:05:48 +0000 (22:05 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Apr 2005 22:05:48 +0000 (22:05 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@578 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

diff --git a/Evergreen/circ_rules/circ_main.rules b/Evergreen/circ_rules/circ_main.rules
new file mode 100644 (file)
index 0000000..64438be
--- /dev/null
@@ -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 (file)
index 0000000..98f3200
--- /dev/null
@@ -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");
+
+%]