[open-ils-commits] r140 - in conifer/trunk: . circ (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Mar 5 23:36:59 EST 2009
Author: dbs
Date: 2009-03-05 23:36:56 -0500 (Thu, 05 Mar 2009)
New Revision: 140
Added:
conifer/trunk/circ/
conifer/trunk/circ/circ_duration.js
conifer/trunk/circ/circ_groups.js
Log:
Add basic circulation rule tests
Added: conifer/trunk/circ/circ_duration.js
===================================================================
--- conifer/trunk/circ/circ_duration.js (rev 0)
+++ conifer/trunk/circ/circ_duration.js 2009-03-06 04:36:56 UTC (rev 140)
@@ -0,0 +1,62 @@
+function go(){
+
+load_lib('circ/circ_item_config.js');
+load_lib('JSON_v1.js');
+log_vars('circ_duration');
+
+
+/* treat pre-cat copies like vanilla books */
+if( isTrue(isPrecat) ) {
+ log_info("pre-cat copy getting duration defaults...");
+ result.durationRule = 'default';
+ result.recurringFinesRule = 'default';
+ result.maxFine = 'default'
+ return;
+}
+
+
+/* grab the config from the config script */
+var config = getItemConfig();
+var itemForm = (marcXMLDoc) ? extractFixedField(marcXMLDoc,'Form') : "";
+
+
+/* -----------------------------------------------------------------------------
+ Now set the rule values based on the config. If there is no configured info
+ on this copy, fall back on defaults.
+ ----------------------------------------------------------------------------- */
+if( config ) {
+
+ log_debug("circ_duration found a config for the copy");
+ result.durationRule = config.durationRule;
+ result.recurringFinesRule = config.recurringFinesRule;
+ result.maxFine = config.maxFine;
+
+} else {
+
+ result.durationRule = 'default';
+ result.recurringFinesRule = 'default';
+ result.maxFine = 'default';
+}
+
+if (patronProfile == 'Faculty') {
+ result.durationRule = '120_days_2_renew';
+}
+if (patronProfile == 'Graduate students') {
+ result.durationRule = '120_days_2_renew';
+}
+if (patronProfile == 'Undergraduate students') {
+ result.durationRule = '3_weeks_2_renew';
+}
+if (patronProfile == 'Guest borrowers') {
+ result.durationRule = '3_weeks_2_renew';
+}
+
+
+log_info('final duration results: ' +
+ result.durationRule + ' : ' + result.recurringFinesRule + ' : ' + result.maxFine );
+
+} go();
+
+
+
+
Property changes on: conifer/trunk/circ/circ_duration.js
___________________________________________________________________
Name: svn:executable
+ *
Added: conifer/trunk/circ/circ_groups.js
===================================================================
--- conifer/trunk/circ/circ_groups.js (rev 0)
+++ conifer/trunk/circ/circ_groups.js 2009-03-06 04:36:56 UTC (rev 140)
@@ -0,0 +1,46 @@
+/* ---------------------------------------------------------------------
+ Set up the limits for the various profiles (aka permission groups).
+ Values of -1 mean there is no limit
+
+ maxItemsOut - the maximum number of items the user can have out
+ fineThreshold - the fine threshold.
+ overdueThreshold - the overdue items threshold.
+ maxHolds - The maximum number of holds the user can have
+
+ A user exceeds the fineThreshold and/or overdueThreshold if they are
+ equal to or exceed the threshold
+ --------------------------------------------------------------------- */
+
+var GROUP_CONFIG = {
+ 'Patron' : {
+ maxItemsOut : 50,
+ fineThreshold : 10,
+ overdueThreshold : 1,
+ maxHolds : -1
+ },
+ 'Faculty' : {
+ maxItemsOut : 50,
+ fineThreshold : 10,
+ overdueThreshold : 1,
+ maxHolds : -1
+ },
+ 'Graduate students' : {
+ maxItemsOut : 50,
+ fineThreshold : 10,
+ overdueThreshold : 1,
+ maxHolds : -1
+ },
+ 'Undergraduate students' : {
+ maxItemsOut : 30,
+ fineThreshold : 10,
+ overdueThreshold : 1,
+ maxHolds : -1
+ },
+ 'Guest borrowers' : {
+ maxItemsOut : 15,
+ fineThreshold : 10,
+ overdueThreshold : 1,
+ maxHolds : -1
+ },
+
+}
Property changes on: conifer/trunk/circ/circ_groups.js
___________________________________________________________________
Name: svn:executable
+ *
More information about the open-ils-commits
mailing list