[open-ils-commits] r518 - conifer/trunk/circ (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jun 8 14:59:39 EDT 2009
Author: dbs
Date: 2009-06-08 14:59:36 -0400 (Mon, 08 Jun 2009)
New Revision: 518
Modified:
conifer/trunk/circ/circ_duration_OSUL.js
Log:
Refine Laurentian rules; add some fancy reserve rules
Modified: conifer/trunk/circ/circ_duration_OSUL.js
===================================================================
--- conifer/trunk/circ/circ_duration_OSUL.js 2009-06-05 21:28:14 UTC (rev 517)
+++ conifer/trunk/circ/circ_duration_OSUL.js 2009-06-08 18:59:36 UTC (rev 518)
@@ -2,33 +2,15 @@
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 ) {
+/* Set the defaults for books for most patron types */
+result.durationRule = '3_weeks_2_renew';
+result.recurringFinesRule = 'OSUL_daily';
+result.maxFine = 'OSUL_daily';
- 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' ||
patronProfile == 'Graduate') {
result.durationRule = '120_days_2_renew';
}
-if (patronProfile == 'Undergraduate' ||
- patronProfile == 'Staff members' ||
- patronProfile == 'Readers') {
- result.durationRule = '3_weeks_2_renew';
-}
/* Distance education laptops */
if (copy.circ_modifier == 'COMPUTER') {
@@ -44,6 +26,28 @@
result.maxFine = 'overdue_equip_max';
}
+/* Study room keys */
+if (copy.circ_modifier == 'KEYS') {
+ result.durationRule = '4_hours_0_renew';
+ result.recurringFinesRule = 'OSUL_hourly';
+ result.maxFine = 'OSUL_hourly';
+}
+
+/* Reserve items - let's use regular expressions to save some pain */
+res_day_re = /^RESERVE (\d+) DAY$/;
+res_hour_re = /^RESERVE (\d+) HOUR$/;
+res_day_match = res_day_re.exec(copy.circ_modifier);
+res_hour_match = res_hour_re.exec(copy.circ_modifier);
+if (res_day_match) {
+ result.durationRule = res_day_match[1] + '_days_0_renew';
+ result.recurringFinesRule = 'OSUL_reserves_daily';
+ result.maxFine = 'OSUL_reserves_daily';
+} else if (res_hour_match) {
+ result.durationRule = res_hour_match[1] + '_hours_0_renew';
+ result.recurringFinesRule = 'OSUL_reserves_daily';
+ result.maxFine = 'OSUL_reserves_daily';
+}
+
/* RACER books */
if (copy.circ_modifier == 'PEB-LIVRE') {
result.durationRule = '14_days_0_renew';
More information about the open-ils-commits
mailing list