Add Reserve circ rules for Boreal
authorDan Scott <dan@coffeecode.net>
Thu, 1 Sep 2011 19:01:39 +0000 (15:01 -0400)
committerDan Scott <dscott@laurentian.ca>
Wed, 8 May 2013 14:22:56 +0000 (10:22 -0400)
Still need some clarification on how these rules are to be applied, but
better to get the durations working right now and fix up the fines
later.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/javascript/backend/circ/circ_duration_OSBO.js

index b1062cf..6225838 100644 (file)
@@ -39,3 +39,18 @@ if (copy.circ_modifier == 'DVD VIDEO') {
     result.durationRule = '7_days_1_renew';
     result.recurringFinesRule = '1_dollar_per_day';
 }
+
+/* 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 = '25_cent_per_day';
+} else if (res_hour_match) {
+    result.durationRule = res_hour_match[1] + '_hours_0_renew';
+    result.recurringFinesRule = '25_cent_per_hour';
+}
+
+