[open-ils-commits] r431 - in conifer/trunk: circ tools/migration-scripts (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sat May 2 09:20:50 EDT 2009
Author: dbs
Date: 2009-05-02 09:20:49 -0400 (Sat, 02 May 2009)
New Revision: 431
Added:
conifer/trunk/circ/circ_duration_OWA.js
conifer/trunk/tools/migration-scripts/circ_rules.sql
Modified:
conifer/trunk/circ/circ_duration.js
Log:
First cut at OWA/OWAL circ rules
Modified: conifer/trunk/circ/circ_duration.js
===================================================================
--- conifer/trunk/circ/circ_duration.js 2009-05-01 15:51:06 UTC (rev 430)
+++ conifer/trunk/circ/circ_duration.js 2009-05-02 13:20:49 UTC (rev 431)
@@ -4,7 +4,15 @@
load_lib('JSON_v1.js');
log_vars('circ_duration');
+/* load circ rules for specific institutions */
+var circ_duration_institution_file = 'circ/circ_duration_' + currentLocation.shortname + '.js';
+load_lib(circ_duration_institution_file);
+log_error(circ_duration_institution_file);
+
+/* if an institution specific script was loaded, then stop */
+if (result.durationRule) return;
+
/* treat pre-cat copies like vanilla books */
if( isTrue(isPrecat) ) {
log_info("pre-cat copy getting duration defaults...");
Added: conifer/trunk/circ/circ_duration_OWA.js
===================================================================
--- conifer/trunk/circ/circ_duration_OWA.js (rev 0)
+++ conifer/trunk/circ/circ_duration_OWA.js 2009-05-02 13:20:49 UTC (rev 431)
@@ -0,0 +1,609 @@
+/* SIP media types
+000 Other
+001 Book
+002 Magazine
+003 Bound journal
+004 Audio tape
+005 Video tape
+006 CD/CDROM
+007 Diskette
+008 Book with diskette
+009 Book with CD
+010 Book with audio tape
+*/
+
+/* set item type defaults - if the either the patron group or the circ modifier
+ is missing or invalid, these settings will be used */
+
+// do these first two have any significance for us?
+result.SIPMediaType = '001';
+result.magneticMedia = 'f';
+
+// if result.durationRule is not modified for a patron group, item does not circulate
+result.durationRule = 'non_circ';
+
+// for fines, set the most common value here
+result.recurringFinesRule = '50_cent_per_day';
+result.maxFine = '10_dollars';
+
+/* adjust rules by patron group and circ modifier */
+
+switch(patronProfile) {
+
+ case 'Circulators':
+ result.durationRule = '120_days_2_renew';
+ break;
+
+ case 'Patrons':
+ switch(copy.circ_modifier) {
+ case 'cd music':
+ // use defaults
+ break;
+ case 'circ':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'circ short':
+ // use defaults
+ break;
+ case 'crc media':
+ result.durationRule = '7_days_3_renew';
+ break;
+ case 'crc spec':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'crc text':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'dnon':
+ // use defaults
+ break;
+ case 'doc':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'dvd video':
+ result.durationRule = '3_days_1_renew';
+ break;
+ case 'law mono':
+ // use defaults
+ break;
+ case 'law nocirc':
+ // use defaults
+ break;
+ case 'law res1d':
+ // use defaults
+ break;
+ case 'law res3d':
+ // use defaults
+ break;
+ case 'law res3h':
+ // use defaults
+ break;
+ case 'law res5h':
+ // use defaults
+ break;
+ case 'law serial':
+ // use defaults
+ break;
+ case 'map':
+ // use defaults
+ break;
+ case 'map (circulating)':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'map (reference)':
+ // use defaults
+ break;
+ case 'media':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'mform':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'mform ref':
+ // use defaults
+ break;
+ case 'mform ser':
+ // use defaults
+ break;
+ case 'ref':
+ result.durationRule = '7_days_3_renew';
+ break;
+ case 'rsv1':
+ // use defaults
+ break;
+ case 'rsv2':
+ // use defaults
+ break;
+ case 'rsv3':
+ // use defaults
+ break;
+ case 'rsv7':
+ // use defaults
+ break;
+ case 'ser':
+ // use defaults
+ break;
+ case 'thesis':
+ result.durationRule = '14_days_3_renew';
+ break;
+ }
+ break;
+
+ case 'Faculty':
+ switch(copy.circ_modifier) {
+ case 'cd music':
+ result.durationRule = '3_days_1_renew';
+ break;
+ case 'circ':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'circ short':
+ result.durationRule = '3_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'crc media':
+ result.durationRule = '7_days_3_renew';
+ break;
+ case 'crc spec':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'crc text':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'dnon':
+ // use defaults
+ break;
+ case 'doc':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'dvd video':
+ result.durationRule = '3_days_1_renew';
+ break;
+
+ /* settings for law item types are those applicable to LAW FACLTY
+ and will need to be changed as soon as a conifer Law Faculty patron
+ group can be created */
+
+ case 'law mono':
+ result.durationRule = '28_days_5_renew';
+ result.recurringFinesRule = 'free';
+ result.maxFine = 0;
+ break;
+ case 'law nocirc':
+ result.durationRule = '14_days_5_renew';
+ result.recurringFinesRule = 'free';
+ result.maxFine = 0;
+ break;
+ case 'law res1d':
+ result.durationRule = '2_days_20_renew';
+ result.recurringFinesRule = 'free';
+ result.maxFine = 0;
+ break;
+ case 'law res3d':
+ result.durationRule = '3_days_20_renew';
+ result.recurringFinesRule = 'free';
+ result.maxFine = 0;
+ break;
+ case 'law res3h':
+ result.durationRule = '2_days_20_renew';
+ result.recurringFinesRule = 'free';
+ result.maxFine = 0;
+ break;
+ case 'law res5h':
+ result.durationRule = '2_days_20_renew';
+ result.recurringFinesRule = 'free';
+ result.maxFine = 0;
+ break;
+ case 'law serial':
+ result.durationRule = '14_days_5_renew';
+ result.recurringFinesRule = 'free';
+ result.maxFine = 0;
+ break;
+ case 'map':
+ // use defaults
+ break;
+ case 'map (circulating)':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'map (reference)':
+ // use defaults
+ break;
+ case 'media':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'mform':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'mform ref':
+ // use defaults
+ break;
+ case 'mform ser':
+ // use defaults
+ break;
+ case 'ref':
+ result.durationRule = '7_days_3_renew';
+ break;
+ case 'rsv1':
+ result.durationRule = '1_day_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv2':
+ result.durationRule = '120_minutes_0_renew';
+ result.recurringFinesRule = '5_cents_per_minute';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv3':
+ result.durationRule = '3_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv7':
+ result.durationRule = '7_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'ser':
+ result.durationRule = '1_day_1_renew';
+ result.recurringFinesRule = '2_dollars_per_day';
+ break;
+ case 'thesis':
+ result.durationRule = '28_days_3_renew';
+ break;
+ }
+ break;
+
+ case 'Graduate':
+ switch(copy.circ_modifier) {
+ case 'cd music':
+ // use defaults
+ break;
+ case 'circ':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'circ short':
+ result.durationRule = '3_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'crc media':
+ result.durationRule = '7_days_3_renew';
+ break;
+ case 'crc spec':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'crc text':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'dnon':
+ // use defaults
+ break;
+ case 'doc':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'dvd video':
+ result.durationRule = '3_days_1_renew';
+ break;
+ case 'law mono':
+ result.durationRule = '28_days_5_renew';
+ result.recurringFinesRule = '50_cent_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law nocirc':
+ // use defaults
+ break;
+ case 'law res1d':
+ result.durationRule = '16_hours_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law res3d':
+ result.durationRule = '2_days_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law res3h':
+ result.durationRule = '3_hours_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law res5h':
+ result.durationRule = '5_hours_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law serial':
+ // use defaults
+ break;
+ case 'map':
+ // use defaults
+ break;
+ case 'map (circulating)':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'map (reference)':
+ // use defaults
+ break;
+ case 'media':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'mform':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'mform ref':
+ // use defaults
+ break;
+ case 'mform ser':
+ // use defaults
+ break;
+ case 'ref':
+ result.durationRule = '7_days_3_renew';
+ break;
+ case 'rsv1':
+ result.durationRule = '1_day_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv2':
+ result.durationRule = '120_minutes_0_renew';
+ result.recurringFinesRule = '5_cents_per_minute';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv3':
+ result.durationRule = '3_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv7':
+ result.durationRule = '7_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'ser':
+ result.durationRule = '1_day_1_renew';
+ result.recurringFinesRule = '2_dollars_per_day';
+ break;
+ case 'thesis':
+ result.durationRule = '28_days_3_renew';
+ break;
+ }
+ break;
+
+ case 'Readers':
+
+ /* currently STAFF, LAW1, LAW2, and LAW3. applying STAFF rules to Leddy items
+ and LAWx rules to Law items - fix as soon as Windsor groups exists! */
+
+ switch(copy.circ_modifier) {
+ case 'cd music':
+ result.durationRule = '3_days_1_renew';
+ break;
+ case 'circ':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'circ short':
+ result.durationRule = '1_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'crc media':
+ result.durationRule = '7_days_3_renew';
+ break;
+ case 'crc spec':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'crc text':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'dnon':
+ // use defaults
+ break;
+ case 'doc':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'dvd video':
+ result.durationRule = '3_days_1_renew';
+ break;
+ case 'law mono':
+ result.durationRule = '28_days_5_renew';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law nocirc':
+ // use defaults
+ break;
+ case 'law res1d':
+ result.durationRule = '16_hours_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law res3d':
+ result.durationRule = '2_days_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law res3h':
+ result.durationRule = '3_hours_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law res5h':
+ result.durationRule = '5_hours_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law serial':
+ // use defaults
+ break;
+ case 'map':
+ // use defaults
+ break;
+ case 'map (circulating)':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'map (reference)':
+ // use defaults
+ break;
+ case 'media':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'mform':
+ result.durationRule = '28_days_3_renew';
+ break;
+ case 'mform ref':
+ // use defaults
+ break;
+ case 'mform ser':
+ // use defaults
+ break;
+ case 'ref':
+ result.durationRule = '7_days_3_renew';
+ break;
+ case 'rsv1':
+ result.durationRule = '1_day_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv2':
+ result.durationRule = '120_minutes_0_renew';
+ result.recurringFinesRule = '5_cents_per_minute';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv3':
+ result.durationRule = '3_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv7':
+ result.durationRule = '7_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'ser':
+ result.durationRule = '1_day_1_renew';
+ result.recurringFinesRule = '2_dollars_per_day';
+ break;
+ case 'thesis':
+ result.durationRule = '28_days_3_renew';
+ break;
+ }
+ break;
+
+ case 'Undergraduate':
+ switch(copy.circ_modifier) {
+ case 'cd music':
+ // use defaults
+ break;
+ case 'circ':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'circ short':
+ result.durationRule = '3_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'crc media':
+ result.durationRule = '7_days_3_renew';
+ break;
+ case 'crc spec':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'crc text':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'dnon':
+ // use defaults
+ break;
+ case 'doc':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'dvd video':
+ result.durationRule = '3_days_1_renew';
+ break;
+ case 'law mono':
+ result.durationRule = '28_days_5_renew';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law nocirc':
+ // use defaults
+ break;
+ case 'law res1d':
+ result.durationRule = '16_hours_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law res3d':
+ result.durationRule = '2_days_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law res3h':
+ result.durationRule = '3_hours_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law res5h':
+ result.durationRule = '5_hours_20_renew';
+ result.recurringFinesRule = '60_cents_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'law serial':
+ // use defaults
+ break;
+ case 'map':
+ // use defaults
+ break;
+ case 'map (circulating)':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'map (reference)':
+ // use defaults
+ break;
+ case 'media':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'mform':
+ result.durationRule = '14_days_3_renew';
+ break;
+ case 'mform ref':
+ // use defaults
+ break;
+ case 'mform ser':
+ // use defaults
+ break;
+ case 'ref':
+ result.durationRule = '7_days_3_renew';
+ break;
+ case 'rsv1':
+ result.durationRule = '1_day_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv2':
+ result.durationRule = '120_minutes_0_renew';
+ result.recurringFinesRule = '5_cents_per_minute';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv3':
+ result.durationRule = '3_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'rsv7':
+ result.durationRule = '7_days_1_renew';
+ result.recurringFinesRule = '10_dollars_per_day';
+ result.maxFine = '50_dollars';
+ break;
+ case 'ser':
+ // use defaults
+ break;
+ case 'thesis':
+ result.durationRule = '14_days_3_renew';
+ break;
+ }
+ break;
+
+}
+
+/* set variable to tell circ_duration.js that an institution specific script has executed */
+circ_institution_override = true;
Added: conifer/trunk/tools/migration-scripts/circ_rules.sql
===================================================================
--- conifer/trunk/tools/migration-scripts/circ_rules.sql (rev 0)
+++ conifer/trunk/tools/migration-scripts/circ_rules.sql 2009-05-02 13:20:49 UTC (rev 431)
@@ -0,0 +1,29 @@
+INSERT INTO config.rule_circ_duration (name, extended, normal, shrt, max_renewals) VALUES
+ ('120_days_2_renew', '120 days', '120 days', '120 days', 2), -- OSUL rules
+ ('3_weeks_2_renew', '3 weeks', '3 weeks', '3 weeks', 2),
+ ('14_days_3_renew', '14 days', '14 days', '14 days', 3), -- OWA rules
+ ('28_days_3_renew', '28 days', '28 days', '28 days', 3),
+ ('7_days_1_renew', '7 days', '7 days', '7 days', 1),
+ ('7_days_3_renew', '7 days', '7 days', '7 days', 3),
+ ('120_minutes_0_renew', '120 minutes', '120 minutes', '120 minutes', 0),
+
+ ('28_days_5_renew', '28 days', '28 days', '28 days', 5), -- OWAL rules
+ ('14_days_5_renew', '14 days', '14 days', '14 days', 5),
+ ('2_days_20_renew', '2 days', '2 days', '2 days', 20),
+ ('3_days_20_renew', '3 days', '3 days', '3 days', 20),
+ ('1_day_1_renew', '1 day', '1 day', '1 day', 1),
+ ('16_hours_20_renew', '16 hours', '16 hours', '16 hours', 20),
+ ('3_hours_20_renew', '3 hours', '3 hours', '3 hours', 20),
+ ('5_hours_20_renew', '5 hours', '5 hours', '5 hours', 20),
+ ('non_circ', '0 days', '0 days', '0 days', 0); -- obviously a sign that permit_patron or permit_copy should be invoked instead, but oh well for now
+
+INSERT INTO config.rule_max_fine (name, amount) VALUES
+ ('10_dollars', 10.00),
+ ('50_dollars', 50.00);
+
+INSERT INTO config.rule_recuring_fine (name, high, normal, low, recurance_interval) VALUES
+ ('free', 0.00, 0.00, 0.00, '1 day'),
+ ('5_cents_per_minute', 00.05, 00.05, 00.05, '1 minute'),
+ ('60_cents_per_day', 00.60, 00.60, 00.60, '1 day'),
+ ('2_dollars_per_day', 2.00, 2.00, 2.00, '1 day'),
+ ('10_dollars_per_day', 10.00, 10.00, 10.00, '1 day');
More information about the open-ils-commits
mailing list